Managing Orders
Build, approve, sign, fill, cancel and save orders with the Swap SDK.
Building Orders
import { NftSwapV4 } from '@traderxyz/nft-swap-sdk';
const nftSwapSdk = new NftSwapV4(provider, signer, chainId);
const CRYPTOPUNK_420 = {
tokenAddress: '0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb', // CryptoPunk contract address
tokenId: '420', // Token Id of the CryptoPunk we want to swap
type: 'ERC721', // Must be one of 'ERC20', 'ERC721', or 'ERC1155'
};
const SIXTY_NINE_USDC = {
tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC contract address
amount: '69000000', // 69 USDC (USDC is 6 digits)
type: 'ERC20',
};
const walletAddressUserA = '0x1eeD19957E0a81AED9a80f09a3CCEaD83Ea6D86b';
const order = nftSwapSdk.buildOrder(
nftToSwapUserA,
usdcToSwapUserB,
walletAddressUserA
);
Approving Orders
Signing Orders
Filling an Order
Cancelling Orders
Advanced Cancellations
Saving Orders
Orderbook / Order Persistance
Save Order
Fetch Order(s)
Last updated