Coder Social home page Coder Social logo

trader-xyz / nft-swap-sdk Goto Github PK

View Code? Open in Web Editor NEW
218.0 13.0 84.0 1.95 MB

Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.

Home Page: https://swapsdk.xyz

License: MIT License

TypeScript 100.00%
nft swap ethereum erc20 erc721 erc1155 exchange trade 0x typescript

nft-swap-sdk's Introduction

NFT Swap Banner

Swap SDK

The missing peer-to-peer swap library for Ethereum and EVM-compatible chains, powered by the 0x protocol, written in TypeScript for web3 developers. Trade tokens (ERC20s), NFTs, and other collectibles (ERC721 and ERC1155) with just a few lines of code. Seriously, easily trade anything on Ethereum with this library.

πŸŽ‰ Update 1/31/22: Swap SDK now supports 0x v4, check out the docs. πŸŽ‰

Overview

tl;dr: NFT Swap SDK is the easiest, most-powerful swap library available on the EVM. Supports Ethereum and EVM-compatible chains (Polygon, Avalanche, BSC, etc.). Works in both browser and Node.js. Written in TypeScript, built using the 0x protocol. With this library, you can build support for NFT marketplaces, over-the-counter (OTC) exchanges, and/or peer-to-peer exchanges.

The NFT Swap SDK developed by Trader.xyz offers swap support for ERC20s, ERC721s, and ERC1155s. Exchange NFTs for NFTs, NFTs for ERC20 tokens, or bundles of NFTs and tokens. This library provides the ultimate swap flexibility combined with a simple API surface area so you can be productive immediately and focus on building your web3 app.

This library is powered and secured by the 0x v3 protocol. The 0x v3 protocol has been in production for multiple years securing billions of dollars with of trades.

Goals

We want to share all underlying technology trader.xyz uses with the community. While we won't be open-sourcing our frontend, as we think design and UX is our differentiator, we believe in open-sourcing and freely sharing all underlying technology.

Our end goal is every piece of tech you see trader.xyz use (protocol, swap libraries, open-source orderbook, order monitor, high-performance NFT indexer, property-based orders, specific React hooks, and NFT aggregation) end up open-source. This library is the first step to achieving our goal.

Installation

You can install the SDK with yarn:

yarn add @traderxyz/nft-swap-sdk

or npm:

npm install @traderxyz/nft-swap-sdk

You can check out an example project here or check out the example repo here

Configuration

To use the SDK, create a new NftSwap instance.

import { NftSwap } from '@traderxyz/nft-swap-sdk';

// From your app, provide NftSwap the web3 provider, signer for the user's wallet, and the chain id.
const nftSwapSdk = new NftSwap(provider, signer, chainId);

Now you're set up and ready to use the SDK in your program. Check out the examples below to learn how to swap with the library.

Examples

Example 1: NFT <> NFT swap

In this first example, we're going to do a 1:1 NFT swap. We're going to swap User A's CryptoPunk NFT for User B's Bored Ape NFT.

Terminology: maker: Since User A will initiate the trade, we'll refer to User A as the maker of the trade.

Terminology: taker: Since User B will be filling and completing the trade created by User A, we'll refer to User B as the taker of the trade.

// Setup the sample data...
const CHAIN_ID = 1; // Chain 1 corresponds to Mainnet. Visit https://chainid.network/ for a complete list of chain ids

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 BORED_APE_69 = {
  tokenAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // BAYC contract address
  tokenId: '69', // Token Id of the BoredApe we want to swap
  type: 'ERC721',
};

// User A Trade Data
const walletAddressUserA = '0x1eeD19957E0a81AED9a80f09a3CCEaD83Ea6D86b';
const assetsToSwapUserA = [CRYPTOPUNK_420];

// User B Trade Data
const walletAddressUserB = '0x44beA2b43600eE240AB6Cb90696048CeF32aBf1D';
const assetsToSwapUserB = [BORED_APE_69];

