Get started integrating the Swap SDK into your app
Installation
You can install the SDK with yarn:
yarn add @traderxyz/nft-swap-sdk
or npm:
npm install @traderxyz/nft-swap-sdk
Configuration
To use the SDK, create a new NftSwapV4 instance.
import{NftSwapV4}from'@traderxyz/nft-swap-sdk';// Supply a provider, signer, and chain id to get started// Signer is optional if you only need read-only methodsconstnftSwapSdk=newNftSwapV4(provider,signer,chainId);
Note: 0x v4 contracts with NFT support are currently live on Ethereum Mainnet, Polygon, Optimism, BSC, Fantom, and Celo, and Ropsten Testnet.
Quick Start
Let's walk through the most common NFT swap case: swapping an NFT (ERC721 or ERC1155) with an ERC20.
Swap an NFT with an ERC20
That's it! More examples and advanced usage can be found in the examples documentation.