React Cheatsheet

Task@thirdweb-dev/reactthirdweb
Providerimport { ThirdwebProvider} from @thirdweb-dev/reactimport { ThirdwebProvider } from "thirdweb/react"
ContractuseContract(...)getContract(...) // not a hook
AddressuseAddress(...)useActiveAccount(...) // account?.address
ReaduseContractRead(...)useReadContract(...)
WriteuseContractWrite(...)useSendTransaction()
ExtensionsuseNFTs(...)useReadContract(getNFTs, { ... })
Get SigneruseSigner()useActiveAccount()
Get WalletuseWallet()useActiveWallet()
ButtonWeb3ButtonTransactionButton
ConnectConnectWalletConnectButton
Connection StatususeConnectionStatus()useActiveWalletConnectionStatus()
Switch ChainuseSwitchChain()useSwitchActiveWalletChain()
Get Connected ChainuseChain()useActiveWalletChain()

TypeScript Cheatsheet

Task@thirdweb-dev/sdkthirdweb
Chainsimport { Sepolia } from "@thirdweb-dev/chains"import { sepolia } from "thirdweb/chains"
Walletsimport { MetaMaskWallet } from "@thirdweb-dev/wallets"import { createWallet } from "thirdweb/wallets"
Initializenew ThirdwebSDK(...)createThirdwebClient({ ... })
Contractawait sdk.getContract(...)getContract(...) // no await
Readawait contract.call(...)await readContract(...)
Prepareawait contract.prepare(...)prepareContractCall(...) // no await
Sendawait contract.call(...)await sendTransaction(...)
Extensionsawait contract.erc721.getAll()await getNFTs(...)
Deploysdk.deployer.deployBuiltInContract(...)await deployPublishedContract(...)