Skip to content

Releases: trader-xyz/nft-swap-sdk

v0.12 - No approvals required when accepting offer for NFT

05 Feb 21:38
Compare
Choose a tag to compare

📢 tl;dr: No approvals required when a user accepts a bid on their NFT -- a first for NFT marketplaces and swaps! 📢

🤝 If a user receives a bid on their NFT, they can accept the bid without needing to approve the NFT for transfer/swap first.

Simply call fillBuyNftOrderWithoutApproval instead of fillSignedOrder with the Swap SDK.

This provides the most seamless UX for accepting NFT bids on Ethereum, no more two-step process, and saves users money. 🤑

More info here

Note: This only works on NFT Buy orders (e.g. maker offers to buy NFT, taker can fill [by selling their NFT], without approval)

v0.11 - Fee support (Royalties, rewards, etc)

05 Feb 06:03
Compare
Choose a tag to compare

Adds configurable fee support to NFT Swap SDK.

Fees unlock all sorts of use cases:

  • Monetize applications,
  • Royalties for creators or DAOs
  • Reward users
  • Send payouts to a contract that implements custom fee disbursement logic

🔥 Under 120k gas for a NFT swap with one fee, the cheapest on the EVM 🔥

Fees can be specified by:

interface Fee {
    recipient: string // The address to send the fee to
    amount: string // The amount (based in the same erc20Token) to charge for fee
    feeData?: string | undefined; // optional feeData callback
}

Important notes:

  • Buyer of the NFT pays the fee(s)
  • Fees are in addition to the erc20TokenAmount that the buyer is paying for the NFT itself
  • Can support multiple fees
const MAKER_ASSET: SwappableAsset = {
  type: 'ERC721',
  tokenAddress: TEST_NFT_CONTRACT_ADDRESS,
  tokenId: '11045',
};

const TAKER_ASSET: SwappableAsset = {
  type: 'ERC20',
  tokenAddress: USDC_TOKEN_ADDRESS,
  amount: '420000000000000', // 4200 USDC
};

const v4Erc721Order = nftSwap.buildOrder(
  MAKER_ASSET,
  TAKER_ASSET,
  MAKER_WALLET_ADDRESS,
  {
    fees: [
      {
        amount: '6900000000000', // 69 USDC fee
        recipient: '0xaaa1388cD71e88Ae3D8432f16bed3c603a58aD34', // your DAO treasury 
      },
    ],
  }
);

Docs here: https://0x.org/docs/guides/0x-v4-nft-features-overview#fees

Spec: For each Fee specified in an order, the buyer of the NFT will pay the fee recipient the given amount of ETH/ERC20 tokens. This is in addition to the erc20TokenAmount that the buyer is paying for the NFT itself. There is an optional callback for each fee:

v0.10 - Collection-based orders

05 Feb 05:30
Compare
Choose a tag to compare

Adds Collection-based orders to NFT Swap SDK. (Also can be used as 'floor-based' orders).

🔥 Under 105k gas 🔥

These orders can be filled using any NFT from a particular collection.

The SDK provides a simple API:

// Maker creates an order for any NFT from a collection (you can think of it as a 'bid')
// Specifically in this example, the maker will sell 1000 USDC for any NFT in the collection specified
const v4Erc721Order = nftSwap.buildCollectionBasedOrder(
  // Selling ERC20
  {
    type: "ERC20",
    tokenAddress: USDC_TOKEN_ADDRESS,
    amount: "100000000000000", // 1000 USDC
  },
  // Bidding on any NFT in the collection
  {
    tokenAddress: NFT_CONTRACT_ADDDRESS,
    type: "ERC721", // "ERC721" | "ERC1155"
  },
  makerWalletAddress // Maker wallet address
)

const signedOrder = await nftSwap.signOrder(v4Erc721Order)

// Later, taker can sell an NFT from the specified collection, filling the bid.
const fillTx = await nftSwap.fillSignedCollectionOrder(
  signedOrder,
  "11045" // Token ID from the collection to fill order with
)

https://docs.swapsdk.xyz/0x-v4/collection-based-floor-based-orders

v0.9 - Initial 0x v4 NFT support

31 Jan 07:08
Compare
Choose a tag to compare

🎉 Swap SDK now supports using 0x v4 NFT to swap NFTs. 🎉

📄 Docs can be found here: https://docs.swapsdk.xyz/0x-v4

✏️ 0x v3 is still the default while 0x v4 rolls out to all chains. To use 0x v4, developers can opt-in by importing the NftSwapV4 class.

v1.0 release to follow soon, which will include open orderbook APIs and order persistance.

v0.8 - Fill orders with ETH

08 Jan 18:52
Compare
Choose a tag to compare

Adds ability to fill orders with ETH or native token if on another chain, e.g. if on Polygon, can fill an order with MATIC.

This is done via the audited 0x Forwarder contract

Advanced order configuration support

03 Jan 16:35
Compare
Choose a tag to compare
  • Adds more options for order configuration.
  • DevX enhancements

v0.6.1

27 Dec 07:09
Compare
Choose a tag to compare

Pre-1.0 stable release.

Rewritten entirely in ethers (w/ typechain type-safety)

Includes all public functionality for 1.0.

Initial public release

02 Nov 00:10
Compare
Choose a tag to compare
v0.2.1

v0.2.1