// ............................
// Part 1 of the trade -- User A (the 'maker') initiates an order
// ............................

// Initiate the SDK for User A.
// Pass the user's wallet signer (available via the user's wallet provider) to the Swap SDK
const nftSwapSdk = new NftSwap(provider, signerUserA, CHAIN_ID);

// Check if we need to approve the NFT for swapping
const approvalStatusForUserA = await nftSwapSdk.loadApprovalStatus(
  assetsToSwapUserA[0],
  walletAddressUserA
);
// If we do need to approve User A's CryptoPunk for swapping, let's do that now
if (!approvalStatusForUserA.contractApproved) {
  const approvalTx = await nftSwapSdk.approveTokenOrNftByAsset(
    assetsToSwapUserA[0],
    makerAddress
  );
  const approvalTxReceipt = await approvalTx.wait();
  console.log(
    `Approved ${assetsToSwapUserA[0].tokenAddress} contract to swap with 0x (txHash: ${approvalTxReceipt.transactionHash})`
  );
}

// Create the order (Remember, User A initiates the trade, so User A creates the order)
const order = nftSwapSdk.buildOrder(
  assetsToSwapUserA,
  assetsToSwapUserB,
  walletAddressUserA
);
// Sign the order (User A signs since they are initiating the trade)
const signedOrder = await nftSwapSdk.signOrder(order, makerAddress);
// Part 1 Complete. User A is now done. Now we send the `signedOrder` to User B to complete the trade.

// ............................
// Part 2 of the trade -- User B (the 'taker') accepts and fills order from User A and completes trade
// ............................
// Initiate the SDK for User B.
const nftSwapSdk = new NftSwap(provider, signerUserB, CHAIN_ID);

// Check if we need to approve the NFT for swapping
const approvalStatusForUserB = await nftSwapSdk.loadApprovalStatus(
  assetsToSwapUserB[0],
  walletAddressUserB
);
// If we do need to approve NFT for swapping, let's do that now
if (!approvalStatusForUserB.contractApproved) {
  const approvalTx = await nftSwapSdk.approveTokenOrNftByAsset(
    assetsToSwapUserB[0],
    walletAddressUserB
  );
  const approvalTxReceipt = await approvalTx.wait();
  console.log(
    `Approved ${assetsToSwapUserB[0].tokenAddress} contract to swap with 0x. TxHash: ${approvalTxReceipt.transactionHash})`
  );
}
// The final step is the taker (User B) submitting the order.
// The taker approves the trade transaction and it will be submitted on the blockchain for settlement.
// Once the transaction is confirmed, the trade will be settled and cannot be reversed.
const fillTx = await nftSwapSdk.fillSignedOrder(signedOrder);
const fillTxReceipt = await nftSwapSdk.awaitTransactionHash(fillTx.hash);
console.log(`πŸŽ‰ πŸ₯³ Order filled. TxHash: ${fillTxReceipt.transactionHash}`);

Example 2: Swap bundles -- Bundle of mixed ERC721s and ERC20 <> Bundle of ERC20s

Here we show an example of what the swap library is capable of. We can even swap arbitrary ERC tokens in bundles. We call it a bundle when we have more than one item that a party will swap. Bundles can have different ERC types within the same bundle.

In other words, we can swap [ERC721, ERC1155, ERC20] <> [ERC721, ERC1155, ERC20]. There's really no limit to what we can swap.

More concrete example: We can swap [2 CryptoPunks and 1,000 DAI] for [420 WETH and 694,200 USDC]. In this case we'd be swapping two ERC721s and an ERC20 (Punk NFT and DAI, respectively) for two ERC20s (WETH and USDC).

This is just one example. In reality, you can swap as many things as you'd like, any way you'd like. The underlying 0x protocol is extremely flexible, and the NFT swap library abstracts all the complexity away so you don't have to worry about protocol nuances.

// Set up the sample data for the swap...
const CHAIN_ID = 1; // Mainnet

const CRYPTOPUNK_420 = {
  tokenAddress: '0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb',
  tokenId: '420',
  type: 'ERC721',
};

