Skip to main content
@uniformlabs/multiliquid-evm-sdk is the TypeScript SDK for the Multiliquid contracts, built on viem. It wraps quoting, swapping, delegated authorization, asset and delegate reads, capital provider administration, $TSY yield, and events, with typed inputs and decoded errors. For a walkthrough, start with Swap on-chain.

Install

The package needs Node.js 22.23.4 or later on 22.x, 24.22.1 or later on 24.x, or 26.12.1 or later. It ships ES module and CommonJS builds with type declarations.

Create a client

The client also exposes ml.deployment, ml.publicClient, and ml.walletClient. Write methods return the transaction hash without waiting for a receipt.

Deployments

Asset IDs are under deployment.assetIds.rwa and deployment.assetIds.stablecoin, keyed by name, such as assetIds.stablecoin.USDC. A loaded deployment keeps the preset’s names and adds the API’s tokens under their symbols.

Modules

ml.quote

ml.swap

ml.assets

ml.delegates

ml.issuerAdmin

The capital provider admin module. It keeps the contracts’ issuerAdmin name. Every write takes stablecoinID to resolve the delegate, plus the function’s arguments: isIssuerAdmin(stablecoinID, account) reads the admin set. For a multisig, buildIssuerAdminCalldata(method, params) encodes the call, and buildIssuerAdminTransaction(stablecoinID, method, params) returns { to, data } with the delegate resolved:

ml.yield

For yield-bearing registrations such as $TSY. Each method takes the registration’s stablecoinID and throws NotYieldBearingError for any other.

ml.events

A SwapEvent carries the event’s fields, with the fees named issuerFee, spreadFee, and lpFee, and the raw log.

ml.multicall

read(calls) batches any view calls through Multicall3, with each result typed from its ABI. It uses the deployment’s multicall3 address, or CANONICAL_MULTICALL3_ADDRESS.

Constants and ABIs

The package also exports the types it uses, such as SwapInputs, ApprovalPermit, SwapResolved, SwapEvent, and ChainDeployment.

Errors

Every SDK error extends MultiliquidError. A revert from a contract the SDK has no ABI for, such as a price adapter or a token, becomes a MultiliquidContractError with errorName set to UnknownContractError. decodeMultiliquidError(data) decodes raw revert data the same way.