The TokenboundClient class provides an interface for interacting with tokenbound accounts, enabling operations like account creation, transaction execution, token transfers (including ERC-721, ERC-1155, and ERC-20 tokens), and message signing.
The TokenboundClient enables the creation of and interaction with Tokenbound accounts:
createAccount
Creates a tokenbound account for an NFT. The deterministic address is calculated using the deploy_syscall with listed parameters alongside the implementation address. createAccount adds the account to the registry and initializes it for use.
awaittokenbound.createAccount({ tokenContract:`<tokenContract>`, tokenId:`<token_id>`, salt:`arbitrary number`>, chain_id:`<"SN_SEPOLIA" or "MAINNET"> });
getAccount
Gets the tokenbound account address for an NFT.
Returns the tokenbound account address for a given token contract and token ID.
Execute a contract call on any arbitrary contract and engage in multi-contract interaction within a single transaction (multicall).
import { Call } from'starknet-tokenbound-sdk';constcall1:Call= { to:`<contractAddress>`,//contractAddress to call selector:`<selector>`,// method to be called on the contract calldata: [] // payload to be passed alongside the selector }constcall2:Call= { to:`<contractAddress>`,//contractAddress to call selector:`<selector>`,// method to be called on the contract calldata: [] // payload to be passed alongside the selector }try {awaittokenbound.execute(account asstring, [call1, call2]) }