const CRYPTOPUNK_421 = {
  tokenAddress: '0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb',
  tokenId: '421',
  type: 'ERC721',
};

const ONE_THOUSAND_DAI = {
  tokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f', // DAI contract address
  amount: '1000000000000000000000', // 1,000 DAI (DAI is 18 digits) -- amount to swap
  type: 'ERC20',
};

const SIXTY_NINE_USDC = {
  tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC contract address
  amount: '69000000', // 69 USDC (USDC is 6 digits)
  type: 'ERC20',
};

const FOUR_THOUSAND_TWENTY_WETH = {
  tokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f', // WETH contract address
  amount: '420000000000000000000', // 420 Wrapped-ETH (WETH is 18 digits)
  type: 'ERC20',
};

// User A Trade Data
const walletAddressUserA = '0x1eeD19957E0a81AED9a80f09a3CCEaD83Ea6D86b';
const assetsToSwapUserA = [CRYPTOPUNK_420, CRYPTOPUNK_421, ONE_THOUSAND_DAI];

// User B Trade Data
const walletAddressUserB = '0x44beA2b43600eE240AB6Cb90696048CeF32aBf1D';
const assetsToSwapUserB = [SIXTY_NINE_USDC, FOUR_THOUSAND_TWENTY_WETH];

// ............................
// Part 1 of the trade -- User A (the 'maker') initiates an order
// ............................
const nftSwapSdk = new NftSwap(provider, signerUserA, CHAIN_ID);
// Note: For brevity, we assume all assets are approved for swap in this example.
// See previous example on how to approve an asset.

const order = nftSwapSdk.buildOrder(
  assetsToSwapUserA,
  assetsToSwapUserB,
  walletAddressUserA
);
const signedOrder = await nftSwapSdk.signOrder(order, makerAddress);

// ............................
// Part 2 of the trade -- User B (the 'taker') accepts and fills order from User A and completes trade
// ............................
const nftSwapSdk = new NftSwap(provider, signerUserB, CHAIN_ID);

const fillTx = await nftSwapSdk.fillSignedOrder(signedOrder);
const fillTxReceipt = await nftSwapSdk.awaitTransactionHash(fillTx);
console.log(`πŸŽ‰ πŸ₯³ Order filled. TxHash: ${fillTxReceipt.transactionHash}`);

// Not so bad, right? We can arbitrarily add more assets to our swap without introducing additional complexity!

Example 3: React Hooks + Swap SDK

In this example, we'll leverage the amazing web3-react React Hook library.

const App = () => {
  const { library, chainId } = useWeb3React<Web3React>();

  const [swapSdk, setSwapSdk] = useState(null);
  useEffect(() => {
    const sdk = new NftSwap(library, library.getSigner(), chainId);
    setSwapSdk(sdk);
  }, [library, chainId])

  // Use the SDK however you'd like in the app...
  const handleClick = useCallback(() => {
    if (!swapSdk) {
      return;
    }
    swapSdk.buildOrder(...)
  }, [swapSdk])

  // ...
}

FAQ

  • Which ERCs does this library support?

    • ERC20, ERC721, and ERC1155
  • What EVM chains are currently supported?

    • Mainnet (1)
    • Kovan (42)
    • Rinkeby (4)
    • Polygon (137)
    • Binance Smart Chain (56)
    • Avalanche (43114)
  • What protocol does this library use?

    • trader.xyz and trader.xyz libraries are powered by 0x v3 Protocol. This protocol is mature and lindy, and has been extremely well-audited.
    • Check out the 0x v3 spec here
    • Check out the 0x v3 Consensys audit here
  • Are there any protocol fees to execute swaps?

    • No
  • How do I get the user's signer object?

    • Generally you can get it from the user's web3 wallet provider, by something like this: provider.getSigner().
    • See this ethers guide (control-f for getSigner).
    • In web3-react you can do:
      • const { library } = useWeb3React();
      • const signer = library.getSigner();
  • How do I store a SignedOrder

    • That's up to you. This library has no opinions on how to store orders. You can throw them in a centralized SQL database, save them to localstorage, use a decentralized messaging solution -- it's really up to you and your app concerns. You can even serialize and compress an order to fit in a tweet or shareable URL! 🀯

