trader-xyz / nft-swap-sdk

Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.
https://swapsdk.xyz
MIT License
219 stars 83 forks source link

add react hooks and swap sdk provider #75

Open ErnestMironov opened 2 years ago

ErnestMironov commented 2 years ago

List of React hooks:

  1. useCancelOrder return a method that takes as input: nonce orderType

  2. useCreateBasedOrder - creates an order of any NFT from a certain collection that the user has.

  3. useCreateOrder creates an order to buy an NFT, return a method that takes as input: collection address tokenId ERC20 address ERC20 amount

  4. useFullfillOrder - makes another user buy an NFT, with an order already created, takes as input: signedOrderObject

  5. useOrders - finds orders that match the passed parameters. Returns all orders or one specific order

  6. useQuickSwap - finds a corresponding order and executes a transaction

  7. useWallet - connects wallet, returns address and balance.

johnrjj commented 2 years ago

Hey! I'm working on switching up the repo to support the react hooks

Definitely intend on landing this PR.

JoaoCampos89 commented 2 years ago

Hey, I recommend create maybe a new repo only for the hooks, there are users that already have their custom hooks using same functionality. Only to keep bundle size minimal and easier to mantain.