Buy NFT With Seaport Example with wagmi #144
matthewhausman
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey y'all. I saw some discussions where there was confusion surrounding simplistic scenarios like buying an NFT. Just wanted to show one way to do so with the seaport js client.
const { connector: activeConnector, isConnected } = useAccount()
const signer = activeConnector.getSigner()
...
and something like
const dat = (await res.json())
Get the address of the signer from step 1.
const { executeAllActions } = await seaportClient.current.fulfillOrder(
{
order: responseData.orders[0].protocol_data, // from response data in step 2
accountAddress: address
}
);
const transaction = await executeAllActions();
console.log('validated: ', await transaction.wait());
So something important to note is how simple it is to actually buy the nft. just query for the nft you want to buy with the listings endpoint and pass directly to the fillfillOrder fn.
Beta Was this translation helpful? Give feedback.
All reactions