Support

For personalized help, please join the #dev-help channel in our Discord: https://discord.gg/RTvpQcxn4V

For general documentation, check out https://docs.swapsdk.xyz

Roadmap

We're currently working on the following features for the next iteration of this library:

  • βœ… LIVE -- Persistent data store of orders (off-the-shelf storage in trader.xyz's public order storage server). Think of it as a public good
  • βœ… LIVE -- Property-based orders
  • βœ… LIVE -- Order validation
  • βœ… LIVE -- Live order status
  • Order event streaming via WebSockets

If you have feature requests, reach out in our Discord.

We want to make this library a one-stop shop for all your NFT swapping needs.

nft-swap-sdk's People

Contributors

arilotter avatar coopbri avatar dependabot[bot] avatar esco avatar haidarezio avatar johnrjj avatar jyap808 avatar nhodges avatar pcaversaccio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nft-swap-sdk's Issues

cancelOrder can only be called by the maker

In a scenario where a swap is direct and can only be filled by a designated taker, the taker should also be able to cancel the order. When trying to do so I get an unpredictable gas limit error

Intermittent Failures with loadApprovalStatus

Getting errors on polygon PoS (137) when trying to check approval status. Sometimes I try to load status for a single token, sometimes I try to load for a number of tokens i.e. 3-6 tokens. The issue is intermittent but it fails more often that it succeeds. My gut tells me i'm getting rate limited somehow. Swap SDK is configured to use the provider injected onto the window by metamask.

Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="getApproved(uint256)", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)

Does orderbook have support for celo?

I have been working with nft swap sdk for polygon and it works like a charm however i also wanted to extend my product to be available on celo and was wondering if 0x can add support for it?

Problem posting NFT for sale

I am getting this when trying to post a sell order for an ERC1155 token on Ropsten network:

"Error looking up maker balance and approval data. Order may be using incorrect/bad token 0xd526a2c6d167b3c8b7145c7279c179426d61e1a9, chainId: 3."

The contract address is correct, so is the chain id. I am also setting the approval successfully beforehand on the same contract with the same SDK and that works and I can see the transaction on etherscan. I am also able to check the balance for my wallet through web3 with no issue.

Orderbook Allowance Error

I've using the sdk for a couple of days.

Today I started to get an error after call the "postOrder" method:

{errorCode: "INSUFFICIENT_MAKER_ALLOWANCE",…} errorCode: "INSUFFICIENT_MAKER_ALLOWANCE" errorMessage: "Maker does not have sufficient allowance of 0xc778417e063141139fce010982780140aa0cd5ab (ERC20)"

verifyOrderSignature always returns false !

Hey Guys.

trying to verify an order on Polygon swapSDK v3

I am passing 0x0c58c1170f1ded633862a1166f52107490a9c594 as the exchange contract address. Chain ID as 137

I keep getting false even though the swap goes through. seems to be an issue.

V4 | The buyer cannot select the quantity purchased from the order

Hello everyone!

I noticed that the user, when he bought an ERC1155 against an ERC20 could not choose the quantity bought; If the offer is 5 ETH against 5 ERC1155, it is impossible from the SDK to buy 1 ERC1155 for 1 ETH.

I have fork your project and create a fix, not being allowed to make a PR, here is a screen of the patch :

(src/sdk/v4/NftSwapV4.ts): https://prnt.sc/c1G4i5T-Z13m
(src/sdk/v4/types.ts) : https://prnt.sc/B4Fw-ZR2Zd2w

call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="getApproved(uint256)", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)

I'm trying to create a transaction "ERC20 Example", but I'm encountering this problem: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="getApproved(uint256)", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
image
This error is thrown by this function nftSwapSdk.loadApprovalStatus()

NFT <> NFT Trades are not supported by V4 SDK

Hello! I'm trying to test out the NFT <> NFT trades with V4 and it looks like that isn't supported yet. I understand from the error messages I receive that I should use V3 instead for this.

Now that I'm trying to use V3 SDK I find that the addresses.json of V3 SDK does not include chainId 5.

I would like to use a testnet with NFT <> NFT trades and since rinkeby is deprecated it would be awesome if you could update the addresses.json to include testnet Goerli (chain 5).

Another question regarding Goerli and V3. Will the V3 version of the SDK work with the protocol contracts deployed to Goerli?

BuildOrderAdditionalConfig in V3 is not documented

  1. It seems V4 doesn't support NFT < - > NF swap, so I have to use SwapSDK V3 if I need to do NFT <-> NFT?

  2. For V3, it seems the way to specify the fee components will be passing a BuildOrderAdditionalConfig to buildOrder function. However I cannot see any example / doc about how to use this parameter. can anyone share some experiences with the fee configuration ?
    any help will be much appreciated. thanks

V4 Custom Expiry

By default order expiry is set to 30 days. While building an order, I've tried to add an expiry field that is set to 24hrs (in milliseconds). I see this being set correctly while signing the order on the maker sideβ€”but while attempting to execute on the taker side the transaction fails. My hypothesis is it has something to do with the nonce this tool auto generates, not expecting a change to expiry

Order updates

I know the WebSockets are still a work in progress, but someone here might know how to answer this: is the 0x WebSocket API only streaming ERC20 to ERC20 order updates? Could I possibly hook into that to stream NFT order events?

Thank you!

[v0.32.0] loadApprovalStatusForOrder still forcing user to choose custom spending cap

I just upgraded to v0.32.0 and read the release notes. I thought it was supposed to now set the minimal viable approval now but I still get MetaMask asking to set a custom spending cap for WETH or choose max.

Screenshot 2023-06-29 at 4 11 18 AM

Here is part of my code for V4 SDK:

const approvalStatusForTaker = await swapSdkV4?.loadApprovalStatusForOrder(order_data, 'TAKER');

if (!approvalStatusForTaker?.contractApproved) {
    const approvalTx = await swapSdkV4?.approveTokenOrNftByAsset(ethToSwapTaker, walletAddressTaker);
    const approvalTxReceipt = await approvalTx?.wait();
}

Is this supposed to happen? It seems the same as the previous release. Thanks!

loadApprovalStatusForOrder returning `false` for the taker

Neither these two functions seem to be returning the correct result (true). I've confirmed the inputs and have confirmed the approve limits on revoke.cash. Notably, it's only on the taker side this is occurring.

const amount = ethers.BigNumber.from(bundle[0].amount);
return await nftSwapSdk.loadApprovalStatus(bundle[0], signerAddress, undefined, {
   approvalAmount: amount,
});
const approvalStatus = await nftSwapSdk.loadApprovalStatusForOrder(
   signed_order,
   "TAKER"
);

V3 fillSignedOrder - MetaMask - RPC Error when signing

Hi,

I'm working with V3 on Polygon and getting a Metamask internal error when using fillSignedOrder.

Before filling I verify the order signature is correct and that it passes.

Does anyone know what could be causing the following issue when using fillSignedOrder results in:

MetaMask - RPC Error: Internal JSON-RPC error.
code: -32603
data: 
    code: 3
    data: "0x4678472b43693c6356dfe50fa860e046b18bfc620c5c855517bfab74eebfdcb898531f4a00000000000000000000000000000000000000000000000000......."
    message:  "execution reverted"
message: "Internal JSON-RPC error."

SDK ready for v1.0.0

SDK seems stable enough to release a 1.0.0.

That way we can start semantically verisoning any changes, since we have a good bit of integrators using the sdk now!

Support of Rinkeby testnet in V4

