To get started using the SDK, you must first initialize an instance of ThirdWebSDK, and connect to the Pivotal network by passing in the Pivotal chain.
To initialize the SDK with the Pivotal network and get a contract:
import { Pivotal } from '@thirdweb-dev/chains';
import { ThirdwebSDK } from '@thirdweb-dev/sdk/evm';
const sdk = new ThirdwebSDK(Pivotal);
const contract = await sdk.getContract('0x0000000000000000000000000000000000000000');
The thirdweb SDK provides convenience functions when your smart contract uses extensions. This is the easiest way to read data and write transactions with your smart contracts.
For example, if your contract implements the ERC721 extension, you can utilize all of the functions of the corresponding erc721 standard in the SDK.
As an example, below is a code snippet that uses useOwnedNFTs hook to get a list of NFTs owned by a single wallet address:
If your contract doesn’t use any extensions, or you want to directly call functions on your smart contract to read data, you can use the useContractRead hook.
Read data on your contract from a connected wallet:
If your contract doesn’t use any extensions, or you want to directly call functions on your smart contract to write data, you can use the useContractWrite hook.
Make transactions on your contract from a connected wallet: