Typescript SDK
1. Importing Required Modules
import { getSwapData } from '@mosaic-ag/ts-sdk';
import { Aptos, AptosConfig, Network, APTOS_COIN, Ed25519PublicKey, Ed25519PrivateKey, Account } from '@aptos-labs/ts-sdk';
import invariant from 'tiny-invariant';2. Setting Up Constants
export const TEST_WALLET_ADDRESS = ''; // change me
export const TEST_PRIVATE_KEY = ''; // change me
export const TEST_PUBLIC_KEY = ''; // change me
export const USDC = '0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce63ba8a27c563c6f::tokens::USDC';
export const SLIPPAGE_BPS = 50;3. Configuring Aptos Movement
const aptosConfig = new AptosConfig({ network: Network.CUSTOM, fullnode: "https://aptos.testnet.suzuka.movementlabs.xyz/v1" })
export const aptos = new Aptos(aptosConfig);4. Retrieving Swap Data
5. Building the Transaction
6. Simulating the Transaction
7. Signing and Submitting the Transaction
8. Waiting for Transaction Confirmation
9. Logging the Transaction Result
Last updated