in V4 Ropsten is supported, but not Rinkeby. It would be great features, since for testing it could be necessary to use OpenSea (supports Rinkeby, but not Ropsten)

ERC20 Allowance checks broken

Hi,

I don't understand why the SDK expects almost an unlimited ERC20 allowance.
For a buy offer, if the allowance is gte than the offered purchase price (+ optional fees), it should work.

I skipped the SDK functions for allowance checks but now I'm stuck with the orderbook which does the same checks.

How to reproduce:

  • approve 10 WMATIC to be spent by 0x
  • make a buy offer on a NFT for 5 WMATIC
    => allowance is checked against a max instead of 5 WMATIC
    contractApproved: approvedForMax,

V3 BuildOrder - Not setting makerFeeAssetData & takerFeeAssetData on Polygon

I have a buildOrder setup on Polygon but it is not including makerFeeAssetData & takerFeeAssetData. I'm using WETH contract on polygon 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619.

// My setup is similar to this...
const CHAIN_ID = 137; // Polygon Mainnet

const ASSET_420 = {
  tokenAddress: '0xb4....',
  tokenId: '420',
  type: 'ERC721',
};

const ASSET_421 = {
  tokenAddress: '0xb4...',
  tokenId: '421',
  type: 'ERC721',
};

const ONE_WETH = {
  tokenAddress: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH contract address
  amount: '100000000000000000', // Wrapped-ETH (WETH is 18 digits)
  type: 'ERC20',
};

// User A Trade Data
const walletAddressUserA = '0x1e....';
const assetsToSwapUserA = [ASSET_420];

// User B Trade Data
const walletAddressUserB = '0x44....';
const assetsToSwapUserB = [ASSET_421, ONE_WETH];

// ............................
// Part 1 of the trade -- User A (the 'maker') initiates an order
// ............................
const nftSwapSdk = new NftSwap(provider, signerUserA, CHAIN_ID);

const order = nftSwapSdk.buildOrder(
  assetsToSwapUserA,
  assetsToSwapUserB,
  walletAddressUserA, {
              takerAddress: walletAddressUserB,
              expiration: Math.floor(Date.now() / 1000 + 3600 * 24 * 2), // 2 days
              chainId: CHAIN_ID,
              feeRecipientAddress: process.env.NEXT_PUBLIC_FEE_RECIPIENT_ADDRESS,
              makerFee: ethers.utils.parseUnits('0.005', 'ether'), // 0.005 WETH
              takerFee: ethers.utils.parseUnits('0.005', 'ether'), // 0.005 WETH
          }
);
const signedOrder = await nftSwapSdk.signOrder(order, walletAddressUserB);

The signature request will show:

makerAddress: 0x0a...
takerAddress: 0x41...
feeRecipientAddress: 0xe7...
senderAddress: 0x0000000000000000000000000000000000000000
makerAssetAmount: 1
takerAssetAmount: 2
makerFee: 5000000000000000
takerFee: 5000000000000000
expirationTimeSeconds: 1666461
salt: 1666...
makerAssetData: 0x0257179....92
takerAssetData: 0x0257179....96
makerFeeAssetData: 0x
takerFeeAssetData: 0x

Should I be including makerFeeAssetData and takerFeeAssetData in the buildOrder orderConfig?

If so how can I encode that data to bytes? to include the values in the orderConfig?

Getting the order timestamp

When fetching orders from the hosted orderbook, it seems there is no information on when a particular order was created. We only have access to the expiry. Will this be addressed in the future? It would be useful to know when a particular offer has been created and not just when it will expire.

Unsupported chainId: 5

From the 0x v4 docs, Goerli should be supported. However, when posting an order to the public orderbook, I receive this error:

Unsupported chainId: 5

Question about flow of swapping

So in the nft<>nft swap, signedOrder is used in part A and at the end of part B. Do we have to store signedOrder externally from part A's app and then have part B's app pull signedOrder? Is there no way to get the signed order through the SDK?

I would ask in Discord, but the link in the readme is broken I believe.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.