sodax.moneyMarket: supply, borrow, withdraw, repay. Each has a complete one-call form and a create*Intent form when you want the transaction only. On Sonic, the transaction goes to the SODAX wallet router, which executes the action through the user’s hub wallet.
The assets that work in the money market from Sonic are listed at runtime, as below, or see Networks & Assets. Native S is one of them.
Supply on Sonic
Supplying native S needs no approval: the SDK sends it as the transaction value and wraps it to wS in the same transaction. Supplying an ERC-20 needs an allowance first, and on Sonic the spender is not an asset manager but the user’s own hub wallet.isAllowanceValid and approve resolve it for you:
Borrow to Sonic, or anywhere
dstChainKey and dstAddress default to the source. Borrowing into Sonic is one transaction with no relay. Set any other supported network as the destination and the SDK relays the delivery there: collateral on the hub, borrowed liquidity on the network your user needs it.
withdraw and repay follow the same shape. Withdraw and borrow need no approval; repaying with an ERC-20 needs an allowance for the hub wallet, like supply. Repay never relays from Sonic; withdraw relays only when it delivers to another network.
Hub wallets
SODAX gives every user a deterministic wallet on the hub, and that wallet, not the user’s address, holds their money market positions. It is derived from the user’s address together with the network they act from:- From a spoke network, the hub wallet is derived from the spoke’s chain ID and the user’s address.
- From Sonic, it is derived from the user’s Sonic address through the SODAX wallet router. This is the address the money market approves as spender on Sonic.
Building a lending UI
sodax.moneyMarket.data exposes what you need for rates, positions, and health factors without extra indexing:
getReservesHumanized(): all reserves, human-readable.getUserReservesHumanized(spokeChainKey, userAddress): a user’s positions, withChainKeys.SONIC_MAINNETfor users acting on Sonic.formatReservesUSD(request)/formatUserSummary(request): USD-converted reserves and portfolio summaries.
Error handling
The module returns typed results. Discriminate onresult.error.code ('EXECUTION_FAILED', 'TX_VERIFICATION_FAILED', …) with structured context on result.error.context. Relay codes such as 'RELAY_TIMEOUT' only apply when a Sonic action delivers to another network.
Full reference, including intent-only methods, gas estimation, and the per-method error-code table: Lend / Borrow (Money Market).