How bridging, transfers, and contract calls map to SDK methods.
Every cross-chain operation in the SDK is an intent. Bridging, transfers, and contract calls are different ways to use one.
Operation
Method
Bridge
swapWithExactOut or swapWithExactIn, with the same asset on each chain
Transfer
swapAndExecute, with a token transfer as the destination call
Execute
execute, using funds already on the destination chain
Fund and execute
swapAndExecute
Bridge
A bridge is a same-asset swap. Pass the asset's address on each source chain and on the destination chain. Funds always arrive at the connected wallet.TypeScript
Swaps have no recipient field. To deliver funds to another address, use swapAndExecute and make the destination call a transfer. Your wallet funds itself on the destination chain, then sends the call.TypeScript
For a native-token transfer, set execute.to to the recipient and execute.value to the amount.
Execute
execute() calls any contract on a supported chain with funds the wallet already holds there. You supply the contract address, calldata, and an optional token approval.
Fund and execute
swapAndExecute() funds a destination contract call, then runs it. With exact output, it funds only the shortfall and skips the swap when the wallet already holds enough (result.swapSkipped).By default the connected wallet sends the call after fulfillment (executionMode: 'wallet'). With useProviderDestinationExecution: true, Relay executes the call as part of fulfillment instead (executionMode: 'provider'). See swap and execute.