Calling Methods
Here is an example of how to call a method:
import { useWalletKit } from '@mysten/wallet-kit'
const { signAndExecuteTransactionBlock } = useWalletKit()
const transactionBlock = await suiTradingClient.buyListings({
listingIds: [listing.id],
walletAddress: '0x...'
})
await signAndExecuteTransactionBlock({ transactionBlock })
Note that the SDK method returns a Sui Transaction Block that you need to pass into the wallet signing method of whichever client library you are using. In this example, the signAndSendTransaction
method is coming from the useWalletKit
hook from @mysten/wallet-kit
The listing.id
in the example above comes from our NFT Data API.
The walletAddress
is the signer’s Sui wallet address.