Calling Methods
Here is an example of how to call a method:
import { useSignAndExecuteTransaction } from '@mysten/dapp-kit'
const { mutate: signAndExecuteTransaction } = useSignAndExecuteTransaction()
const transaction = await suiTradingClient.buyListings({
listingIds: [listing.id],
walletAddress: '0x...'
})
await signAndExecuteTransaction({ transaction })
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.