Loading...
Loading...
Implement swapWithExactIn, swapWithExactOut, and swapAndExecute flows with Nexus SDK. Use when wiring swap operations, swap intent hooks, or swap event progress updates.
npx skill4agent add availproject/nexus-elements nexus-sdk-swap-flowssdk.swapWithExactIn(input, { onEvent? })ExactInSwapInputfrom: { chainId: number; amount: bigint; tokenAddress: Hex }[]toChainId: numbertoTokenAddress: HexfromTOKEN_CONTRACT_ADDRESSESSwapResult{ success: true; result: SuccessfulSwapResult }sdk.swapWithExactOut(input, { onEvent? })ExactOutSwapInputtoChainId: numbertoTokenAddress: HextoAmount: biginttoNativeAmount?: bigintfromSources?: { chainId: number; tokenAddress: Hex }[]fromSourcessdk.swapAndExecute(input, { onEvent? })SwapAndExecuteParamstoChainId: numbertoTokenAddress: HextoAmount: bigintfromSources?: { chainId: number; tokenAddress: Hex }[]execute: SwapExecuteParamsSwapExecuteParamsto: Hexdata?: Hexvalue?: bigintgas: bigintgasPrice?: 'low' | 'medium' | 'high'tokenApproval?: { token: Hex; amount: bigint; spender: Hex }SwapAndExecuteResultswapResult: SuccessfulSwapResult | nullSUPPORTED_CHAINSTOKEN_CONTRACT_ADDRESSESsdk.setOnSwapIntentHook(...)allow()NEXUS_EVENTS.SWAP_STEP_COMPLETEsdk.utils.parseUnits(value, decimals)sdk.convertTokenReadableAmountToBigInt(value, tokenSymbol, chainId)