Inputs to createMusdClient: the chain, a viem public client, and (for writes) a wallet client; addresses overrides the bundled deployment.

interface CreateMusdClientParams {
    addresses?: Partial<MusdAddresses>;
    chainId: number;
    constantsTtlMs?: number;
    gasMarginPercent?: number;
    publicClient: {};
    walletClient?: {};
}

Properties

addresses?: Partial<MusdAddresses>

Per-contract address overrides (also enables an unsupported chainId).

chainId: number
constantsTtlMs?: number

How long a cached read of the governable constants stays usable, in milliseconds. Defaults to DEFAULT_CONSTANTS_TTL_MS (60 seconds). 0 re-reads every time (MK-012).

gasMarginPercent?: number

Percent added to the gas estimate on every write, over 100. Defaults to DEFAULT_GAS_MARGIN_PERCENT (25), which is a measured number, not a convention: see its docstring for the per path spread it was sized against (MK-035).

0 sends the bare estimate, which is what the SDK did before and is what produced the reverts MK-035 records. Raise it if you send during periods where the chain moves fast between your estimate and your inclusion.

Unused gas is refunded, so a larger margin costs no fees. What it does cost is the native balance that must be AVAILABLE: the account must hold gasLimit * gasPrice + value or the send is rejected before it reaches the chain.

publicClient: {}
walletClient?: {}

Required for the write methods, which throw MissingWalletClient without one; reads use publicClient.