From e03b622a09d207b0598fa6cceec0f512ed145e8f Mon Sep 17 00:00:00 2001 From: MananTank Date: Tue, 29 Apr 2025 20:35:54 +0000 Subject: [PATCH] Portal: Commit llms txt files, add logs in postbuild scripts (#6890) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on enhancing error handling and logging in the `extractSearchData.ts` and `extractLLMData.ts` scripts, while also updating the content of the `llms.txt` file with new documentation. ### Detailed summary - Added logging for successful extraction in `extractSearchData.ts` and `extractLLMData.ts`. - Implemented error handling with `try-catch` blocks in both scripts. - Updated `llms.txt` with new documentation content, including UI components, transactions, and hooks. > The following files were skipped due to too many changes: `apps/portal/public/llms.txt`, `apps/portal/public/llms-full.txt` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- apps/portal/.gitignore | 2 - apps/portal/public/llms-full.txt | 56666 +++++++++++++++++++++ apps/portal/public/llms.txt | 1225 + apps/portal/scripts/extractLLMData.ts | 13 +- apps/portal/scripts/extractSearchData.ts | 11 +- 5 files changed, 57910 insertions(+), 7 deletions(-) create mode 100644 apps/portal/public/llms-full.txt create mode 100644 apps/portal/public/llms.txt diff --git a/apps/portal/.gitignore b/apps/portal/.gitignore index 67fe01f7026..182bbb9ac4e 100644 --- a/apps/portal/.gitignore +++ b/apps/portal/.gitignore @@ -39,8 +39,6 @@ next-env.d.ts # generated files searchIndex.json -public/llms.txt -public/llms-full.txt .env public/sitemap*.xml diff --git a/apps/portal/public/llms-full.txt b/apps/portal/public/llms-full.txt new file mode 100644 index 00000000000..f7e49d4c12f --- /dev/null +++ b/apps/portal/public/llms-full.txt @@ -0,0 +1,56666 @@ +# __thirdweb TypeScript SDK Documentation__ + +> Frontend, Backend, and Onchain tools to build complete web3 apps — on every EVM chain. + +--- +**UI Components** +--- +# Wallets +--- + +## AccountAddress + +### Example + +#### Basic usage + +```tsx +import { AccountProvider, AccountAddress } from "thirdweb/react"; + + + +; +``` + + Result: + +```html +0x12345674b599ce99958242b3D3741e7b01841DF3 +``` + +#### Shorten the address + +```tsx +import { AccountProvider, AccountAddress } from "thirdweb/react"; +import { shortenAddress } from "thirdweb/utils"; + + + +; +``` + + Result: + +```html +0x1234...1DF3 +``` + +```ts +function AccountAddress( + __namedParameters: AccountAddressProps, +): Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",formatFn : (str: string) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: Element; +``` + + a `` containing the full wallet address of the account +--- + +## AccountBlobbie + + A wrapper for the Blobbie component + +```ts +function AccountBlobbie( + props: Omit, +): Element; +``` + +### Parameters + + BlobbieProps + +#### Type + +```ts +let props: Omit; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- + +## AccountProvider + + A React context provider component that supplies Account-related data to its child components. + + This component serves as a wrapper around the `AccountProviderContext.Provider` and passes the provided account data down to all of its child components through the context API. + +### Example + +```tsx +import { + AccountProvider, + AccountAvatar, + AccountName, + AccountAddress, +} from "thirdweb/react"; + + + + + +; +``` + +```ts +function AccountProvider( + props: PropsWithChildren, +): Element; +``` + +### Parameters + +#### Type + +```ts +let props: PropsWithChildren; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- + +## Blobbie + + A unique gradient avatar based on the provided address. + +### Example + +```tsx +import { Blobbie } from "thirdweb/react"; + +; +``` + +```ts +function Blobbie(props: BlobbieProps): Element; +``` + +### Parameters + + The component props. + +#### Type + +```ts +let props: BlobbieProps; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- + +## WalletProvider + + /\*\* + +* A React context provider component that supplies Wallet-related data to its child components. +* This component serves as a wrapper around the `WalletProviderContext.Provider` and passes +* the provided wallet data down to all of its child components through the context API. + +### Example + +* #### Basic usage +* ```tsx +``` +* import { WalletProvider, WalletIcon, WalletName } from "thirdweb/react"; +* `` +* `` +* `` +* `` + +```ts +function WalletProvider( + props: PropsWithChildren, +): Element; +``` + +### Parameters + +#### Type + +```ts +let props: PropsWithChildren; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +# Wallet Connection +--- + +## AutoConnectProps + +```ts +type AutoConnectProps = { + accountAbstraction?: SmartWalletOptions; + appMetadata?: AppMetadata; + chain?: Chain; + client: ThirdwebClient; + onConnect?: (wallet: Wallet) => void; + onTimeout?: () => void; + timeout?: number; + wallets?: Array; +}; +``` + + Enable Account abstraction for all wallets. This will connect to the users's smart account based on the connected personal wallet and the given options. + + If you are connecting to smart wallet using personal wallet - setting this configuration will autoConnect the personal wallet and then connect to the smart wallet. + +```tsx + +``` + +```ts +type accountAbstraction = SmartWalletOptions; +``` + + Metadata of the app that will be passed to connected wallet. Setting this is highly recommended. + + Some wallets display this information to the user when they connect to your app. + +```ts +type appMetadata = AppMetadata; +``` + +### Example + +```ts +{ + name: "My App", + url: "https://my-app.com", + description: "some description about your app", + logoUrl: "https://path/to/my-app/logo.svg", +}; +``` + + Optional chain to autoconnect to + +```ts +type chain = Chain; +``` + + A client is the entry point to the thirdweb SDK. It is required for all other actions. You can create a client using the `createThirdwebClient` function. Refer to the [ Creating a Client](https://portal.thirdweb.com/typescript/v5/client) documentation for more information. + + You must provide a `clientId` or `secretKey` in order to initialize a client. Pass `clientId` if you want for client-side usage and `secretKey` for server-side usage. + +```tsx +import { createThirdwebClient } from "thirdweb"; + +const client = createThirdwebClient({ + clientId: "", +}); +``` + +```ts +type client = ThirdwebClient; +``` + +```ts +function onConnect(wallet: Wallet): void; +``` + +##### Parameters + +###### Type + +```ts +let wallet: { + getAdminAccount?: () => Account | undefined; + getConfig: () => CreateWalletArgs[1]; + id: TWalletId; + onConnectRequested?: () => Promise; + subscribe: WalletEmitter["subscribe"]; + autoConnect: ( + options: WalletAutoConnectionOption, + ) => Promise; + connect: ( + options: WalletConnectionOption, + ) => Promise; + disconnect: () => Promise; + getAccount: () => undefined | Account; + getChain: () => + | undefined + | Readonly; + switchChain: ( + chain: Readonly, + ) => Promise; +}; +``` + +##### Returns + +```ts +let returnType: void; +``` + +```ts +function onTimeout(): void; +``` + +##### Returns + +```ts +let returnType: void; +``` + + if the autoConnection does not succeed within given timeout in milliseconds, it will be cancelled. + + By default, the timeout is set to 15000ms (15 seconds). + +```tsx +; +``` + +```ts +type timeout = number; +``` + + Array of wallets that your app uses + +```ts +type wallets = Array; +``` + +### Example + +```tsx +import { AutoConnect } from "thirdweb/react"; +import { createWallet, inAppWallet } from "thirdweb/wallets"; + +const wallets = [ + inAppWallet(), + createWallet("io.metamask"), + createWallet("com.coinbase.wallet"), + createWallet("me.rainbow"), +]; + +function Example() { + return ; +} +``` +--- + +## ConnectButton + + A fully featured wallet connection component that allows to: + +* Connect to 500+ external wallets +* Connect with email, phone, passkey or socials +* Convert any wallet to a ERC4337 smart wallet for gasless transactions +* Sign in with ethereum (Auth) + + Once connected, the component allows to: + +* Reolve ENS names and avatars +* Manage multipple connected wallets +* Send and receive native tokens and ERC20 tokens +* View ERC20 tokens and NFTs +* Onramp, bridge and swap tokens +* Switch chains +* Connect to another app with WalletConnect + +### Example + +### Default setup + +```tsx +import { createThirdwebClient } from "thirdweb"; +import { ConnectButton } from "thirdweb/react"; + +const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); + +; +``` + +[ View all available config options](https://portal.thirdweb.com/references/typescript/v5/ConnectButtonProps) + +### Customization options + +#### Customizing wallet options + +```tsx +; +``` + +[ View all available wallets](https://portal.thirdweb.com/typescript/v5/supported-wallets) + +#### Customizing the default chain to connect to + +```tsx +import { sepolia } from "thirdweb/chains"; + +; +``` + +#### Enabling Account Abstraction + + By passing the `accountAbstraction` prop, ALL connected wallets will be converted to smart accounts. And by setting `sponsorGas` to `true` , all transactions done with those smart accounts will be sponsored. + +```tsx +; +``` + + Note that this prop doesn't affect ecosystem wallets. Ecosystem wallets will only be converted to smart accounts if the ecosystem owner has enabled account abstraction. + +#### Enabling sign in with ethereum (Auth) + +```tsx + { + console.log("checking if logged in!", { address }); + return await isLoggedIn(); + }, + doLogin: async (params) => { + console.log("logging in!"); + await login(params); + }, + getLoginPayload: async ({ address }) => + generatePayload({ address }), + doLogout: async () => { + console.log("logging out!"); + await logout(); + }, + }} +/>; +``` + +#### Customizing the theme + +```tsx +; +``` + + For more granular control, you can also pass a custom theme object: + +```tsx +; +``` + +[ View all available themes properties](https://portal.thirdweb.com/references/typescript/v5/Theme) + +#### Changing the display language + +```tsx +; +``` + +[ View all available locales](https://portal.thirdweb.com/references/typescript/v5/LocaleId) + +#### Customizing the connect button UI + +```tsx +; +``` + +#### Customizing the modal UI + +```tsx +; +``` + +#### Customizing details button UI (after connecting) + +```tsx +; +``` + +[ View all available auth helper functions](https://portal.thirdweb.com/references/typescript/v5/createAuth) + +#### Customizing the Auth sign in button (after connecting, but before authenticating) + +```tsx +; +``` + +#### Customizing supported Tokens and NFTs + + These tokens and NFTs will be shown in the modal when the user clicks "View Assets", as well as the send token screen. + +```tsx +; +``` + +#### Customizing the orders of the tabs in the \[View Funds\] screen + + When you click on "View Assets", by default the "Tokens" tab is shown first. If you want to show the "NFTs" tab first, change the order of the asset tabs to: \["nft", "token"\] Note: If an empty array is passed, the \[View Funds\] button will be hidden + +```tsx +; +``` + +#### Callback for when the details modal is closed + +```tsx + { + console.log({ screen }); + }, + }} +/>; +``` + +```ts +function ConnectButton(props: ConnectButtonProps): Element; +``` + +### Parameters + + Props for the `ConnectButton` component + + Refer to [ ConnectButtonProps](https://portal.thirdweb.com/references/typescript/v5/ConnectButtonProps) to see the available props. + +#### Type + +```ts +let props: { + accountAbstraction?: SmartWalletOptions; + appMetadata?: AppMetadata; + auth?: SiweAuthOptions; + autoConnect?: { timeout: number } | boolean; + chain?: Chain; + chains?: Array; + client: ThirdwebClient; + connectButton?: ConnectButton_connectButtonOptions; + connectModal?: ConnectButton_connectModalOptions; + detailsButton?: ConnectButton_detailsButtonOptions; + detailsModal?: ConnectButton_detailsModalOptions; + locale?: LocaleId; + onConnect?: (wallet: Wallet) => void; + onDisconnect?: (info: { account: Account; wallet: Wallet }) => void; + recommendedWallets?: Array; + showAllWallets?: boolean; + signInButton?: { + className?: string; + label?: string; + style?: React.CSSProperties; + }; + supportedNFTs?: SupportedNFTs; + supportedTokens?: SupportedTokens; + switchButton?: { + className?: string; + label?: string; + style?: React.CSSProperties; + }; + theme?: "dark" | "light" | Theme; + walletConnect?: { projectId?: string }; + wallets?: Array; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` + + A JSX element that renders the `` component. +--- + +## ConnectEmbed + + An inline wallet connection component that allows to: + +* Connect to 500+ external wallets +* Connect with email, phone, passkey or socials +* Convert any wallet to a ERC4337 smart wallet for gasless transactions +* Sign in with ethereum (Auth) + + It renders the same UI as the [ConnectButton](https://portal.thirdweb.com/react/v5/ConnectButton) component's modal - but directly inline in the page instead of being in a modal. + + Once connected, the component does not render any UI. It only renders UI if wallet is not connected. + +### Example + +### Default setup + +```tsx +import { createThirdwebClient } from "thirdweb"; +import { ConnectEmbed } from "thirdweb/react"; + +const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); + +; +``` + +[ View all available config options](https://portal.thirdweb.com/references/typescript/v5/ConnectEmbedProps) + +### Customization options + +#### Customizing wallet options + +```tsx +; +``` + +[ View all available wallets](https://portal.thirdweb.com/typescript/v5/supported-wallets) + +#### Customizing the default chain to connect to + +```tsx +import { base } from "thirdweb/chains"; + +; +``` + +#### Enabling Account Abstraction + + By passing the `accountAbstraction` prop, ALL connected wallets will be converted to smart accounts. And by setting `sponsorGas` to `true` , all transactions done with those smart accounts will be sponsored. + +```tsx +; +``` + + Note that this prop doesn't affect ecosystem wallets. Ecosystem wallets will only be converted to smart accounts if the ecosystem owner has enabled account abstraction. + +#### Enabling sign in with ethereum (Auth) + +```tsx + { + console.log("checking if logged in!", { address }); + return await isLoggedIn(); + }, + doLogin: async (params) => { + console.log("logging in!"); + await login(params); + }, + getLoginPayload: async ({ address }) => + generatePayload({ address }), + doLogout: async () => { + console.log("logging out!"); + await logout(); + }, + }} +/>; +``` + +#### Customizing the theme + +```tsx +; +``` + + For more granular control, you can also pass a custom theme object: + +```tsx +; +``` + +[ View all available themes properties](https://portal.thirdweb.com/references/typescript/v5/Theme) + +#### Changing the display language + +```tsx +; +``` + +[ View all available locales](https://portal.thirdweb.com/references/typescript/v5/LocaleId) + +```ts +function ConnectEmbed(props: ConnectEmbedProps): Element; +``` + +### Parameters + + The props for the `ConnectEmbed` component. + + Refer to the [ConnectEmbedProps](https://portal.thirdweb.com/references/typescript/v5/ConnectEmbedProps) type for more details + +#### Type + +```ts +let props: { + accountAbstraction?: SmartWalletOptions; + appMetadata?: AppMetadata; + auth?: SiweAuthOptions; + autoConnect?: { timeout: number } | boolean; + chain?: Chain; + chains?: Array; + className?: string; + client: ThirdwebClient; + header?: { title?: string; titleIcon?: string } | true; + locale?: LocaleId; + modalSize?: "compact" | "wide"; + onConnect?: (wallet: Wallet) => void; + privacyPolicyUrl?: string; + recommendedWallets?: Array; + requireApproval?: boolean; + showAllWallets?: boolean; + showThirdwebBranding?: boolean; + style?: React.CSSProperties; + termsOfServiceUrl?: string; + theme?: "dark" | "light" | Theme; + walletConnect?: { projectId?: string }; + wallets?: Array; + welcomeScreen?: WelcomeScreen; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` + + A JSX element that renders the `` component. +--- + +## SiteEmbed + + Embeds another thirdweb-supported site for seamless in-app and ecosystem wallet connection. + + Make sure the embedded site includes `` and supports frame ancestors, see [ here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors) for more information. + + The embedded site must support the connected wallet (ecosystem or in-app). + +### Example + +```tsx +import { SiteEmbed } from "thirdweb/react"; + +; +``` + +```ts +function SiteEmbed( + props: { + client: ThirdwebClient; + ecosystem?: Ecosystem; + src: string; + } & ClassAttributes & + IframeHTMLAttributes, +): Element; +``` + +### Parameters + + The props to pass to the iframe + +#### Type + +```ts +let props: { + client: ThirdwebClient; + ecosystem?: Ecosystem; + src: string; +} & ClassAttributes & + IframeHTMLAttributes; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- + +## SiteLink + + Creates a link to another thirdweb-supported site with wallet connection parameters. + + The target site must support the connected wallet (ecosystem or in-app). + +### Example + +```tsx +import { SiteLink } from "thirdweb/react"; + + + Visit Site +; +``` + +```ts +function SiteLink( + props: { + children: ReactNode; + client: ThirdwebClient; + ecosystem?: Ecosystem; + href: string; + } & Omit, "href">, +): Element; +``` + +### Parameters + + The props to pass to the anchor tag + +#### Type + +```ts +let props: { + children: ReactNode; + client: ThirdwebClient; + ecosystem?: Ecosystem; + href: string; +} & Omit, "href">; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- + +## ThirdwebProvider + + The ThirdwebProvider is component is a provider component that sets up the React Query client. + +### Example + +```jsx +import { ThirdwebProvider } from "thirdweb/react"; + +function Example() { + return ( + + + + ); +} +``` + +```ts +function ThirdwebProvider( + props: PropsWithChildren<{ + connectionManager?: { + activeAccountStore: Store; + activeWalletChainStore: Store< + undefined | Readonly + >; + activeWalletConnectionStatusStore: Store; + activeWalletStore: Store; + addConnectedWallet: (wallet: Wallet) => void; + connect: ( + wallet: Wallet, + options?: ConnectManagerOptions, + ) => Promise; + connectedWallets: ReadonlyStore>; + defineChains: ( + chains: Array>, + ) => void; + disconnectWallet: (wallet: Wallet) => void; + handleConnection: ( + wallet: Wallet, + options?: ConnectManagerOptions, + ) => Promise; + isAutoConnecting: Store; + removeConnectedWallet: (wallet: Wallet) => void; + setActiveWallet: (activeWallet: Wallet) => Promise; + switchActiveWalletChain: ( + chain: Readonly, + ) => Promise; + }; + }>, +): Element; +``` + +### Parameters + + The props for the ThirdwebProvider + +#### Type + +```ts +let props: PropsWithChildren<{ + connectionManager?: { + activeAccountStore: Store; + activeWalletChainStore: Store< + undefined | Readonly + >; + activeWalletConnectionStatusStore: Store; + activeWalletStore: Store; + addConnectedWallet: (wallet: Wallet) => void; + connect: ( + wallet: Wallet, + options?: ConnectManagerOptions, + ) => Promise; + connectedWallets: ReadonlyStore>; + defineChains: ( + chains: Array>, + ) => void; + disconnectWallet: (wallet: Wallet) => void; + handleConnection: ( + wallet: Wallet, + options?: ConnectManagerOptions, + ) => Promise; + isAutoConnecting: Store; + removeConnectedWallet: (wallet: Wallet) => void; + setActiveWallet: (activeWallet: Wallet) => Promise; + switchActiveWalletChain: ( + chain: Readonly, + ) => Promise; + }; +}>; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +# Chain +--- + +## ChainProvider + + A React context provider component that supplies Chain-related data to its child components. + + This component serves as a wrapper around the `ChainProviderContext.Provider` and passes the provided chain data down to all of its child components through the context API. + +### Example + +#### Basic usage + +```tsx +import { ChainProvider, ChainIcon, ChainName } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + + +; +``` + +#### Usage with defineChain + +```tsx +import { defineChain } from "thirdweb/chains"l +import { ChainProvider, ChainName } from "thirdweb/react"; + +const chainId = someNumber; + + + + +``` + +```ts +function ChainProvider( + props: PropsWithChildren, +): Element; +``` + +### Parameters + +#### Type + +```ts +let props: PropsWithChildren; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +# Transactions +--- + +## BuyDirectListingButton + + This button is used with thirdweb Marketplace v3 contract, for buying NFT(s) from a listing. + + Under the hood, it prepares a transaction using the [buyFromListing extension](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyFromListing)and then pass it to a `` + + Since it uses the TransactionButton, it can take in any props that can be passed to the [TransactionButton](https://portal.thirdweb.com/references/typescript/v5/TransactionButton) + +### Example + +```tsx +import { BuyDirectListingButton } from "thirdweb/react"; + + + Buy NFT + +``` + + For error handling & callbacks on transaction-sent and transaction-confirmed, please refer to the TransactionButton docs. + +```ts +function BuyDirectListingButton( + props: BuyDirectListingButtonProps, +): Element; +``` + +### Parameters + +#### Type + +```ts +let props: Omit & { + chain: Chain; + client: ThirdwebClient; + contractAddress: string; + listingId: bigint; + quantity?: bigint; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` + +`` +--- + +## ClaimButton + + This button is used to claim tokens (NFT or ERC20) from a given thirdweb Drop contract. + + there are 3 type of Drop contract: NFT Drop (DropERC721), Edition Drop (DropERC1155) and Token Drop (DropERC20) + + Learn more: https://thirdweb.com/explore/drops + + Note: This button only works with thirdweb Drop contracts. For custom contract, please use [TransactionButton](https://portal.thirdweb.com/references/typescript/v5/TransactionButton) + +### Example + + Example for claiming NFT from an NFT Drop contract + +```tsx +import { ClaimButton } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + Claim now +; +``` + + For Edition Drop (ERC1155) + +```tsx + + Claim now +; +``` + + For Token Drop (ERC20) + +```tsx + + Claim now +; +``` + + Attach custom Pay metadata + +```tsx + + ... +; +``` + + Since this button uses the `TransactionButton` , it can take in any props that can be passed to the [TransactionButton](https://portal.thirdweb.com/references/typescript/v5/TransactionButton) + + For error handling & callbacks on transaction-sent and transaction-confirmed, please refer to the TransactionButton docs. + +```ts +function ClaimButton(props: ClaimButtonProps): Element; +``` + +### Parameters + +#### Type + +```ts +let props: Omit & { + chain: Chain; + claimParams: ClaimParams; + client: ThirdwebClient; + contractAddress: string; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` + + A wrapper for TransactionButton +--- + +## CreateDirectListingButton + + This button is used to create Direct listings for the thirdweb Marketplace v3 contract + + It uses the [TransactionButton](https://portal.thirdweb.com/references/typescript/v5/TransactionButton)and the [createListing extension](https://portal.thirdweb.com/references/typescript/v5/marketplace/createListing) under the hood which means it inherits all the props of those 2 components. + +### Example + +```tsx +import { CreateDirectListingButton } from "thirdweb/react"; + + +> + Sell NFT + +``` + + For error handling & callbacks on transaction-sent and transaction-confirmed, please refer to the TransactionButton docs. + +```ts +function CreateDirectListingButton( + props: CreateDirectListingButtonProps, +): Element; +``` + +### Parameters + +#### Type + +```ts +let props: Omit & + CreateListingParams & { + chain: Chain; + client: ThirdwebClient; + contractAddress: string; + }; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- + +## TransactionButton + + TransactionButton component is used to render a button that triggers a transaction. It shows a "Switch Network" button if the connected wallet is on a different chain than the transaction. + +### Example + +#### Basic usage + +```tsx + {}} + onTransactionConfirmed={handleSuccess} + onError={handleError} +> + Confirm Transaction +; +``` + +#### Customize the styling by passing the `unstyled` prop and your inline styles and/or classes: + +```tsx + {}} + unstyled + className="bg-white text-black rounded-md p-4 flex items-center justify-center" +> + Confirm Transaction +; +``` + +#### Handle errors + +```tsx + ...} + onError={(err) => { + alert(err.message); + // Add your own logic here + }} +> + Confirm Transaction + +``` + +#### Alert when a transaction is sent + +```tsx + ...} + onTransactionSent={(tx) => { + alert("transaction sent!"); + // Add your own logic here. For example, a toast + }} +> + Confirm Transaction + +``` + +#### Alert when a transaction is completed + +```tsx + ...} + onTransactionConfirmed={(tx) => { + alert("transaction sent!"); + console.log(tx); + // Add your own logic here. For example, a toast + }} +> + Confirm Transaction + +``` + +#### The onClick prop, if provided, will be called before the transaction is sent. + +```tsx + alert("Transaction is about to be sent")} + transaction={...} +> + ... + +``` + +#### Attach custom Pay metadata + +```tsx + + ... +; +``` + +#### Gasless usage with [ thirdweb Engine](https://portal.thirdweb.com/engine) + +```tsx + + ... +; +``` + +#### Gasless usage with OpenZeppelin + +```tsx + + ... +; +``` + +```ts +function TransactionButton(props: TransactionButtonProps): Element; +``` + +### Parameters + + The props for this component. Refer to [ TransactionButtonProps](https://portal.thirdweb.com/references/typescript/v5/TransactionButtonProps) for details. + +#### Type + +```ts +let props: { + children: React.ReactNode; + className?: string; + disabled?: boolean; + gasless?: GaslessOptions; + onClick?: () => void; + onError?: (error: Error) => void; + onTransactionConfirmed?: (receipt: TransactionReceipt) => void; + onTransactionSent?: ( + transactionResult: WaitForReceiptOptions, + ) => void; + payModal?: SendTransactionPayModalConfig; + style?: React.CSSProperties; + theme?: "dark" | "light" | Theme; + transaction: () => + | PreparedTransaction + | Promise>; + type?: HTMLButtonElement["type"]; + unstyled?: boolean; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +# NFT +--- + +## NFTProvider + + A React context provider component that supplies NFT-related data to its child components. + + This component serves as a wrapper around the `NFTProviderContext.Provider` and passes the provided NFT data down to all of its child components through the context API. + +### Example + +```tsx +import { getContract } from "thirdweb"; +import { + NFTProvider, + NFTMedia, + NFTDescription, + NFTName, +} from "thirdweb/react"; + +const contract = getContract({ + address: "0x...", + chain: ethereum, + client: yourThirdwebClient, +}); + + + + + +; +``` + +```ts +function NFTProvider( + props: PropsWithChildren, +): Element; +``` + +### Parameters + + The props for the NFT provider + +#### Type + +```ts +let props: PropsWithChildren; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +# Tokens +--- + +## TokenProvider + + A React context provider component that supplies Token-related data to its child components. + + This component serves as a wrapper around the `TokenProviderContext.Provider` and passes the provided token data down to all of its child components through the context API. + +### Example + +#### Basic usage + +```tsx +import { TokenProvider, TokenIcon, TokenName } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + + + +``` + +#### This component also works with native token! + +```tsx +import { NATIVE_TOKEN_ADDRESS } from "thirdweb"; +import { ethereum } from "thirdweb/chains"; + + + // "ETH" +; +``` + +```ts +function TokenProvider( + props: PropsWithChildren, +): Element; +``` + +### Parameters + +#### Type + +```ts +let props: PropsWithChildren; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +# Miscellaneous +--- + +## MediaRenderer + +```ts +function MediaRenderer( + props: MediaRendererProps & RefAttributes, +): ReactNode; +``` + +### Parameters + + Refer to [MediaRendererProps](https://portal.thirdweb.com/references/typescript/v5/MediaRendererProps) to see the available props. + +#### Type + +```ts +let props: MediaRendererProps & RefAttributes; +``` + +### Returns + +```ts +let returnType: ReactNode; +``` +--- + +## PayEmbed + + Embed a prebuilt UI for funding wallets, purchases or transactions with crypto or fiat. + +### Example + +#### Default configuration + + By default, the `PayEmbed` component will allows users to fund their wallets with crypto or fiat on any of the supported chains.. + +```tsx +; +``` + +#### Top up wallets + + You can set the `mode` option to `"fund_wallet"` to allow users to top up their wallets with crypto or fiat. + +```tsx +; +``` + +#### Direct Payments + + You can set the `mode` option to `"direct_payment"` to allow users to make a direct payment to a wallet address. + +```tsx +; +``` + +#### Transactions + + You can set the `mode` option to `"transaction"` to allow users to execute a transaction with a different wallet, chain or token. + +```tsx +; +``` + + You can also handle ERC20 payments by passing `erc20value` to your transaction: + +```tsx + +``` + +#### Enable/Disable payment methods + + You can disable the use of crypto or fiat by setting the `buyWithCrypto` or `buyWithFiat` options to `false` . + +```tsx + + +### Customize the UI + +You can customize the UI of the `PayEmbed` component by passing a custom theme object to the `theme` prop. + +```tsx + +``` + + Refer to the [Theme](https://portal.thirdweb.com/references/typescript/v5/Theme) type for more details. + +#### Configure the wallet connection + + You can customize the wallet connection flow by passing a `connectOptions` object to the `PayEmbed` component. + +```tsx +; +``` + + Refer to the [PayEmbedConnectOptions](https://portal.thirdweb.com/references/typescript/v5/PayEmbedConnectOptions) type for more details. + + @buyCrypto + +```ts +function PayEmbed(props: PayEmbedProps): Element; +``` + +### Parameters + + Props of type [PayEmbedProps](https://portal.thirdweb.com/references/typescript/v5/PayEmbedProps) to configure the PayEmbed component. + +#### Type + +```ts +let props: { + className?: string; + client: ThirdwebClient; + connectOptions?: PayEmbedConnectOptions; + hiddenWallets?: Array; + locale?: LocaleId; + payOptions?: PayUIOptions; + style?: React.CSSProperties; + supportedTokens?: SupportedTokens; + theme?: "light" | "dark" | Theme; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` +--- +**React Hooks** +--- +# Extensions +--- +## EIP5792 +--- + +## useCallsStatus + + A hook to get a call bundle's current status according to [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) . + + This function is dependent on the wallet's support for EIP-5792 and could throw an error if it's not supported. + +### Example + +```tsx +import { useCallsStatus } from "thirdweb/react"; +const { data: status, isLoading } = useCallsStatus({ + bundleId, + client, +}); +``` + +```ts +function useCallsStatus(options: { + bundleId: string; + client: ThirdwebClient; + queryOptions?: { enabled?: boolean; retry?: number }; +}): UseQueryResult; +``` + +### Parameters + +#### Type + +```ts +let options: { + bundleId: string; + client: ThirdwebClient; + queryOptions?: { enabled?: boolean; retry?: number }; +}; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + a React Query object. +--- + +## useCapabilities + + A hook to get the current wallet's capabilities according to [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) . + + This function is dependent on the wallet's support for EIP-5792, but will not throw. _The returned object contains a `message` field detailing any issues with the wallet's support for EIP-5792._ + +### Example + +```tsx +import { useCapabilities } from "thirdweb/react"; +const { data: capabilities, isLoading } = useCapabilities(); +``` + +```ts +function useCapabilities(options?: { + queryOptions?: { enabled?: boolean; retry?: number }; +}): UseQueryResult; +``` + +### Parameters + +#### Type + +```ts +let options: { queryOptions?: { enabled?: boolean; retry?: number } }; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + a React Query object. +--- + +## useSendCalls + + A hook to send [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) calls to a wallet. This hook works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792\. Transactions will be bundled and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions. + + When calls are sent, all contracts that are interacted with will have their corresponding reads revalidated via React Query. + + This hook is dependent on the wallet's support for EIP-5792 and could fail. The mutatuon function will use your currently connected wallet by default, but you can pass it a specific wallet to use if you'd like. + +### Example + +```tsx +import { useSendCalls } from "thirdweb/react"; + +const sendTx1 = approve({ + contract: USDT_CONTRACT, + amount: 100, + spender: "0x33d9B8BEfE81027E2C859EDc84F5636cbb202Ed6", +}); +const sendTx2 = approve({ + contract: USDT_CONTRACT, + amount: 100, + spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709", +}); +const { mutate: sendCalls, data: bundleId } = useSendCalls({ + client, +}); +await sendCalls({ + wallet, + client, + calls: [sendTx1, sendTx2], +}); +``` + + Await the bundle's full confirmation: + +```tsx +const { mutate: sendCalls, data: bundleId } = useSendCalls({ + client, + waitForResult: true, +}); +await sendCalls({ + wallet, + client, + calls: [sendTx1, sendTx2], +}); +``` + + Sponsor transactions with a paymaster: + +```ts +const { mutate: sendCalls, data: bundleId } = useSendCalls(); +await sendCalls({ + client, + calls: [sendTx1, sendTx2], + capabilities: { + paymasterService: { + url: `https://${CHAIN.id}.bundler.thirdweb.com/${client.clientId}`, + }, + }, +}); +``` + + We recommend proxying any paymaster calls via an API route you setup and control. + +```ts +function useSendCalls(__namedParameters: { + client: ThirdwebClient; + waitForResult?: boolean; +}): UseMutationResult< + GetCallsStatusResponse | WalletSendCallsId, + Error, + Omit & { wallet?: Wallet } +>; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: { + client: ThirdwebClient; + waitForResult?: boolean; +}; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + GetCallsStatusResponse | WalletSendCallsId, + Error, + Omit & { wallet?: Wallet } +>; +``` + + A React Query mutatuon object to interact with sendCalls +--- +## ENS +--- + +## useEnsAvatar + + Get the ENS avatar for an ENS name + +### Example + +```tsx +import { useEnsAvatar } from "thirdweb/react"; + +const { data: ensAvatar } = useEnsAvatar({ + client, + ensName: "my-ens-name.eth", +}); +``` + +```ts +function useEnsAvatar(options: { + client: ThirdwebClient; + ensName: undefined | null | string; +}): UseQueryResult; +``` + +### Parameters + + the client and ENS name to get the avatar for + +#### Type + +```ts +let options: { + client: ThirdwebClient; + ensName: undefined | null | string; +}; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + +* a query object that resolves to the avatar +--- + +## useEnsName + + Get the ENS name and avatar for an address + +### Example + +```tsx +import { useEnsName } from "thirdweb/react"; + +const { data: ensName } = useEnsName({ + client, + address: "0x1234...", +}); +``` + +```ts +function useEnsName(options: { + address: undefined | string; + client: ThirdwebClient; +}): UseQueryResult; +``` + +### Parameters + + the client and address to get the ENS name and avatar for + +#### Type + +```ts +let options: { address: undefined | string; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + +* a query object that resolves to the ENS name +--- +# Wallets +--- + +## useLinkProfile + + Links a web2 or web3 profile to the connected in-app or ecosystem account. _When a profile is linked to the account, that profile can then be used to sign into the same account._ + +### Example + +#### Linking a social profile + +```jsx +import { useLinkProfile } from "thirdweb/react"; + +const { mutate: linkProfile } = useLinkProfile(); + +const onClick = () => { + linkProfile({ + client, + strategy: "discord", // or "google", "x", "telegram", etc + }); +}; +``` + +#### Linking an email + +```jsx +import { useLinkProfile } from "thirdweb/react"; +import { preAuthenticate } from "thirdweb/wallets"; + +const { mutate: linkProfile } = useLinkProfile(); + +// send a verification email first +const sendEmail = async () => { + const email = await preAuthenticate({ + client, + strategy: "email", + email: "john.doe@example.com", + }); +}; + +// then link the profile with the verification code +const onClick = (code: string) => { + linkProfile({ + client, + strategy: "email", + email: "john.doe@example.com", + verificationCode: code, + }); +}; +``` + + The same process can be used for phone and email, simply swap out the `strategy` parameter. + +#### Linking a wallet + +```jsx +import { useLinkProfile } from "thirdweb/react"; + +const { mutate: linkProfile } = useLinkProfile(); + +const onClick = () => { + linkProfile({ + client, + strategy: "wallet", + wallet: createWallet("io.metamask"), // autocompletion for 400+ wallet ids + chain: sepolia, // any chain works, needed for SIWE signature + }); +}; +``` + +```ts +function useLinkProfile(): UseMutationResult< + Array, + Error, + AuthArgsType, + unknown +>; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + Array, + Error, + AuthArgsType, + unknown +>; +``` +--- + +## useNetworkSwitcherModal + + Hook to open the Wallet Network Switcher Modal that shows allows users to switch to different network. + +### Example + +```tsx +import { createThirdwebClient } from "thirdweb"; +import { useNetworkSwitcherModal } from "thirdweb/react"; +import { base, ethereum, polygon, sepolia, arbitrum } from "thirdweb/chains"; + +const client = createThirdwebClient({ + clientId: "", +}); + +function Example() { + const networkSwitcher = useNetworkSwitcherModal(); + + function handleClick() { + networkSwitcher.open({ + client, + theme: 'light' + sections: [ + { label: 'Recently used', chains: [arbitrum, polygon] }, + { label: 'Popular', chains: [base, ethereum, sepolia] }, + ] + }); + } + + return +} +``` + +```ts +function useNetworkSwitcherModal(): { + close: () => void; + open: (props: UseNetworkSwitcherModalOptions) => Promise; +}; +``` + +### Returns + +```ts +let returnType: { + close: () => void; + open: (props: UseNetworkSwitcherModalOptions) => Promise; +}; +``` +--- + +## useProfiles + + Retrieves all linked profiles of the connected in-app or ecosystem account. + +### Example + +```jsx +import { useProfiles } from "thirdweb/react"; + +const { data: profiles } = useProfiles({ + client, +}); + +console.log("Type:", profiles[0].type); // "discord" +console.log("Email:", profiles[0].details.email); // "john.doe@example.com" +``` + +```ts +function useProfiles(args: { + client: ThirdwebClient; +}): UseQueryResult>; +``` + +### Parameters + +#### Type + +```ts +let args: { client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: UseQueryResult>; +``` + + A React Query result containing the linked profiles for the connected in-app account. This hook will only run if the connected wallet supports account linking. +--- + +## useUnlinkProfile + + Unlinks a web2 or web3 profile currently connected in-app or ecosystem account. _When a profile is unlinked from the account, it will no longer be able to be used to sign into the account._ + +### Example + +#### Unlinking an email account + +```jsx +import { useUnlinkProfile } from "thirdweb/react"; + +const { data: connectedProfiles, isLoading } = useProfiles({ + client: props.client, +}); +const { mutate: unlinkProfile } = useUnlinkProfile(); + +const onClick = () => { + unlinkProfile({ + client, + // Select any other profile you want to unlink + profileToUnlink: connectedProfiles[1], + }); +}; +``` + +```ts +function useUnlinkProfile(): UseMutationResult< + void, + Error, + { client: ThirdwebClient; profileToUnlink: Profile }, + unknown +>; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + void, + Error, + { client: ThirdwebClient; profileToUnlink: Profile }, + unknown +>; +``` +--- + +## useWalletBalance + + Fetch the balance of a wallet in native currency or for a specific token. Leave `tokenAddress` undefined to fetch the native token balance. + +### Example + +#### Fetching the native token balance + +```ts +import { useWalletBalance } from "thirdweb/react"; + +const { data, isLoading, isError } = useWalletBalance({ + chain, + address, + client, +}); +console.log("balance", data?.displayValue, data?.symbol); +``` + +#### Fetching a specific token balance + +```ts +import { useWalletBalance } from "thirdweb/react"; + +const tokenAddress = "0x..."; // the ERC20 token address + +const { data, isLoading, isError } = useWalletBalance({ + chain, + address, + client, + tokenAddress, +}); +console.log("balance", data?.displayValue, data?.symbol); +``` + +```ts +function useWalletBalance( + options: { + address: undefined | string; + chain: undefined | Readonly; + client: ThirdwebClient; + tokenAddress?: string; + }, + queryOptions?: UseWalletBalanceQueryOptions, +): UseQueryResult; +``` + +### Parameters + + GetWalletBalanceOptions - The options for fetching the wallet balance. + +#### Type + +```ts +let options: { + address: undefined | string; + chain: undefined | Readonly; + client: ThirdwebClient; + tokenAddress?: string; +}; +``` + +#### Type + +```ts +let queryOptions: UseWalletBalanceQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + GetWalletBalanceResult The result of the query. +--- + +## useWalletDetailsModal + + Hook to open the Wallet Details Modal that shows various information about the connected wallet and allows users to perform various actions like sending funds, receiving funds, switching networks, Buying tokens, etc. + +### Example + +#### Basic usage + +```tsx +import { createThirdwebClient } from "thirdweb"; +import { useWalletDetailsModal } from "thirdweb/react"; + +const client = createThirdwebClient({ + clientId: "", +}); + +function Example() { + const detailsModal = useWalletDetailsModal(); + + function handleClick() { + detailsModal.open({ client, theme: "light" }); + } + + return ; +} +``` + +#### Callback for when the modal is closed + +```tsx +detailsModal.open({ + client, + onClose: (screen: string) => console.log({ screen }), +}); +``` + +```ts +function useWalletDetailsModal(): { + open: (props: UseWalletDetailsModalOptions) => void; +}; +``` + +### Returns + +```ts +let returnType: { + open: (props: UseWalletDetailsModalOptions) => void; +}; +``` +--- + +## useWalletImage + + Returns the wallet icon for the provided wallet id. + +### Example + +```tsx +import { useWalletImage } from "thirdweb/react"; + +const { data: walletImage } = useWalletImage("io.metamask"); + +return MetaMask logo; +``` + +```ts +function useWalletImage( + id: undefined | WalletId, +): UseQueryResult; +``` + +### Parameters + +#### Type + +```ts +let id: undefined | WalletId; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` +--- + +## useWalletInfo + + Returns the wallet info for the provided wallet id. + +### Example + +```tsx +import { useWalletInfo } from "thirdweb/react"; + +const { data: walletInfo } = useWalletInfo("io.metamask"); +console.log("Walelt name", walletInfo?.name); +``` + +```ts +function useWalletInfo( + id: undefined | WalletId, +): UseQueryResult; +``` + +### Parameters + +#### Type + +```ts +let id: undefined | WalletId; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` +--- +# Wallet Connection +--- + +## useActiveAccount + + A hook that returns the active account + +### Example + +```jsx +import { useActiveAccount } from "thirdweb/react"; + +const activeAccount = useActiveAccount(); +console.log("address", activeAccount?.address); +``` + +```ts +function useActiveAccount(): undefined | Account; +``` + +### Returns + +```ts +let returnType: undefined | Account; +``` + + The active `Account` or `undefined` if no active account is set. +--- + +## useActiveWallet + + A hook that returns the active wallet + +### Example + +#### Basic usage + +```jsx +import { useActiveWallet } from "thirdweb/react"; + +const wallet = useActiveWallet(); +``` + +#### Listen to account change event + +```jsx +const wallet = useActiveWallet(); + +wallet?.subscribe("accountChanged", (account) => { + console.log(account); +}); +``` + +#### Listen to multiple accounts changed event + +```jsx +const wallet = useActiveWallet(); + +wallet?.subscribe("accountsChanged", (addresses) => { + console.log(addresses); +}); +``` + +#### Listen to network change event + +```jsx +const wallet = useActiveWallet(); + +wallet?.subscribe("chainChanged", (chain) => { + console.log(chain); +}); +``` + +```ts +function useActiveWallet(): undefined | Wallet; +``` + +### Returns + +```ts +let returnType: undefined | Wallet; +``` + + The active `Wallet` or `undefined` if no active wallet is set. +--- + +## useActiveWalletChain + + A hook that returns the chain the active wallet is connected to + +### Example + +```jsx +import { useActiveWalletChain } from "thirdweb/react"; + +const activeChain = useActiveWalletChain(); +``` + +```ts +function useActiveWalletChain(): + | undefined + | Readonly; +``` + +### Returns + +```ts +let returnType: undefined | Readonly; +``` + + The chain the active wallet is connected to or null if no active wallet. +--- + +## useActiveWalletConnectionStatus + + A hook that returns the active account's connection status. + +### Example + +```jsx +import { useActiveWalletConnectionStatus } from "thirdweb/react"; + +function Example() { + const status = useActiveWalletConnectionStatus(); + console.log(status); + return
...
; +} +``` + +```ts +function useActiveWalletConnectionStatus(): ConnectionStatus; +``` + +### Returns + +```ts +let returnType: "connected" | "disconnected" | "connecting"; +``` + + The active wallet's connection status. +--- + +## useAdminWallet + + Get the admin wallet for the active wallet Useful for smart wallets to get the underlying personal account + +```ts +function useAdminWallet(): undefined | Wallet; +``` + +### Returns + +```ts +let returnType: undefined | Wallet; +``` + + The admin wallet for the active wallet, or the active wallet if it doesn't have an admin account +--- + +## useAutoConnect + + Autoconnect the last previously connected wallet. + +### Example + +```tsx +import { useAutoConnect } from "thirdweb/react"; + +const { data: autoConnected, isLoading } = useAutoConnect({ + client, + accountAbstraction, + wallets, + onConnect, + timeout, +}); +``` + +```ts +function useAutoConnect( + props: AutoConnectProps, +): UseQueryResult; +``` + +### Parameters + + The props for auto connect. + +#### Type + +```ts +let props: { + accountAbstraction?: SmartWalletOptions; + appMetadata?: AppMetadata; + chain?: Chain; + client: ThirdwebClient; + onConnect?: (wallet: Wallet) => void; + onTimeout?: () => void; + timeout?: number; + wallets?: Array; +}; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + whether the auto connect was successful. +--- + +## useConnect + + A hook to set a wallet as active wallet + +### Example + +```jsx +import { createThirdwebClient } from "thirdweb"; +import { useConnect } from "thirdweb/react"; +import { createWallet } from "thirdweb/wallets"; + +const client = createThirdwebClient({ + clientId: "YOUR_CLIENT_ID", +}); + +function Example() { + const { connect, isConnecting, error } = useConnect(); + return ( + + ); +} +``` + +```ts +function useConnect(options?: ConnectManagerOptions): { + readonly connect: ( + walletOrFn: Wallet | (() => Promise), + ) => Promise; + error: null | Error; + isConnecting: boolean; +}; +``` + +### Parameters + +#### Type + +```ts +let options: { + accountAbstraction?: SmartWalletOptions; + client: ThirdwebClient; + onConnect?: (wallet: Wallet) => void; +}; +``` + +### Returns + +```ts +let returnType: { + readonly connect: ( + walletOrFn: Wallet | (() => Promise), + ) => Promise; + error: null | Error; + isConnecting: boolean; +}; +``` + + A function that lets you connect a wallet. +--- + +## useConnectedWallets + + A hook that returns all connected wallets + +### Example + +```jsx +import { useConnectedWallets } from "thirdweb/react"; + +const wallets = useConnectedWallets(); +``` + +```ts +function useConnectedWallets(): Array; +``` + +### Returns + +```ts +let returnType: Array; +``` + + An array of all connected wallets +--- + +## useConnectModal + + hook that allows you to open the Connect UI in a Modal to prompt the user to connect wallet. + +### Example + +```tsx +import { createThirdwebClient } from "thirdweb"; +import { useConnectModal } from "thirdweb/react"; + +const client = createThirdwebClient({ + clientId: "", +}); + +function Example() { + const { connect, isConnecting } = useConnectModal(); + + async function handleConnect() { + const wallet = await connect({ client }); // opens the connect modal + console.log("connected to", wallet); + } + + return ; +} +``` + + The returned `connect` method takes an object of type [ UseConnectModalOptions](https://portal.thirdweb.com/references/typescript/v5/ConnectButtonProps)as an argument to customize the Connect Modal UI. Refer to [ UseConnectModalOptions](https://portal.thirdweb.com/references/typescript/v5/ConnectButtonProps) to see the available options. + +```ts +function useConnectModal(): { + connect: (props: UseConnectModalOptions) => Promise; + isConnecting: boolean; +}; +``` + +### Returns + +```ts +let returnType: { + connect: (props: UseConnectModalOptions) => Promise; + isConnecting: boolean; +}; +``` +--- + +## useDisconnect + + Disconnect from given account + +### Example + +```jsx +import { useDisconnect, useActiveWallet } from "thirdweb/react"; + +function Example() { + const { disconnect } = useDisconnect(); + const wallet = useActiveWallet(); + + return ( + + ); +} +``` + +```ts +function useDisconnect(): { disconnect: (wallet: Wallet) => void }; +``` + +### Returns + +```ts +let returnType: { disconnect: (wallet: Wallet) => void }; +``` + + An object with a function to disconnect an account +--- + +## useIsAutoConnecting + + A hook to check if the auto connect is in progress. + +### Example + +```jsx +function Example() { + const isAutoConnecting = useIsAutoConnecting(); + + return
...
; +} +``` + +```ts +function useIsAutoConnecting(): boolean; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the auto connect is in progress. +--- + +## useSetActiveWallet + + A hook that lets you set the active wallet. + +### Example + +```jsx +import { useSetActiveWallet } from "thirdweb/react"; + +const setActiveWallet = useSetActiveWallet(); + +// later in your code +await setActiveWallet(wallet); +``` + +```ts +function useSetActiveWallet(): ( + activeWallet: Wallet, +) => Promise; +``` + +### Returns + +```ts +let returnType: (activeWallet: Wallet) => Promise; +``` + + A function that lets you set the active wallet. +--- + +## useSwitchActiveWalletChain + + Switch to blockchain with given chain id in the active wallet. + +### Example + +```jsx +import { useSwitchActiveWalletChain } from "thirdweb/react"; +import { sepolia } from "thirdweb/chains"; + +const switchChain = useSwitchActiveWalletChain(); + +// later in your code +; +``` + +```ts +function useSwitchActiveWalletChain(): ( + chain: Readonly, +) => Promise; +``` + +### Returns + +```ts +let returnType: ( + chain: Readonly, +) => Promise; +``` + + A function to switch to blockchain with given chain id in the active wallet. +--- +# Chain +--- + +## useChainMetadata + + Retrieves metadata for a chain such as name, icon, available faucets, block explorers, etc. + +### Example + +`import { useChainMetadata } from "thirdweb/react"; + +const { data: chainMetadata } = useChainMetadata(defineChain(11155111)); + +console.log("Name:", chainMetadata.name); // Sepolia + +console.log("Faucets:", chainMetadata.faucets); // ["https://thirdweb.com/sepolia/faucet"] + +console.log("Explorers:", chainMetadata.explorers); // ["https://sepolia.etherscan.io/"] + +` + +```ts +function useChainMetadata( + chain?: Readonly, +): UseQueryResult; +``` + +### Parameters + + Chain to retrieve metadata for, see [ defineChain](https://portal.thirdweb.com/references/typescript/v5/defineChain) for how to create a chain from a chain ID. + +#### Type + +```ts +let chain: Readonly; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A React Query result containing the chain metadata +--- +# Contract +--- + +## useContractEvents + + Watches contract events and returns the parsed logs. + +### Example + +#### Using event extensions + + The `thirdweb/extesions` export contains event definitions for many popular contracts. You can use these event definitions to watch for specific events with a type-safe API. + +```jsx +import { useContractEvents } from "thirdweb/react"; +import { tokensClaimedEvent } from "thirdweb/extensions/erc721"; + +const account = useActiveAccount(); +const contractEvents = useContractEvents({ + contract, + events: [tokensClaimedEvent({ claimer: account?.address })], +}); +``` + +#### Using custom events + + You can also watch for custom events by passing an array of [ prepared events](https://portal.thirdweb.com/references/typescript/v5/prepareEvent) . + +```jsx +import { useContractEvents } from "thirdweb/react"; +import { prepareEvent } from "thirdweb"; + +const myEvent = prepareEvent({ + signature: "event MyEvent(uint256 myArg)", +}); + +const contractEvents = useContractEvents({ + contract, + events: [myEvent], +}); +``` + +```ts +function useContractEvents( + options: UseContractEventsOptions, +): UseQueryResult, Error>; +``` + +### Parameters + + The options for watching contract events. + +#### Type + +```ts +let options: UseContractEventsOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult< + ParseEventLogsResult, + Error +>; +``` + + The contract events of the watched contract events. +--- + +## useReadContract + +### Signature#1 + + A hook to read state from a contract that automatically updates when the contract changes. + + You can use raw read calls or read [ extensions](https://portal.thirdweb.com/react/v5/extensions) to read from a contract. + +#### Example + +```jsx +import { getContract } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; +import { useReadContract } from "thirdweb/react"; + +const contract = getContract({ + client, + address: "0x...", + chain: sepolia, +}); + +const { data, isLoading } = useReadContract({ + contract, + method: "function tokenURI(uint256 tokenId) returns (string)" + params: [1n], +}); +``` + +```ts +function useReadContract( + options: WithPickedOnceQueryOptions< + ReadContractOptions + >, +): UseQueryResult< + ReadContractResult>[2]> +>; +``` + +#### Parameters + + The options for reading from a contract + +##### Type + +```ts +let options: WithPickedOnceQueryOptions< + ReadContractOptions +>; +``` + +#### Returns + +```ts +let returnType: UseQueryResult< + ReadContractResult>[2]> +>; +``` + + a UseQueryResult object. + +### Signature#2 + + A hook to read state from a contract that automatically updates when the contract changes. You can use raw read calls or read [ extensions](https://portal.thirdweb.com/react/v5/extensions) to read from a contract. + +#### Example + + Read a contract extension let you do complex contract queries with less code. + +```jsx +import { useReadContract } from "thirdweb/react"; +import { getOwnedNFTs } form "thirdweb/extensions/erc721"; + +const { data, isLoading } = useReadContract(getOwnedNFTs, { contract, owner: address }); +``` + +```ts +function useReadContract( + extension: Extension, + options: WithPickedOnceQueryOptions< + BaseTransactionOptions + >, +): UseQueryResult; +``` + +#### Parameters + + An extension to call. + +##### Type + +```ts +let extension: Extension; +``` + + The read extension params. + +##### Type + +```ts +let options: WithPickedOnceQueryOptions< + BaseTransactionOptions +>; +``` + +#### Returns + +```ts +let returnType: UseQueryResult; +``` + + a UseQueryResult object. +--- +# Transactions +--- + +## useEstimateGas + + A hook to estimate the gas for a given transaction. + +### Example + +```jsx +import { useEstimateGas } from "thirdweb/react"; +const { mutate: estimateGas, data: gasEstimate } = useEstimateGas(); + +// later +const estimatedGas = await estimateGas(tx); +``` + +```ts +function useEstimateGas(): UseMutationResult< + EstimateGasResult, + Error, + PreparedTransaction +>; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + EstimateGasResult, + Error, + PreparedTransaction +>; +``` + + A mutation object to estimate gas. +--- + +## useEstimateGasCost + + A hook to estimate the gas cost in ether and wei for a given transaction. + +### Example + +```jsx +import { useEstimateGasCost } from "thirdweb/react"; +const { mutate: estimateGasCost, data: gasEstimate } = + useEstimateGas(); + +// later +const estimatedGas = await estimateGasCost(tx); +console.log("gas cost in ether", estimatedGas.ether); +``` + +```ts +function useEstimateGasCost(): UseMutationResult< + EstimateGasCostResult, + Error, + PreparedTransaction +>; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + EstimateGasCostResult, + Error, + PreparedTransaction +>; +``` + + A mutation object to estimate gas cost. +--- + +## useSendAndConfirmTransaction + + A hook to send a transaction. + +### Example + +```jsx +import { useSendAndConfirmTransaction } from "thirdweb/react"; +const { mutate: sendAndConfirmTx, data: transactionReceipt } = + useSendAndConfirmTransaction(); + +// later +sendAndConfirmTx(tx); +``` + +#### Gasless usage with [ thirdweb Engine](https://portal.thirdweb.com/engine) + +```tsx +import { useSendAndConfirmTransaction } from "thirdweb/react"; +const mutation = useSendAndConfirmTransaction({ + gasless: { + provider: "engine", + relayerUrl: + "https://thirdweb.engine-***.thirdweb.com/relayer/***", + relayerForwarderAddress: "0x...", + }, +}); +``` + +#### Gasless usage with OpenZeppelin + +```tsx +import { useSendAndConfirmTransaction } from "thirdweb/react"; +const mutation = useSendAndConfirmTransaction({ + gasless: { + provider: "openzeppelin", + relayerUrl: "https://...", + relayerForwarderAddress: "0x...", + }, +}); +``` + +```ts +function useSendAndConfirmTransaction( + config: SendAndConfirmTransactionConfig, +): UseMutationResult; +``` + +### Parameters + +#### Type + +```ts +let config: SendAndConfirmTransactionConfig; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + TransactionReceipt, + Error, + PreparedTransaction +>; +``` + + A mutation object to send a transaction. +--- + +## useSendBatchTransaction + + A hook to send a transaction. + +### Example + +```jsx +import { useSendBatchTransaction } from "thirdweb/react"; +const { mutate: sendBatch, data: transactionResult } = + useSendBatchTransaction(); + +// later +sendBatch([tx1, tx2]); +``` + +```ts +function useSendBatchTransaction(): UseMutationResult< + WaitForReceiptOptions, + Error, + Array +>; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + WaitForReceiptOptions, + Error, + Array +>; +``` + + A mutation object to send a transaction. +--- + +## useSendTransaction + + A hook to send a transaction with from the user's connected wallet. + + You can send a transaction with a [ prepared contract call](https://portal.thirdweb.com/references/typescript/v5/prepareContractCall) , a [ prepared transaction](https://portal.thirdweb.com/references/typescript/v5/prepareTransaction) , or using a write [ Extension](https://portal.thirdweb.com/react/v5/extensions) . + +### Example + +#### Sending a prepared contract call + +```tsx +import { useSendTransaction } from "thirdweb/react"; +import { getContract, prepareContractCall } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; + +const contract = getContract({ + address: "0x...", + chain: sepolia, + client, +}); + +const { mutate: sendTx, data: transactionResult } = + useSendTransaction(); + +const onClick = () => { + const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [to, value], + }); + sendTx(transaction); +}; +``` + +#### Using a write extension + +```tsx +import { useSendTransaction } from "thirdweb/react"; +import { mintTo } from "thirdweb/extensions/erc721"; + +const { mutate: sendTx, data: transactionResult } = + useSendTransaction(); + +const onClick = () => { + const transaction = mintTo({ + contract, + to: "0x...", + nft: { + name: "NFT Name", + description: "NFT Description", + image: "https://example.com/image.png", + }, + }); + sendTx(transaction); +}; +``` + +#### Sending a prepared transaction + +```tsx +import { useSendTransaction } from "thirdweb/react"; +import { prepareTransaction } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; + +const { mutate: sendTx, data: transactionResult } = + useSendTransaction(); + +const onClick = () => { + // Send 0.1 SepoliaETH to an address + const transaction = prepareTransaction({ + to: "0x...", + value: toWei("0.1"), + chain: sepolia, + client: thirdwebClient, + }); + sendTx(transaction); +}; +``` + +```ts +function useSendTransaction( + config: SendTransactionConfig, +): UseMutationResult< + { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + }, + Error, + PreparedTransaction +>; +``` + +### Parameters + + Configuration for the `useSendTransaction` hook. Refer to [SendTransactionConfig](https://portal.thirdweb.com/references/typescript/v5/SendTransactionConfig) for more details. + +#### Type + +```ts +let config: { + gasless?: GaslessOptions; + payModal?: SendTransactionPayModalConfig; +}; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + }, + Error, + PreparedTransaction +>; +``` + + A UseMutationResult object to send a transaction. +--- + +## useSimulateTransaction + + A hook to simulate a transaction. + +### Example + +```jsx +import { useSimulateTransaction } from "thirdweb/react"; +const { mutate: simulateTx } = useSimulateTransaction(); + +// later +const result = await simulateTx(tx); +``` + +```ts +function useSimulateTransaction(): UseMutationResult< + Awaited>, + Error, + SimulateOptions +>; +``` + +### Returns + +```ts +let returnType: UseMutationResult< + Awaited>, + Error, + SimulateOptions +>; +``` + + A mutation object to simulate a transaction. +--- + +## useWaitForReceipt + + A hook to wait for a transaction receipt. + +### Example + +```jsx +import { useWaitForReceipt } from "thirdweb/react"; +const { data: receipt, isLoading } = useWaitForReceipt({ + client, + chain, + transactionHash, +}); +``` + +```ts +function useWaitForReceipt( + options: + | undefined + | { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + }, +): UseQueryResult; +``` + +### Parameters + + The options for waiting for a transaction receipt. + +#### Type + +```ts +let options: + | undefined + | { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + }; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + a query object. +--- +# Social API +--- + +## useSocialProfiles + + Fetches the wallet's available social profiles. + +### Example + +```tsx +import { useSocialProfiles } from "thirdweb/react"; +const { data: profiles } = useSocialProfiles({ + client, + address: "0x...", +}); +``` + +```ts +function useSocialProfiles(options: { + address: undefined | string; + client: ThirdwebClient; +}): UseQueryResult, Error>; +``` + +### Parameters + + The options to use when fetching the social profiles. + +#### Type + +```ts +let options: { address: undefined | string; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: UseQueryResult, Error>; +``` + + A React Query result containing the social profiles. +--- +# Buy Crypto +--- + +## useBuyHistory + + Hook to get the history of Buy transactions for a given wallet - This includes both "buy with crypto" and "buy with fiat" transactions. + + This hook is a React Query wrapper of the [getBuyHistory](https://portal.thirdweb.com/references/typescript/v5/getBuyHistory) function. You can also use that function directly + +### Example + +```tsx +import { useBuyHistory } from "thirdweb/react"; + +function Component() { + const buyHistoryQuery = useBuyHistory(params); + return
...
; +} +``` + +```ts +function useBuyHistory( + params?: BuyHistoryParams, + queryParams?: BuyHistoryQueryOptions, +): UseQueryResult; +``` + +### Parameters + + object of type [BuyHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyHistoryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; +``` + + options to configure the react query + +#### Type + +```ts +let queryParams: BuyHistoryQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A React Query object which contains the data of type [BuyHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyHistoryData) +--- + +## useBuyWithCryptoHistory + + Hook to get the "Buy with crypto" transaction history for a given wallet address. + + This hook is a React Query wrapper of the [getBuyWithCryptoHistory](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoHistory) function. You can also use that function directly + +### Example + +```tsx +import { useBuyWithCryptoHistory } from "thirdweb/react"; + +function Component() { + const buyWithCryptoHistory = useBuyWithCryptoHistory(params); + return
...
; +} +``` + +```ts +function useBuyWithCryptoHistory( + params?: BuyWithCryptoHistoryParams, + queryParams?: BuyWithCryptoHistoryQueryOptions, +): UseQueryResult; +``` + +### Parameters + + object of type [BuyWithCryptoHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; +``` + + options to configure the react query + +#### Type + +```ts +let queryParams: BuyWithCryptoHistoryQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A React Query object which contains the data of type [BuyWithCryptoHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryData) +--- + +## useBuyWithCryptoQuote + + Hook to get a price quote for performing a "Buy with crypto" transaction that allows users to buy a token with another token - aka a swap. + + The price quote is an object of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) . This quote contains the information about the purchase such as token amounts, processing fees, estimated time etc. + + This hook is a React Query wrapper of the [getBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoQuote) function. You can also use that function directly + + Once you have the quote, you can use the [useSendTransaction](https://portal.thirdweb.com/references/typescript/v5/useSendTransaction) function to send the purchase and [useBuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/useBuyWithCryptoStatus) function to get the status of the swap transaction. + +### Example + +```tsx +import { + useBuyWithCryptoQuote, + useBuyWithCryptoStatus, + type BuyWithCryptoStatusQueryParams, + useActiveAccount, +} from "thirdweb/react"; +import { sendTransaction } from "thirdweb"; + +function Component() { + const buyWithCryptoQuoteQuery = useBuyWithCryptoQuote(swapParams); + const [buyTxHash, setBuyTxHash] = useState< + BuyWithCryptoStatusQueryParams | undefined + >(); + const buyWithCryptoStatusQuery = useBuyWithCryptoStatus( + buyTxHash + ? { + client, + transactionHash: buyTxHash, + } + : undefined, + ); + + async function handleBuyWithCrypto() { + const account = useActiveAccount(); + + // if approval is required + if (buyWithCryptoQuoteQuery.data.approval) { + const approveTx = await sendTransaction({ + transaction: swapQuote.data.approval, + account: account, + }); + await waitForApproval(approveTx); + } + + // send the transaction to buy crypto + // this promise is resolved when user confirms the transaction in the wallet and the transaction is sent to the blockchain + const buyTx = await sendTransaction({ + transaction: swapQuote.data.transactionRequest, + account: account, + }); + await waitForApproval(buyTx); + + // set buyTx.transactionHash to poll the status of the swap transaction + setBuyWithCryptoTx(buyTx.transactionHash); + } + + return ; +} +``` + +```ts +function useBuyWithCryptoQuote( + params?: GetBuyWithCryptoQuoteParams, + queryParams?: BuyWithCryptoQuoteQueryOptions, +): UseQueryResult; +``` + +### Parameters + + object of type [BuyWithCryptoQuoteQueryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuoteQueryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + fromAddress: string; + fromChainId: number; + fromTokenAddress: string; + intentId?: string; + maxSlippageBPS?: number; + purchaseData?: object; + toAddress: string; + toChainId: number; + toTokenAddress: string; +} & ( + | { fromAmount: string; toAmount?: never } + | { fromAmount?: never; toAmount: string } +); +``` + + options to configure the react query + +#### Type + +```ts +let queryParams: BuyWithCryptoQuoteQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A React Query object which contains the data of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) +--- + +## useBuyWithCryptoStatus + + A hook to get a status of a "Buy with crypto" transaction to determine if the transaction is completed, failed or pending. + + This hook is a React Query wrapper of the [getBuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoStatus) function. You can also use that function directly. + +### Example + +```tsx +import { + useSendTransaction, + useBuyWithCryptoQuote, + useBuyWithCryptoStatus, + type BuyWithCryptoStatusQueryParams, + useActiveAccount, +} from "thirdweb/react"; +import { sendTransaction } from "thirdweb"; + +function Component() { + const buyWithCryptoQuoteQuery = useBuyWithCryptoQuote(swapParams); + const [buyTxHash, setBuyTxHash] = useState< + BuyWithCryptoStatusQueryParams | undefined + >(); + const buyWithCryptoStatusQuery = useBuyWithCryptoStatus( + buyTxHash + ? { + client, + transactionHash: buyTxHash, + } + : undefined, + ); + const account = useActiveAccount(); + + async function handleBuyWithCrypto() { + // if approval is required + if (buyWithCryptoQuoteQuery.data.approval) { + const approveTx = await sendTransaction({ + account: account, + transaction: swapQuote.data.approval, + }); + await waitForApproval(approveTx); + } + + // send the transaction to buy crypto + // this promise is resolved when user confirms the transaction in the wallet and the transaction is sent to the blockchain + const buyTx = await sendTransactionMutation.mutateAsync({ + transaction: swapQuote.data.transactionRequest, + account: account, + }); + await waitForApproval(buyTx); + + // set buyTx.transactionHash to poll the status of the swap transaction + setBuyWithCryptoTx(buyTx.transactionHash); + } + + return ; +} +``` + +```ts +function useBuyWithCryptoStatus( + params?: BuyWithCryptoTransaction, +): UseQueryResult; +``` + +### Parameters + + object of type [BuyWithCryptoTransaction](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransaction) + +#### Type + +```ts +let params: { client: ThirdwebClient; transactionHash: string }; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A react query object which contains the data of type [BuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoStatus) +--- + +## useBuyWithFiatHistory + + Hook to get the "Buy with Fiat" transaction history for a given wallet address. + + This hook is a React Query wrapper of the [getBuyWithFiatHistory](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatHistory) function. You can also use that function directly + +### Example + +```tsx +import { useBuyWithFiatHistory } from "thirdweb/react"; + +function Component() { + const historyQuery = useBuyWithFiatHistory(params); + return
...
; +} +``` + +```ts +function useBuyWithFiatHistory( + params?: BuyWithFiatHistoryParams, + queryParams?: BuyWithFiatHistoryQueryOptions, +): UseQueryResult; +``` + +### Parameters + + object of type [BuyWithFiatHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; +``` + + options to configure the react query + +#### Type + +```ts +let queryParams: BuyWithFiatHistoryQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A React Query object which contains the data of type [BuyWithFiatHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryData) +--- + +## useBuyWithFiatQuote + + Hook to get a price quote for performing a "Buy with Fiat" transaction that allows users to buy a token with fiat currency. + + The price quote is an object of type [BuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatQuote) . This quote contains the information about the purchase such as token amounts, processing fees, estimated time etc. + + This hook is a React Query wrapper of the [getBuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatQuote) function. You can also use that function directly + + Once you have the `quote` , you can open a new window with `quote.onRampLink` to allow the user to buy the token with fiat currency. and [useBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/useBuyWithFiatStatus) function to start polling for the status of this transaction. + +### Example + +```ts +import { NATIVE_TOKEN_ADDRESS } from "thirdweb"; +import { base } from "thirdweb/chains"; +import { useBuyWithFiatQuote } from "thirdweb/react"; + +// get a quote for buying 0.01 base native token with USD fiat currency +function Example() { + const quote = useBuyWithFiatQuote({ + client: client, // thirdweb client + fromCurrencySymbol: "USD", // fiat currency symbol + toChainId: base.id, // base chain id + toAmount: "0.01", // amount of token to buy + toTokenAddress: NATIVE_TOKEN_ADDRESS, // native token + toAddress: "0x...", // user's wallet address + }); + + return ( +
+ {quote.data && ( + + open onramp provider + + )} +
+ ); +} +``` + +```ts +function useBuyWithFiatQuote( + params?: GetBuyWithFiatQuoteParams, + queryOptions?: BuyWithFiatQuoteQueryOptions, +): UseQueryResult; +``` + +### Parameters + + object of type [GetBuyWithFiatQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatQuoteParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + fromAddress: string; + fromAmount?: string; + fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR" | "JPY"; + isTestMode?: boolean; + maxSlippageBPS?: number; + preferredProvider?: FiatProvider; + purchaseData?: object; + toAddress: string; + toAmount?: string; + toChainId: number; + toGasAmountWei?: string; + toTokenAddress: string; +}; +``` + +#### Type + +```ts +let queryOptions: BuyWithFiatQuoteQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A React Query object which contains the data of type [BuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatQuote) +--- + +## useBuyWithFiatStatus + + A hook to get a status of a "Buy with Fiat" transaction to determine if the transaction is completed, failed or pending. + + This hook is a React Query wrapper of the [getBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoStatus) function. You can also use that function directly. + +`useBuyWithFiatStatus` refetches the status using `getBuyWithFiatStatus` every 5 seconds. + +### Example + +```tsx +import { useBuyWithFiatStatus } from "thirdweb/react"; +import { client } from "./client"; + +function Example() { + const fiatStatus = useBuyWithFiatStatus({ + client: client, // thirdweb client + intentId: "....", // get the intentId from quote ( quote.intentId ) + }); + + console.log(fiatStatus.data); + + return
...
; +} +``` + +```ts +function useBuyWithFiatStatus( + params?: GetBuyWithFiatStatusParams, +): UseQueryResult; +``` + +### Parameters + + object of type [GetBuyWithFiatStatusParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransaction) + +#### Type + +```ts +let params: { client: ThirdwebClient; intentId: string }; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + A react query object which contains the data of type [BuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoStatus) +--- + +## usePostOnRampQuote + + When buying a token with fiat currency - It only involes doing on-ramp if the on-ramp provider supports buying the given destination token directly. + + If the on-ramp provider does not support buying the destination token directly, user can be sent an intermediate token with fiat currency from the on-ramp provider which can be swapped to destination token onchain. + +`usePostOnRampQuote` hook is used to get the quote for swapping the on-ramp token to destination token. + + When you get a "Buy with Fiat" status of type `"CRYPTO_SWAP_REQUIRED"` from the [useBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/useBuyWithFiatStatus) hook, you can use `usePostOnRampQuote` hook to get the quote of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) for swapping the on-ramp token to destination token to complete the step-2 of the process. + + Once you have the quote, you can start the Swap process by following the same steps as mentioned in the [useBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/useBuyWithCryptoQuote) documentation. + +```ts +function usePostOnRampQuote( + params?: GetPostOnRampQuoteParams, + queryOptions?: PostOnRampQuoteQueryOptions, +): UseQueryResult; +``` + +### Parameters + + object of type [GetPostOnRampQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetPostOnRampQuoteParams) + +#### Type + +```ts +let params: { + buyWithFiatStatus: BuyWithFiatStatus; + client: ThirdwebClient; +}; +``` + +#### Type + +```ts +let queryOptions: PostOnRampQuoteQueryOptions; +``` + +### Returns + +```ts +let returnType: UseQueryResult; +``` + + Object of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) which contains the information about the quote such as processing fees, estimated time, converted token amounts, etc. +--- +# Utils +--- + +## useBlockNumber + + Hook that watches for changes in the block number on a given chain. + +### Example + +```ts +import { useBlockNumber } from "thirdweb/react"; +const blockNumber = useBlockNumber({ client, chain }); +``` + +```ts +function useBlockNumber( + options: UseBlockNumberOptions, +): undefined | bigint; +``` + +### Parameters + + The options for the hook. + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; + enabled?: boolean; + watch?: boolean; +}; +``` + +### Returns + +```ts +let returnType: undefined | bigint; +``` + + The latest block number. +--- +**Core Functions** +--- +# Extensions +--- +## EIP1193 +--- + +## fromProvider + + Creates a Thirdweb wallet from an EIP-1193 compatible provider. + + This adapter allows you to use any EIP-1193 provider (like MetaMask, WalletConnect, etc.) as a Thirdweb wallet. It handles all the necessary conversions between the EIP-1193 interface and Thirdweb's wallet interface. + +### Example + +```ts +import { EIP1193 } from "thirdweb/wallets"; + +// Create a Thirdweb wallet from MetaMask's provider +const wallet = EIP1193.fromProvider({ + provider: window.ethereum, + walletId: "io.metamask", +}); + +// Use like any other Thirdweb wallet +const account = await wallet.connect({ + client: createThirdwebClient({ clientId: "..." }), +}); + +// Sign messages +await account.signMessage({ message: "Hello World" }); + +// Send transactions +await account.sendTransaction({ + to: "0x...", + value: 1000000000000000000n, +}); +``` + +```ts +function fromProvider(options: FromEip1193AdapterOptions): Wallet; +``` + +### Parameters + + Configuration options for creating the wallet adapter + +#### Type + +```ts +let options: { + provider: EIP1193Provider | (() => Promise); + walletId?: WalletId; +}; +``` + +### Returns + +```ts +let returnType: { + getAdminAccount?: () => Account | undefined; + getConfig: () => CreateWalletArgs[1]; + id: TWalletId; + onConnectRequested?: () => Promise; + subscribe: WalletEmitter["subscribe"]; + autoConnect: ( + options: WalletAutoConnectionOption, + ) => Promise; + connect: ( + options: WalletConnectionOption, + ) => Promise; + disconnect: () => Promise; + getAccount: () => undefined | Account; + getChain: () => + | undefined + | Readonly; + switchChain: ( + chain: Readonly, + ) => Promise; +}; +``` + + A Thirdweb wallet instance that wraps the EIP-1193 provider +--- + +## toProvider + + Converts a Thirdweb wallet into an EIP-1193 compatible provider. + + This adapter allows you to use a Thirdweb wallet with any library or dApp that expects an EIP-1193 provider. The provider implements the standard EIP-1193 interface including request handling and event subscription. + +### Example + +```ts +import { EIP1193 } from "thirdweb/wallets"; + +// Create an EIP-1193 provider from a Thirdweb wallet +const provider = EIP1193.toProvider({ + wallet, + chain: ethereum, + client: createThirdwebClient({ clientId: "..." }), +}); + +// Use with any EIP-1193 compatible library +const accounts = await provider.request({ + method: "eth_requestAccounts", +}); + +// Listen for events +provider.on("accountsChanged", (accounts) => { + console.log("Active accounts:", accounts); +}); +``` + +```ts +function toProvider( + options: ToEip1193ProviderOptions, +): EIP1193Provider; +``` + +### Parameters + + Configuration options for creating the provider + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; + connectOverride?: (wallet: Wallet) => Promise; + wallet: Wallet; +}; +``` + +### Returns + +```ts +let returnType: { + request: (params: any) => Promise; + on: (event: any, listener: (params: any) => any) => void; + removeListener: ( + event: any, + listener: (params: any) => any, + ) => void; +}; +``` + + An EIP-1193 compatible provider that wraps the Thirdweb wallet +--- +## DEPLOY +--- + +## prepareDirectDeployTransaction + + Prepares a direct deploy transaction with ABI. + +### Example + +```ts +import { prepareDirectDeployTransaction } from "thirdweb/deploys"; +import { ethereum } from "thirdweb/chains"; +const tx = prepareDirectDeployTransaction({ + client, + chain: ethereum, + bytecode: "0x...", + constructorAbi: { + inputs: [{ type: "uint256", name: "value" }], + type: "constructor", + }, + constructorParams: [123], +}); +``` + +```ts +function prepareDirectDeployTransaction(options: { + abi: Abi; + bytecode: `0x${string}`; + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; +}): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + The options for preparing the transaction. + +#### Type + +```ts +let options: { + abi: Abi; + bytecode: `0x${string}`; + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + +* The prepared transaction. +--- + +## computePublishedContractAddress + + Predicts the implementation address of any published contract + +### Example + +```ts +import { computePublishedContractAddress } from "thirdweb/deploys"; + +const address = await computePublishedContractAddress({ + client, + chain, + contractId: "AccountFactory", + constructorParams, +}); +``` + +```ts +function computePublishedContractAddress(args: { + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; + contractId: string; + publisher?: string; + salt?: string; + version?: string; +}): Promise; +``` + +### Parameters + + The arguments for predicting the address of a published contract. + +#### Type + +```ts +let args: { + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; + contractId: string; + publisher?: string; + salt?: string; + version?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the predicted address of the contract. +--- + +## deployContract + + Deploy a contract on a given chain + +### Example + +### Deploying a regular contract from ABI and bytecode + +```ts +import { deployContract } from "thirdweb/deployContract"; + +const address = await deployContract({ + client, + chain, + bytecode: "0x...", + abi: contractAbi, + constructorParams: { + param1: "value1", + param2: 123, + }, + salt, // optional: salt enables deterministic deploys +}); +``` + +### Deploying a contract deterministically + +```ts +import { deployContract } from "thirdweb/deployContract"; + +const address = await deployContract({ + client, + chain, + bytecode: "0x...", + abi: contractAbi, + constructorParams: { + param1: "value1", + param2: 123, + }, + salt, // passing a salt will enable deterministic deploys +}); +``` + +```ts +function deployContract( + options: { + abi: Abi; + bytecode: `0x${string}`; + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; + } & { account: Account; salt?: string }, +): Promise; +``` + +### Parameters + + the deploy options + +#### Type + +```ts +let options: { + abi: Abi; + bytecode: `0x${string}`; + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; +} & { account: Account; salt?: string }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + +* a promise that resolves to the deployed contract address +--- + +## deployERC1155Contract + + Deploys an thirdweb ERC1155 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. + +### Example + +```ts +import { deployERC1155Contract } from "thirdweb/deploys"; +const contractAddress = await deployERC1155Contract({ + chain, + client, + account, + type: "DropERC1155", + params: { + name: "MyEdition", + description: "My edition contract", + symbol: "ME", +}); +``` + +```ts +function deployERC1155Contract(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: ERC1155ContractParams; + type: ERC1155ContractType; +}): Promise; +``` + +### Parameters + + The deployment options. + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: ERC1155ContractParams; + type: ERC1155ContractType; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The deployed contract address. +--- + +## deployERC20Contract + + Deploys an thirdweb ERC20 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. + +### Example + +```ts +import { deployERC20Contract } from "thirdweb/deploys"; +const contractAddress = await deployERC20Contract({ + chain, + client, + account, + type: "TokenERC20", + params: { + name: "MyToken", + description: "My Token contract", + symbol: "MT", +}); +``` + +```ts +function deployERC20Contract(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: ERC20ContractParams; + publisher?: string; + type: ERC20ContractType; +}): Promise; +``` + +### Parameters + + The deployment options. + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: ERC20ContractParams; + publisher?: string; + type: ERC20ContractType; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The deployed contract address. +--- + +## deployERC721Contract + + Deploys an thirdweb ERC721 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. + +### Example + +```ts +import { deployERC721Contract } from "thirdweb/deploys"; +const contractAddress = await deployERC721Contract({ + chain, + client, + account, + type: "DropERC721", + params: { + name: "MyNFT", + description: "My NFT contract", + symbol: "NFT", +}); +``` + +```ts +function deployERC721Contract(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: ERC721ContractParams; + type: ERC721ContractType; +}): Promise; +``` + +### Parameters + + The deployment options. + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: ERC721ContractParams; + type: ERC721ContractType; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The deployed contract address. +--- + +## deployPackContract + + Deploy a thirdweb Pack contract + +### Example + +```ts +import { deployPackContract } from "thirdweb/extensions/deploy"; + +const packAddress = await deployPackContract({ + account, + client, + chain, + params: { + name: "Pack contract name", + symbol: "PACK1155", + }, +}); +``` + +```ts +function deployPackContract(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: PackContractParams; +}): Promise; +``` + +### Parameters + + params for deploying [Pack contract](https://thirdweb.com/thirdweb.eth/Pack) + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: PackContractParams; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## deployPublishedContract + + Deploy an instance of a published contract on a given chain + +### Example + +### Deploying a published contract + +```ts +import { deployPublishedContract } from "thirdweb/deploys"; + +const address = await deployPublishedContract({ + client, + chain, + account, + contractId: "MyPublishedContract", + contractParams: { + param1: "value1", + param2: 123, + }, + publisher: "0x...", // optional, defaults to the thirdweb deployer +}); +``` + +### Deploying a published contract deterministically + +```ts +import { deployPublishedContract } from "thirdweb/deploys"; + +const address = await deployPublishedContract({ + client, + chain, + account, + contractId: "MyPublishedContract", + contractParams: { + param1: "value1", + param2: 123, + }, + publisher: "0x...", + salt: "your-salt", // this will deterministically deploy the contract at the same address on all chains +}); +``` + +```ts +function deployPublishedContract( + options: DeployPublishedContractOptions, +): Promise; +``` + +### Parameters + + the deploy options + +#### Type + +```ts +let options: { + account: Account; + chain: Chain; + client: ThirdwebClient; + contractId: string; + contractParams?: Record; + implementationConstructorParams?: Record; + publisher?: string; + salt?: string; + version?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + a promise that resolves to the deployed contract address +--- + +## deploySplitContract + + Deploys a thirdweb [Split contract](https://thirdweb.com/thirdweb.eth/Split)On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. + +### Example + +```ts +import { deploySplitContract } from "thirdweb/deploys"; +const contractAddress = await deploySplitContract({ + chain, + client, + account, + params: { + name: "Split contract", + payees: ["0x...123", "0x...456"], + shares: [5100, 4900], // See type `SplitContractParams` for more context + }, +}); +``` + +```ts +function deploySplitContract(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: SplitContractParams; +}): Promise; +``` + +### Parameters + + The deployment options. + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + params: SplitContractParams; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The deployed contract address. +--- + +## prepareDeterministicDeployTransaction + + Deploy a contract deterministically - will maintain the same address across chains. This is meant to be used with published contracts configured with the 'direct deploy' method. Under the hood, this uses a keyless transaction with a common create2 factory. + +### Example + +```ts +import { prepareDeterministicDeployTransaction } from "thirdweb/deploys"; +import { sepolia } from "thirdweb/chains"; + +const tx = prepareDeterministicDeployTransaction({ + client, + chain: sepolia, + contractId: "AccountFactory", + constructorParams: [123], +}); +``` + +```ts +function prepareDeterministicDeployTransaction(options: { + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; + contractId: string; + publisher?: string; + salt?: string; + version?: string; +}): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + the options to deploy the contract + +#### Type + +```ts +let options: { + chain: Readonly; + client: ThirdwebClient; + constructorParams?: Record; + contractId: string; + publisher?: string; + salt?: string; + version?: string; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + +* the transaction to deploy the contract +--- +## AIRDROP +--- + +## airdropERC1155 + + Prepares a transaction to call the "airdropERC1155" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropERC1155 } from "thirdweb/extensions/airdrop"; + +const transaction = airdropERC1155({ + contract, + tokenAddress: ..., + contents: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropERC1155( + options: BaseTransactionOptions< + | AirdropERC1155Params + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropERC1155" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropERC1155Params + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## airdropERC1155WithSignature + + Prepares a transaction to call the "airdropERC1155WithSignature" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropERC1155WithSignature } from "thirdweb/extensions/airdrop"; + +const transaction = airdropERC1155WithSignature({ + contract, + req: ..., + signature: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropERC1155WithSignature( + options: BaseTransactionOptions< + | AirdropERC1155WithSignatureParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropERC1155WithSignature" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropERC1155WithSignatureParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## airdropERC20 + + Prepares a transaction to call the "airdropERC20" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropERC20 } from "thirdweb/extensions/airdrop"; + +const transaction = airdropERC20({ + contract, + tokenAddress: ..., + contents: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropERC20( + options: BaseTransactionOptions< + | AirdropERC20Params + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropERC20" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropERC20Params + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## airdropERC20WithSignature + + Prepares a transaction to call the "airdropERC20WithSignature" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropERC20WithSignature } from "thirdweb/extensions/airdrop"; + +const transaction = airdropERC20WithSignature({ + contract, + req: ..., + signature: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropERC20WithSignature( + options: BaseTransactionOptions< + | AirdropERC20WithSignatureParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropERC20WithSignature" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropERC20WithSignatureParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## airdropERC721 + + Prepares a transaction to call the "airdropERC721" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropERC721 } from "thirdweb/extensions/airdrop"; + +const transaction = airdropERC721({ + contract, + tokenAddress: ..., + contents: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropERC721( + options: BaseTransactionOptions< + | AirdropERC721Params + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropERC721" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropERC721Params + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## airdropERC721WithSignature + + Prepares a transaction to call the "airdropERC721WithSignature" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropERC721WithSignature } from "thirdweb/extensions/airdrop"; + +const transaction = airdropERC721WithSignature({ + contract, + req: ..., + signature: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropERC721WithSignature( + options: BaseTransactionOptions< + | AirdropERC721WithSignatureParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropERC721WithSignature" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropERC721WithSignatureParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## airdropNativeToken + + Prepares a transaction to call the "airdropNativeToken" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { airdropNativeToken } from "thirdweb/extensions/airdrop"; + +const transaction = airdropNativeToken({ + contract, + contents: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function airdropNativeToken( + options: BaseTransactionOptions< + | AirdropNativeTokenParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "airdropNativeToken" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | AirdropNativeTokenParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## claimERC1155 + + Claim airdrop of ERC1155 tokens for allowlisted addresses. (Pull based airdrop) + +### Example + +```ts +import { claimERC1155 } from "thirdweb/extensions/airdrop"; +import { sendTransaction } from "thirdweb"; + +const tokenAddress = "0x..."; // Address of airdropped tokens to claim +const recipient = "0x..."; // Address of the allowlisted recipient + +const claimTransaction = claimERC1155({ + contract, + tokenAddress, + recipient, +}); + +await sendTransaction({ claimTransaction, account }); +``` + +```ts +function claimERC1155( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## claimERC20 + + Claim airdrop of ERC20 tokens for allowlisted addresses. (Pull based airdrop) + +### Example + +```ts +import { claimERC20 } from "thirdweb/extensions/airdrop"; +import { sendTransaction } from "thirdweb"; + +const tokenAddress = "0x..."; // Address of airdropped tokens to claim +const recipient = "0x..."; // Address of the allowlisted recipient + +const claimTransaction = claimERC20({ + contract, + tokenAddress, + recipient, +}); + +await sendTransaction({ claimTransaction, account }); +``` + +```ts +function claimERC20( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## claimERC721 + + Claim airdrop of ERC721 tokens for allowlisted addresses. (Pull based airdrop) + +### Example + +```ts +import { claimERC721 } from "thirdweb/extensions/airdrop"; +import { sendTransaction } from "thirdweb"; + +const tokenAddress = "0x..."; // Address of airdropped tokens to claim +const recipient = "0x..."; // Address of the allowlisted recipient + +const claimTransaction = claimERC721({ + contract, + tokenAddress, + recipient, +}); + +await sendTransaction({ claimTransaction, account }); +``` + +```ts +function claimERC721( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## fetchProofsERC1155 + + Retrieves the claim merkle proof for the provided address. + +### Example + +```ts +import { fetchProofsERCC1155 } from "thirdweb/extensions/airdrop"; +import { getContract, defineChain } from "thirdweb"; + +const TOKEN = getContracct({ + client, + chain: defineChain(1), + address: "0x...", +}); + +const merkleRoot = await tokenMerkleRoot({ + contract: TOKEN, + tokenAddress: TOKEN.address, +}); + +const proof = await fetchProofsERC1155({ + contract: TOKEN, + recipient: "0x...", + merkleRoot, +}); +``` + +```ts +function fetchProofsERC1155(options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the proof or null if the recipient is not in the allowlist +--- + +## fetchProofsERC20 + + Retrieves the claim merkle proof for the provided address. + +### Example + +```ts +import { fetchProofsERCC20 } from "thirdweb/extensions/airdrop"; +import { getContract, defineChain } from "thirdweb"; + +const TOKEN = getContracct({ + client, + chain: defineChain(1), + address: "0x...", +}); + +const merkleRoot = await tokenMerkleRoot({ + contract: TOKEN, + tokenAddress: TOKEN.address, +}); + +const proof = await fetchProofsERC20({ + contract: TOKEN, + recipient: "0x...", + merkleRoot, +}); +``` + +```ts +function fetchProofsERC20(options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; + tokenDecimals: number; +}): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; + tokenDecimals: number; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the proof or null if the recipient is not in the allowlist +--- + +## fetchProofsERC721 + + Retrieves the claim merkle proof for the provided address. + +### Example + +```ts +import { fetchProofsERC721 } from "thirdweb/extensions/airdrop"; +import { getContract, defineChain } from "thirdweb"; + +const NFT = getContracct({ + client, + chain: defineChain(1), + address: "0x...", +}); + +const merkleRoot = await tokenMerkleRoot({ + contract: NFT, + tokenAddress: NFT.address, +}); + +const proof = await fetchProofsERC721({ + contract: NFT, + recipient: "0x...", + merkleRoot, +}); +``` + +```ts +function fetchProofsERC721(options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the proof or null if the recipient is not in the allowlist +--- + +## generateAirdropSignatureERC1155 + + Generates the req and signature for sending ERC1155 airdrop. + +### Example + +```ts +import { + airdropERC1155WithSignature, + generateAirdropSignatureERC1155, +} from "thirdweb/extensions/airdrop"; + +// list of recipients, tokenIds and amounts to airdrop for each recipient +const contents = [ + { recipient: "0x...", tokenId: 0, amount: 10n }, + { recipient: "0x...", tokenId: 0, amount: 15n }, + { recipient: "0x...", tokenId: 0, amount: 20n }, +]; + +const { req, signature } = await generateAirdropSignatureERC1155({ + account, + contract, + airdropRequest: { + tokenAddress: "0x...", // address of the ERC1155 token to airdrop + contents, + }, +}); + +const transaction = airdropERC1155WithSignature({ + contract, + req, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function generateAirdropSignatureERC1155(options: GenerateAirdropERC1155SignatureOptions) : Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +``` + +### Parameters + + The options for the airdrop. + +#### Type + +```ts +let options: { + account: Account; + airdropRequest: GenerateReqInput; + contract: ThirdwebContract; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +``` + + A promise that resolves to the req and signature. +--- + +## generateAirdropSignatureERC20 + + Generates the req and signature for sending ERC20 airdrop. + +### Example + +```ts +import { + airdropERC20WithSignature, + generateAirdropSignatureERC20, +} from "thirdweb/extensions/airdrop"; + +// list of recipients and amounts to airdrop for each recipient +const contents = [ + { recipient: "0x...", amount: 10n }, // amount in wei + { recipient: "0x...", amount: 15n }, // amount in wei + { recipient: "0x...", amount: 20n }, // amount in wei +]; + +const { req, signature } = await generateAirdropSignatureERC20({ + account, + contract, + airdropRequest: { + tokenAddress: "0x...", // address of the ERC20 token to airdrop + contents, + }, +}); + +const transaction = airdropERC20WithSignature({ + contract, + req, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function generateAirdropSignatureERC20(options: GenerateAirdropERC20SignatureOptions) : Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +``` + +### Parameters + + The options for the airdrop. + +#### Type + +```ts +let options: { + account: Account; + airdropRequest: GenerateReqInput; + contract: ThirdwebContract; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +``` + + A promise that resolves to the req and signature. +--- + +## generateAirdropSignatureERC721 + + Generates the req and signature for sending ERC721 airdrop. + +### Example + +```ts +import { + airdropERC721WithSignature, + generateAirdropSignatureERC721, +} from "thirdweb/extensions/airdrop"; + +// list of recipients and tokenIds to airdrop for each recipient +const contents = [ + { recipient: "0x...", tokenId: 0 }, + { recipient: "0x...", tokenId: 1 }, + { recipient: "0x...", tokenId: 2 }, +]; + +const { req, signature } = await generateAirdropSignatureERC721({ + account, + contract, + airdropRequest: { + tokenAddress: "0x...", // address of the ERC721 token to airdrop + contents, + }, +}); + +const transaction = airdropERC721WithSignature({ + contract, + req, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function generateAirdropSignatureERC721(options: GenerateAirdropERC721SignatureOptions) : Promise<{ req: { contents: readonly Array<{ recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +``` + +### Parameters + + The options for the airdrop. + +#### Type + +```ts +let options: { + account: Account; + airdropRequest: GenerateReqInput; + contract: ThirdwebContract; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ req: { contents: readonly Array<{ recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +``` + + A promise that resolves to the req and signature. +--- + +## generateMerkleTreeInfoERC1155 + + Generate merkle tree for a given snapshot. + +### Example + +```ts +import { generateMerkleTreeInfoERC1155 } from "thirdweb/extensions/airdrop"; + +// snapshot / allowlist of airdrop recipients and amounts +const snapshot = [ + { recipient: "0x...", tokenId: 0, amount: 10 }, + { recipient: "0x...", tokenId: 1, amount: 12 }, + { recipient: "0x...", tokenId: 2, amount: 15 }, +]; + +const tokenAddress = "0x..."; // Address of ERC1155 airdrop token + +const { merkleRoot, snapshotUri } = + await generateMerkleTreeInfoERC1155({ + contract, + tokenAddress, + snapshot, + }); + +// Optional next steps {See: saveSnapshot and setMerkleRoot functions} +// - Save snapshot on-chain (on the airdrop contract uri) +// - Set merkle root on the contract to enable claiming +``` + +```ts +function generateMerkleTreeInfoERC1155( + options: BaseTransactionOptions, +): Promise<{ merkleRoot: string; snapshotUri: string }>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; +``` + + A promise that resolves to the merkle-root and snapshot-uri. +--- + +## generateMerkleTreeInfoERC20 + + Generate merkle tree for a given snapshot. + +### Example + +```ts +import { generateMerkleTreeInfoERC20 } from "thirdweb/extensions/airdrop"; + +// snapshot / allowlist of airdrop recipients and amounts +const snapshot = [ + { recipient: "0x...", amount: 10 }, + { recipient: "0x...", amount: 15 }, + { recipient: "0x...", amount: 20 }, +]; + +const tokenAddress = "0x..."; // Address of ERC20 airdrop token + +const { merkleRoot, snapshotUri } = await generateMerkleTreeInfoERC20( + { + contract, + tokenAddress, + snapshot, + }, +); + +// Optional next steps {See: saveSnapshot and setMerkleRoot functions} +// - Save snapshot on-chain (on the airdrop contract uri) +// - Set merkle root on the contract to enable claiming +``` + +```ts +function generateMerkleTreeInfoERC20( + options: BaseTransactionOptions, +): Promise<{ merkleRoot: string; snapshotUri: string }>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; +``` + + A promise that resolves to the merkle-root and snapshot-uri. +--- + +## generateMerkleTreeInfoERC721 + + Generate merkle tree for a given snapshot. + +### Example + +```ts +import { generateMerkleTreeInfoERC721 } from "thirdweb/extensions/airdrop"; + +// snapshot / allowlist of airdrop recipients and amounts +const snapshot = [ + { recipient: "0x...", tokenId: 0 }, + { recipient: "0x...", tokenId: 1 }, + { recipient: "0x...", tokenId: 2 }, +]; + +const tokenAddress = "0x..."; // Address of ERC721 airdrop token + +const { merkleRoot, snapshotUri } = + await generateMerkleTreeInfoERC721({ + contract, + tokenAddress, + snapshot, + }); + +// Optional next steps {See: saveSnapshot and setMerkleRoot functions} +// - Save snapshot on-chain (on the airdrop contract uri) +// - Set merkle root on the contract to enable claiming +``` + +```ts +function generateMerkleTreeInfoERC721( + options: BaseTransactionOptions, +): Promise<{ merkleRoot: string; snapshotUri: string }>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; +``` + + A promise that resolves to the merkle-root and snapshot-uri. +--- + +## isClaimed + + Calls the "isClaimed" function on the contract. + +### Example + +```ts +import { isClaimed } from "thirdweb/extensions/airdrop"; + +const result = await isClaimed({ + contract, + receiver: ..., + token: ..., + tokenId: ..., +}); +``` + +```ts +function isClaimed( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isClaimed function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## saveSnapshot + + Generate merkle tree for a given snapshot and save the info on-chain. + +### Example + +```ts +// This is ERC20 example. Should import and use other ERC variants as needed + +import { generateMerkleTreeInfoERC20, saveSnapshot, setMerkleRoot } from "thirdweb/extensions/airdrop"; + +// snapshot / allowlist of airdrop recipients and amounts +const snapshot = [ + { recipient: "0x...", amount: 10 }, + { recipient: "0x...", amount: 15 }, + { recipient: "0x...", amount: 20 }, +]; + +const tokenAddress = "0x..." // Address of airdrop token + +const { merkleRoot, snapshotUri } = await generateMerkleTreeInfoERC20({ + contract, + tokenAddress, + snapshot +}); + +const saveSnapshotTransaction = saveSnapshot({ + contract, + merkleRoot, + snapshotUri, +}); +await sendTransaction({ saveSnapshotTransaction, account }); + +const setMerkleRootTransaction = setMerkleRoot({ + contract, + token, + tokenMerkleRoot: merkleRoot as `0x${string}`, + resetClaimStatus: false // toggle as needed + signature, +}); +await sendTransaction({ setMerkleRootTransaction, account }); +``` + +```ts +function saveSnapshot( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## setMerkleRoot + + Prepares a transaction to call the "setMerkleRoot" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setMerkleRoot } from "thirdweb/extensions/airdrop"; + +const transaction = setMerkleRoot({ + contract, + token: ..., + tokenMerkleRoot: ..., + resetClaimStatus: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setMerkleRoot( + options: BaseTransactionOptions< + | SetMerkleRootParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setMerkleRoot" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetMerkleRootParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## tokenConditionId + + Calls the "tokenConditionId" function on the contract. + +### Example + +```ts +import { tokenConditionId } from "thirdweb/extensions/airdrop"; + +const result = await tokenConditionId({ + contract, + tokenAddress: ..., +}); +``` + +```ts +function tokenConditionId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the tokenConditionId function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## tokenMerkleRoot + + Calls the "tokenMerkleRoot" function on the contract. + +### Example + +```ts +import { tokenMerkleRoot } from "thirdweb/extensions/airdrop"; + +const result = await tokenMerkleRoot({ + contract, + tokenAddress: ..., +}); +``` + +```ts +function tokenMerkleRoot( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the tokenMerkleRoot function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- +## COMMON +--- + +## contractURI + + Calls the "contractURI" function on the contract. + +### Example + +```ts +import { contractURI } from "thirdweb/extensions/common"; + +const result = await contractURI({ + contract, +}); +``` + +```ts +function contractURI( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the contractURI function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getContractMetadata + + Retrieves the contract metadata including name and symbol. + +### Example + +```ts +import { getContractMetadata } from "thirdweb/extensions/common"; +const metadata = await getContractMetadata({ contract }); +``` + +```ts +function getContractMetadata( + options: BaseTransactionOptions, +): Promise<{ name: string; symbol: string }>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<{ name: string; symbol: string }>; +``` + + A promise that resolves to an object containing the resolved metadata, name, and symbol. +--- + +## getDefaultRoyaltyInfo + + Calls the "getDefaultRoyaltyInfo" function on the contract. + +### Example + +```ts +import { getDefaultRoyaltyInfo } from "thirdweb/extensions/common"; + +const result = await getDefaultRoyaltyInfo({ + contract, +}); +``` + +```ts +function getDefaultRoyaltyInfo( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getDefaultRoyaltyInfo function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getPlatformFeeInfo + + Calls the "getPlatformFeeInfo" function on the contract. + +### Example + +```ts +import { getPlatformFeeInfo } from "thirdweb/extensions/common"; + +const result = await getPlatformFeeInfo({ + contract, +}); +``` + +```ts +function getPlatformFeeInfo( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getPlatformFeeInfo function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getRoyaltyInfoForToken + + Calls the "getRoyaltyInfoForToken" function on the contract. + +### Example + +```ts +import { getRoyaltyInfoForToken } from "thirdweb/extensions/common"; + +const result = await getRoyaltyInfoForToken({ + contract, + tokenId: ..., +}); +``` + +```ts +function getRoyaltyInfoForToken( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getRoyaltyInfoForToken function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isGetContractMetadataSupported + + Checks if the `contractURI` method is supported by the given contract. + +### Example + +```ts +import { isContractURISupported } from "thirdweb/extensions/common"; +const supported = isContractURISupported(["0x..."]); +``` + +```ts +function isGetContractMetadataSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `contractURI` method is supported. +--- + +## isGetDefaultRoyaltyInfoSupported + + Checks if the `getDefaultRoyaltyInfo` method is supported by the given contract. + +### Example + +```ts +import { isGetDefaultRoyaltyInfoSupported } from "thirdweb/extensions/common"; +const supported = isGetDefaultRoyaltyInfoSupported(["0x..."]); +``` + +```ts +function isGetDefaultRoyaltyInfoSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getDefaultRoyaltyInfo` method is supported. +--- + +## isGetPlatformFeeInfoSupported + + Checks if the `getPlatformFeeInfo` method is supported by the given contract. + +### Example + +```ts +import { isGetPlatformFeeInfoSupported } from "thirdweb/extensions/common"; +const supported = isGetPlatformFeeInfoSupported(["0x..."]); +``` + +```ts +function isGetPlatformFeeInfoSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getPlatformFeeInfo` method is supported. +--- + +## isGetRoyaltyInfoForTokenSupported + + Checks if the `getRoyaltyInfoForToken` method is supported by the given contract. + +### Example + +```ts +import { isGetRoyaltyInfoForTokenSupported } from "thirdweb/extensions/common"; +const supported = isGetRoyaltyInfoForTokenSupported(["0x..."]); +``` + +```ts +function isGetRoyaltyInfoForTokenSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getRoyaltyInfoForToken` method is supported. +--- + +## isMulticallSupported + + Checks if the `multicall` method is supported by the given contract. + +### Example + +```ts +import { isMulticallSupported } from "thirdweb/extensions/common"; + +const supported = isMulticallSupported(["0x..."]); +``` + +```ts +function isMulticallSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `multicall` method is supported. +--- + +## isNameSupported + + Checks if the `name` method is supported by the given contract. + +### Example + +```ts +import { isNameSupported } from "thirdweb/extensions/common"; +const supported = isNameSupported(["0x..."]); +``` + +```ts +function isNameSupported(availableSelectors: Array): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `name` method is supported. +--- + +## isOwnerSupported + + Checks if the `owner` method is supported by the given contract. + +### Example + +```ts +import { isOwnerSupported } from "thirdweb/extensions/common"; +const supported = isOwnerSupported(["0x..."]); +``` + +```ts +function isOwnerSupported(availableSelectors: Array): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `owner` method is supported. +--- + +## isPrimarySaleRecipientSupported + + Checks if the `primarySaleRecipient` method is supported by the given contract. + +### Example + +```ts +import { isPrimarySaleRecipientSupported } from "thirdweb/extensions/common"; +const supported = isPrimarySaleRecipientSupported(["0x..."]); +``` + +```ts +function isPrimarySaleRecipientSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `primarySaleRecipient` method is supported. +--- + +## isSetContractURISupported + + Checks if the `setContractURI` method is supported by the given contract. + +### Example + +```ts +import { isSetContractURISupported } from "thirdweb/extensions/common"; + +const supported = isSetContractURISupported(["0x..."]); +``` + +```ts +function isSetContractURISupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setContractURI` method is supported. +--- + +## isSetDefaultRoyaltyInfoSupported + + Checks if the `setDefaultRoyaltyInfo` method is supported by the given contract. + +### Example + +```ts +import { isSetDefaultRoyaltyInfoSupported } from "thirdweb/extensions/common"; + +const supported = isSetDefaultRoyaltyInfoSupported(["0x..."]); +``` + +```ts +function isSetDefaultRoyaltyInfoSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setDefaultRoyaltyInfo` method is supported. +--- + +## isSetPlatformFeeInfoSupported + + Checks if the `setPlatformFeeInfo` method is supported by the given contract. + +### Example + +```ts +import { isSetPlatformFeeInfoSupported } from "thirdweb/extensions/common"; + +const supported = isSetPlatformFeeInfoSupported(["0x..."]); +``` + +```ts +function isSetPlatformFeeInfoSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setPlatformFeeInfo` method is supported. +--- + +## isSetPrimarySaleRecipientSupported + + Checks if the `setPrimarySaleRecipient` method is supported by the given contract. + +### Example + +```ts +import { isSetPrimarySaleRecipientSupported } from "thirdweb/extensions/common"; + +const supported = isSetPrimarySaleRecipientSupported(["0x..."]); +``` + +```ts +function isSetPrimarySaleRecipientSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setPrimarySaleRecipient` method is supported. +--- + +## isSetRoyaltyInfoForTokenSupported + + Checks if the `setRoyaltyInfoForToken` method is supported by the given contract. + +### Example + +```ts +import { isSetRoyaltyInfoForTokenSupported } from "thirdweb/extensions/common"; + +const supported = isSetRoyaltyInfoForTokenSupported(["0x..."]); +``` + +```ts +function isSetRoyaltyInfoForTokenSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setRoyaltyInfoForToken` method is supported. +--- + +## isSymbolSupported + + Checks if the `symbol` method is supported by the given contract. + +### Example + +```ts +import { isSymbolSupported } from "thirdweb/extensions/common"; +const supported = isSymbolSupported(["0x..."]); +``` + +```ts +function isSymbolSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `symbol` method is supported. +--- + +## multicall + + Prepares a transaction to call the "multicall" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { multicall } from "thirdweb/extensions/common"; + +const transaction = multicall({ + contract, + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function multicall( + options: BaseTransactionOptions< + MulticallParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "multicall" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + MulticallParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## name + + Retrieves the name associated with the given contract. + +### Example + +```ts +import { name } from "thirdweb/extensions/common"; + +const contractName = await name({ contract }); +``` + +```ts +function name(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the name associated with the contract. +--- + +## owner + + Calls the "owner" function on the contract. + +### Example + +```ts +import { owner } from "thirdweb/extensions/common"; + +const result = await owner({ + contract, +}); +``` + +```ts +function owner(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the owner function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## ownerUpdatedEvent + + Creates an event object for the OwnerUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { ownerUpdatedEvent } from "thirdweb/extensions/common"; + +const events = await getContractEvents({ +contract, +events: [ + ownerUpdatedEvent({ + prevOwner: ..., + newOwner: ..., +}) +], +}); +``` + +```ts +function ownerUpdatedEvent( + filters: Partial<{ newOwner: string; prevOwner: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "prevOwner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "newOwner"; + readonly type: "address"; + }, + ]; + readonly name: "OwnerUpdated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ newOwner: string; prevOwner: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "prevOwner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "newOwner"; + readonly type: "address"; + }, + ]; + readonly name: "OwnerUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## primarySaleRecipient + + Calls the "primarySaleRecipient" function on the contract. + +### Example + +```ts +import { primarySaleRecipient } from "thirdweb/extensions/common"; + +const result = await primarySaleRecipient({ + contract, +}); +``` + +```ts +function primarySaleRecipient( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the primarySaleRecipient function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## setContractMetadata + + Sets the metadata for a contract. + +### Example + +```ts +import { setContractMetadata } from "@thirdweb/extensions/common"; +import { sendTransaction } from "thirdweb"; + +const transaction = setContractMetadata({ + contract, + name: "My NFT", + symbol: "NFT", +}); + +// Send the transaction +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function setContractMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for setting the contract metadata. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + +* The prepared transaction to set the contract metadata. +--- + +## setContractURI + + Prepares a transaction to call the "setContractURI" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setContractURI } from "thirdweb/extensions/common"; + +const transaction = setContractURI({ + contract, + uri: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setContractURI( + options: BaseTransactionOptions< + | SetContractURIParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setContractURI" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetContractURIParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setDefaultRoyaltyInfo + + Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setDefaultRoyaltyInfo } from "thirdweb/extensions/common"; + +const transaction = setDefaultRoyaltyInfo({ + contract, + royaltyRecipient: ..., + royaltyBps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setDefaultRoyaltyInfo( + options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setDefaultRoyaltyInfo" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setOwner + + Prepares a transaction to call the "setOwner" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setOwner } from "thirdweb/extensions/common"; + +const transaction = setOwner({ + contract, + newOwner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setOwner( + options: BaseTransactionOptions< + SetOwnerParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setOwner" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + SetOwnerParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setPlatformFeeInfo + + Prepares a transaction to call the "setPlatformFeeInfo" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setPlatformFeeInfo } from "thirdweb/extensions/common"; + +const transaction = setPlatformFeeInfo({ + contract, + platformFeeRecipient: ..., + platformFeeBps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setPlatformFeeInfo( + options: BaseTransactionOptions< + | SetPlatformFeeInfoParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setPlatformFeeInfo" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetPlatformFeeInfoParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setPrimarySaleRecipient + + Prepares a transaction to call the "setPrimarySaleRecipient" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setPrimarySaleRecipient } from "thirdweb/extensions/common"; + +const transaction = setPrimarySaleRecipient({ + contract, + saleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setPrimarySaleRecipient( + options: BaseTransactionOptions< + | SetPrimarySaleRecipientParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setPrimarySaleRecipient" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetPrimarySaleRecipientParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setRoyaltyInfoForToken + + Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setRoyaltyInfoForToken } from "thirdweb/extensions/common"; + +const transaction = setRoyaltyInfoForToken({ + contract, + tokenId: ..., + recipient: ..., + bps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setRoyaltyInfoForToken( + options: BaseTransactionOptions< + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setRoyaltyInfoForToken" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## symbol + + Retrieves the name associated with the given contract. + +### Example + +```ts +import { symbol } from "thirdweb/extensions/common"; + +const contractSymbol = await symbol({ contract }); +``` + +```ts +function symbol(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the name associated with the contract. +--- +## ENS +--- + +## parseNftUri + + Parses an NFT URI. + +### Example + +```ts +import { parseNftUri } from "thirdweb/utils/ens"; +const nftUri = await parseNftUri({ + client, + uri: "eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063", +}); + +console.log(nftUri); // ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/ +``` + +```ts +function parseNftUri(options: { + client: ThirdwebClient; + uri: string; +}): Promise; +``` + +### Parameters + + The options for parsing an NFT URI. + +#### Type + +```ts +let options: { client: ThirdwebClient; uri: string }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the NFT URI, or null if the URI could not be parsed. +--- + +## parseAvatarRecord + + Parses an ENS or similar avatar record. Supports NFT URIs, IPFS scheme, and HTTPS URIs. + +### Example + +```ts +import { parseAvatarRecord } from "thirdweb/utils/ens"; +const avatarUrl = await parseAvatarRecord({ + client, + uri: "ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/", +}); + +console.log(avatarUrl); // "https://ipfs.io/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/" + +const avatarUrl2 = await parseAvatarRecord({ + client, + uri: "eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063", +}); + +console.log(avatarUrl2); // "https://opensea.io/assets/0xb32979486938aa9694bfc898f35dbed459f44424/10063" +``` + +```ts +function parseAvatarRecord( + options: ParseAvatarOptions, +): Promise; +``` + +### Parameters + + The options for parsing an ENS avatar record. + +#### Type + +```ts +let options: { client: ThirdwebClient; uri: string }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the avatar URL, or null if the URI could not be parsed. +--- + +## resolveAddress + + Resolves an ENS name to an Ethereum address. + +### Example + +```ts +import { resolveAddress } from "thirdweb/extensions/ens"; +const address = await resolveAddress({ + client, + name: "vitalik.eth", +}); +``` + + Resolve an address to a Basename. + +```ts +import { + resolveAddress, + BASENAME_RESOLVER_ADDRESS, +} from "thirdweb/extensions/ens"; +import { base } from "thirdweb/chains"; +const address = await resolveAddress({ + client, + name: "myk.base.eth", + resolverAddress: BASENAME_RESOLVER_ADDRESS, + resolverChain: base, +}); +``` + +```ts +function resolveAddress( + options: ResolveAddressOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for resolving an ENS address. + +#### Type + +```ts +let options: { + client: ThirdwebClient; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + A promise that resolves to the Ethereum address. +--- + +## resolveAvatar + + Resolves an ENS name to the avatar URL. + +### Example + +```ts +import { resolveAvatar } from "thirdweb/extensions/ens"; +const address = await resolveAvatar({ + client, + name: "vitalik.eth", +}); +``` + +```ts +function resolveAvatar( + options: ResolveAvatarOptions, +): Promise; +``` + +### Parameters + + The options for resolving an ENS address. + +#### Type + +```ts +let options: { + client: ThirdwebClient; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the avatar url, or null if not set. +--- + +## resolveL2Name + + Resolves the L2 name for a specified address. + +### Example + +```ts +import { resolveL2Name } from "thirdweb/extensions/ens"; +const name = await resolveL2Name({ + client, + address: "0x1234...", + resolverAddress: "0x...", + resolverChain: base, +}); +``` + + Resolve a Basename. + +```ts +import { + resolveL2Name, + BASENAME_RESOLVER_ADDRESS, +} from "thirdweb/extensions/ens"; +import { base } from "thirdweb/chains"; +const name = await resolveL2Name({ + client, + address: "0x1234...", + resolverAddress: BASENAME_RESOLVER_ADDRESS, + resolverChain: base, +}); +``` + +```ts +function resolveL2Name( + options: ResolveL2NameOptions, +): Promise; +``` + +### Parameters + + The options for resolving an L2 ENS address. + +#### Type + +```ts +let options: { + address: Address; + client: ThirdwebClient; + resolverAddress: string; + resolverChain: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the Ethereum address. +--- + +## resolveName + + Resolves the primary name for a specified address. + +### Example + +```ts +import { resolveName } from "thirdweb/extensions/ens"; +const name = await resolveName({ + client, + address: "0x1234...", +}); +``` + +```ts +function resolveName( + options: ResolveNameOptions, +): Promise; +``` + +### Parameters + + The options for resolving an ENS address. + +#### Type + +```ts +let options: { + address: Address; + client: ThirdwebClient; + resolverAddress?: string; + resolverChain?: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the Ethereum address. +--- + +## resolveText + + Resolves an ENS name and key to the specified record. + +### Example + +```ts +import { resolveText } from "thirdweb/extensions/ens"; +const twitterUsername = await resolveText({ + client, + name: "vitalik.eth", + key: "com.twitter", +}); +``` + +```ts +function resolveText( + options: ResolveTextOptions, +): Promise; +``` + +### Parameters + + The options for resolving an ENS address. + +#### Type + +```ts +let options: { + client: ThirdwebClient; + key: string; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the text record. +--- +## ERC1155 +--- + +## approvalForAllEvent + + Creates an event object for the ApprovalForAll event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { approvalForAllEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + approvalForAllEvent({ + _owner: ..., + _operator: ..., +}) +], +}); +``` + +```ts +function approvalForAllEvent( + filters: Partial<{ _operator: string; _owner: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "_owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_operator"; + readonly type: "address"; + }, + { readonly name: "_approved"; readonly type: "bool" }, + ]; + readonly name: "ApprovalForAll"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ _operator: string; _owner: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "_owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_operator"; + readonly type: "address"; + }, + { readonly name: "_approved"; readonly type: "bool" }, + ]; + readonly name: "ApprovalForAll"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## balanceOf + + Calls the "balanceOf" function on the contract. + +### Example + +```ts +import { balanceOf } from "thirdweb/extensions/erc1155"; + +const result = await balanceOf({ + contract, + owner: ..., + tokenId: ..., +}); +``` + +```ts +function balanceOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the balanceOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## balanceOfBatch + + Calls the "balanceOfBatch" function on the contract. + +### Example + +```ts +import { balanceOfBatch } from "thirdweb/extensions/erc1155"; + +const result = await balanceOfBatch({ + contract, + owners: ..., + tokenIds: ..., +}); +``` + +```ts +function balanceOfBatch(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the balanceOfBatch function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## batchMetadataUpdateEvent + + Creates an event object for the BatchMetadataUpdate event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { batchMetadataUpdateEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ + contract, + events: [batchMetadataUpdateEvent()], +}); +``` + +```ts +function batchMetadataUpdateEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_fromTokenId"; readonly type: "uint256" }, + { readonly name: "_toTokenId"; readonly type: "uint256" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_fromTokenId"; readonly type: "uint256" }, + { readonly name: "_toTokenId"; readonly type: "uint256" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## burn + + Prepares a transaction to call the "burn" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { burn } from "thirdweb/extensions/erc1155"; + +const transaction = burn({ + contract, + account: ..., + id: ..., + value: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function burn( + options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "burn" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## burnBatch + + Prepares a transaction to call the "burnBatch" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { burnBatch } from "thirdweb/extensions/erc1155"; + +const transaction = burnBatch({ + contract, + account: ..., + ids: ..., + values: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function burnBatch( + options: BaseTransactionOptions< + BurnBatchParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "burnBatch" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + BurnBatchParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## claimTo + + Claim ERC1155 NFTs to a specified address + +### Example + +#### Basic usage + +```ts +import { claimTo } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = claimTo({ + contract, + to: "0x...", + tokenId: 0n, + quantity: 1n, +}); + +await sendTransaction({ transaction, account }); +``` + +#### For Drops with allowlists + + You need to specify the claimer address as the `from` param to avoid any issue with the allowlist + +```ts +const transaction = claimTo({ + contract, + to: "0x...", + tokenId: 0n, + quantity: 1n, + from: "0x...", // address of the one claiming +}); +``` + +```ts +function claimTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transaction + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The prepared transaction +--- + +## createPack + + Prepares a transaction to call the "createPack" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { createPack } from "thirdweb/extensions/erc1155"; + +const transaction = createPack({ + contract, + contents: ..., + numOfRewardUnits: ..., + packUri: ..., + openStartTimestamp: ..., + amountDistributedPerOpen: ..., + recipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function createPack( + options: BaseTransactionOptions< + | CreatePackParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "createPack" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + CreatePackParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## encodeSafeTransferFrom + + Encodes the "safeTransferFrom" function into a Hex string with its parameters. + +### Example + +```ts +import { encodeSafeTransferFrom } from "thirdweb/extensions/erc1155"; +const result = encodeSafeTransferFrom({ + from: ..., + to: ..., + tokenId: ..., + value: ..., + data: ..., +}); +``` + +```ts +function encodeSafeTransferFrom( + options: SafeTransferFromParams, +): `0xf242432a${string}`; +``` + +### Parameters + + The options for the safeTransferFrom function. + +#### Type + +```ts +let options: WithOverrides<{ + data: AbiParameterToPrimitiveType<{ name: "_data"; type: "bytes" }>; + from: AbiParameterToPrimitiveType<{ + name: "_from"; + type: "address"; + }>; + to: AbiParameterToPrimitiveType<{ name: "_to"; type: "address" }>; + tokenId: AbiParameterToPrimitiveType<{ + name: "tokenId"; + type: "uint256"; + }>; + value: AbiParameterToPrimitiveType<{ + name: "_value"; + type: "uint256"; + }>; +}>; +``` + +### Returns + +```ts +let returnType: `0xf242432a${string}`; +``` + + The encoded hexadecimal string. +--- + +## freezeMetadata + + Prepares a transaction to call the "freezeMetadata" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { freezeMetadata } from "thirdweb/extensions/erc1155"; + +const transaction = freezeMetadata(); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function freezeMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the "freezeMetadata" function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## generateMintSignature + + Generates the payload and signature for minting an ERC1155 token. + +### Example + +```ts +import { + mintWithSignature, + generateMintSignature, +} from "thirdweb/extensions/erc1155"; + +const { payload, signature } = await generateMintSignature({ + account, + contract, + mintRequest: { + to: "0x...", + quantity: 10n, + metadata: { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, + }, +}); + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise<{ + payload: { + currency: string; + pricePerToken: bigint; + primarySaleRecipient: string; + quantity: bigint; + royaltyBps: bigint; + royaltyRecipient: string; + to: string; + tokenId: bigint; + uid: `0x${string}`; + uri: string; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; +}>; +``` + +### Parameters + + The options for the minting process. + +#### Type + +```ts +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ + payload: { + currency: string; + pricePerToken: bigint; + primarySaleRecipient: string; + quantity: bigint; + royaltyBps: bigint; + royaltyRecipient: string; + to: string; + tokenId: bigint; + uid: `0x${string}`; + uri: string; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; +}>; +``` + + A promise that resolves to the payload and signature. +--- + +## getActiveClaimCondition + + Retrieves the active claim condition. + +### Example + +```ts +import { getActiveClaimCondition } from "thirdweb/extensions/erc1155"; +const activeClaimCondition = await getActiveClaimCondition({ + contract, + tokenId, +}); +``` + +```ts +function getActiveClaimCondition( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the active claim condition. +--- + +## getClaimConditionById + + Calls the "getClaimConditionById" function on the contract. + +### Example + +```ts +import { getClaimConditionById } from "thirdweb/extensions/erc1155"; + +const result = await getClaimConditionById({ + contract, + tokenId: ..., + conditionId: ..., +}); +``` + +```ts +function getClaimConditionById( + options: BaseTransactionOptions, +): Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; +``` + +### Parameters + + The options for the getClaimConditionById function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getClaimConditions + + Retrieves all claim conditions. + +### Example + +```ts +import { getClaimConditions } from "thirdweb/extensions/erc1155"; +const conditions = await getClaimConditions({ + contract, + tokenId: 1n, +}); +``` + +```ts +function getClaimConditions( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to all claim conditions. +--- + +## getNFT + + Retrieves information about a specific ERC1155 non-fungible token (NFT). + +### Example + +```ts +import { getNFT } from "thirdweb/extensions/erc1155"; +const nft = await getNFT({ + contract, + tokenId: 1n, +}); +``` + +```ts +function getNFT( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the NFT. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + tokenURI: string; + type: "ERC721"; + } + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + supply: bigint; + tokenURI: string; + type: "ERC1155"; + }; +``` + + A promise that resolves to the NFT object. +--- + +## getNFTs + + Retrieves an array of NFTs ("ERC1155") based on the provided options. + +### Example + +```ts +import { getNFTs } from "thirdweb/extensions/erc1155"; +const nfts = await getNFTs({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getNFTs( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the NFTs. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + tokenURI: string; + type: "ERC721"; + } + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + supply: bigint; + tokenURI: string; + type: "ERC1155"; + }; +``` + + A promise that resolves to an array of NFTs. +--- + +## getOwnedNFTs + + Retrieves the owned ERC1155 NFTs for a given wallet address. + +### Example + +```ts +import { getOwnedNFTs } from "thirdweb/extensions/erc1155"; +const nfts = await getOwnedNFTs({ + contract, + start: 0, + count: 10, + address: "0x123...", +}); +``` + +```ts +function getOwnedNFTs( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The transaction options and parameters. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + tokenURI: string; + type: "ERC721"; + } + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + supply: bigint; + tokenURI: string; + type: "ERC1155"; + }; +``` + + A promise that resolves to an array of ERC1155 NFTs owned by the wallet address, along with the quantity owned. +--- + +## getOwnedTokenIds + + Retrieves the owned ERC1155 tokenIds & the owned balance of each tokenId for a given wallet address. + +### Example + +```ts +import { getOwnedNFTs } from "thirdweb/extensions/erc1155"; +const ownedTokenIds = await getOwnedTokenIds({ + contract, + start: 0, + count: 10, + address: "0x123...", +}); +``` + +```ts +function getOwnedTokenIds( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The transaction options and parameters. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to an array of ERC1155 NFTs owned by the wallet address, along with the quantity owned. +--- + +## isApprovedForAll + + Calls the "isApprovedForAll" function on the contract. + +### Example + +```ts +import { isApprovedForAll } from "thirdweb/extensions/erc1155"; + +const result = await isApprovedForAll({ + contract, + owner: ..., + operator: ..., +}); +``` + +```ts +function isApprovedForAll( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isApprovedForAll function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isBurnSupported + + Checks if the `burn` method is supported by the given contract. + +### Example + +```ts +import { isBurnSupported } from "thirdweb/extensions/erc1155"; + +const supported = isBurnSupported(["0x..."]); +``` + +```ts +function isBurnSupported(availableSelectors: Array): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `burn` method is supported. +--- + +## isClaimToSupported + + Checks if the `claimTo` method is supported by the given contract. + +### Example + +```ts +import { isClaimToSupported } from "thirdweb/extensions/erc1155"; + +const supported = isClaimToSupported(["0x..."]); +``` + +```ts +function isClaimToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `claimTo` method is supported. +--- + +## isERC1155 + + Check if a contract supports the ERC1155 interface. + +### Example + +```ts +import { isERC1155 } from "thirdweb/extensions/erc1155"; +const result = await isERC1155({ contract }); +``` + +```ts +function isERC1155(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A boolean indicating whether the contract supports the ERC1155 interface. +--- + +## isGetActiveClaimConditionSupported + + Checks if the `getActiveClaimCondition` method is supported by the given contract. + +### Example + +```ts +import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc1155"; + +const supported = isGetActiveClaimConditionSupported(["0x..."]); +``` + +```ts +function isGetActiveClaimConditionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getActiveClaimCondition` method is supported. +--- + +## isGetClaimConditionByIdSupported + + Checks if the `getClaimConditionById` method is supported by the given contract. + +### Example + +```ts +import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc1155"; +const supported = isGetClaimConditionByIdSupported(["0x..."]); +``` + +```ts +function isGetClaimConditionByIdSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getClaimConditionById` method is supported. +--- + +## isGetClaimConditionsSupported + + Checks if the `getClaimConditions` method is supported by the given contract. + +### Example + +```ts +import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc1155"; + +const supported = isGetClaimConditionsSupported(["0x..."]); +``` + +```ts +function isGetClaimConditionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getClaimConditions` method is supported. +--- + +## isGetNFTsSupported + + Checks if the `getNFTs` method is supported by the given contract. + +### Example + +```ts +import { isGetNFTsSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetNFTsSupported(["0x..."]); +``` + +```ts +function isGetNFTsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getNFTs` method is supported. +--- + +## isGetNFTSupported + + Checks if the `uri` method is supported by the given contract. + +### Example + +```ts +import { isUriSupported } from "thirdweb/extensions/erc1155"; +const supported = isUriSupported(["0x..."]); +``` + +```ts +function isGetNFTSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `uri` method is supported. +--- + +## isLazyMintSupported + + Checks if the `lazyMint` method is supported by the given contract. + +### Example + +```ts +import { isLazyMintSupported } from "thirdweb/extensions/erc1155"; + +const supported = isLazyMintSupported(["0x..."]); +``` + +```ts +function isLazyMintSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `lazyMint` method is supported. +--- + +## isMintAdditionalSupplyToSupported + + Checks if the `mintAdditionalSupplyTo` method is supported by the given contract. + +### Example + +```ts +import { isMintAdditionalSupplyToSupported } from "thirdweb/extensions/erc1155"; + +const supported = isMintAdditionalSupplyToSupported(["0x..."]); +``` + +```ts +function isMintAdditionalSupplyToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `mintAdditionalSupplyTo` method is supported. +--- + +## isMintToSupported + + Checks if the `mintTo` method is supported by the given contract. + +### Example + +```ts +import { isMintToSupported } from "thirdweb/extensions/erc1155"; + +const supported = isMintToSupported(["0x..."]); +``` + +```ts +function isMintToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `mintTo` method is supported. +--- + +## isNextTokenIdToMintSupported + + Checks if the `nextTokenIdToMint` method is supported by the given contract. + +### Example + +```ts +import { isNextTokenIdToMintSupported } from "thirdweb/extensions/erc1155"; +const supported = isNextTokenIdToMintSupported(["0x..."]); +``` + +```ts +function isNextTokenIdToMintSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `nextTokenIdToMint` method is supported. +--- + +## isResetClaimEligibilitySupported + + Checks if the `resetClaimEligibility` method is supported by the given contract. + +### Example + +```ts +import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc1155"; + +const supported = isResetClaimEligibilitySupported(["0x..."]); +``` + +```ts +function isResetClaimEligibilitySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `resetClaimEligibility` method is supported. +--- + +## isSetClaimConditionsSupported + + Checks if the `setClaimConditions` method is supported by the given contract. + +### Example + +```ts +import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc1155"; + +const supported = isSetClaimConditionsSupported(["0x..."]); +``` + +```ts +function isSetClaimConditionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setClaimConditions` method is supported. +--- + +## isTotalSupplySupported + + Checks if the `totalSupply` method is supported by the given contract. + +### Example + +```ts +import { isTotalSupplySupported } from "thirdweb/extensions/erc1155"; +const supported = isTotalSupplySupported(["0x..."]); +``` + +```ts +function isTotalSupplySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `totalSupply` method is supported. +--- + +## isUpdateTokenURISupported + + Checks if the `setTokenURI` method is supported by the given contract. + +### Example + +```ts +import { isSetTokenURISupported } from "thirdweb/extensions/erc1155"; + +const supported = isSetTokenURISupported(["0x..."]); +``` + +```ts +function isUpdateTokenURISupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setTokenURI` method is supported. +--- + +## lazyMint + + Lazily mints ERC1155 tokens. + +### Example + +```ts +import { lazyMint } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = lazyMint({ + contract, + nfts: [ + { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, + ], +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function lazyMint( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the lazy minting process. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the prepared contract call. +--- + +## metadataFrozenEvent + + Creates an event object for the MetadataFrozen event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { metadataFrozenEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ + contract, + events: [metadataFrozenEvent()], +}); +``` + +```ts +function metadataFrozenEvent(): PreparedEvent<{ + readonly inputs: readonly []; + readonly name: "MetadataFrozen"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly []; + readonly name: "MetadataFrozen"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## metadataUpdateEvent + + Creates an event object for the MetadataUpdate event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { metadataUpdateEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ + contract, + events: [metadataUpdateEvent()], +}); +``` + +```ts +function metadataUpdateEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_tokenId"; readonly type: "uint256" }, + ]; + readonly name: "MetadataUpdate"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_tokenId"; readonly type: "uint256" }, + ]; + readonly name: "MetadataUpdate"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## mintAdditionalSupplyTo + + Mints a "supply" number of additional ERC1155 tokens to the specified "to" address. + +### Example + +```ts +import { mintAdditionalSupplyTo } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = mintAdditionalSupplyTo({ + contract, + to: "0x...", + tokenId: 1n, + supply: 10n, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintAdditionalSupplyTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## mintAdditionalSupplyToBatch + + This extension batches multiple `mintAdditionalSupplyToBatch` extensions into one single multicall. Keep in mind that there is a limit of how many NFTs you can mint per transaction. This limit varies depends on the network that you are transacting on. + + You are recommended to experiment with the number to figure out the best number for your chain of choice. + +### Example + +```ts +import { mintAdditionalSupplyToBatch } from "thirdweb/extensions/erc1155"; + +const transaction = mintAdditionalSupplyToBatch({ + contract, + nfts: [ + { tokenId: 0n, supply: 99n, to: account.address }, + { tokenId: 1n, supply: 98n, to: account.address }, + { tokenId: 2n, supply: 97n, to: account.address }, + ], +}); +``` + +```ts +function mintAdditionalSupplyToBatch( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` +--- + +## mintTo + + Mints a "supply" number of new ERC1155 tokens to the specified "to" address. If the `nft` parameter is a string, it will be used as the token URI. If the `nft` parameter is a file, it will be uploaded to the storage server and the resulting URI will be used as the token URI. + +### Example + +```ts +import { mintTo } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = mintTo({ + contract, + to: "0x...", + supply: 10n, + nft: { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## mintToBatch + + This extension batches multiple `mintTo` extensions into one single multicall. Keep in mind that there is a limit of how many NFTs you can mint per transaction. This limit varies depends on the network that you are transacting on. + + You are recommended to experiment with the number to figure out the best number for your chain of choice. + +### Example + +```ts +import { mintBatchTo } from "thirdweb/extension/erc1155"; + +const transaction = mintToBatch({ + contract: editionContract, + to: "0x...", + nfts: [ + { + metadata: { + name: "Token #0", + image: "...", + attributes: [], + }, + supply: 100n, + }, + { + metadata: { + name: "Token #1", + image: "...", + attributes: [], + }, + supply: 111n, + }, + ], +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintToBatch( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + the transaction options + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## mintWithSignature + + Mints a new ERC1155 token with the given minter signature + +### Example + +```ts +import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const { payload, signature } = await generateMintSignature(...) + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithSignature( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## nextTokenId + + Calls the "nextTokenId" function on the contract. + +### Example + +```ts +import { nextTokenId } from "thirdweb/extensions/erc1155"; + +const result = await nextTokenId({ + contract, +}); +``` + +```ts +function nextTokenId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the nextTokenId function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## nextTokenIdToMint + + Calls the "nextTokenIdToMint" function on the contract. + +### Example + +```ts +import { nextTokenIdToMint } from "thirdweb/extensions/erc1155"; + +const result = await nextTokenIdToMint({ + contract, +}); +``` + +```ts +function nextTokenIdToMint( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the nextTokenIdToMint function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## openPack + + Prepares a transaction to call the "openPack" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { openPack } from "thirdweb/extensions/erc1155"; + +const transaction = openPack({ + contract, + packId: ..., + amountToOpen: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function openPack( + options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "openPack" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## packCreatedEvent + + Creates an event object for the PackCreated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { packCreatedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + packCreatedEvent({ + packId: ..., +}) +], +}); +``` + +```ts +function packCreatedEvent( + filters: Partial<{ packId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackCreated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ packId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackCreated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## packOpenedEvent + + Creates an event object for the PackOpened event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { packOpenedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + packOpenedEvent({ + packId: ..., + opener: ..., +}) +], +}); +``` + +```ts +function packOpenedEvent( + filters: Partial<{ opener: string; packId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "opener"; + readonly type: "address"; + }, + { readonly name: "numOfPacksOpened"; readonly type: "uint256" }, + { + readonly components: readonly [ + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "totalAmount"; readonly type: "uint256" }, + ]; + readonly name: "rewardUnitsDistributed"; + readonly type: "tuple[]"; + }, + ]; + readonly name: "PackOpened"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ opener: string; packId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "opener"; + readonly type: "address"; + }, + { readonly name: "numOfPacksOpened"; readonly type: "uint256" }, + { + readonly components: readonly [ + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "totalAmount"; readonly type: "uint256" }, + ]; + readonly name: "rewardUnitsDistributed"; + readonly type: "tuple[]"; + }, + ]; + readonly name: "PackOpened"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## packUpdatedEvent + + Creates an event object for the PackUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { packUpdatedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + packUpdatedEvent({ + packId: ..., +}) +], +}); +``` + +```ts +function packUpdatedEvent( + filters: Partial<{ packId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackUpdated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ packId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## resetClaimEligibility + + Reset the claim eligibility for all users. + +### Example + +```ts +import { resetClaimEligibility } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = resetClaimEligibility({ + contract, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function resetClaimEligibility( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## safeBatchTransferFrom + + Prepares a transaction to call the "safeBatchTransferFrom" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { safeBatchTransferFrom } from "thirdweb/extensions/erc1155"; + +const transaction = safeBatchTransferFrom({ + contract, + from: ..., + to: ..., + tokenIds: ..., + values: ..., + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function safeBatchTransferFrom( + options: BaseTransactionOptions< + | SafeBatchTransferFromParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "safeBatchTransferFrom" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SafeBatchTransferFromParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## safeTransferFrom + + Prepares a transaction to call the "safeTransferFrom" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { safeTransferFrom } from "thirdweb/extensions/erc1155"; + +const transaction = safeTransferFrom({ + contract, + from: ..., + to: ..., + tokenId: ..., + value: ..., + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function safeTransferFrom( + options: BaseTransactionOptions< + | SafeTransferFromParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "safeTransferFrom" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SafeTransferFromParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setApprovalForAll + + Prepares a transaction to call the "setApprovalForAll" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setApprovalForAll } from "thirdweb/extensions/erc1155"; + +const transaction = setApprovalForAll({ + contract, + operator: ..., + approved: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setApprovalForAll( + options: BaseTransactionOptions< + | SetApprovalForAllParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setApprovalForAll" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetApprovalForAllParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setClaimConditions + + Set the claim conditions for a ERC1155 drop + +### Example + +```ts +import { setClaimConditions } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = setClaimConditions({ + contract, + tokenId: 0n, + phases: [ + { + maxClaimableSupply: 100n, + maxClaimablePerWallet: 1n, + currencyAddress: "0x...", + price: 0.1, + startTime: new Date(), + }, + ], +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function setClaimConditions( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## setTokenURI + + Prepares a transaction to call the "setTokenURI" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setTokenURI } from "thirdweb/extensions/erc1155"; + +const transaction = setTokenURI({ + contract, + tokenId: ..., + uri: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTokenURI( + options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTokenURI" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## tokensClaimedEvent + + Creates an event object for the TokensClaimed event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensClaimedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + tokensClaimedEvent({ + claimConditionIndex: ..., + claimer: ..., + receiver: ..., +}) +], +}); +``` + +```ts +function tokensClaimedEvent( + filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "claimConditionIndex"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "claimer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantityClaimed"; readonly type: "uint256" }, + ]; + readonly name: "TokensClaimed"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "claimConditionIndex"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "claimer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantityClaimed"; readonly type: "uint256" }, + ]; + readonly name: "TokensClaimed"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensLazyMintedEvent + + Creates an event object for the TokensLazyMinted event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensLazyMintedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + tokensLazyMintedEvent({ + startTokenId: ..., +}) +], +}); +``` + +```ts +function tokensLazyMintedEvent( + filters: Partial<{ startTokenId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "startTokenId"; + readonly type: "uint256"; + }, + { readonly name: "endTokenId"; readonly type: "uint256" }, + { readonly name: "baseURI"; readonly type: "string" }, + { readonly name: "encryptedBaseURI"; readonly type: "bytes" }, + ]; + readonly name: "TokensLazyMinted"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ startTokenId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "startTokenId"; + readonly type: "uint256"; + }, + { readonly name: "endTokenId"; readonly type: "uint256" }, + { readonly name: "baseURI"; readonly type: "string" }, + { readonly name: "encryptedBaseURI"; readonly type: "bytes" }, + ]; + readonly name: "TokensLazyMinted"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensMintedWithSignatureEvent + + Creates an event object for the TokensMintedWithSignature event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + tokensMintedWithSignatureEvent({ + signer: ..., + mintedTo: ..., + tokenIdMinted: ..., +}) +], +}); +``` + +```ts +function tokensMintedWithSignatureEvent( + filters: Partial<{ + mintedTo: string; + signer: string; + tokenIdMinted: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenIdMinted"; + readonly type: "uint256"; + }, + { + readonly components: readonly [ + { readonly name: "to"; readonly type: "address" }, + { + readonly name: "royaltyRecipient"; + readonly type: "address"; + }, + { readonly name: "royaltyBps"; readonly type: "uint256" }, + { + readonly name: "primarySaleRecipient"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "uri"; readonly type: "string" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { + readonly name: "validityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "validityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "mintRequest"; + readonly type: "tuple"; + }, + ]; + readonly name: "TokensMintedWithSignature"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + mintedTo: string; + signer: string; + tokenIdMinted: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenIdMinted"; + readonly type: "uint256"; + }, + { + readonly components: readonly [ + { readonly name: "to"; readonly type: "address" }, + { + readonly name: "royaltyRecipient"; + readonly type: "address"; + }, + { readonly name: "royaltyBps"; readonly type: "uint256" }, + { + readonly name: "primarySaleRecipient"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "uri"; readonly type: "string" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { + readonly name: "validityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "validityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "mintRequest"; + readonly type: "tuple"; + }, + ]; + readonly name: "TokensMintedWithSignature"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## totalSupply + + Calls the "totalSupply" function on the contract. + +### Example + +```ts +import { totalSupply } from "thirdweb/extensions/erc1155"; + +const result = await totalSupply({ + contract, + id: ..., +}); +``` + +```ts +function totalSupply( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalSupply function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## transferBatchEvent + + Creates an event object for the TransferBatch event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { transferBatchEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + transferBatchEvent({ + _operator: ..., + _from: ..., + _to: ..., +}) +], +}); +``` + +```ts +function transferBatchEvent( + filters: Partial<{ _from: string; _operator: string; _to: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "_operator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_to"; + readonly type: "address"; + }, + { readonly name: "tokenIds"; readonly type: "uint256[]" }, + { readonly name: "_values"; readonly type: "uint256[]" }, + ]; + readonly name: "TransferBatch"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + _from: string; + _operator: string; + _to: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "_operator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_to"; + readonly type: "address"; + }, + { readonly name: "tokenIds"; readonly type: "uint256[]" }, + { readonly name: "_values"; readonly type: "uint256[]" }, + ]; + readonly name: "TransferBatch"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## transferSingleEvent + + Creates an event object for the TransferSingle event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { transferSingleEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + transferSingleEvent({ + _operator: ..., + _from: ..., + _to: ..., +}) +], +}); +``` + +```ts +function transferSingleEvent( + filters: Partial<{ _from: string; _operator: string; _to: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "_operator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_to"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "_value"; readonly type: "uint256" }, + ]; + readonly name: "TransferSingle"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + _from: string; + _operator: string; + _to: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "_operator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "_to"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "_value"; readonly type: "uint256" }, + ]; + readonly name: "TransferSingle"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## updateMetadata + + Update the metadata of the single token in an Edition Drop (DropERC1155) collection For Edition contracts, use `setTokenURI` + +### Example + +```ts +import { updateMetadata } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; + +const transaction = updateMetadata({ + contract, + targetTokenId: 0n, + client: thirdwebClient, + newMetadata: { + name: "this is the new nft name", + description: "...", + image: "new image uri", + // ... + }, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function updateMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## updateTokenURI + + This function is an abstracted layer of the [setTokenURI extension](https://portal.thirdweb.com/references/typescript/v5/erc1155/setTokenURI) , which means it uses `setTokenURI` under the hood. While the `setTokenURI` method only takes in a uri string, this extension takes in a user-friendly [NFTInput](https://portal.thirdweb.com/references/typescript/v5/NFTInput) , upload that content to IPFS and pass the IPFS URI (of said `NFTInput` ) to the underlying `setTokenURI` method. + + This extension does not validate the NFTInput so make sure you are passing the proper content that you want to update. + +### Example + +```ts +import { updateTokenURI } from "thirdweb/extensions/erc1155"; + +const transaction = updateTokenURI({ + tokenId: 0n, + nft: { + name: "new name", + description: "new description", + image: "https://image-host.com/new-image.png", + }, +}); +``` + +```ts +function updateTokenURI( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction from `setTokenURI` +--- + +## uri + + Calls the "uri" function on the contract. + +### Example + +```ts +import { uri } from "thirdweb/extensions/erc1155"; + +const result = await uri({ + contract, + tokenId: ..., +}); +``` + +```ts +function uri( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the uri function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- +## ERC721 +--- + +## isUpdateMetadataSupported + + Checks if the `updateMetadata` method is supported by the given contract. + +### Example + +```ts +import { isUpdateMetadataSupported } from "thirdweb/extensions/erc721"; + +const supported = isUpdateMetadataSupported(["0x..."]); +``` + +```ts +function isUpdateMetadataSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `updateMetadata` method is supported. +--- + +## isGetClaimConditionsSupported + + Checks if the `getClaimConditions` method is supported by the given contract. + +### Example + +```ts +import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetClaimConditionsSupported(["0x..."]); +``` + +```ts +function isGetClaimConditionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getClaimConditions` method is supported. +--- + +## approvalEvent + + Creates an event object for the Approval event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { approvalEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + approvalEvent({ + owner: ..., + approved: ..., + tokenId: ..., +}) +], +}); +``` + +```ts +function approvalEvent( + filters: Partial<{ + approved: string; + owner: string; + tokenId: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "approved"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenId"; + readonly type: "uint256"; + }, + ]; + readonly name: "Approval"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + approved: string; + owner: string; + tokenId: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "approved"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenId"; + readonly type: "uint256"; + }, + ]; + readonly name: "Approval"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## approvalForAllEvent + + Creates an event object for the ApprovalForAll event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { approvalForAllEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + approvalForAllEvent({ + owner: ..., + operator: ..., +}) +], +}); +``` + +```ts +function approvalForAllEvent( + filters: Partial<{ operator: string; owner: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "operator"; + readonly type: "address"; + }, + { readonly name: "approved"; readonly type: "bool" }, + ]; + readonly name: "ApprovalForAll"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ operator: string; owner: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "operator"; + readonly type: "address"; + }, + { readonly name: "approved"; readonly type: "bool" }, + ]; + readonly name: "ApprovalForAll"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## approve + + Prepares a transaction to call the "approve" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { approve } from "thirdweb/extensions/erc721"; + +const transaction = approve({ + contract, + to: ..., + tokenId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function approve( + options: BaseTransactionOptions< + ApproveParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "approve" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + ApproveParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## balanceOf + + Calls the "balanceOf" function on the contract. + +### Example + +```ts +import { balanceOf } from "thirdweb/extensions/erc721"; + +const result = await balanceOf({ + contract, + owner: ..., +}); +``` + +```ts +function balanceOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the balanceOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## burn + + Prepares a transaction to call the "burn" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { burn } from "thirdweb/extensions/erc721"; + +const transaction = burn({ + contract, + tokenId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function burn( + options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "burn" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## claimConditionsUpdatedEvent + + Creates an event object for the ClaimConditionsUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { claimConditionsUpdatedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ + contract, + events: [claimConditionsUpdatedEvent()], +}); +``` + +```ts +function claimConditionsUpdatedEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly components: readonly [ + { readonly name: "startTimestamp"; readonly type: "uint256" }, + { + readonly name: "maxClaimableSupply"; + readonly type: "uint256"; + }, + { readonly name: "supplyClaimed"; readonly type: "uint256" }, + { + readonly name: "quantityLimitPerWallet"; + readonly type: "uint256"; + }, + { readonly name: "merkleRoot"; readonly type: "bytes32" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "metadata"; readonly type: "string" }, + ]; + readonly name: "claimConditions"; + readonly type: "tuple[]"; + }, + { readonly name: "resetEligibility"; readonly type: "bool" }, + ]; + readonly name: "ClaimConditionsUpdated"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly components: readonly [ + { readonly name: "startTimestamp"; readonly type: "uint256" }, + { + readonly name: "maxClaimableSupply"; + readonly type: "uint256"; + }, + { readonly name: "supplyClaimed"; readonly type: "uint256" }, + { + readonly name: "quantityLimitPerWallet"; + readonly type: "uint256"; + }, + { readonly name: "merkleRoot"; readonly type: "bytes32" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "metadata"; readonly type: "string" }, + ]; + readonly name: "claimConditions"; + readonly type: "tuple[]"; + }, + { readonly name: "resetEligibility"; readonly type: "bool" }, + ]; + readonly name: "ClaimConditionsUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## claimTo + + Claim ERC721 NFTs to a specified address + +### Example + +#### Basic usage + +```ts +import { claimTo } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 1n, +}); + +await sendTransaction({ transaction, account }); +``` + +#### For Drops with allowlists + + You need to specify the claimer address as the `from` param to avoid any issue with the allowlist + +```ts +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 1n, + from: "0x...", // address of the one claiming +}); +``` + +```ts +function claimTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transaction + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves with the submitted transaction hash. +--- + +## claimToBatch + + This extension batches multiple `claimTo` extensions into one single multicall. Keep in mind that there is a limit of how many NFTs you can claim per transaction. This limit varies depends on the network that you are transacting on. + + You are recommended to experiment with the number to figure out the best number for your chain of choice. + +### Example + +```ts +import { claimToBatch } from "thirdweb/extensions/erc721"; + +const transaction = claimToBatch({ + contract: nftDropContract, + from: claimer.address, // address of the one calling this transaction + content: [ + { to: "0x...1", quantity: 1n }, + { to: "0x...2", quantity: 12n }, + { to: "0x...3", quantity: 2n }, + ], +}); +``` + +```ts +function claimToBatch( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + the transaction options + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## createDelayedRevealBatch + + Creates a batch of encrypted NFTs that can be revealed at a later time. + +### Example + +```ts +import { createDelayedRevealBatch } from "thirdweb/extensions/erc721"; + +const placeholderNFT = { + name: "Hidden NFT", + description: "Will be revealed next week!" +}; + +const realNFTs = [{ + name: "Common NFT #1", + description: "Common NFT, one of many.", + image: ipfs://..., +}, { + name: "Super Rare NFT #2", + description: "You got a Super Rare NFT!", + image: ipfs://..., +}]; + +const transaction = createDelayedRevealBatch({ + contract, + placeholderMetadata: placeholderNFT, + metadata: realNFTs, + password: "password123", +}); + +const { transactionHash } = await sendTransaction({ transaction, account }); +``` + +```ts +function createDelayedRevealBatch( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + {CreateDelayedRevealBatchParams} - The delayed reveal options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The prepared transaction to send. +--- + +## generateMintSignature + + Generates the payload and signature for minting an ERC721 token. + +### Example + +```ts +import { + mintWithSignature, + generateMintSignature, +} from "thirdweb/extensions/erc721"; + +const { payload, signature } = await generateMintSignature({ + account, + contract, + mintRequest: { + to: "0x...", + metadata: { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, + }, +}); + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise>; +``` + +### Parameters + + The options for the minting process. + +#### Type + +```ts +let options: GenerateMintSignatureOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to the payload and signature. +--- + +## getActiveClaimCondition + + Retrieves the active claim condition. + +### Example + +```ts +import { getActiveClaimCondition } from "thirdweb/extensions/erc721"; +const activeClaimCondition = await getActiveClaimCondition({ + contract, +}); +``` + +```ts +function getActiveClaimCondition( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the active claim condition. +--- + +## getActiveClaimConditionId + + Calls the "getActiveClaimConditionId" function on the contract. + +### Example + +```ts +import { getActiveClaimConditionId } from "thirdweb/extensions/erc721"; + +const result = await getActiveClaimConditionId({ + contract, +}); +``` + +```ts +function getActiveClaimConditionId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getActiveClaimConditionId function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getAllOwners + + Retrieves the owners of all ERC721 tokens within a specified range. + +### Example + +```ts +import { getAllOwners } from "thirdweb/extensions/erc721"; +const owners = await getAllOwners({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllOwners( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the owners. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to an array of objects containing the token ID and owner address. +--- + +## getBatchesToReveal + + Retrieves the batches available to reveal in an NFT contract. + +### Example + +```ts +import { getBatchesToReveal } from "thirdweb/extensions/erc721"; + +const batches = await getBatchesToReveal({ contract: contract }); + +const { transactionHash } = await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function getBatchesToReveal( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + {BaseTransactionOptions} - The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: { + batchId: bigint; + batchUri: string; + placeholderMetadata: undefined | NFTMetadata; +}; +``` + + A promise resolving to an array of unrevealed batches. + + Use the `batchId` and corresponding password for each batch to reveal it with `reveal` . reveal +--- + +## getClaimConditionById + + Calls the "getClaimConditionById" function on the contract. + +### Example + +```ts +import { getClaimConditionById } from "thirdweb/extensions/erc721"; + +const result = await getClaimConditionById({ + contract, + conditionId: ..., +}); +``` + +```ts +function getClaimConditionById( + options: BaseTransactionOptions, +): Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; +``` + +### Parameters + + The options for the getClaimConditionById function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getClaimConditions + + Retrieves all claim conditions. + +### Example + +```ts +import { getClaimConditions } from "thirdweb/extensions/erc721"; +const conditions = await getClaimConditions({ contract }); +``` + +```ts +function getClaimConditions( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to all claim conditions. +--- + +## getNFT + + Retrieves information about a specific ERC721 non-fungible token (NFT). + +### Example + +```ts +import { getNFT } from "thirdweb/extensions/erc721"; +const nft = await getNFT({ + contract, + tokenId: 1n, +}); +``` + +```ts +function getNFT( + options: BaseTransactionOptions<{ + includeOwner?: boolean; + tokenId: bigint; + }>, +): Promise; +``` + +### Parameters + + The options for retrieving the NFT. + +#### Type + +```ts +let options: BaseTransactionOptions<{ + includeOwner?: boolean; + tokenId: bigint; +}>; +``` + +### Returns + +```ts +let returnType: + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + tokenURI: string; + type: "ERC721"; + } + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + supply: bigint; + tokenURI: string; + type: "ERC1155"; + }; +``` + + A promise that resolves to the NFT object. +--- + +## getNFTs + + Retrieves an array of NFTs ("ERC721") based on the provided options. + +### Example + +```ts +import { getNFTs } from "thirdweb/extensions/erc721"; +const nfts = await getNFTs({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getNFTs( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the NFTs. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + tokenURI: string; + type: "ERC721"; + } + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + supply: bigint; + tokenURI: string; + type: "ERC1155"; + }; +``` + + A promise that resolves to an array of NFTs. +--- + +## getOwnedNFTs + + Retrieves the owned NFTs for a given owner. This extension only works with ERC721 contracts that support the [tokenOfOwnerByIndex](https://portal.thirdweb.com/references/typescript/v5/erc721/tokenOfOwnerByIndex) method + +### Example + +```ts +import { getOwnedNFTs } from "thirdweb/extensions/erc721"; + +const ownedNFTs = await getOwnedNFTs({ + contract, + owner: "0x1234...", +}); +``` + +```ts +function getOwnedNFTs( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the owned NFTs. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + tokenURI: string; + type: "ERC721"; + } + | { + id: bigint; + metadata: NFTMetadata; + owner: string | null; + supply: bigint; + tokenURI: string; + type: "ERC1155"; + }; +``` + + A promise that resolves to an array of NFTs owned by the specified owner. +--- + +## getOwnedTokenIds + + Retrieves the token IDs owned by a specific address. + +### Example + +```ts +import { getOwnedTokenIds } from "thirdweb/extensions/erc721"; + +const ownedTokenIds = await getOwnedTokenIds({ + contract, + owner: "0x1234...", +}); +``` + +```ts +function getOwnedTokenIds( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the owned token IDs. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to an array of bigint representing the owned token IDs. +--- + +## getTotalClaimedSupply + + Retrieves the total claimed supply of ERC721 tokens. + +### Example + +```ts +import { getTotalClaimedSupply } from "thirdweb/extensions/erc721"; + +const totalClaimedSupply = await getTotalClaimedSupply({ + contract, +}); +``` + +```ts +function getTotalClaimedSupply( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The base transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the total claimed supply as a bigint. +--- + +## getTotalUnclaimedSupply + + Retrieves the total unclaimed supply of ERC721 tokens. + +### Example + +```ts +import { getTotalUnclaimedSupply } from "thirdweb/extensions/erc721"; + +const totalUnclaimedSupply = await getTotalUnclaimedSupply({ + contract, +}); +``` + +```ts +function getTotalUnclaimedSupply( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The base transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the total unclaimed supply as a bigint. +--- + +## isApprovedForAll + + Calls the "isApprovedForAll" function on the contract. + +### Example + +```ts +import { isApprovedForAll } from "thirdweb/extensions/erc721"; + +const result = await isApprovedForAll({ + contract, + owner: ..., + operator: ..., +}); +``` + +```ts +function isApprovedForAll( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isApprovedForAll function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isBurnSupported + + Checks if the `burn` method is supported by the given contract. + +### Example + +```ts +import { isBurnSupported } from "thirdweb/extensions/erc721"; + +const supported = isBurnSupported(["0x..."]); +``` + +```ts +function isBurnSupported(availableSelectors: Array): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `burn` method is supported. +--- + +## isClaimToSupported + + Checks if the `claimTo` method is supported by the given contract. + +### Example + +```ts +import { isClaimToSupported } from "thirdweb/extensions/erc721"; + +const supported = isClaimToSupported(["0x..."]); +``` + +```ts +function isClaimToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `claimTo` method is supported. +--- + +## isCreateDelayedRevealBatchSupported + + Checks if the `createDelayedRevealBatch` method is supported by the given contract. + +### Example + +```ts +import { isCreateDelayedRevealBatchSupported } from "thirdweb/extensions/erc721"; +const supported = isCreateDelayedRevealBatchSupported(["0x..."]); +``` + +```ts +function isCreateDelayedRevealBatchSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `createDelayedRevealBatch` method is supported. +--- + +## isERC721 + + Check if a contract supports the ERC721 interface. + +### Example + +```ts +import { isERC721 } from "thirdweb/extensions/erc721"; +const result = await isERC721({ contract }); +``` + +```ts +function isERC721(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A boolean indicating whether the contract supports the ERC721 interface. +--- + +## isGetActiveClaimConditionIdSupported + + Checks if the `getActiveClaimConditionId` method is supported by the given contract. + +### Example + +```ts +import { isGetActiveClaimConditionIdSupported } from "thirdweb/extensions/erc721"; +const supported = isGetActiveClaimConditionIdSupported(["0x..."]); +``` + +```ts +function isGetActiveClaimConditionIdSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getActiveClaimConditionId` method is supported. +--- + +## isGetActiveClaimConditionSupported + + Checks if the `getActiveClaimCondition` method is supported by the given contract. + +### Example + +```ts +import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetActiveClaimConditionSupported(["0x..."]); +``` + +```ts +function isGetActiveClaimConditionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getActiveClaimCondition` method is supported. +--- + +## isGetBatchesToRevealSupported + + Checks if the `getBatchesToReveal` method is supported by the given contract. + +### Example + +```ts +import { isGetBatchesToRevealSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetBatchesToRevealSupported(["0x..."]); +``` + +```ts +function isGetBatchesToRevealSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getBatchesToReveal` method is supported. +--- + +## isGetClaimConditionByIdSupported + + Checks if the `getClaimConditionById` method is supported by the given contract. + +### Example + +```ts +import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc721"; +const supported = isGetClaimConditionByIdSupported(["0x..."]); +``` + +```ts +function isGetClaimConditionByIdSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getClaimConditionById` method is supported. +--- + +## isGetClaimConditionsSupported + + Checks if the `getClaimConditions` method is supported by the given contract. + +### Example + +```ts +import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetClaimConditionsSupported(["0x..."]); +``` + +```ts +function isGetClaimConditionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getClaimConditions` method is supported. +--- + +## isGetNFTsSupported + + Checks if the `getNFTs` method is supported by the given contract. + +### Example + +```ts +import { isGetNFTsSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetNFTsSupported(["0x..."]); +``` + +```ts +function isGetNFTsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getNFTs` method is supported. +--- + +## isGetNFTSupported + + Checks if the `tokenURI` method is supported by the given contract. + +### Example + +```ts +import { isTokenURISupported } from "thirdweb/extensions/erc721"; +const supported = isTokenURISupported(["0x..."]); +``` + +```ts +function isGetNFTSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `tokenURI` method is supported. +--- + +## isLazyMintSupported + + Checks if the `lazyMint` method is supported by the given contract. + +### Example + +```ts +import { isLazyMintSupported } from "thirdweb/extensions/erc721"; + +const supported = isLazyMintSupported(["0x..."]); +``` + +```ts +function isLazyMintSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `lazyMint` method is supported. +--- + +## isMintToSupported + + Checks if the `mintTo` method is supported by the given contract. + +### Example + +```ts +import { isMintToSupported } from "thirdweb/extensions/erc721"; + +const supported = isMintToSupported(["0x..."]); +``` + +```ts +function isMintToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `mintTo` method is supported. +--- + +## isNextTokenIdToMintSupported + + Checks if the `nextTokenIdToMint` method is supported by the given contract. + +### Example + +```ts +import { isNextTokenIdToMintSupported } from "thirdweb/extensions/erc721"; +const supported = isNextTokenIdToMintSupported(["0x..."]); +``` + +```ts +function isNextTokenIdToMintSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `nextTokenIdToMint` method is supported. +--- + +## isResetClaimEligibilitySupported + + Checks if the `resetClaimEligibility` method is supported by the given contract. + +### Example + +```ts +import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc721"; + +const supported = isResetClaimEligibilitySupported(["0x..."]); +``` + +```ts +function isResetClaimEligibilitySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `resetClaimEligibility` method is supported. +--- + +## isRevealSupported + + Checks if the `reveal` method is supported by the given contract. + +### Example + +```ts +import { isRevealSupported } from "thirdweb/extensions/erc721"; + +const supported = isRevealSupported(["0x..."]); +``` + +```ts +function isRevealSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `reveal` method is supported. +--- + +## isSetClaimConditionsSupported + + Checks if the `setClaimConditions` method is supported by the given contract. + +### Example + +```ts +import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc721"; + +const supported = isSetClaimConditionsSupported(["0x..."]); +``` + +```ts +function isSetClaimConditionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setClaimConditions` method is supported. +--- + +## isSetSharedMetadataSupported + + Checks if the `setSharedMetadata` method is supported by the given contract. + +### Example + +```ts +import { isSetSharedMetadataSupported } from "thirdweb/extensions/erc721"; + +const supported = isSetSharedMetadataSupported(["0x..."]); +``` + +```ts +function isSetSharedMetadataSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setSharedMetadata` method is supported. +--- + +## isSharedMetadataSupported + + Checks if the `sharedMetadata` method is supported by the given contract. + +### Example + +```ts +import { isSharedMetadataSupported } from "thirdweb/extensions/erc721"; +const supported = isSharedMetadataSupported(["0x..."]); +``` + +```ts +function isSharedMetadataSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `sharedMetadata` method is supported. +--- + +## isTotalSupplySupported + + Checks if the `totalSupply` method is supported by the given contract. + +### Example + +```ts +import { isTotalSupplySupported } from "thirdweb/extensions/erc721"; +const supported = isTotalSupplySupported(["0x..."]); +``` + +```ts +function isTotalSupplySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `totalSupply` method is supported. +--- + +## isUpdateMetadataSupported + + Checks if the `updateMetadata` method is supported by the given contract. + +### Example + +```ts +import { isUpdateMetadataSupported } from "thirdweb/extensions/erc721"; + +const supported = isUpdateMetadataSupported(["0x..."]); +``` + +```ts +function isUpdateMetadataSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `updateMetadata` method is supported. +--- + +## isUpdateTokenURISupported + + Checks if the `setTokenURI` method is supported by the given contract. + +### Example + +```ts +import { isSetTokenURISupported } from "thirdweb/extensions/erc721"; + +const supported = isSetTokenURISupported(["0x..."]); +``` + +```ts +function isUpdateTokenURISupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setTokenURI` method is supported. +--- + +## lazyMint + + Lazily mints ERC721 tokens. + +### Example + +```ts +import { lazyMint } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const transaction = lazyMint({ + contract, + nfts: [ + { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, + ], +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function lazyMint( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the lazy minting process. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the prepared contract call. +--- + +## mintTo + + Mints a new ERC721 token and assigns it to the specified address. If the `nft` parameter is a string, it will be used as the token URI. If the `nft` parameter is a file, it will be uploaded to the storage server and the resulting URI will be used as the token URI. + +### Example + +```ts +import { mintTo } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const transaction = mintTo({ + contract, + to: "0x...", + nft: { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## mintWithSignature + + Mints a new ERC721 token with the given minter signature + +### Example + +```ts +import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const { payload, signature } = await generateMintSignature(...) + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithSignature( + options: BaseTransactionOptions< + | { + payload: { + currency: string; + pricePerToken: bigint; + primarySaleRecipient: string; + quantity: bigint; + royaltyBps: bigint; + royaltyRecipient: string; + to: string; + uid: `0x${string}`; + uri: string; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; + } + | { + payload: { + currency: string; + price: bigint; + primarySaleRecipient: string; + royaltyBps: bigint; + royaltyRecipient: string; + to: string; + uid: `0x${string}`; + uri: string; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; + } + >, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions< + | { + payload: { + currency: string; + pricePerToken: bigint; + primarySaleRecipient: string; + quantity: bigint; + royaltyBps: bigint; + royaltyRecipient: string; + to: string; + uid: `0x${string}`; + uri: string; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; + } + | { + payload: { + currency: string; + price: bigint; + primarySaleRecipient: string; + royaltyBps: bigint; + royaltyRecipient: string; + to: string; + uid: `0x${string}`; + uri: string; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; + } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## nextTokenIdToMint + + Calls the "nextTokenIdToMint" function on the contract. + +### Example + +```ts +import { nextTokenIdToMint } from "thirdweb/extensions/erc721"; + +const result = await nextTokenIdToMint({ + contract, +}); +``` + +```ts +function nextTokenIdToMint( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the nextTokenIdToMint function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## ownerOf + + Calls the "ownerOf" function on the contract. + +### Example + +```ts +import { ownerOf } from "thirdweb/extensions/erc721"; + +const result = await ownerOf({ + contract, + tokenId: ..., +}); +``` + +```ts +function ownerOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the ownerOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## resetClaimEligibility + + Reset the claim eligibility for all users. + +### Example + +```ts +import { resetClaimEligibility } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const transaction = resetClaimEligibility({ + contract, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function resetClaimEligibility( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## reveal + + Reveals a previously lazy minted batch of NFTs. + +### Example + +```ts +import { reveal } from "thirdweb/extensions/erc721"; + +const transaction = await reveal({ + contract: contract, + batchId: 0, + password: "password", +}); + +const { transactionHash } = await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function reveal( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + {RevealParams} - The reveal parameters. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The prepared transaction to send. +--- + +## setApprovalForAll + + Prepares a transaction to call the "setApprovalForAll" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setApprovalForAll } from "thirdweb/extensions/erc721"; + +const transaction = setApprovalForAll({ + contract, + operator: ..., + approved: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setApprovalForAll( + options: BaseTransactionOptions< + | SetApprovalForAllParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setApprovalForAll" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetApprovalForAllParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setClaimConditions + + Set the claim conditions for a ERC721 drop + +### Example + +```ts +import { setClaimConditions } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const transaction = setClaimConditions({ + contract, + phases: [ + { + maxClaimableSupply: 100n, + maxClaimablePerWallet: 1n, + currencyAddress: "0x...", + price: 0.1, + startTime: new Date(), + }, + ], +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function setClaimConditions( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## setSharedMetadata + + Sets the shared metadata for a OpenEdition contract. + +```ts +function setSharedMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The prepared transaction. +--- + +## setTokenURI + + Prepares a transaction to call the "setTokenURI" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setTokenURI } from "thirdweb/extensions/erc721"; + +const transaction = setTokenURI({ + contract, + tokenId: ..., + uri: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTokenURI( + options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTokenURI" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## sharedMetadata + + Calls the "sharedMetadata" function on the contract. + +### Example + +```ts +import { sharedMetadata } from "thirdweb/extensions/erc721"; + +const result = await sharedMetadata({ + contract, +}); +``` + +```ts +function sharedMetadata( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the sharedMetadata function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## sharedMetadataUpdatedEvent + + Creates an event object for the SharedMetadataUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { sharedMetadataUpdatedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ + contract, + events: [sharedMetadataUpdatedEvent()], +}); +``` + +```ts +function sharedMetadataUpdatedEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "name"; readonly type: "string" }, + { readonly name: "description"; readonly type: "string" }, + { readonly name: "imageURI"; readonly type: "string" }, + { readonly name: "animationURI"; readonly type: "string" }, + ]; + readonly name: "SharedMetadataUpdated"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "name"; readonly type: "string" }, + { readonly name: "description"; readonly type: "string" }, + { readonly name: "imageURI"; readonly type: "string" }, + { readonly name: "animationURI"; readonly type: "string" }, + ]; + readonly name: "SharedMetadataUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## startTokenId + + Calls the "startTokenId" function on the contract. + +### Example + +```ts +import { startTokenId } from "thirdweb/extensions/erc721"; + +const result = await startTokenId({ + contract, +}); +``` + +```ts +function startTokenId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the startTokenId function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## tokenOfOwnerByIndex + + Calls the "tokenOfOwnerByIndex" function on the contract. + +### Example + +```ts +import { tokenOfOwnerByIndex } from "thirdweb/extensions/erc721"; + +const result = await tokenOfOwnerByIndex({ + contract, + owner: ..., + index: ..., +}); +``` + +```ts +function tokenOfOwnerByIndex( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the tokenOfOwnerByIndex function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## tokensClaimedEvent + + Creates an event object for the TokensClaimed event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensClaimedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + tokensClaimedEvent({ + claimConditionIndex: ..., + claimer: ..., + receiver: ..., +}) +], +}); +``` + +```ts +function tokensClaimedEvent( + filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "claimConditionIndex"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "claimer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { readonly name: "startTokenId"; readonly type: "uint256" }, + { readonly name: "quantityClaimed"; readonly type: "uint256" }, + ]; + readonly name: "TokensClaimed"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "claimConditionIndex"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "claimer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { readonly name: "startTokenId"; readonly type: "uint256" }, + { readonly name: "quantityClaimed"; readonly type: "uint256" }, + ]; + readonly name: "TokensClaimed"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensLazyMintedEvent + + Creates an event object for the TokensLazyMinted event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensLazyMintedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + tokensLazyMintedEvent({ + startTokenId: ..., +}) +], +}); +``` + +```ts +function tokensLazyMintedEvent( + filters: Partial<{ startTokenId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "startTokenId"; + readonly type: "uint256"; + }, + { readonly name: "endTokenId"; readonly type: "uint256" }, + { readonly name: "baseURI"; readonly type: "string" }, + { readonly name: "encryptedBaseURI"; readonly type: "bytes" }, + ]; + readonly name: "TokensLazyMinted"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ startTokenId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "startTokenId"; + readonly type: "uint256"; + }, + { readonly name: "endTokenId"; readonly type: "uint256" }, + { readonly name: "baseURI"; readonly type: "string" }, + { readonly name: "encryptedBaseURI"; readonly type: "bytes" }, + ]; + readonly name: "TokensLazyMinted"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensMintedWithSignatureEvent + + Creates an event object for the TokensMintedWithSignature event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + tokensMintedWithSignatureEvent({ + signer: ..., + mintedTo: ..., + tokenIdMinted: ..., +}) +], +}); +``` + +```ts +function tokensMintedWithSignatureEvent( + filters: Partial<{ + mintedTo: string; + signer: string; + tokenIdMinted: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenIdMinted"; + readonly type: "uint256"; + }, + { + readonly components: readonly [ + { readonly name: "to"; readonly type: "address" }, + { + readonly name: "royaltyRecipient"; + readonly type: "address"; + }, + { readonly name: "royaltyBps"; readonly type: "uint256" }, + { + readonly name: "primarySaleRecipient"; + readonly type: "address"; + }, + { readonly name: "uri"; readonly type: "string" }, + { readonly name: "price"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { + readonly name: "validityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "validityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "mintpayload"; + readonly type: "tuple"; + }, + ]; + readonly name: "TokensMintedWithSignature"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + mintedTo: string; + signer: string; + tokenIdMinted: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenIdMinted"; + readonly type: "uint256"; + }, + { + readonly components: readonly [ + { readonly name: "to"; readonly type: "address" }, + { + readonly name: "royaltyRecipient"; + readonly type: "address"; + }, + { readonly name: "royaltyBps"; readonly type: "uint256" }, + { + readonly name: "primarySaleRecipient"; + readonly type: "address"; + }, + { readonly name: "uri"; readonly type: "string" }, + { readonly name: "price"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { + readonly name: "validityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "validityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "mintpayload"; + readonly type: "tuple"; + }, + ]; + readonly name: "TokensMintedWithSignature"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensOfOwner + + Calls the "tokensOfOwner" function on the contract. + +### Example + +```ts +import { tokensOfOwner } from "thirdweb/extensions/erc721"; + +const result = await tokensOfOwner({ + contract, + owner: ..., +}); +``` + +```ts +function tokensOfOwner(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the tokensOfOwner function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## tokenURI + + Calls the "tokenURI" function on the contract. + +### Example + +```ts +import { tokenURI } from "thirdweb/extensions/erc721"; + +const result = await tokenURI({ + contract, + tokenId: ..., +}); +``` + +```ts +function tokenURI( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the tokenURI function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## tokenURIRevealedEvent + + Creates an event object for the TokenURIRevealed event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokenURIRevealedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + tokenURIRevealedEvent({ + index: ..., +}) +], +}); +``` + +```ts +function tokenURIRevealedEvent( + filters: Partial<{ index: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "index"; + readonly type: "uint256"; + }, + { readonly name: "revealedURI"; readonly type: "string" }, + ]; + readonly name: "TokenURIRevealed"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ index: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "index"; + readonly type: "uint256"; + }, + { readonly name: "revealedURI"; readonly type: "string" }, + ]; + readonly name: "TokenURIRevealed"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## totalSupply + + Calls the "totalSupply" function on the contract. + +### Example + +```ts +import { totalSupply } from "thirdweb/extensions/erc721"; + +const result = await totalSupply({ + contract, +}); +``` + +```ts +function totalSupply( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalSupply function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## transferEvent + + Creates an event object for the Transfer event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { transferEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + transferEvent({ + from: ..., + to: ..., + tokenId: ..., +}) +], +}); +``` + +```ts +function transferEvent( + filters: Partial<{ from: string; to: string; tokenId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenId"; + readonly type: "uint256"; + }, + ]; + readonly name: "Transfer"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ from: string; to: string; tokenId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "tokenId"; + readonly type: "uint256"; + }, + ]; + readonly name: "Transfer"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## transferFrom + + Prepares a transaction to call the "transferFrom" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { transferFrom } from "thirdweb/extensions/erc721"; + +const transaction = transferFrom({ + contract, + from: ..., + to: ..., + tokenId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function transferFrom( + options: BaseTransactionOptions< + | TransferFromParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "transferFrom" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | TransferFromParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## updateMetadata + + Update the metadata of the single token in an NFT Drop (DropERC721) collection For NFT Collection, please use `setTokenURI` + +### Example + +```ts +import { updateMetadata } from "thirdweb/extensions/erc721"; + +const transaction = updateMetadata({ + contract, + targetTokenId: 0n, + client: thirdwebClient, + newMetadata: { + name: "this is the new nft name", + description: "...", + image: "new image uri", + // ... + }, +}); +``` + +```ts +function updateMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## updateTokenURI + + This function is an abstracted layer of the [setTokenURI extension](https://portal.thirdweb.com/references/typescript/v5/erc721/setTokenURI) , which means it uses `setTokenURI` under the hood. While the `setTokenURI` method only takes in a uri string, this extension takes in a user-friendly [NFTInput](https://portal.thirdweb.com/references/typescript/v5/NFTInput) , upload that content to IPFS and pass the IPFS URI (of said `NFTInput` ) to the underlying `setTokenURI` method. + + This extension does not validate the NFTInput so make sure you are passing the proper content that you want to update. + +### Example + +```ts +import { updateTokenURI } from "thirdweb/extensions/erc721"; + +const transaction = updateTokenURI({ + tokenId: 0n, + nft: { + name: "new name", + description: "new description", + image: "https://image-host.com/new-image.png", + }, +}); +``` + +```ts +function updateTokenURI( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction from `setTokenURI` +--- +## ERC1271 +--- + +## checkContractWalletSignature + +Deprecated + + Use `verifySignature` instead + + Checks if a contract wallet signature is valid. + +### Example + +```ts +import { checkContractWalletSignature } from "thirdweb/extensions/erc1271"; +const isValid = await checkContractWalletSignature({ + contract: myContract, + message: "hello world", + signature: "0x...", +}); +``` + +```ts +function checkContractWalletSignature( + options: CheckContractWalletSignatureOptions, +): Promise; +``` + +### Parameters + + The options for the checkContractWalletSignature function. + +#### Type + +```ts +let options: { + contract: ThirdwebContract; + message: SignableMessage; + signature: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves with a boolean indicating if the signature is valid. +--- + +## checkContractWalletSignedTypedData + +Deprecated + + Use `verifyTypedData` instead + + Checks if a contract wallet signature is valid. + +### Example + +```ts +import { checkContractWalletSignedTypedData } from "thirdweb/extensions/erc1271"; +const isValid = await checkContractWalletSignedTypedData({ + contract: myContract, + data: { + primaryType: "EIP712Domain", + domain: { + name: "Example", + version: "1", + chainId: 1, + verifyingContract: myContract.address, + }, +}); +``` + +```ts +function checkContractWalletSignedTypedData( + options: CheckContractWalletSignTypedDataOptions< + typedData, + primaryType + >, +): Promise; +``` + +### Parameters + + The options for the checkContractWalletSignature function. + +#### Type + +```ts +let options: CheckContractWalletSignTypedDataOptions< + typedData, + primaryType +>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves with a boolean indicating if the signature is valid. +--- +## ERC20 +--- + +## allowance + + Calls the "allowance" function on the contract. + +### Example + +```ts +import { allowance } from "thirdweb/extensions/erc20"; + +const result = await allowance({ + contract, + owner: ..., + spender: ..., +}); +``` + +```ts +function allowance( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the allowance function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## approvalEvent + + Creates an event object for the Approval event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { approvalEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ +contract, +events: [ + approvalEvent({ + owner: ..., + spender: ..., +}) +], +}); +``` + +```ts +function approvalEvent( + filters: Partial<{ owner: string; spender: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "spender"; + readonly type: "address"; + }, + { readonly name: "value"; readonly type: "uint256" }, + ]; + readonly name: "Approval"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ owner: string; spender: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "spender"; + readonly type: "address"; + }, + { readonly name: "value"; readonly type: "uint256" }, + ]; + readonly name: "Approval"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## approve + + Approves the spending of tokens by a specific address. + +### Example + +```ts +import { approve } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = await approve({ + contract, + spender: "0x...", + amount: 100, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function approve( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## balanceOf + + Calls the "balanceOf" function on the contract. + +### Example + +```ts +import { balanceOf } from "thirdweb/extensions/erc20"; + +const result = await balanceOf({ + contract, + address: ..., +}); +``` + +```ts +function balanceOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the balanceOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## burn + + Prepares a transaction to call the "burn" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { burn } from "thirdweb/extensions/erc20"; + +const transaction = burn({ + contract, + amount: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function burn( + options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "burn" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## burnFrom + + Prepares a transaction to call the "burnFrom" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { burnFrom } from "thirdweb/extensions/erc20"; + +const transaction = burnFrom({ + contract, + account: ..., + amount: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function burnFrom( + options: BaseTransactionOptions< + BurnFromParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "burnFrom" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + BurnFromParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## claimConditionsUpdatedEvent + + Creates an event object for the ClaimConditionsUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { claimConditionsUpdatedEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ + contract, + events: [claimConditionsUpdatedEvent()], +}); +``` + +```ts +function claimConditionsUpdatedEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly components: readonly [ + { readonly name: "startTimestamp"; readonly type: "uint256" }, + { + readonly name: "maxClaimableSupply"; + readonly type: "uint256"; + }, + { readonly name: "supplyClaimed"; readonly type: "uint256" }, + { + readonly name: "quantityLimitPerWallet"; + readonly type: "uint256"; + }, + { readonly name: "merkleRoot"; readonly type: "bytes32" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "metadata"; readonly type: "string" }, + ]; + readonly name: "claimConditions"; + readonly type: "tuple[]"; + }, + { readonly name: "resetEligibility"; readonly type: "bool" }, + ]; + readonly name: "ClaimConditionsUpdated"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly components: readonly [ + { readonly name: "startTimestamp"; readonly type: "uint256" }, + { + readonly name: "maxClaimableSupply"; + readonly type: "uint256"; + }, + { readonly name: "supplyClaimed"; readonly type: "uint256" }, + { + readonly name: "quantityLimitPerWallet"; + readonly type: "uint256"; + }, + { readonly name: "merkleRoot"; readonly type: "bytes32" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "metadata"; readonly type: "string" }, + ]; + readonly name: "claimConditions"; + readonly type: "tuple[]"; + }, + { readonly name: "resetEligibility"; readonly type: "bool" }, + ]; + readonly name: "ClaimConditionsUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## claimTo + + Claim ERC20 NFTs to a specified address + +### Example + +#### Basic usage + +```ts +import { claimTo } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 100n, +}); + +await sendTransaction({ transaction, account }); +``` + +#### For Drops with allowlists + + You need to specify the claimer address as the `from` param to avoid any issue with the allowlist + +```ts +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 100n, + from: "0x...", // address of the one claiming +}); +``` + +```ts +function claimTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transaction + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves with the submitted transaction hash. +--- + +## decimals + + Retrieves the number of decimal places for a given ERC20 contract. + +### Example + +```ts +import { decimals } from "thirdweb/extensions/erc20"; + +const tokenDecimals = await decimals({ contract }); +``` + +```ts +function decimals(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the number of decimal places. +--- + +## delegate + + Prepares a transaction to call the "delegate" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { delegate } from "thirdweb/extensions/erc20"; + +const transaction = delegate({ + contract, + delegatee: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function delegate( + options: BaseTransactionOptions< + DelegateParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "delegate" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + DelegateParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## delegates + + Calls the "delegates" function on the contract. + +### Example + +```ts +import { delegates } from "thirdweb/extensions/erc20"; + +const result = await delegates({ + contract, + account: ..., +}); +``` + +```ts +function delegates( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the delegates function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## deposit + + Calls the "deposit" function on the contract (useful to wrap ETH). + +### Example + +```ts +import { deposit } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = deposit({ contract, amount: "0.1" }); + +await sendTransaction({ transaction, account }); +``` + +```ts +function deposit( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the "deposit" function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## generateMintSignature + + Generates the payload and signature for minting an ERC20 token. + +### Example + +```ts +import { + mintWithSignature, + generateMintSignature, +} from "thirdweb/extensions/erc20"; + +const { payload, signature } = await generateMintSignature({ + account, + contract, + mintRequest: { + to: "0x...", + quantity: "10", + }, +}); + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise<{ + payload: { + currency: string; + price: bigint; + primarySaleRecipient: string; + quantity: bigint; + to: string; + uid: `0x${string}`; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; +}>; +``` + +### Parameters + + The options for the minting process. + +#### Type + +```ts +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ + payload: { + currency: string; + price: bigint; + primarySaleRecipient: string; + quantity: bigint; + to: string; + uid: `0x${string}`; + validityEndTimestamp: bigint; + validityStartTimestamp: bigint; + }; + signature: `0x${string}`; +}>; +``` + + A promise that resolves to the payload and signature. +--- + +## getActiveClaimCondition + + Retrieves the active claim condition. + +### Example + +```ts +import { getActiveClaimCondition } from "thirdweb/extensions/erc20"; +const activeClaimCondition = await getActiveClaimCondition({ + contract, +}); +``` + +```ts +function getActiveClaimCondition( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the active claim condition. +--- + +## getActiveClaimConditionId + + Calls the "getActiveClaimConditionId" function on the contract. + +### Example + +```ts +import { getActiveClaimConditionId } from "thirdweb/extensions/erc20"; + +const result = await getActiveClaimConditionId({ + contract, +}); +``` + +```ts +function getActiveClaimConditionId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getActiveClaimConditionId function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getBalance + + Retrieves the balance of an ERC20 token for a specific address. + +### Example + +```ts +import { getBalance } from "thirdweb/extensions/erc20"; + +const balance = await getBalance({ contract, address: "0x..." }); +``` + +```ts +function getBalance( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The transaction options including the address. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + decimals: number; + displayValue: string; + name: string; + symbol: string; + value: bigint; +}; +``` + + An object containing the balance value, display value, and symbol. +--- + +## getClaimConditionById + + Calls the "getClaimConditionById" function on the contract. + +### Example + +```ts +import { getClaimConditionById } from "thirdweb/extensions/erc20"; + +const result = await getClaimConditionById({ + contract, + conditionId: ..., +}); +``` + +```ts +function getClaimConditionById( + options: BaseTransactionOptions, +): Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; +``` + +### Parameters + + The options for the getClaimConditionById function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getClaimConditions + + Retrieves all claim conditions. + +### Example + +```ts +import { getClaimConditions } from "thirdweb/extensions/erc20"; +const conditions = await getClaimConditions({ contract }); +``` + +```ts +function getClaimConditions( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to all claim conditions. +--- + +## getCurrencyMetadata + + Retrieves the metadata of a currency. + +### Example + +```ts +import { getCurrencyMetadata } from "thirdweb/extensions/erc20"; + +const currencyMetadata = await getCurrencyMetadata({ contract }); +``` + +```ts +function getCurrencyMetadata( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: { decimals: number; name: string; symbol: string }; +``` + + A promise that resolves to an object containing the currency metadata. +--- + +## isClaimToSupported + + Checks if the `claimTo` method is supported by the given contract. + +### Example + +```ts +import { isClaimToSupported } from "thirdweb/extensions/erc20"; + +const supported = isClaimToSupported(["0x..."]); +``` + +```ts +function isClaimToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `claimTo` method is supported. +--- + +## isERC20 + + Check if a contract is an ERC20 token. + +### Example + +```ts +import { isERC20 } from "thirdweb/extensions/erc20"; +import { resolveContractAbi } from "thirdweb/contract"; + +const abi = await resolveContractAbi(contract); +const selectors = abi + .filter((f) => f.type === "function") + .map((f) => toFunctionSelector(f)); + +const result = await isERC20(selectors); +``` + +```ts +function isERC20(availableSelectors: Array): boolean; +``` + +### Parameters + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating whether the contract is an ERC20 token. +--- + +## isGetActiveClaimConditionIdSupported + + Checks if the `getActiveClaimConditionId` method is supported by the given contract. + +### Example + +```ts +import { isGetActiveClaimConditionIdSupported } from "thirdweb/extensions/erc20"; +const supported = isGetActiveClaimConditionIdSupported(["0x..."]); +``` + +```ts +function isGetActiveClaimConditionIdSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getActiveClaimConditionId` method is supported. +--- + +## isGetActiveClaimConditionSupported + + Checks if the `getActiveClaimCondition` method is supported by the given contract. + +### Example + +```ts +import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc20"; + +const supported = isGetActiveClaimConditionSupported(["0x..."]); +``` + +```ts +function isGetActiveClaimConditionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getActiveClaimCondition` method is supported. +--- + +## isGetClaimConditionByIdSupported + + Checks if the `getClaimConditionById` method is supported by the given contract. + +### Example + +```ts +import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc20"; +const supported = isGetClaimConditionByIdSupported(["0x..."]); +``` + +```ts +function isGetClaimConditionByIdSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getClaimConditionById` method is supported. +--- + +## isMintToSupported + + Checks if the `mintTo` method is supported by the given contract. + +### Example + +```ts +import { isMintToSupported } from "thirdweb/extensions/erc20"; + +const supported = isMintToSupported(["0x..."]); +``` + +```ts +function isMintToSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `mintTo` method is supported. +--- + +## isResetClaimEligibilitySupported + + Checks if the `resetClaimEligibility` method is supported by the given contract. + +### Example + +```ts +import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc20"; + +const supported = isResetClaimEligibilitySupported(["0x..."]); +``` + +```ts +function isResetClaimEligibilitySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `resetClaimEligibility` method is supported. +--- + +## isSetClaimConditionsSupported + + Checks if the `setClaimConditions` method is supported by the given contract. + +### Example + +```ts +import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc20"; + +const supported = isSetClaimConditionsSupported(["0x..."]); +``` + +```ts +function isSetClaimConditionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `setClaimConditions` method is supported. +--- + +## mintTo + + Mints a specified amount of tokens to a given address. + +### Example + +```ts +import { mintTo } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = mintTo({ + contract, + to: "0x...", + amount: 100, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintTo( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## mintWithSignature + + Mints a new ERC20 token with the given minter signature + +### Example + +```ts +import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const { payload, signature } = await generateMintSignature(...) + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithSignature( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## resetClaimEligibility + + Reset the claim eligibility for all users. + +### Example + +```ts +import { resetClaimEligibility } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = resetClaimEligibility({ + contract, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function resetClaimEligibility( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## setClaimConditions + + Set the claim conditions for a ERC20 drop + +### Example + +```ts +import { setClaimConditions } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = setClaimConditions({ + contract, + phases: [ + { + maxClaimableSupply: 100n, + maxClaimablePerWallet: 1n, + currencyAddress: "0x...", + price: 0.1, + startTime: new Date(), + }, + ], +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function setClaimConditions( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + the prepared transaction +--- + +## tokensClaimedEvent + + Creates an event object for the TokensClaimed event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensClaimedEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ +contract, +events: [ + tokensClaimedEvent({ + claimConditionIndex: ..., + claimer: ..., + receiver: ..., +}) +], +}); +``` + +```ts +function tokensClaimedEvent( + filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "claimConditionIndex"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "claimer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { readonly name: "quantityClaimed"; readonly type: "uint256" }, + ]; + readonly name: "TokensClaimed"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "claimConditionIndex"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "claimer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { readonly name: "quantityClaimed"; readonly type: "uint256" }, + ]; + readonly name: "TokensClaimed"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensMintedEvent + + Creates an event object for the TokensMinted event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensMintedEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ +contract, +events: [ + tokensMintedEvent({ + mintedTo: ..., +}) +], +}); +``` + +```ts +function tokensMintedEvent( + filters: Partial<{ mintedTo: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { readonly name: "quantityMinted"; readonly type: "uint256" }, + ]; + readonly name: "TokensMinted"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ mintedTo: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { readonly name: "quantityMinted"; readonly type: "uint256" }, + ]; + readonly name: "TokensMinted"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## tokensMintedWithSignatureEvent + + Creates an event object for the TokensMintedWithSignature event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ +contract, +events: [ + tokensMintedWithSignatureEvent({ + signer: ..., + mintedTo: ..., +}) +], +}); +``` + +```ts +function tokensMintedWithSignatureEvent( + filters: Partial<{ mintedTo: string; signer: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "to"; readonly type: "address" }, + { + readonly name: "primarySaleRecipient"; + readonly type: "address"; + }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "price"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { + readonly name: "validityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "validityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "mintRequest"; + readonly type: "tuple"; + }, + ]; + readonly name: "TokensMintedWithSignature"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ mintedTo: string; signer: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "mintedTo"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "to"; readonly type: "address" }, + { + readonly name: "primarySaleRecipient"; + readonly type: "address"; + }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "price"; readonly type: "uint256" }, + { readonly name: "currency"; readonly type: "address" }, + { + readonly name: "validityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "validityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "mintRequest"; + readonly type: "tuple"; + }, + ]; + readonly name: "TokensMintedWithSignature"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## totalSupply + + Calls the "totalSupply" function on the contract. + +### Example + +```ts +import { totalSupply } from "thirdweb/extensions/erc20"; + +const result = await totalSupply({ + contract, +}); +``` + +```ts +function totalSupply( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalSupply function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## transfer + + Transfers ERC20 tokens from the sender's address to the specified recipient address. + +### Example + +```ts +import { transfer } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = transfer({ + contract, + to: "0x...", + amount: 100, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function transfer( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transfer transaction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the prepared transaction. +--- + +## transferBatch + + Transfers a batch of ERC20 tokens from the sender's address to the specified recipient address. + +### Example + +```ts +import { transferBatch } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = transferBatch({ + contract, + batch: [ + { + to: "0x...", + amount: 100, + }, + { + to: "0x...", + amount: "0.1", + }, +]); + +await sendTransaction({ transaction, account }); +``` + +```ts +function transferBatch( + options: BaseTransactionOptions<{ + batch: Array< + { to: string } & ( + | { amount: string | number } + | { amountWei: bigint } + ) + >; + }>, +): PreparedTransaction; +``` + +### Parameters + + The options for the batch transfer transaction. + +#### Type + +```ts +let options: BaseTransactionOptions<{ + batch: Array< + { to: string } & ( + | { amount: string | number } + | { amountWei: bigint } + ) + >; +}>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the prepared transaction. +--- + +## transferEvent + + Creates an event object for the Transfer event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { transferEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ +contract, +events: [ + transferEvent({ + from: ..., + to: ..., +}) +], +}); +``` + +```ts +function transferEvent( + filters: Partial<{ from: string; to: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { readonly name: "value"; readonly type: "uint256" }, + ]; + readonly name: "Transfer"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ from: string; to: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { readonly name: "value"; readonly type: "uint256" }, + ]; + readonly name: "Transfer"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## transferFrom + + Transfers a specified amount of tokens from one address to another address on the ERC20 contract. + +### Example + +```ts +import { transferFrom } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = transferFrom({ + contract: USDC_CONTRACT, + from: "0x1234...", + to: "0x5678...", + amount: 100, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function transferFrom( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options including from, to, amount, and gas price. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the prepared transaction object. +--- + +## withdraw + + Prepares a transaction to call the "withdraw" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { withdraw } from "thirdweb/extensions/erc20"; + +const transaction = withdraw({ + contract, + amount: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function withdraw( + options: BaseTransactionOptions< + WithdrawParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "withdraw" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + WithdrawParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## ERC4337 +--- + +## accountDeployedEvent + + Creates an event object for the AccountDeployed event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { accountDeployedEvent } from "thirdweb/extensions/erc4337"; + +const events = await getContractEvents({ +contract, +events: [ + accountDeployedEvent({ + userOpHash: ..., + sender: ..., +}) +], +}); +``` + +```ts +function accountDeployedEvent( + filters: Partial<{ sender: string; userOpHash: `0x${string}` }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + { readonly name: "factory"; readonly type: "address" }, + { readonly name: "paymaster"; readonly type: "address" }, + ]; + readonly name: "AccountDeployed"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ sender: string; userOpHash: `0x${string}` }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + { readonly name: "factory"; readonly type: "address" }, + { readonly name: "paymaster"; readonly type: "address" }, + ]; + readonly name: "AccountDeployed"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## addAdmin + + Adds admin permissions for a specified address. + +### Example + +```ts +import { addAdmin } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; + +const transaction = addAdmin({ + contract, + account, + adminAddress: "0x...", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function addAdmin( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the addAdmin function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction object to be sent. +--- + +## addSessionKey + + Adds session key permissions for a specified address. + +### Example + +```ts +import { addSessionKey } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; + +const transaction = addSessionKey({ + contract, + account, + sessionKeyAddress, + permissions: { + approvedTargets: ["0x..."], + nativeTokenLimitPerTransaction: 0.1, // in ETH + permissionStartTimestamp: new Date(), + permissionEndTimestamp: new Date( + Date.now() + 1000 * 60 * 60 * 24 * 365, + ), // 1 year from now + }, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function addSessionKey( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the removeSessionKey function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction object to be sent. +--- + +## adminUpdatedEvent + + Creates an event object for the AdminUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { adminUpdatedEvent } from "thirdweb/extensions/erc4337"; + +const events = await getContractEvents({ +contract, +events: [ + adminUpdatedEvent({ + signer: ..., +}) +], +}); +``` + +```ts +function adminUpdatedEvent( + filters: Partial<{ signer: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { readonly name: "isAdmin"; readonly type: "bool" }, + ]; + readonly name: "AdminUpdated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ signer: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "signer"; + readonly type: "address"; + }, + { readonly name: "isAdmin"; readonly type: "bool" }, + ]; + readonly name: "AdminUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## createAccount + + Prepares a transaction to call the "createAccount" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { createAccount } from "thirdweb/extensions/erc4337"; + +const transaction = createAccount({ + contract, + admin: ..., + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function createAccount( + options: BaseTransactionOptions< + | CreateAccountParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "createAccount" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CreateAccountParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## getAccounts + + Calls the "getAccounts" function on the contract. + +### Example + +```ts +import { getAccounts } from "thirdweb/extensions/erc4337"; + +const result = await getAccounts({ + contract, + start: ..., + end: ..., +}); +``` + +```ts +function getAccounts(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getAccounts function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getAccountsOfSigner + + Calls the "getAccountsOfSigner" function on the contract. + +### Example + +```ts +import { getAccountsOfSigner } from "thirdweb/extensions/erc4337"; + +const result = await getAccountsOfSigner({ + contract, + signer: ..., +}); +``` + +```ts +function getAccountsOfSigner(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getAccountsOfSigner function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getAllAccounts + + Calls the "getAllAccounts" function on the contract. + +### Example + +```ts +import { getAllAccounts } from "thirdweb/extensions/erc4337"; + +const result = await getAllAccounts({ + contract, +}); +``` + +```ts +function getAllAccounts(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getAllAccounts function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getAllActiveSigners + + Calls the "getAllActiveSigners" function on the contract. + +### Example + +```ts +import { getAllActiveSigners } from "thirdweb/extensions/erc4337"; + +const result = await getAllActiveSigners({ + contract, +}); +``` + +```ts +function getAllActiveSigners(options: BaseTransactionOptions) : Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +``` + +### Parameters + + The options for the getAllActiveSigners function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +``` + + The parsed result of the function call. +--- + +## getAllAdmins + + Calls the "getAllAdmins" function on the contract. + +### Example + +```ts +import { getAllAdmins } from "thirdweb/extensions/erc4337"; + +const result = await getAllAdmins({ + contract, +}); +``` + +```ts +function getAllAdmins(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getAllAdmins function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getAllSigners + + Calls the "getAllSigners" function on the contract. + +### Example + +```ts +import { getAllSigners } from "thirdweb/extensions/erc4337"; + +const result = await getAllSigners({ + contract, +}); +``` + +```ts +function getAllSigners(options: BaseTransactionOptions) : Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +``` + +### Parameters + + The options for the getAllSigners function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +``` + + The parsed result of the function call. +--- + +## getPermissionsForSigner + + Calls the "getPermissionsForSigner" function on the contract. + +### Example + +```ts +import { getPermissionsForSigner } from "thirdweb/extensions/erc4337"; + +const result = await getPermissionsForSigner({ + contract, + signer: ..., +}); +``` + +```ts +function getPermissionsForSigner(options: BaseTransactionOptions) : Promise<{ approvedTargets: readonly Array; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }> +``` + +### Parameters + + The options for the getPermissionsForSigner function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ approvedTargets: readonly Array; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }> +``` + + The parsed result of the function call. +--- + +## getUserOpHash + + Calls the "getUserOpHash" function on the contract. + +### Example + +```ts +import { getUserOpHash } from "thirdweb/extensions/erc4337"; + +const result = await getUserOpHash({ + contract, + userOp: ..., +}); +``` + +```ts +function getUserOpHash( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the getUserOpHash function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## isAccountDeployed + + Adds admin permissions for a specified address. + +### Example + +```ts +import { isAccountDeployed } from "thirdweb/extensions/erc4337"; + +const transaction = addAdmin({ + contract, + account, + adminAddress: "0x...", +}); + +await isAccountDeployed({ contract, adminSigner }); +``` + +```ts +function isAccountDeployed( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the addAdmin function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The transaction object to be sent. +--- + +## isActiveSigner + + Calls the "isActiveSigner" function on the contract. + +### Example + +```ts +import { isActiveSigner } from "thirdweb/extensions/erc4337"; + +const result = await isActiveSigner({ + contract, + signer: ..., +}); +``` + +```ts +function isActiveSigner( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isActiveSigner function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isAddAdminSupported + + Checks if the `isAddAdminSupported` method is supported by the given contract. + +### Example + +```ts +import { isAddAdminSupported } from "thirdweb/extensions/erc4337"; + +const supported = isAddAdminSupported(["0x..."]); +``` + +```ts +function isAddAdminSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isAddAdminSupported` method is supported. +--- + +## isAddSessionKeySupported + + Checks if the `isAddSessionKeySupported` method is supported by the given contract. + +### Example + +```ts +import { isAddSessionKeySupported } from "thirdweb/extensions/erc4337"; + +const supported = isAddSessionKeySupported(["0x..."]); +``` + +```ts +function isAddSessionKeySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isAddSessionKeySupported` method is supported. +--- + +## isAdmin + + Calls the "isAdmin" function on the contract. + +### Example + +```ts +import { isAdmin } from "thirdweb/extensions/erc4337"; + +const result = await isAdmin({ + contract, + signer: ..., +}); +``` + +```ts +function isAdmin( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isAdmin function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isCreateAccountSupported + + Checks if the `createAccount` method is supported by the given contract. + +### Example + +```ts +import { isCreateAccountSupported } from "thirdweb/extensions/erc4337"; + +const supported = isCreateAccountSupported(["0x..."]); +``` + +```ts +function isCreateAccountSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `createAccount` method is supported. +--- + +## isGetAccountsOfSignerSupported + + Checks if the `getAccountsOfSigner` method is supported by the given contract. + +### Example + +```ts +import { isGetAccountsOfSignerSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAccountsOfSignerSupported(["0x..."]); +``` + +```ts +function isGetAccountsOfSignerSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAccountsOfSigner` method is supported. +--- + +## isGetAccountsSupported + + Checks if the `getAccounts` method is supported by the given contract. + +### Example + +```ts +import { isGetAccountsSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAccountsSupported(["0x..."]); +``` + +```ts +function isGetAccountsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAccounts` method is supported. +--- + +## isGetAllAccountsSupported + + Checks if the `getAllAccounts` method is supported by the given contract. + +### Example + +```ts +import { isGetAllAccountsSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllAccountsSupported(["0x..."]); +``` + +```ts +function isGetAllAccountsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAllAccounts` method is supported. +--- + +## isGetAllActiveSignersSupported + + Checks if the `getAllActiveSigners` method is supported by the given contract. + +### Example + +```ts +import { isGetAllActiveSignersSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllActiveSignersSupported(["0x..."]); +``` + +```ts +function isGetAllActiveSignersSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAllActiveSigners` method is supported. +--- + +## isGetAllAdminsSupported + + Checks if the `getAllAdmins` method is supported by the given contract. + +### Example + +```ts +import { isGetAllAdminsSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllAdminsSupported(["0x..."]); +``` + +```ts +function isGetAllAdminsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAllAdmins` method is supported. +--- + +## isGetAllSignersSupported + + Checks if the `getAllSigners` method is supported by the given contract. + +### Example + +```ts +import { isGetAllSignersSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllSignersSupported(["0x..."]); +``` + +```ts +function isGetAllSignersSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAllSigners` method is supported. +--- + +## isIsAccountDeployedSupported + + Checks if the `getAddress` method is supported by the given contract. + +### Example + +```ts +import { isGetAddressSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAddressSupported(["0x..."]); +``` + +```ts +function isIsAccountDeployedSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAddress` method is supported. +--- + +## isIsActiveSignerSupported + + Checks if the `isActiveSigner` method is supported by the given contract. + +### Example + +```ts +import { isIsActiveSignerSupported } from "thirdweb/extensions/erc4337"; +const supported = isIsActiveSignerSupported(["0x..."]); +``` + +```ts +function isIsActiveSignerSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isActiveSigner` method is supported. +--- + +## isIsAdminSupported + + Checks if the `isAdmin` method is supported by the given contract. + +### Example + +```ts +import { isIsAdminSupported } from "thirdweb/extensions/erc4337"; +const supported = isIsAdminSupported(["0x..."]); +``` + +```ts +function isIsAdminSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isAdmin` method is supported. +--- + +## isRegistered + + Calls the "isRegistered" function on the contract. + +### Example + +```ts +import { isRegistered } from "thirdweb/extensions/erc4337"; + +const result = await isRegistered({ + contract, + account: ..., +}); +``` + +```ts +function isRegistered( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isRegistered function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isRemoveAdminSupported + + Checks if the `isRemoveAdminSupported` method is supported by the given contract. + +### Example + +```ts +import { isRemoveAdminSupported } from "thirdweb/extensions/erc4337"; + +const supported = isRemoveAdminSupported(["0x..."]); +``` + +```ts +function isRemoveAdminSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isRemoveAdminSupported` method is supported. +--- + +## isRemoveSessionKeySupported + + Checks if the `isRemoveSessionKeySupported` method is supported by the given contract. + +### Example + +```ts +import { isRemoveSessionKeySupported } from "thirdweb/extensions/erc4337"; + +const supported = isRemoveSessionKeySupported(["0x..."]); +``` + +```ts +function isRemoveSessionKeySupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isRemoveSessionKeySupported` method is supported. +--- + +## isTotalAccountsSupported + + Checks if the `totalAccounts` method is supported by the given contract. + +### Example + +```ts +import { isTotalAccountsSupported } from "thirdweb/extensions/erc4337"; +const supported = isTotalAccountsSupported(["0x..."]); +``` + +```ts +function isTotalAccountsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `totalAccounts` method is supported. +--- + +## isValidateUserOpSupported + + Checks if the `validateUserOp` method is supported by the given contract. + +### Example + +```ts +import { isValidateUserOpSupported } from "thirdweb/extensions/erc4337"; + +const supported = isValidateUserOpSupported(["0x..."]); +``` + +```ts +function isValidateUserOpSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `validateUserOp` method is supported. +--- + +## predictAccountAddress + + Calls the "getAddress" function on the contract. + +### Example + +```ts +import { getAddress } from "thirdweb/extensions/erc4337"; + +const result = await getAddress({ + contract, + adminSigner: ..., + data: ..., +}); +``` + +```ts +function predictAccountAddress( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getAddress function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## removeAdmin + + Removes admin permissions for a specified address. + +### Example + +```ts +import { removeAdmin } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; + +const transaction = removeAdmin({ + contract, + account, + adminAddress: "0x...", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function removeAdmin( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the removeAdmin function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction object to be sent. +--- + +## removeSessionKey + + Removes session key permissions for a specified address. + +### Example + +```ts +import { removeSessionKey } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; + +const transaction = removeSessionKey({ + contract, + account, + sessionKeyAddress, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function removeSessionKey( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the removeSessionKey function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction object to be sent. +--- + +## signerPermissionsUpdatedEvent + + Creates an event object for the SignerPermissionsUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { signerPermissionsUpdatedEvent } from "thirdweb/extensions/erc4337"; + +const events = await getContractEvents({ +contract, +events: [ + signerPermissionsUpdatedEvent({ + authorizingSigner: ..., + targetSigner: ..., +}) +], +}); +``` + +```ts +function signerPermissionsUpdatedEvent( + filters: Partial<{ + authorizingSigner: string; + targetSigner: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "authorizingSigner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "targetSigner"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "signer"; readonly type: "address" }, + { readonly name: "isAdmin"; readonly type: "uint8" }, + { + readonly name: "approvedTargets"; + readonly type: "address[]"; + }, + { + readonly name: "nativeTokenLimitPerTransaction"; + readonly type: "uint256"; + }, + { + readonly name: "permissionStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "permissionEndTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "reqValidityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "reqValidityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "permissions"; + readonly type: "tuple"; + }, + ]; + readonly name: "SignerPermissionsUpdated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + authorizingSigner: string; + targetSigner: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "authorizingSigner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "targetSigner"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "signer"; readonly type: "address" }, + { readonly name: "isAdmin"; readonly type: "uint8" }, + { + readonly name: "approvedTargets"; + readonly type: "address[]"; + }, + { + readonly name: "nativeTokenLimitPerTransaction"; + readonly type: "uint256"; + }, + { + readonly name: "permissionStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "permissionEndTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "reqValidityStartTimestamp"; + readonly type: "uint128"; + }, + { + readonly name: "reqValidityEndTimestamp"; + readonly type: "uint128"; + }, + { readonly name: "uid"; readonly type: "bytes32" }, + ]; + readonly name: "permissions"; + readonly type: "tuple"; + }, + ]; + readonly name: "SignerPermissionsUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## simulateHandleOp + + Prepares a transaction to call the "simulateHandleOp" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { simulateHandleOp } from "thirdweb/extensions/erc4337"; + +const transaction = simulateHandleOp({ + contract, + op: ..., + target: ..., + targetCallData: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function simulateHandleOp( + options: BaseTransactionOptions< + | SimulateHandleOpParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "simulateHandleOp" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SimulateHandleOpParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## totalAccounts + + Calls the "totalAccounts" function on the contract. + +### Example + +```ts +import { totalAccounts } from "thirdweb/extensions/erc4337"; + +const result = await totalAccounts({ + contract, +}); +``` + +```ts +function totalAccounts( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalAccounts function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## userOperationEventEvent + + Creates an event object for the UserOperationEvent event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { userOperationEventEvent } from "thirdweb/extensions/erc4337"; + +const events = await getContractEvents({ +contract, +events: [ + userOperationEventEvent({ + userOpHash: ..., + sender: ..., + paymaster: ..., +}) +], +}); +``` + +```ts +function userOperationEventEvent( + filters: Partial<{ + paymaster: string; + sender: string; + userOpHash: `0x${string}`; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "paymaster"; + readonly type: "address"; + }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "success"; readonly type: "bool" }, + { readonly name: "actualGasCost"; readonly type: "uint256" }, + { readonly name: "actualGasUsed"; readonly type: "uint256" }, + ]; + readonly name: "UserOperationEvent"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + paymaster: string; + sender: string; + userOpHash: `0x${string}`; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "paymaster"; + readonly type: "address"; + }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "success"; readonly type: "bool" }, + { readonly name: "actualGasCost"; readonly type: "uint256" }, + { readonly name: "actualGasUsed"; readonly type: "uint256" }, + ]; + readonly name: "UserOperationEvent"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## userOperationRevertReasonEvent + + Creates an event object for the UserOperationRevertReason event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { userOperationRevertReasonEvent } from "thirdweb/extensions/erc4337"; + +const events = await getContractEvents({ +contract, +events: [ + userOperationRevertReasonEvent({ + userOpHash: ..., + sender: ..., +}) +], +}); +``` + +```ts +function userOperationRevertReasonEvent( + filters: Partial<{ sender: string; userOpHash: `0x${string}` }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "revertReason"; readonly type: "bytes" }, + ]; + readonly name: "UserOperationRevertReason"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ sender: string; userOpHash: `0x${string}` }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "revertReason"; readonly type: "bytes" }, + ]; + readonly name: "UserOperationRevertReason"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- +## ERC4626 +--- + +## asset + + Calls the "asset" function on the contract. + +### Example + +```ts +import { asset } from "thirdweb/extensions/erc4626"; + +const result = await asset({ + contract, +}); +``` + +```ts +function asset(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the asset function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## convertToAssets + + Calls the "convertToAssets" function on the contract. + +### Example + +```ts +import { convertToAssets } from "thirdweb/extensions/erc4626"; + +const result = await convertToAssets({ + contract, + shares: ..., +}); +``` + +```ts +function convertToAssets( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the convertToAssets function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## convertToShares + + Calls the "convertToShares" function on the contract. + +### Example + +```ts +import { convertToShares } from "thirdweb/extensions/erc4626"; + +const result = await convertToShares({ + contract, + assets: ..., +}); +``` + +```ts +function convertToShares( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the convertToShares function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## deposit + + Prepares a transaction to call the "deposit" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { deposit } from "thirdweb/extensions/erc4626"; + +const transaction = deposit({ + contract, + assets: ..., + receiver: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function deposit( + options: BaseTransactionOptions< + DepositParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "deposit" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + DepositParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## depositEvent + + Creates an event object for the Deposit event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { depositEvent } from "thirdweb/extensions/erc4626"; + +const events = await getContractEvents({ +contract, +events: [ + depositEvent({ + caller: ..., + owner: ..., +}) +], +}); +``` + +```ts +function depositEvent( + filters: Partial<{ caller: string; owner: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "caller"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { readonly name: "assets"; readonly type: "uint256" }, + { readonly name: "shares"; readonly type: "uint256" }, + ]; + readonly name: "Deposit"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ caller: string; owner: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "caller"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { readonly name: "assets"; readonly type: "uint256" }, + { readonly name: "shares"; readonly type: "uint256" }, + ]; + readonly name: "Deposit"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## maxDeposit + + Calls the "maxDeposit" function on the contract. + +### Example + +```ts +import { maxDeposit } from "thirdweb/extensions/erc4626"; + +const result = await maxDeposit({ + contract, + receiver: ..., +}); +``` + +```ts +function maxDeposit( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the maxDeposit function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## maxMint + + Calls the "maxMint" function on the contract. + +### Example + +```ts +import { maxMint } from "thirdweb/extensions/erc4626"; + +const result = await maxMint({ + contract, + receiver: ..., +}); +``` + +```ts +function maxMint( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the maxMint function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## maxRedeem + + Calls the "maxRedeem" function on the contract. + +### Example + +```ts +import { maxRedeem } from "thirdweb/extensions/erc4626"; + +const result = await maxRedeem({ + contract, + owner: ..., +}); +``` + +```ts +function maxRedeem( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the maxRedeem function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## maxWithdraw + + Calls the "maxWithdraw" function on the contract. + +### Example + +```ts +import { maxWithdraw } from "thirdweb/extensions/erc4626"; + +const result = await maxWithdraw({ + contract, + owner: ..., +}); +``` + +```ts +function maxWithdraw( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the maxWithdraw function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## mint + + Prepares a transaction to call the "mint" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { mint } from "thirdweb/extensions/erc4626"; + +const transaction = mint({ + contract, + shares: ..., + receiver: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mint( + options: BaseTransactionOptions< + MintParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "mint" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + MintParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## previewDeposit + + Calls the "previewDeposit" function on the contract. + +### Example + +```ts +import { previewDeposit } from "thirdweb/extensions/erc4626"; + +const result = await previewDeposit({ + contract, + assets: ..., +}); +``` + +```ts +function previewDeposit( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the previewDeposit function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## previewMint + + Calls the "previewMint" function on the contract. + +### Example + +```ts +import { previewMint } from "thirdweb/extensions/erc4626"; + +const result = await previewMint({ + contract, + shares: ..., +}); +``` + +```ts +function previewMint( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the previewMint function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## previewRedeem + + Calls the "previewRedeem" function on the contract. + +### Example + +```ts +import { previewRedeem } from "thirdweb/extensions/erc4626"; + +const result = await previewRedeem({ + contract, + shares: ..., +}); +``` + +```ts +function previewRedeem( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the previewRedeem function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## previewWithdraw + + Calls the "previewWithdraw" function on the contract. + +### Example + +```ts +import { previewWithdraw } from "thirdweb/extensions/erc4626"; + +const result = await previewWithdraw({ + contract, + assets: ..., +}); +``` + +```ts +function previewWithdraw( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the previewWithdraw function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## redeem + + Prepares a transaction to call the "redeem" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { redeem } from "thirdweb/extensions/erc4626"; + +const transaction = redeem({ + contract, + shares: ..., + receiver: ..., + owner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function redeem( + options: BaseTransactionOptions< + RedeemParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "redeem" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RedeemParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## totalAssets + + Calls the "totalAssets" function on the contract. + +### Example + +```ts +import { totalAssets } from "thirdweb/extensions/erc4626"; + +const result = await totalAssets({ + contract, +}); +``` + +```ts +function totalAssets( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalAssets function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## withdraw + + Prepares a transaction to call the "withdraw" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { withdraw } from "thirdweb/extensions/erc4626"; + +const transaction = withdraw({ + contract, + assets: ..., + receiver: ..., + owner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function withdraw( + options: BaseTransactionOptions< + WithdrawParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "withdraw" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + WithdrawParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## withdrawEvent + + Creates an event object for the Withdraw event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { withdrawEvent } from "thirdweb/extensions/erc4626"; + +const events = await getContractEvents({ +contract, +events: [ + withdrawEvent({ + caller: ..., + receiver: ..., + owner: ..., +}) +], +}); +``` + +```ts +function withdrawEvent( + filters: Partial<{ + caller: string; + owner: string; + receiver: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "caller"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { readonly name: "assets"; readonly type: "uint256" }, + { readonly name: "shares"; readonly type: "uint256" }, + ]; + readonly name: "Withdraw"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + caller: string; + owner: string; + receiver: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "caller"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "receiver"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "owner"; + readonly type: "address"; + }, + { readonly name: "assets"; readonly type: "uint256" }, + { readonly name: "shares"; readonly type: "uint256" }, + ]; + readonly name: "Withdraw"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- +## FARCASTER +--- + +## addSigner + + Adds farcaster signer for the given account. + +### Example + +```ts +import { addSigner } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; + +const transaction = addSigner({ + client, + appAccount, + signerPublicKey, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function addSigner( + options: AddSignerParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + The options for adding the signer. + +#### Type + +```ts +let options: Prettify< + { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + signerPublicKey: Hex; + } & ( + | { appAccount: Account } + | { + appAccountAddress: Address; + deadline: bigint; + signedKeyRequestMetadata: Hex; + } + ) +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object to add the signer to the account. +--- + +## addSignerFor + + Adds farcaster signer for a given user. Helpful if you want to cover the gas fee for a user. + +### Example + +```ts +import { addSignerFor } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; + +const transaction = addSignerFor({ + client, + appAccount, + userAccount, + signerPublicKey, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function addSignerFor( + options: AddSignerForParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + The options for adding the signer. + +#### Type + +```ts +let options: Prettify< + { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + signerPublicKey: Hex; + } & ( + | { appAccount: Account } + | { + appAccountAddress: Address; + deadline: bigint; + signedKeyRequestMetadata: Hex; + } + ) & + ( + | { userAccount: Account } + | { addSignature: Hex; deadline: bigint; userAddress: Address } + ) +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object to add the signer to the account. +--- + +## createEd25519Keypair + + Generates an Ed25519 keypair to be used as an account signer. + +### Example + +```ts +createSigner(); +``` + +```ts +function createEd25519Keypair(): Promise; +``` + +### Returns + +```ts +let returnType: { privateKey: Hex; publicKey: Hex }; +``` + + A promise resolving to the generated keypair. +--- + +## encodeSignedKeyRequestMetadata + + Encodes the signed key request metadata into a hexadecimal string. This function takes in the request signer's address, the key request signature, the request Fid, and the deadline, and returns the encoded ABI parameters as a hexadecimal string. It's used to prepare the metadata for transactions involving signed key requests. + +### Example + +```ts +const encodedMetadata = encodeSignedKeyRequestMetadata({ + requestSigner: "0x123...", + keyRequestSignature: "0xabcd...", + requestFid: 123456789n, + deadline: 1657758061n, +}); +``` + +```ts +function encodeSignedKeyRequestMetadata(options: { + deadline: bigint; + keyRequestSignature: `0x${string}`; + requestFid: bigint; + requestSigner: string; +}): Hex; +``` + +### Parameters + + The options for encoding the signed key request metadata. + +#### Type + +```ts +let options: { + deadline: bigint; + keyRequestSignature: `0x${string}`; + requestFid: bigint; + requestSigner: string; +}; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The encoded ABI parameters as a hexadecimal string. +--- + +## getAddData + + Prepares the data required for signing an Add message according to EIP-712. + +### Example + +```typescript +const message: AddMessage = { + owner: "0xYourAddress", + keyType: 1, + key: "0xYourPublicKey", + metadataType: 1, + metadata: "0xYourMetadata", + nonce: BigInt("YourNonce"), + deadline: BigInt("YourDeadline"), +}; + +const data = getAddData(message); +``` + +```ts +function getAddData(message: AddMessage): { + domain: { + readonly chainId: 10; + readonly name: "Farcaster KeyGateway"; + readonly verifyingContract: "0x00000000fC56947c7E7183f8Ca4B62398CaAdf0B"; + readonly version: "1"; + }; + message: AddMessage; + primaryType: "Add"; + types: { + readonly Add: readonly [ + { readonly name: "owner"; readonly type: "address" }, + { readonly name: "keyType"; readonly type: "uint32" }, + { readonly name: "key"; readonly type: "bytes" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "metadata"; readonly type: "bytes" }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "deadline"; readonly type: "uint256" }, + ]; + }; +}; +``` + +### Parameters + + The AddMessage object containing the message to be signed. + +#### Type + +```ts +let message: { + deadline: bigint; + key: Hex; + keyType: number; + metadata: Hex; + metadataType: number; + nonce: bigint; + owner: Address; +}; +``` + +### Returns + +```ts +let returnType: { + domain: { + readonly chainId: 10; + readonly name: "Farcaster KeyGateway"; + readonly verifyingContract: "0x00000000fC56947c7E7183f8Ca4B62398CaAdf0B"; + readonly version: "1"; + }; + message: AddMessage; + primaryType: "Add"; + types: { + readonly Add: readonly [ + { readonly name: "owner"; readonly type: "address" }, + { readonly name: "keyType"; readonly type: "uint32" }, + { readonly name: "key"; readonly type: "bytes" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "metadata"; readonly type: "bytes" }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "deadline"; readonly type: "uint256" }, + ]; + }; +}; +``` + + The data object structured according to EIP-712, ready for signing. +--- + +## getBundler + + Retrieves the Bundler contract. + +### Example + +```ts +import { getBundler } from "thirdweb/extensions/farcaster"; + +const bundler = await getBundler({ + client, +}); +``` + +```ts +function getBundler( + options: FarcasterContractOptions, +): ThirdwebContract; +``` + +### Parameters + + The thirdweb client and an optional custom chain. + +#### Type + +```ts +let options: { chain?: Chain; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` + + The Bundler contract instance. +--- + +## getFid + + Retrieves the current fid for an account. + +### Example + +```ts +import { getFid } from "thirdweb/extensions/farcaster"; + +const price = await getFid({ + client, + address, +}); +``` + +```ts +function getFid(options: GetFidParams): Promise; +``` + +### Parameters + + Parameters to pass to the function. + +#### Type + +```ts +let options: { + address: Address; + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the account's fid, if one exists, otherwise 0. +--- + +## getIdGateway + + Retrieves the IdGateway contract. + +### Example + +```ts +import { getIdGatway } from "thirdweb/extensions/farcaster"; + +const idGateway = await getIdGateway({ + client, +}); +``` + +```ts +function getIdGateway( + options: FarcasterContractOptions, +): ThirdwebContract; +``` + +### Parameters + + The thirdweb client and an optional custom chain. + +#### Type + +```ts +let options: { chain?: Chain; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` + + The IdGateway contract instance. +--- + +## getIdRegistry + + Retrieves the IdRegistry contract. + +### Example + +```ts +import { getIdRegistry } from "thirdweb/extensions/farcaster"; + +const idRegistry = await getIdRegistry({ + client, +}); +``` + +```ts +function getIdRegistry( + options: FarcasterContractOptions, +): ThirdwebContract; +``` + +### Parameters + + The thirdweb client and an optional custom chain. + +#### Type + +```ts +let options: { chain?: Chain; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` + + The IdRegistry contract instance. +--- + +## getKeyGateway + + Retrieves the KeyGateway contract. + +### Example + +```ts +import { getKeyGateway } from "thirdweb/extensions/farcaster"; + +const keyGateway = await getKeyGateway({ + client, +}); +``` + +```ts +function getKeyGateway( + options: FarcasterContractOptions, +): ThirdwebContract; +``` + +### Parameters + + The thirdweb client and an optional custom chain. + +#### Type + +```ts +let options: { chain?: Chain; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` + + The KeyGateway contract instance. +--- + +## getKeyRequestData + + Prepares the data required for signing a key request using EIP-712 typed data signing. This includes the domain, types, primary type, and the message to be signed. + +### Example + +```ts +const message = { + requestFid: 123456789n, + key: "0x04bfc...", + deadline: 1657758061n, +}; +const eip712Data = getKeyRequestData(message); +``` + +```ts +function getKeyRequestData(message: SignedKeyRequestMessage): { + domain: { + readonly chainId: 10; + readonly name: "Farcaster SignedKeyRequestValidator"; + readonly verifyingContract: "0x00000000FC700472606ED4fA22623Acf62c60553"; + readonly version: "1"; + }; + message: SignedKeyRequestMessage; + primaryType: "SignedKeyRequest"; + types: { + readonly SignedKeyRequest: Array<{ name: string; type: string }>; + }; +}; +``` + +### Parameters + + The message to be signed, containing the request FID, key, and deadline. + +#### Type + +```ts +let message: { deadline: bigint; key: Hex; requestFid: bigint }; +``` + +### Returns + +```ts +let returnType: { + domain: { + readonly chainId: 10; + readonly name: "Farcaster SignedKeyRequestValidator"; + readonly verifyingContract: "0x00000000FC700472606ED4fA22623Acf62c60553"; + readonly version: "1"; + }; + message: SignedKeyRequestMessage; + primaryType: "SignedKeyRequest"; + types: { + readonly SignedKeyRequest: Array<{ name: string; type: string }>; + }; +}; +``` + + An object containing the domain, types, primary type, and the message for EIP-712 signing. +--- + +## getNonce + + Retrieves the current key gateway nonce for an account. + +### Example + +```ts +import { getNonce } from "thirdweb/extensions/farcaster"; + +const nonce = await getNonce({ + client, + address, +}); +``` + +```ts +function getNonce(options: GetNonceParams): Promise; +``` + +### Parameters + + Parameters to pass to the function. + +#### Type + +```ts +let options: { + address: Address; + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the current nonce. +--- + +## getRegisterData + + Constructs the data required for signing a register message in the Farcaster ID Gateway. This includes the EIP-712 domain, types, and the message to be signed. + +### Example + +```ts +import { getRegisterData } from "thirdweb/extensions/farcaster"; + +const data = getRegisterData(message); +``` + +```ts +function getRegisterData(message: RegisterMessage): { + domain: { + readonly chainId: 10; + readonly name: "Farcaster IdGateway"; + readonly verifyingContract: "0x00000000Fc25870C6eD6b6c7E41Fb078b7656f69"; + readonly version: "1"; + }; + message: RegisterMessage; + primaryType: "Register"; + types: { + readonly Register: readonly [ + { readonly name: "to"; readonly type: "address" }, + { readonly name: "recovery"; readonly type: "address" }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "deadline"; readonly type: "uint256" }, + ]; + }; +}; +``` + +### Parameters + + The register message containing the necessary information for the signature. + +#### Type + +```ts +let message: { + deadline: bigint; + nonce: bigint; + recovery: Address; + to: Address; +}; +``` + +### Returns + +```ts +let returnType: { + domain: { + readonly chainId: 10; + readonly name: "Farcaster IdGateway"; + readonly verifyingContract: "0x00000000Fc25870C6eD6b6c7E41Fb078b7656f69"; + readonly version: "1"; + }; + message: RegisterMessage; + primaryType: "Register"; + types: { + readonly Register: readonly [ + { readonly name: "to"; readonly type: "address" }, + { readonly name: "recovery"; readonly type: "address" }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "deadline"; readonly type: "uint256" }, + ]; + }; +}; +``` + + An object containing the EIP-712 domain, types, and the message, ready to be signed. +--- + +## getRegistrationPrice + + Retrieves the current cost to register a Farcaster fid in wei. + +### Example + +```ts +import { getRegistrationPrice } from "thirdweb/extensions/farcaster"; + +const price = await getRegistrationPrice({ + client, +}); +``` + +```ts +function getRegistrationPrice( + options: GetRegistrationPriceParams, +): Promise; +``` + +### Parameters + + An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. + +#### Type + +```ts +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | number | string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the current cost of a Farcaster fid in wei. +--- + +## getSignedKeyRequestMetadata + + Generates the signed key request metadata to add a signer to an account. This function can either sign a new key request using an account object or use an existing key request signature. It prepares the metadata necessary for transactions involving signed key requests. + +### Example + +```ts +import { getSignedKeyRequestMetadata } from "thirdweb/extensions/farcaster"; + +// Using an existing signature +const signedMetadata = await getSignedKeyRequestMetadata({ + keyRequestSignature: "0xabcd...", + accountAddress: "0x123...", + message: { + requestFid: 123456789n, + deadline: 1657758061n, + }, +}); + +// Signing a new key request +const signedMetadata = await getSignedKeyRequestMetadata({ + account, + message: { + requestFid: 123456789n, + deadline: 1657758061n, + }, +}); +``` + +```ts +function getSignedKeyRequestMetadata( + options: SignedKeyRequestMetadataOptions, +): Promise; +``` + +### Parameters + + The options for signing the key request or using an existing signature. + +#### Type + +```ts +let options: Prettify< + { message: SignedKeyRequestMessage } & ( + | { account: Account } + | { accountAddress: Address; keyRequestSignature: Hex } + ) +>; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the hexadecimal string of the encoded ABI parameters. +--- + +## getStoragePrice + + Retrieves the current cost to register a Farcaster fid in wei. + +### Example + +```ts +import { getStoragePrice } from "thirdweb/extensions/farcaster"; + +const price = await getStoragePrice({ + client, +}); +``` + +```ts +function getStoragePrice( + options: GetStoragePriceParams, +): Promise; +``` + +### Parameters + + An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. + +#### Type + +```ts +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + units?: bigint | number | string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the current cost of a Farcaster fid in USD. +--- + +## getStorageRegistry + + Retrieves the StorageRegistry contract. + +### Example + +```ts +import { getStorageRegistry } from "thirdweb/extensions/farcaster"; + +const storageRegistry = await getStorageRegistry({ + client, +}); +``` + +```ts +function getStorageRegistry( + options: FarcasterContractOptions, +): ThirdwebContract; +``` + +### Parameters + + The thirdweb client and an optional custom chain. + +#### Type + +```ts +let options: { chain?: Chain; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` + + The StorageRegistry contract instance. +--- + +## getUsdRegistrationPrice + + Retrieves the current cost to register a Farcaster fid in USD. + +### Example + +```ts +import { getUsdRegistrationPrice } from "thirdweb/extensions/farcaster"; + +const price = await getUsdRegistrationPrice({ + client, +}); +``` + +```ts +function getUsdRegistrationPrice( + options: GetUsdRegistrationPriceParams, +): Promise; +``` + +### Parameters + + An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. + +#### Type + +```ts +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | number | string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the current cost of a Farcaster fid in USD. +--- + +## getUsdStoragePrice + + Retrieves the current cost to register a Farcaster fid in USD. + +### Example + +```ts +import { getUsdStoragePrice } from "thirdweb/extensions/farcaster"; + +const price = await getUsdStoragePrice({ + client, +}); +``` + +```ts +function getUsdStoragePrice( + options: GetUsdStoragePriceParams, +): Promise; +``` + +### Parameters + + An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. + +#### Type + +```ts +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + units?: bigint | number | string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the current cost of a Farcaster fid in USD. +--- + +## registerFid + + Registers a Farcaster fid for the given wallet. + +### Example + +```ts +import { registerFid } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; + +const transaction = registerFid({ + client, + recoveryAddress, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function registerFid( + options: RegisterFidParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + The options for registering an account. + +#### Type + +```ts +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | string | number; + recoveryAddress: Address; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object to register the account. +--- + +## registerFidAndSigner + + Registers a Farcaster fid and signer for the given wallet using the provided app account. + +### Example + +```ts +import { registerFidAndSigner } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; + +const transaction = registerFidAndSigner({ + client, + userAccount, + appAccount, + recoveryAddress, + signerPublicKey, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function registerFidAndSigner( + options: RegisterFidAndSignerParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + The options for registering an account. + +#### Type + +```ts +let options: Prettify< + { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | number; + recoveryAddress: Address; + signerPublicKey: Hex; + } & ( + | { userAccount: Account } + | { + addSignature: Hex; + deadline: bigint; + registerSignature: Hex; + userAddress: Address; + } + ) & + ( + | { appAccount: Account } + | { + appAccountAddress: Address; + deadline: bigint; + signedKeyRequestMetadata: Hex; + } + ) +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object to register the account. +--- + +## rentStorage + + Rent storage for the provided farcaster fid. + +### Example + +```ts +import { rentStorage } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; + +const transaction = rentStorage({ + client, + fid, + units, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function rentStorage( + options: RentStorageParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +``` + +### Parameters + + The options for calling the `rentStorage` function. + +#### Type + +```ts +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + fid: bigint | number | string; + units?: bigint | number | string; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object to rent the storage. +--- + +## signAdd + + Signs an Add message using the account's signTypedData method. + +### Example + +```typescript +const signedMessage = await signAdd({ + account: yourAccount, + message: yourAddMessage, +}); +``` + +```ts +function signAdd(options: SignAddOptions): Promise; +``` + +### Parameters + + The options for signing the Add message. + +#### Type + +```ts +let options: { account: Account; message: AddMessage }; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the signature of the Add message. +--- + +## signKeyRequest + + Signs a key request message using EIP-712 typed data signing. This function prepares the data for signing, signs it with the provided account, and returns the signature. + +### Example + +```ts +const message = { + requestFid: 123456789n, + key: "0x04bfc...", + deadline: 1657758061n, +}; + +const signature = signKeyRequest({ account: signerAccount, message }); +``` + +```ts +function signKeyRequest(options: SignKeyRequestOptions): Promise; +``` + +### Parameters + + The options for signing the key request, including the account and the message. + +#### Type + +```ts +let options: { account: Account; message: SignedKeyRequestMessage }; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the signature of the key request. +--- + +## signRegister + + Signs the register message for Farcaster ID Gateway. + +### Example + +```ts +const signature = await signRegister({ account, message }); +``` + +```ts +function signRegister(options: SignRegisterOptions): Promise; +``` + +### Parameters + + The signing options. + +#### Type + +```ts +let options: { account: Account; message: RegisterMessage }; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the signature. +--- + +## idGateway + + Calls the "idGateway" function on the contract. + +### Example + +```ts +import { idGateway } from "thirdweb/extensions/farcaster"; + +const result = await idGateway({ + contract, +}); +``` + +```ts +function idGateway(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the idGateway function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## keyGateway + + Calls the "keyGateway" function on the contract. + +### Example + +```ts +import { keyGateway } from "thirdweb/extensions/farcaster"; + +const result = await keyGateway({ + contract, +}); +``` + +```ts +function keyGateway(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the keyGateway function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## price + + Calls the "price" function on the contract. + +### Example + +```ts +import { price } from "thirdweb/extensions/farcaster"; + +const result = await price({ + contract, + extraStorage: ..., +}); +``` + +```ts +function price( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the price function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## register + + Prepares a transaction to call the "register" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { register } from "thirdweb/extensions/farcaster"; + +const transaction = register({ + contract, + recovery: ..., + extraStorage: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function register( + options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "register" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## idRegistry + + Calls the "idRegistry" function on the contract. + +### Example + +```ts +import { idRegistry } from "thirdweb/extensions/farcaster"; + +const result = await idRegistry({ + contract, +}); +``` + +```ts +function idRegistry(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the idRegistry function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## price + + Calls the "price" function on the contract. + +### Example + +```ts +import { price } from "thirdweb/extensions/farcaster"; + +const result = await price({ + contract, + extraStorage: ..., +}); +``` + +```ts +function price( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the price function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## register + + Prepares a transaction to call the "register" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { register } from "thirdweb/extensions/farcaster"; + +const transaction = register({ + contract, + recovery: ..., + extraStorage: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function register( + options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "register" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## REGISTER\_TYPEHASH + + Calls the "REGISTER\_TYPEHASH" function on the contract. + +### Example + +```ts +import { REGISTER_TYPEHASH } from "thirdweb/extensions/farcaster"; + +const result = await REGISTER_TYPEHASH({ + contract, +}); +``` + +```ts +function REGISTER_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the REGISTER\_TYPEHASH function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## registerFor + + Prepares a transaction to call the "registerFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { registerFor } from "thirdweb/extensions/farcaster"; + +const transaction = registerFor({ + contract, + to: ..., + recovery: ..., + deadline: ..., + sig: ..., + extraStorage: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function registerFor( + options: BaseTransactionOptions< + | RegisterForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "registerFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | RegisterForParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setStorageRegistryEvent + + Creates an event object for the SetStorageRegistry event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setStorageRegistryEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setStorageRegistryEvent()], +}); +``` + +```ts +function setStorageRegistryEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldStorageRegistry"; readonly type: "address" }, + { readonly name: "newStorageRegistry"; readonly type: "address" }, + ]; + readonly name: "SetStorageRegistry"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldStorageRegistry"; readonly type: "address" }, + { readonly name: "newStorageRegistry"; readonly type: "address" }, + ]; + readonly name: "SetStorageRegistry"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## storageRegistry + + Calls the "storageRegistry" function on the contract. + +### Example + +```ts +import { storageRegistry } from "thirdweb/extensions/farcaster"; + +const result = await storageRegistry({ + contract, +}); +``` + +```ts +function storageRegistry( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the storageRegistry function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## adminResetEvent + + Creates an event object for the AdminReset event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { adminResetEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + adminResetEvent({ + fid: ..., + key: ..., +}) +], +}); +``` + +```ts +function adminResetEvent( + filters: Partial<{ fid: bigint; key: `0x${string}` }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + ]; + readonly name: "AdminReset"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ fid: bigint; key: `0x${string}` }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + ]; + readonly name: "AdminReset"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH + + Calls the "CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH" function on the contract. + +### Example + +```ts +import { CHANGE_RECOVERY_ADDRESS_TYPEHASH } from "thirdweb/extensions/farcaster"; + +const result = await CHANGE_RECOVERY_ADDRESS_TYPEHASH({ + contract, +}); +``` + +```ts +function CHANGE_RECOVERY_ADDRESS_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## changeRecoveryAddress + + Prepares a transaction to call the "changeRecoveryAddress" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { changeRecoveryAddress } from "thirdweb/extensions/farcaster"; + +const transaction = changeRecoveryAddress({ + contract, + recovery: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function changeRecoveryAddress( + options: BaseTransactionOptions< + | ChangeRecoveryAddressParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "changeRecoveryAddress" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | ChangeRecoveryAddressParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## changeRecoveryAddressEvent + + Creates an event object for the ChangeRecoveryAddress event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { changeRecoveryAddressEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + changeRecoveryAddressEvent({ + id: ..., + recovery: ..., +}) +], +}); +``` + +```ts +function changeRecoveryAddressEvent( + filters: Partial<{ id: bigint; recovery: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "id"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "recovery"; + readonly type: "address"; + }, + ]; + readonly name: "ChangeRecoveryAddress"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ id: bigint; recovery: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "id"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "recovery"; + readonly type: "address"; + }, + ]; + readonly name: "ChangeRecoveryAddress"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## custodyOf + + Calls the "custodyOf" function on the contract. + +### Example + +```ts +import { custodyOf } from "thirdweb/extensions/farcaster"; + +const result = await custodyOf({ + contract, + fid: ..., +}); +``` + +```ts +function custodyOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the custodyOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## freezeIdGatewayEvent + + Creates an event object for the FreezeIdGateway event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { freezeIdGatewayEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [freezeIdGatewayEvent()], +}); +``` + +```ts +function freezeIdGatewayEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "idGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeIdGateway"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "idGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeIdGateway"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## gatewayFrozen + + Calls the "gatewayFrozen" function on the contract. + +### Example + +```ts +import { gatewayFrozen } from "thirdweb/extensions/farcaster"; + +const result = await gatewayFrozen({ + contract, +}); +``` + +```ts +function gatewayFrozen( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the gatewayFrozen function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## idCounter + + Calls the "idCounter" function on the contract. + +### Example + +```ts +import { idCounter } from "thirdweb/extensions/farcaster"; + +const result = await idCounter({ + contract, +}); +``` + +```ts +function idCounter(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the idCounter function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## idGateway + + Calls the "idGateway" function on the contract. + +### Example + +```ts +import { idGateway } from "thirdweb/extensions/farcaster"; + +const result = await idGateway({ + contract, +}); +``` + +```ts +function idGateway(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the idGateway function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## idOf + + Calls the "idOf" function on the contract. + +### Example + +```ts +import { idOf } from "thirdweb/extensions/farcaster"; + +const result = await idOf({ + contract, + owner: ..., +}); +``` + +```ts +function idOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the idOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## recover + + Prepares a transaction to call the "recover" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { recover } from "thirdweb/extensions/farcaster"; + +const transaction = recover({ + contract, + from: ..., + to: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function recover( + options: BaseTransactionOptions< + RecoverParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "recover" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RecoverParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## recoverEvent + + Creates an event object for the Recover event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { recoverEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + recoverEvent({ + from: ..., + to: ..., + id: ..., +}) +], +}); +``` + +```ts +function recoverEvent( + filters: Partial<{ from: string; id: bigint; to: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "id"; + readonly type: "uint256"; + }, + ]; + readonly name: "Recover"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ from: string; id: bigint; to: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "id"; + readonly type: "uint256"; + }, + ]; + readonly name: "Recover"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## recoverFor + + Prepares a transaction to call the "recoverFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { recoverFor } from "thirdweb/extensions/farcaster"; + +const transaction = recoverFor({ + contract, + from: ..., + to: ..., + recoveryDeadline: ..., + recoverySig: ..., + toDeadline: ..., + toSig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function recoverFor( + options: BaseTransactionOptions< + | RecoverForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "recoverFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RecoverForParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## recoveryOf + + Calls the "recoveryOf" function on the contract. + +### Example + +```ts +import { recoveryOf } from "thirdweb/extensions/farcaster"; + +const result = await recoveryOf({ + contract, + fid: ..., +}); +``` + +```ts +function recoveryOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the recoveryOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## registerEvent + + Creates an event object for the Register event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { registerEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + registerEvent({ + to: ..., + id: ..., +}) +], +}); +``` + +```ts +function registerEvent( + filters: Partial<{ id: bigint; to: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "id"; + readonly type: "uint256"; + }, + { readonly name: "recovery"; readonly type: "address" }, + ]; + readonly name: "Register"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ id: bigint; to: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "id"; + readonly type: "uint256"; + }, + { readonly name: "recovery"; readonly type: "address" }, + ]; + readonly name: "Register"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## setIdCounterEvent + + Creates an event object for the SetIdCounter event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setIdCounterEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setIdCounterEvent()], +}); +``` + +```ts +function setIdCounterEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldCounter"; readonly type: "uint256" }, + { readonly name: "newCounter"; readonly type: "uint256" }, + ]; + readonly name: "SetIdCounter"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldCounter"; readonly type: "uint256" }, + { readonly name: "newCounter"; readonly type: "uint256" }, + ]; + readonly name: "SetIdCounter"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## setIdGatewayEvent + + Creates an event object for the SetIdGateway event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setIdGatewayEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setIdGatewayEvent()], +}); +``` + +```ts +function setIdGatewayEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldIdGateway"; readonly type: "address" }, + { readonly name: "newIdGateway"; readonly type: "address" }, + ]; + readonly name: "SetIdGateway"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldIdGateway"; readonly type: "address" }, + { readonly name: "newIdGateway"; readonly type: "address" }, + ]; + readonly name: "SetIdGateway"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## transfer + + Prepares a transaction to call the "transfer" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { transfer } from "thirdweb/extensions/farcaster"; + +const transaction = transfer({ + contract, + to: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function transfer( + options: BaseTransactionOptions< + TransferParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "transfer" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + TransferParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH + + Calls the "TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH" function on the contract. + +### Example + +```ts +import { TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH } from "thirdweb/extensions/farcaster"; + +const result = await TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH({ + contract, +}); +``` + +```ts +function TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## TRANSFER\_TYPEHASH + + Calls the "TRANSFER\_TYPEHASH" function on the contract. + +### Example + +```ts +import { TRANSFER_TYPEHASH } from "thirdweb/extensions/farcaster"; + +const result = await TRANSFER_TYPEHASH({ + contract, +}); +``` + +```ts +function TRANSFER_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the TRANSFER\_TYPEHASH function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## transferAndChangeRecovery + + Prepares a transaction to call the "transferAndChangeRecovery" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { transferAndChangeRecovery } from "thirdweb/extensions/farcaster"; + +const transaction = transferAndChangeRecovery({ + contract, + to: ..., + recovery: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function transferAndChangeRecovery( + options: BaseTransactionOptions< + | TransferAndChangeRecoveryParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "transferAndChangeRecovery" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | TransferAndChangeRecoveryParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## transferEvent + + Creates an event object for the Transfer event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { transferEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + transferEvent({ + from: ..., + to: ..., +}) +], +}); +``` + +```ts +function transferEvent( + filters: Partial<{ from: string; to: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { readonly name: "id"; readonly type: "uint256" }, + ]; + readonly name: "Transfer"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ from: string; to: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "from"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "to"; + readonly type: "address"; + }, + { readonly name: "id"; readonly type: "uint256" }, + ]; + readonly name: "Transfer"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## transferFor + + Prepares a transaction to call the "transferFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { transferFor } from "thirdweb/extensions/farcaster"; + +const transaction = transferFor({ + contract, + from: ..., + to: ..., + fromDeadline: ..., + fromSig: ..., + toDeadline: ..., + toSig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function transferFor( + options: BaseTransactionOptions< + | TransferForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "transferFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | TransferForParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## verifyFidSignature + + Calls the "verifyFidSignature" function on the contract. + +### Example + +```ts +import { verifyFidSignature } from "thirdweb/extensions/farcaster"; + +const result = await verifyFidSignature({ + contract, + custodyAddress: ..., + fid: ..., + digest: ..., + sig: ..., +}); +``` + +```ts +function verifyFidSignature( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the verifyFidSignature function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## add + + Prepares a transaction to call the "add" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { add } from "thirdweb/extensions/farcaster"; + +const transaction = add({ + contract, + keyType: ..., + key: ..., + metadataType: ..., + metadata: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function add( + options: BaseTransactionOptions< + AddParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "add" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + AddParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## ADD\_TYPEHASH + + Calls the "ADD\_TYPEHASH" function on the contract. + +### Example + +```ts +import { ADD_TYPEHASH } from "thirdweb/extensions/farcaster"; + +const result = await ADD_TYPEHASH({ + contract, +}); +``` + +```ts +function ADD_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the ADD\_TYPEHASH function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## addFor + + Prepares a transaction to call the "addFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { addFor } from "thirdweb/extensions/farcaster"; + +const transaction = addFor({ + contract, + fidOwner: ..., + keyType: ..., + key: ..., + metadataType: ..., + metadata: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function addFor( + options: BaseTransactionOptions< + AddForParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "addFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + AddForParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## keyRegistry + + Calls the "keyRegistry" function on the contract. + +### Example + +```ts +import { keyRegistry } from "thirdweb/extensions/farcaster"; + +const result = await keyRegistry({ + contract, +}); +``` + +```ts +function keyRegistry( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the keyRegistry function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## nonces + + Calls the "nonces" function on the contract. + +### Example + +```ts +import { nonces } from "thirdweb/extensions/farcaster"; + +const result = await nonces({ + contract, + account: ..., +}); +``` + +```ts +function nonces( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the nonces function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## addEvent + + Creates an event object for the Add event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { addEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + addEvent({ + fid: ..., + keyType: ..., + key: ..., +}) +], +}); +``` + +```ts +function addEvent( + filters: Partial<{ + fid: bigint; + key: `0x${string}`; + keyType: number; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "keyType"; + readonly type: "uint32"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "metadata"; readonly type: "bytes" }, + ]; + readonly name: "Add"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + fid: bigint; + key: `0x${string}`; + keyType: number; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "keyType"; + readonly type: "uint32"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "metadata"; readonly type: "bytes" }, + ]; + readonly name: "Add"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## adminResetEvent + + Creates an event object for the AdminReset event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { adminResetEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + adminResetEvent({ + fid: ..., + key: ..., +}) +], +}); +``` + +```ts +function adminResetEvent( + filters: Partial<{ fid: bigint; key: `0x${string}` }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + ]; + readonly name: "AdminReset"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ fid: bigint; key: `0x${string}` }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + ]; + readonly name: "AdminReset"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## freezeKeyGatewayEvent + + Creates an event object for the FreezeKeyGateway event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { freezeKeyGatewayEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [freezeKeyGatewayEvent()], +}); +``` + +```ts +function freezeKeyGatewayEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "keyGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeKeyGateway"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "keyGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeKeyGateway"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## gatewayFrozen + + Calls the "gatewayFrozen" function on the contract. + +### Example + +```ts +import { gatewayFrozen } from "thirdweb/extensions/farcaster"; + +const result = await gatewayFrozen({ + contract, +}); +``` + +```ts +function gatewayFrozen( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the gatewayFrozen function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## idRegistry + + Calls the "idRegistry" function on the contract. + +### Example + +```ts +import { idRegistry } from "thirdweb/extensions/farcaster"; + +const result = await idRegistry({ + contract, +}); +``` + +```ts +function idRegistry(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the idRegistry function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## keyAt + + Calls the "keyAt" function on the contract. + +### Example + +```ts +import { keyAt } from "thirdweb/extensions/farcaster"; + +const result = await keyAt({ + contract, + fid: ..., + state: ..., + index: ..., +}); +``` + +```ts +function keyAt( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the keyAt function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## keyDataOf + + Calls the "keyDataOf" function on the contract. + +### Example + +```ts +import { keyDataOf } from "thirdweb/extensions/farcaster"; + +const result = await keyDataOf({ + contract, + fid: ..., + key: ..., +}); +``` + +```ts +function keyDataOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the keyDataOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## keyGateway + + Calls the "keyGateway" function on the contract. + +### Example + +```ts +import { keyGateway } from "thirdweb/extensions/farcaster"; + +const result = await keyGateway({ + contract, +}); +``` + +```ts +function keyGateway(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the keyGateway function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## keysOf + + Calls the "keysOf" function on the contract. + +### Example + +```ts +import { keysOf } from "thirdweb/extensions/farcaster"; + +const result = await keysOf({ + contract, + fid: ..., + state: ..., +}); +``` + +```ts +function keysOf(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the keysOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## maxKeysPerFid + + Calls the "maxKeysPerFid" function on the contract. + +### Example + +```ts +import { maxKeysPerFid } from "thirdweb/extensions/farcaster"; + +const result = await maxKeysPerFid({ + contract, +}); +``` + +```ts +function maxKeysPerFid( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the maxKeysPerFid function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## remove + + Prepares a transaction to call the "remove" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { remove } from "thirdweb/extensions/farcaster"; + +const transaction = remove({ + contract, + key: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function remove( + options: BaseTransactionOptions< + RemoveParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "remove" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RemoveParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## REMOVE\_TYPEHASH + + Calls the "REMOVE\_TYPEHASH" function on the contract. + +### Example + +```ts +import { REMOVE_TYPEHASH } from "thirdweb/extensions/farcaster"; + +const result = await REMOVE_TYPEHASH({ + contract, +}); +``` + +```ts +function REMOVE_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the REMOVE\_TYPEHASH function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## removeEvent + + Creates an event object for the Remove event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { removeEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + removeEvent({ + fid: ..., + key: ..., +}) +], +}); +``` + +```ts +function removeEvent( + filters: Partial<{ fid: bigint; key: `0x${string}` }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + ]; + readonly name: "Remove"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ fid: bigint; key: `0x${string}` }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "fid"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "key"; + readonly type: "bytes"; + }, + { readonly name: "keyBytes"; readonly type: "bytes" }, + ]; + readonly name: "Remove"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## removeFor + + Prepares a transaction to call the "removeFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { removeFor } from "thirdweb/extensions/farcaster"; + +const transaction = removeFor({ + contract, + fidOwner: ..., + key: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function removeFor( + options: BaseTransactionOptions< + RemoveForParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "removeFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RemoveForParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setIdRegistryEvent + + Creates an event object for the SetIdRegistry event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setIdRegistryEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setIdRegistryEvent()], +}); +``` + +```ts +function setIdRegistryEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldIdRegistry"; readonly type: "address" }, + { readonly name: "newIdRegistry"; readonly type: "address" }, + ]; + readonly name: "SetIdRegistry"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldIdRegistry"; readonly type: "address" }, + { readonly name: "newIdRegistry"; readonly type: "address" }, + ]; + readonly name: "SetIdRegistry"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## setKeyGatewayEvent + + Creates an event object for the SetKeyGateway event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setKeyGatewayEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setKeyGatewayEvent()], +}); +``` + +```ts +function setKeyGatewayEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldKeyGateway"; readonly type: "address" }, + { readonly name: "newKeyGateway"; readonly type: "address" }, + ]; + readonly name: "SetKeyGateway"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldKeyGateway"; readonly type: "address" }, + { readonly name: "newKeyGateway"; readonly type: "address" }, + ]; + readonly name: "SetKeyGateway"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## setMaxKeysPerFidEvent + + Creates an event object for the SetMaxKeysPerFid event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setMaxKeysPerFidEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setMaxKeysPerFidEvent()], +}); +``` + +```ts +function setMaxKeysPerFidEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldMax"; readonly type: "uint256" }, + { readonly name: "newMax"; readonly type: "uint256" }, + ]; + readonly name: "SetMaxKeysPerFid"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldMax"; readonly type: "uint256" }, + { readonly name: "newMax"; readonly type: "uint256" }, + ]; + readonly name: "SetMaxKeysPerFid"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## setValidatorEvent + + Creates an event object for the SetValidator event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { setValidatorEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setValidatorEvent()], +}); +``` + +```ts +function setValidatorEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "keyType"; readonly type: "uint32" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "oldValidator"; readonly type: "address" }, + { readonly name: "newValidator"; readonly type: "address" }, + ]; + readonly name: "SetValidator"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "keyType"; readonly type: "uint32" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "oldValidator"; readonly type: "address" }, + { readonly name: "newValidator"; readonly type: "address" }, + ]; + readonly name: "SetValidator"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## totalKeys + + Calls the "totalKeys" function on the contract. + +### Example + +```ts +import { totalKeys } from "thirdweb/extensions/farcaster"; + +const result = await totalKeys({ + contract, + fid: ..., + state: ..., +}); +``` + +```ts +function totalKeys( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalKeys function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## batchRent + + Prepares a transaction to call the "batchRent" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { batchRent } from "thirdweb/extensions/farcaster"; + +const transaction = batchRent({ + contract, + fids: ..., + units: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function batchRent( + options: BaseTransactionOptions< + BatchRentParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "batchRent" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + BatchRentParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## deprecationTimestamp + + Calls the "deprecationTimestamp" function on the contract. + +### Example + +```ts +import { deprecationTimestamp } from "thirdweb/extensions/farcaster"; + +const result = await deprecationTimestamp({ + contract, +}); +``` + +```ts +function deprecationTimestamp( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the deprecationTimestamp function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## maxUnits + + Calls the "maxUnits" function on the contract. + +### Example + +```ts +import { maxUnits } from "thirdweb/extensions/farcaster"; + +const result = await maxUnits({ + contract, +}); +``` + +```ts +function maxUnits(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the maxUnits function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## price + + Calls the "price" function on the contract. + +### Example + +```ts +import { price } from "thirdweb/extensions/farcaster"; + +const result = await price({ + contract, + units: ..., +}); +``` + +```ts +function price( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the price function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## rent + + Prepares a transaction to call the "rent" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { rent } from "thirdweb/extensions/farcaster"; + +const transaction = rent({ + contract, + fid: ..., + units: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function rent( + options: BaseTransactionOptions< + RentParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "rent" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RentParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## rentedUnits + + Calls the "rentedUnits" function on the contract. + +### Example + +```ts +import { rentedUnits } from "thirdweb/extensions/farcaster"; + +const result = await rentedUnits({ + contract, +}); +``` + +```ts +function rentedUnits( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the rentedUnits function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## unitPrice + + Calls the "unitPrice" function on the contract. + +### Example + +```ts +import { unitPrice } from "thirdweb/extensions/farcaster"; + +const result = await unitPrice({ + contract, +}); +``` + +```ts +function unitPrice(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the unitPrice function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## usdUnitPrice + + Calls the "usdUnitPrice" function on the contract. + +### Example + +```ts +import { usdUnitPrice } from "thirdweb/extensions/farcaster"; + +const result = await usdUnitPrice({ + contract, +}); +``` + +```ts +function usdUnitPrice( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the usdUnitPrice function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- +## LENS +--- + +## exists + + Calls the "exists" function on the contract. + +### Example + +```ts +import { exists } from "thirdweb/extensions/lens"; + +const result = await exists({ + contract, + tokenId: ..., +}); +``` + +```ts +function exists( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the exists function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getContentURI + + Calls the "getContentURI" function on the contract. + +### Example + +```ts +import { getContentURI } from "thirdweb/extensions/lens"; + +const result = await getContentURI({ + contract, + profileId: ..., + pubId: ..., +}); +``` + +```ts +function getContentURI( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getContentURI function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getDefaultHandle + + Calls the "getDefaultHandle" function on the contract. + +### Example + +```ts +import { getDefaultHandle } from "thirdweb/extensions/lens"; + +const result = await getDefaultHandle({ + contract, + profileId: ..., +}); +``` + +```ts +function getDefaultHandle( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getDefaultHandle function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getFollowData + + Calls the "getFollowData" function on the contract. + +### Example + +```ts +import { getFollowData } from "thirdweb/extensions/lens"; + +const result = await getFollowData({ + contract, + followTokenId: ..., +}); +``` + +```ts +function getFollowData( + options: BaseTransactionOptions, +): Promise<{ + followerProfileId: bigint; + followTimestamp: number; + originalFollowTimestamp: number; + profileIdAllowedToRecover: bigint; +}>; +``` + +### Parameters + + The options for the getFollowData function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + followerProfileId: bigint; + followTimestamp: number; + originalFollowTimestamp: number; + profileIdAllowedToRecover: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getFollowerCount + + Calls the "getFollowerCount" function on the contract. + +### Example + +```ts +import { getFollowerCount } from "thirdweb/extensions/lens"; + +const result = await getFollowerCount({ + contract, +}); +``` + +```ts +function getFollowerCount( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getFollowerCount function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getFollowerProfileId + + Calls the "getFollowerProfileId" function on the contract. + +### Example + +```ts +import { getFollowerProfileId } from "thirdweb/extensions/lens"; + +const result = await getFollowerProfileId({ + contract, + followTokenId: ..., +}); +``` + +```ts +function getFollowerProfileId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getFollowerProfileId function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getFollowTokenId + + Calls the "getFollowTokenId" function on the contract. + +### Example + +```ts +import { getFollowTokenId } from "thirdweb/extensions/lens"; + +const result = await getFollowTokenId({ + contract, + followerProfileId: ..., +}); +``` + +```ts +function getFollowTokenId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getFollowTokenId function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getFullProfile + + Return the profile data _with Lens handle_ and optional join date + + In Lens Protocol, each profile is associated with an ERC721 token, thus, the tokenId represent profileId and the 2 terms can be used interchangeably + +### Example + +```ts +import { getFullProfile } from "thirdweb/extension/lens"; + +const profileId = 10000n; // profileId is the tokenId of the NFT +const lensProfile = await getFullProfile({ profileId, client }); +``` + +```ts +function getFullProfile( + options: GetFullProfileParams, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + client: ThirdwebClient; + includeJoinDate?: boolean; + overrides?: { + chain?: Chain; + lensHandleAddress?: string; + lensHubAddress?: string; + tokenHandleRegistryAddress?: string; + }; + profileId: bigint; +}; +``` + +### Returns + +```ts +let returnType: { + handle: string; + joinDate: bigint | null; + profileData: LensProfileSchema | null; +} | null; +``` +--- + +## getHandle + + Calls the "getHandle" function on the contract. + +### Example + +```ts +import { getHandle } from "thirdweb/extensions/lens"; + +const result = await getHandle({ + contract, + tokenId: ..., +}); +``` + +```ts +function getHandle( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getHandle function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getHandleFromProfileId + + Return the Lens handle of a profile in the format: lens/@`` + +### Example + +```ts +import { getHandleFromProfileId } from "thirdweb/extensions/lens"; + +const profileId = 461662n; +const handle = await getHandleFromProfileId({ profileId, client }); // "lens/@captain_jack" +``` + +```ts +function getHandleFromProfileId( + options: GetHandleFromProfileIdParams, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + client: ThirdwebClient; + overrides?: { + chain?: Chain; + lensHandleAddress?: string; + tokenHandleRegistryAddress?: string; + }; + profileId: bigint; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## getHandleTokenURIContract + + Calls the "getHandleTokenURIContract" function on the contract. + +### Example + +```ts +import { getHandleTokenURIContract } from "thirdweb/extensions/lens"; + +const result = await getHandleTokenURIContract({ + contract, +}); +``` + +```ts +function getHandleTokenURIContract( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getHandleTokenURIContract function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getLocalName + + Calls the "getLocalName" function on the contract. + +### Example + +```ts +import { getLocalName } from "thirdweb/extensions/lens"; + +const result = await getLocalName({ + contract, + tokenId: ..., +}); +``` + +```ts +function getLocalName( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getLocalName function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getModuleTypes + + Calls the "getModuleTypes" function on the contract. + +### Example + +```ts +import { getModuleTypes } from "thirdweb/extensions/lens"; + +const result = await getModuleTypes({ + contract, + moduleAddress: ..., +}); +``` + +```ts +function getModuleTypes( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getModuleTypes function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getOriginalFollowTimestamp + + Calls the "getOriginalFollowTimestamp" function on the contract. + +### Example + +```ts +import { getOriginalFollowTimestamp } from "thirdweb/extensions/lens"; + +const result = await getOriginalFollowTimestamp({ + contract, + followTokenId: ..., +}); +``` + +```ts +function getOriginalFollowTimestamp( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getOriginalFollowTimestamp function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getProfile + + Calls the "getProfile" function on the contract. + +### Example + +```ts +import { getProfile } from "thirdweb/extensions/lens"; + +const result = await getProfile({ + contract, + profileId: ..., +}); +``` + +```ts +function getProfile( + options: BaseTransactionOptions, +): Promise<{ + __DEPRECATED__followNFTURI: string; + __DEPRECATED__handle: string; + __DEPRECATED__imageURI: string; + followModule: string; + followNFT: string; + metadataURI: string; + pubCount: bigint; +}>; +``` + +### Parameters + + The options for the getProfile function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + __DEPRECATED__followNFTURI: string; + __DEPRECATED__handle: string; + __DEPRECATED__imageURI: string; + followModule: string; + followNFT: string; + metadataURI: string; + pubCount: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getProfileIdAllowedToRecover + + Calls the "getProfileIdAllowedToRecover" function on the contract. + +### Example + +```ts +import { getProfileIdAllowedToRecover } from "thirdweb/extensions/lens"; + +const result = await getProfileIdAllowedToRecover({ + contract, + followTokenId: ..., +}); +``` + +```ts +function getProfileIdAllowedToRecover( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getProfileIdAllowedToRecover function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getProfileIdByHandleHash + + Calls the "getProfileIdByHandleHash" function on the contract. + +### Example + +```ts +import { getProfileIdByHandleHash } from "thirdweb/extensions/lens"; + +const result = await getProfileIdByHandleHash({ + contract, + handleHash: ..., +}); +``` + +```ts +function getProfileIdByHandleHash( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getProfileIdByHandleHash function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getProfileMetadata + + Download user lens profile from Arweave This method does NOT give you the user handle & join-time - consider using `getFullProfileData` instead It is useful & cost efficient if you only want to get user's name, bio, picture, coverPicture etc. + +### Example + +```ts +import { getProfileMetadata } from "thirdweb/extensions/lens"; + +const profileData = await getProfileMetadata({ profileId, client }); + +if (profileData) { + console.log("Display name: ", profileData.lens.name); + console.log("Bio: ", profileData.lens.bio); +} +``` + +```ts +function getProfileMetadata( + options: GetProfileMetadataParams, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + client: ThirdwebClient; + overrides?: { chain?: Chain; lensHubAddress?: string }; + profileId: bigint; +}; +``` + +### Returns + +```ts +let returnType: { + lens: { + appId?: string; + attributes: Array; + bio: string; + coverPicture: string; + id: string; + name: string; + picture: string; + }; + signature: string; +}; +``` + + LensProfileSchema | null +--- + +## getPublication + + Calls the "getPublication" function on the contract. + +### Example + +```ts +import { getPublication } from "thirdweb/extensions/lens"; + +const result = await getPublication({ + contract, + profileId: ..., + pubId: ..., +}); +``` + +```ts +function getPublication( + options: BaseTransactionOptions, +): Promise<{ + __DEPRECATED__collectModule: string; + __DEPRECATED__collectNFT: string; + contentURI: string; + pointedProfileId: bigint; + pointedPubId: bigint; + pubType: number; + referenceModule: string; + rootProfileId: bigint; + rootPubId: bigint; +}>; +``` + +### Parameters + + The options for the getPublication function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + __DEPRECATED__collectModule: string; + __DEPRECATED__collectNFT: string; + contentURI: string; + pointedProfileId: bigint; + pointedPubId: bigint; + pubType: number; + referenceModule: string; + rootProfileId: bigint; + rootPubId: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getTokenId + + Calls the "getTokenId" function on the contract. + +### Example + +```ts +import { getTokenId } from "thirdweb/extensions/lens"; + +const result = await getTokenId({ + contract, + localName: ..., +}); +``` + +```ts +function getTokenId( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getTokenId function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isErc20CurrencyRegistered + + Calls the "isErc20CurrencyRegistered" function on the contract. + +### Example + +```ts +import { isErc20CurrencyRegistered } from "thirdweb/extensions/lens"; + +const result = await isErc20CurrencyRegistered({ + contract, + currencyAddress: ..., +}); +``` + +```ts +function isErc20CurrencyRegistered( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isErc20CurrencyRegistered function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isFollowing + + Calls the "isFollowing" function on the contract. + +### Example + +```ts +import { isFollowing } from "thirdweb/extensions/lens"; + +const result = await isFollowing({ + contract, + followerProfileId: ..., +}); +``` + +```ts +function isFollowing( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isFollowing function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isModuleRegistered + + Calls the "isModuleRegistered" function on the contract. + +### Example + +```ts +import { isModuleRegistered } from "thirdweb/extensions/lens"; + +const result = await isModuleRegistered({ + contract, + moduleAddress: ..., +}); +``` + +```ts +function isModuleRegistered( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isModuleRegistered function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isModuleRegisteredAs + + Calls the "isModuleRegisteredAs" function on the contract. + +### Example + +```ts +import { isModuleRegisteredAs } from "thirdweb/extensions/lens"; + +const result = await isModuleRegisteredAs({ + contract, + moduleAddress: ..., + moduleType: ..., +}); +``` + +```ts +function isModuleRegisteredAs( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isModuleRegisteredAs function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## mintTimestampOf + + Calls the "mintTimestampOf" function on the contract. + +### Example + +```ts +import { mintTimestampOf } from "thirdweb/extensions/lens"; + +const result = await mintTimestampOf({ + contract, + tokenId: ..., +}); +``` + +```ts +function mintTimestampOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the mintTimestampOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## mintTimestampOfFollowNFT + + Calls the "mintTimestampOf" function on the contract. + +### Example + +```ts +import { mintTimestampOf } from "thirdweb/extensions/lens"; + +const result = await mintTimestampOf({ + contract, + tokenId: ..., +}); +``` + +```ts +function mintTimestampOfFollowNFT( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the mintTimestampOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## nonces + + Calls the "nonces" function on the contract. + +### Example + +```ts +import { nonces } from "thirdweb/extensions/lens"; + +const result = await nonces({ + contract, + signer: ..., +}); +``` + +```ts +function nonces( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the nonces function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## resolve + + Calls the "resolve" function on the contract. + +### Example + +```ts +import { resolve } from "thirdweb/extensions/lens"; + +const result = await resolve({ + contract, + handleId: ..., +}); +``` + +```ts +function resolve( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the resolve function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## resolveAddress + + Take in a Lens handle or local-name and return the wallet address behind that handle/local-name. For example, "lens/vitalik" is a handle, with "lens" being the namespace and "vitalik" being the local name + +### Example + +```ts +import { resolveAddress } from "thirdweb/extensions/lens"; + +const walletAddress = await resolveAddress({ + name: "vitalik", + client, +}); +``` + +```ts +function resolveAddress( + options: ResolveLensAddressParams, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + client: ThirdwebClient; + name: string; + overrides?: { chain?: Chain; lensHandleContractAddress?: string }; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## tokenDataOf + + Calls the "tokenDataOf" function on the contract. + +### Example + +```ts +import { tokenDataOf } from "thirdweb/extensions/lens"; + +const result = await tokenDataOf({ + contract, + tokenId: ..., +}); +``` + +```ts +function tokenDataOf( + options: BaseTransactionOptions, +): Promise<{ mintTimestamp: bigint; owner: string }>; +``` + +### Parameters + + The options for the tokenDataOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ mintTimestamp: bigint; owner: string }>; +``` + + The parsed result of the function call. +--- +## MARKETPLACE +--- + +## acceptedOfferEvent + + Creates an event object for the AcceptedOffer event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { acceptedOfferEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + acceptedOfferEvent({ + offeror: ..., + offerId: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function acceptedOfferEvent( + filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "seller"; readonly type: "address" }, + { readonly name: "quantityBought"; readonly type: "uint256" }, + { readonly name: "totalPricePaid"; readonly type: "uint256" }, + ]; + readonly name: "AcceptedOffer"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "seller"; readonly type: "address" }, + { readonly name: "quantityBought"; readonly type: "uint256" }, + { readonly name: "totalPricePaid"; readonly type: "uint256" }, + ]; + readonly name: "AcceptedOffer"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## acceptOffer + + Accepts an offer after performing necessary checks and validations. Throws an error if the offer is not active, the offeror's balance is insufficient, or the offeror's allowance is insufficient. + +### Example + +```ts +import { acceptOffer } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const acceptOfferTx = acceptOffer({ + contract, + offerId: 1n, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function acceptOffer( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for accepting the offer. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction object that can be sent to accept the offer. +--- + +## approveBuyerForListing + + Prepares a transaction to call the "approveBuyerForListing" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { approveBuyerForListing } from "thirdweb/extensions/marketplace"; + +const transaction = approveBuyerForListing({ + contract, + listingId: ..., + buyer: ..., + toApprove: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function approveBuyerForListing( + options: BaseTransactionOptions< + | ApproveBuyerForListingParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "approveBuyerForListing" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | ApproveBuyerForListingParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## approveCurrencyForListing + + Prepares a transaction to call the "approveCurrencyForListing" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { approveCurrencyForListing } from "thirdweb/extensions/marketplace"; + +const transaction = approveCurrencyForListing({ + contract, + listingId: ..., + currency: ..., + pricePerTokenInCurrency: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function approveCurrencyForListing( + options: BaseTransactionOptions< + | ApproveCurrencyForListingParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "approveCurrencyForListing" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | ApproveCurrencyForListingParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## auctionClosedEvent + + Creates an event object for the AuctionClosed event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { auctionClosedEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + auctionClosedEvent({ + auctionId: ..., + assetContract: ..., + closer: ..., +}) +], +}); +``` + +```ts +function auctionClosedEvent( + filters: Partial<{ + assetContract: string; + auctionId: bigint; + closer: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "closer"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "auctionCreator"; readonly type: "address" }, + { readonly name: "winningBidder"; readonly type: "address" }, + ]; + readonly name: "AuctionClosed"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + auctionId: bigint; + closer: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "closer"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "auctionCreator"; readonly type: "address" }, + { readonly name: "winningBidder"; readonly type: "address" }, + ]; + readonly name: "AuctionClosed"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## bidInAuction + + Places a bid in an English auction. + +### Example + +```ts +import { bidInAuction } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = bidInAuction({ + contract, + auctionId: 0n, + bidAmount: "100", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function bidInAuction( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for placing the bid. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that can be sent to place the bid. +--- + +## buyerApprovedForListingEvent + + Creates an event object for the BuyerApprovedForListing event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { buyerApprovedForListingEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + buyerApprovedForListingEvent({ + listingId: ..., + buyer: ..., +}) +], +}); +``` + +```ts +function buyerApprovedForListingEvent( + filters: Partial<{ buyer: string; listingId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "buyer"; + readonly type: "address"; + }, + { readonly name: "approved"; readonly type: "bool" }, + ]; + readonly name: "BuyerApprovedForListing"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ buyer: string; listingId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "buyer"; + readonly type: "address"; + }, + { readonly name: "approved"; readonly type: "bool" }, + ]; + readonly name: "BuyerApprovedForListing"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## buyFromListing + + Buys a listing from the marketplace. + +### Example + +```ts +import { buyFromListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = buyFromListing({ + contract, + listingId: 1n, + quantity: 1n, + recipient: "0x...", +}); + +await sendTransaction({ transaction, account }); +``` + + When using `buyFromListing` with Pay, the `erc20Value` will be automatically set to the listing currency. + +```ts +function buyFromListing( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for buying from a listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the transaction result. +--- + +## buyoutAuction + + Buys out an English auction. + +### Example + +```ts +import { buyoutAuction } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = buyoutAuction({ + contract, + auctionId: 0n, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function buyoutAuction( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for buying out the auction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that can be sent to buy out the auction. +--- + +## cancelAuction + + Cancels an auction by providing the necessary options. + +### Example + +```ts +import { cancelAuction } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = cancelAuction({ + contract, + auctionId: 0n, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function cancelAuction( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for canceling the auction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that can be sent to cancel the auction. +--- + +## cancelledAuctionEvent + + Creates an event object for the CancelledAuction event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { cancelledAuctionEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + cancelledAuctionEvent({ + auctionCreator: ..., + auctionId: ..., +}) +], +}); +``` + +```ts +function cancelledAuctionEvent( + filters: Partial<{ auctionCreator: string; auctionId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + ]; + readonly name: "CancelledAuction"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ auctionCreator: string; auctionId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + ]; + readonly name: "CancelledAuction"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## cancelledListingEvent + + Creates an event object for the CancelledListing event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { cancelledListingEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + cancelledListingEvent({ + listingCreator: ..., + listingId: ..., +}) +], +}); +``` + +```ts +function cancelledListingEvent( + filters: Partial<{ listingCreator: string; listingId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + ]; + readonly name: "CancelledListing"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ listingCreator: string; listingId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + ]; + readonly name: "CancelledListing"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## cancelledOfferEvent + + Creates an event object for the CancelledOffer event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { cancelledOfferEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + cancelledOfferEvent({ + offeror: ..., + offerId: ..., +}) +], +}); +``` + +```ts +function cancelledOfferEvent( + filters: Partial<{ offerId: bigint; offeror: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; + readonly type: "uint256"; + }, + ]; + readonly name: "CancelledOffer"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ offerId: bigint; offeror: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; + readonly type: "uint256"; + }, + ]; + readonly name: "CancelledOffer"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## cancelListing + + Prepares a transaction to call the "cancelListing" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { cancelListing } from "thirdweb/extensions/marketplace"; + +const transaction = cancelListing({ + contract, + listingId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function cancelListing( + options: BaseTransactionOptions< + | CancelListingParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "cancelListing" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CancelListingParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## cancelOffer + + Prepares a transaction to call the "cancelOffer" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { cancelOffer } from "thirdweb/extensions/marketplace"; + +const transaction = cancelOffer({ + contract, + offerId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function cancelOffer( + options: BaseTransactionOptions< + | CancelOfferParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "cancelOffer" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CancelOfferParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## collectAuctionPayout + + Prepares a transaction to call the "collectAuctionPayout" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { collectAuctionPayout } from "thirdweb/extensions/marketplace"; + +const transaction = collectAuctionPayout({ + contract, + auctionId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function collectAuctionPayout( + options: BaseTransactionOptions< + | CollectAuctionPayoutParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "collectAuctionPayout" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CollectAuctionPayoutParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## collectAuctionTokens + + Prepares a transaction to call the "collectAuctionTokens" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { collectAuctionTokens } from "thirdweb/extensions/marketplace"; + +const transaction = collectAuctionTokens({ + contract, + auctionId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function collectAuctionTokens( + options: BaseTransactionOptions< + | CollectAuctionTokensParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "collectAuctionTokens" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CollectAuctionTokensParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## createAuction + + Creates an auction. + +### Example + +```typescript +import { createAuction } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = createAuction({...}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function createAuction( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for creating the auction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The result of creating the auction. +--- + +## createListing + + Creates a direct listing. + +### Example + +```typescript +import { createListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = createListing({ + assetContractAddress: "0x...", // the NFT contract address that you want to sell + tokenId={0n}, // the token id you want to sell + pricePerToken="0.1" // sell for 0.1 +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function createListing( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for creating the direct listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The result of creating the direct listing. +--- + +## currencyApprovedForListingEvent + + Creates an event object for the CurrencyApprovedForListing event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { currencyApprovedForListingEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + currencyApprovedForListingEvent({ + listingId: ..., + currency: ..., +}) +], +}); +``` + +```ts +function currencyApprovedForListingEvent( + filters: Partial<{ currency: string; listingId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "currency"; + readonly type: "address"; + }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + ]; + readonly name: "CurrencyApprovedForListing"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ currency: string; listingId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "currency"; + readonly type: "address"; + }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + ]; + readonly name: "CurrencyApprovedForListing"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## currencyPriceForListing + + Retrieves the currency price for a listing. + +### Example + +```ts +import { currencyPriceForListing } from "thirdweb/extensions/marketplace"; + +const price = await currencyPriceForListing({ + contract, + listingId: 1n, + currency: "0x...", +}); +``` + +```ts +function currencyPriceForListing( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the currency price. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the currency price as a bigint. +--- + +## executeSale + + Executes a sale for an English auction. + +### Example + +```ts +import { executeSale } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = executeSale({ + contract, + auctionId: 0n, +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function executeSale( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for executing the sale. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that can be sent to execute the sale. +--- + +## getAllAuctions + + Retrieves all auctions based on the provided options. + +### Example + +```ts +import { getAllAuctions } from "thirdweb/extensions/marketplace"; + +const listings = await getAllAuctions({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllAuctions( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the auctions. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + bidBufferBps: bigint; + buyoutBidAmount: bigint; + buyoutCurrencyValue: GetBalanceResult; + creatorAddress: Address; + currencyContractAddress: Address; + endTimeInSeconds: bigint; + id: bigint; + minimumBidAmount: bigint; + minimumBidCurrencyValue: GetBalanceResult; + quantity: bigint; + startTimeInSeconds: bigint; + status: ListingStatus; + timeBufferInSeconds: bigint; + tokenId: bigint; + type: "english-auction"; +}; +``` + + A promise that resolves to the auctions array. +--- + +## getAllListings + + Retrieves all direct listings based on the provided options. + +### Example + +```ts +import { getAllListings } from "thirdweb/extensions/marketplace"; + +const listings = await getAllListings({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllListings( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + creatorAddress: Address; + currencyContractAddress: Address; + currencyValuePerToken: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + isReservedListing: boolean; + pricePerToken: bigint; + quantity: bigint; + startTimeInSeconds: bigint; + status: ListingStatus; + tokenId: bigint; + type: "direct-listing"; +}; +``` + + A promise that resolves to the direct listings array. +--- + +## getAllOffers + + Retrieves all offers based on the provided options. + +### Example + +```ts +import { getAllOffers } from "thirdweb/extensions/marketplace"; + +const listings = await getAllOffers({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllOffers( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the offers. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + currencyContractAddress: Address; + currencyValue: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + offerorAddress: Address; + quantity: bigint; + status: ListingStatus; + tokenId: bigint; + totalPrice: bigint; +}; +``` + + A promise that resolves to the offers array. +--- + +## getAllValidAuctions + + Retrieves all valid auctions based on the provided options. + +### Example + +```ts +import { getAllValidAuctions } from "thirdweb/extensions/marketplace"; + +const validAuctions = await getAllValidAuctions({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllValidAuctions( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + bidBufferBps: bigint; + buyoutBidAmount: bigint; + buyoutCurrencyValue: GetBalanceResult; + creatorAddress: Address; + currencyContractAddress: Address; + endTimeInSeconds: bigint; + id: bigint; + minimumBidAmount: bigint; + minimumBidCurrencyValue: GetBalanceResult; + quantity: bigint; + startTimeInSeconds: bigint; + status: ListingStatus; + timeBufferInSeconds: bigint; + tokenId: bigint; + type: "english-auction"; +}; +``` + + A promise that resolves to the valid auctions array. +--- + +## getAllValidListings + + Retrieves all valid direct listings based on the provided options. + +### Example + +```ts +import { getAllValidListings } from "thirdweb/extensions/marketplace"; + +const validListings = await getAllValidListings({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllValidListings( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the valid listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + creatorAddress: Address; + currencyContractAddress: Address; + currencyValuePerToken: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + isReservedListing: boolean; + pricePerToken: bigint; + quantity: bigint; + startTimeInSeconds: bigint; + status: ListingStatus; + tokenId: bigint; + type: "direct-listing"; +}; +``` + + A promise that resolves to the direct listings array. +--- + +## getAllValidOffers + + Retrieves all valid offers based on the provided options. + +### Example + +```ts +import { getAllValidOffers } from "thirdweb/extensions/marketplace"; + +const validOffers = await getAllValidOffers({ + contract, + start: 0, + count: 10, +}); +``` + +```ts +function getAllValidOffers( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving the valid offers. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + currencyContractAddress: Address; + currencyValue: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + offerorAddress: Address; + quantity: bigint; + status: ListingStatus; + tokenId: bigint; + totalPrice: bigint; +}; +``` + + A promise that resolves to the offers array. +--- + +## getAuction + + Retrieves an auction listing based on the provided options. + +### Example + +```ts +import { getListing } from "thirdweb/extensions/marketplace"; + +const listing = await getListing({ contract, listingId: 1n }); +``` + +```ts +function getAuction( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + bidBufferBps: bigint; + buyoutBidAmount: bigint; + buyoutCurrencyValue: GetBalanceResult; + creatorAddress: Address; + currencyContractAddress: Address; + endTimeInSeconds: bigint; + id: bigint; + minimumBidAmount: bigint; + minimumBidCurrencyValue: GetBalanceResult; + quantity: bigint; + startTimeInSeconds: bigint; + status: ListingStatus; + timeBufferInSeconds: bigint; + tokenId: bigint; + type: "english-auction"; +}; +``` + + A promise that resolves to the direct listing. +--- + +## getListing + + Retrieves a direct listing based on the provided options. + +### Example + +```ts +import { getListing } from "thirdweb/extensions/marketplace"; + +const listing = await getListing({ contract, listingId: 1n }); +``` + +```ts +function getListing( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + creatorAddress: Address; + currencyContractAddress: Address; + currencyValuePerToken: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + isReservedListing: boolean; + pricePerToken: bigint; + quantity: bigint; + startTimeInSeconds: bigint; + status: ListingStatus; + tokenId: bigint; + type: "direct-listing"; +}; +``` + + A promise that resolves to the direct listing. +--- + +## getOffer + + Retrieves an offer based on the provided options. + +### Example + +```ts +import { getOffer } from "thirdweb/extensions/marketplace"; + +const listing = await getOffer({ contract, listingId: 1n }); +``` + +```ts +function getOffer( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the offer. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + asset: NFT; + assetContractAddress: Address; + currencyContractAddress: Address; + currencyValue: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + offerorAddress: Address; + quantity: bigint; + status: ListingStatus; + tokenId: bigint; + totalPrice: bigint; +}; +``` + + A promise that resolves to the offer. +--- + +## getWinningBid + + Retrieves the winning bid information for a given auction. + +### Example + +```ts +import { getWinningBid } from "thirdweb/extensions/marketplace"; + +const winningBid = await getWinningBid({ + contract, + auctionId: 0n, +}); +``` + +```ts +function getWinningBid( + options: BaseTransactionOptions, +): Promise< + | undefined + | { + bidAmountWei: bigint; + bidderAddress: string; + currencyAddress: string; + currencyValue: CurrencyValue; + } +>; +``` + +### Parameters + + The options for retrieving the winning bid. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise< + | undefined + | { + bidAmountWei: bigint; + bidderAddress: string; + currencyAddress: string; + currencyValue: CurrencyValue; + } +>; +``` + + The winning bid information, or undefined if there is no winning bid. +--- + +## isBidInAuctionSupported + + Checks if the `bidInAuction` method is supported by the given contract. + +### Example + +```ts +import { isBidInAuctionSupported } from "thirdweb/extensions/marketplace"; + +const supported = isBidInAuctionSupported(["0x..."]); +``` + +```ts +function isBidInAuctionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `bidInAuction` method is supported. +--- + +## isBuyerApprovedForListing + + Checks if the buyer is approved for a listing. + +### Example + +```ts +import { isBuyerApprovedForListing } from "thirdweb/extensions/marketplace"; + +const isApproved = await isBuyerApprovedForListing({ + contract, + listingId: 1n, + buyer: "0x...", +}); +``` + +```ts +function isBuyerApprovedForListing( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for checking buyer approval. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to a boolean indicating whether the buyer is approved for the listing. +--- + +## isBuyFromListingSupported + + Checks if the `buyFromListing` method is supported by the given contract. + +### Example + +```ts +import { isBuyFromListingSupported } from "thirdweb/extensions/marketplace"; + +const supported = isBuyFromListingSupported(["0x..."]); +``` + +```ts +function isBuyFromListingSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `buyFromListing` method is supported. +--- + +## isCancelAuctionSupported + + Checks if the `cancelAuction` method is supported by the given contract. + +### Example + +```ts +import { isCancelAuctionSupported } from "thirdweb/extensions/marketplace"; + +const supported = isCancelAuctionSupported(["0x..."]); +``` + +```ts +function isCancelAuctionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `cancelAuction` method is supported. +--- + +## isCancelListingSupported + + Checks if the `cancelListing` method is supported by the given contract. + +### Example + +```ts +import { isCancelListingSupported } from "thirdweb/extensions/marketplace"; + +const supported = isCancelListingSupported(["0x..."]); +``` + +```ts +function isCancelListingSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `cancelListing` method is supported. +--- + +## isCreateAuctionSupported + + Checks if the `createAuction` method is supported by the given contract. + +### Example + +```ts +import { isCreateAuctionSupported } from "thirdweb/extensions/marketplace"; + +const supported = isCreateAuctionSupported(["0x..."]); +``` + +```ts +function isCreateAuctionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `createAuction` method is supported. +--- + +## isCreateListingSupported + + Checks if the `createListing` method is supported by the given contract. + +### Example + +```ts +import { isCreateAuctionSupported } from "thirdweb/extensions/marketplace"; + +const supported = isCreateAuctionSupported(["0x..."]); +``` + +```ts +function isCreateListingSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `createListing` method is supported. +--- + +## isCurrencyApprovedForListing + + Calls the "isCurrencyApprovedForListing" function on the contract. + +### Example + +```ts +import { isCurrencyApprovedForListing } from "thirdweb/extensions/marketplace"; + +const result = await isCurrencyApprovedForListing({ + contract, + listingId: ..., + currency: ..., +}); +``` + +```ts +function isCurrencyApprovedForListing( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isCurrencyApprovedForListing function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isGetAuctionSupported + + Checks if the `getAuction` method is supported by the given contract. + +### Example + +```ts +import { isGetAuctionSupported } from "thirdweb/extensions/marketplace"; + +const supported = isGetAuctionSupported(["0x..."]); +``` + +```ts +function isGetAuctionSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAuction` method is supported. +--- + +## isGetListingSupported + + Checks if the `isGetListingSupported` method is supported by the given contract. + +### Example + +```ts +import { isGetListingSupported } from "thirdweb/extensions/marketplace"; + +const supported = isGetListingSupported(["0x..."]); +``` + +```ts +function isGetListingSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `isGetListingSupported` method is supported. +--- + +## isGetWinningBidSupported + + Checks if the `getWinningBid` method is supported by the given contract. + +### Example + +```ts +import { isGetWinningBidSupported } from "thirdweb/extensions/marketplace"; + +const supported = isGetWinningBidSupported(["0x..."]); +``` + +```ts +function isGetWinningBidSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getWinningBid` method is supported. +--- + +## isNewWinningBid + + Calls the "isNewWinningBid" function on the contract. + +### Example + +```ts +import { isNewWinningBid } from "thirdweb/extensions/marketplace"; + +const result = await isNewWinningBid({ + contract, + auctionId: ..., + bidAmount: ..., +}); +``` + +```ts +function isNewWinningBid( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isNewWinningBid function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## makeOffer + + Makes an offer for any asset (ERC721 or ERC1155). + +### Example + +```ts +import { makeOffer } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const offerTx = makeOffer({ + contract, + assetContractAddress: "0x1234567890123456789012345678901234567890", + tokenId: 1n, + currencyContractAddress: + "0x1234567890123456789012345678901234567890", + offerExpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24), + totalOffer: "1.0", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function makeOffer( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for making the offer. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction object that can be sent to make the offer. +--- + +## newAuctionEvent + + Creates an event object for the NewAuction event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { newAuctionEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + newAuctionEvent({ + auctionCreator: ..., + auctionId: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function newAuctionEvent( + filters: Partial<{ + assetContract: string; + auctionCreator: string; + auctionId: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "auctionId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { + readonly name: "minimumBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "buyoutBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "timeBufferInSeconds"; + readonly type: "uint64"; + }, + { readonly name: "bidBufferBps"; readonly type: "uint64" }, + { readonly name: "startTimestamp"; readonly type: "uint64" }, + { readonly name: "endTimestamp"; readonly type: "uint64" }, + { readonly name: "auctionCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + ]; + readonly name: "auction"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewAuction"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + auctionCreator: string; + auctionId: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "auctionId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { + readonly name: "minimumBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "buyoutBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "timeBufferInSeconds"; + readonly type: "uint64"; + }, + { readonly name: "bidBufferBps"; readonly type: "uint64" }, + { readonly name: "startTimestamp"; readonly type: "uint64" }, + { readonly name: "endTimestamp"; readonly type: "uint64" }, + { readonly name: "auctionCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + ]; + readonly name: "auction"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewAuction"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## newBidEvent + + Creates an event object for the NewBid event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { newBidEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + newBidEvent({ + auctionId: ..., + bidder: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function newBidEvent( + filters: Partial<{ + assetContract: string; + auctionId: bigint; + bidder: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "bidder"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { readonly name: "bidAmount"; readonly type: "uint256" }, + { + readonly components: readonly [ + { readonly name: "auctionId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { + readonly name: "minimumBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "buyoutBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "timeBufferInSeconds"; + readonly type: "uint64"; + }, + { readonly name: "bidBufferBps"; readonly type: "uint64" }, + { readonly name: "startTimestamp"; readonly type: "uint64" }, + { readonly name: "endTimestamp"; readonly type: "uint64" }, + { readonly name: "auctionCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + ]; + readonly name: "auction"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewBid"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + auctionId: bigint; + bidder: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "auctionId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "bidder"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { readonly name: "bidAmount"; readonly type: "uint256" }, + { + readonly components: readonly [ + { readonly name: "auctionId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { + readonly name: "minimumBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "buyoutBidAmount"; + readonly type: "uint256"; + }, + { + readonly name: "timeBufferInSeconds"; + readonly type: "uint64"; + }, + { readonly name: "bidBufferBps"; readonly type: "uint64" }, + { readonly name: "startTimestamp"; readonly type: "uint64" }, + { readonly name: "endTimestamp"; readonly type: "uint64" }, + { readonly name: "auctionCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + ]; + readonly name: "auction"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewBid"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## newListingEvent + + Creates an event object for the NewListing event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { newListingEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + newListingEvent({ + listingCreator: ..., + listingId: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function newListingEvent( + filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "listingId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "startTimestamp"; readonly type: "uint128" }, + { readonly name: "endTimestamp"; readonly type: "uint128" }, + { readonly name: "listingCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + { readonly name: "reserved"; readonly type: "bool" }, + ]; + readonly name: "listing"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewListing"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "listingId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "startTimestamp"; readonly type: "uint128" }, + { readonly name: "endTimestamp"; readonly type: "uint128" }, + { readonly name: "listingCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + { readonly name: "reserved"; readonly type: "bool" }, + ]; + readonly name: "listing"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewListing"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## newOfferEvent + + Creates an event object for the NewOffer event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { newOfferEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + newOfferEvent({ + offeror: ..., + offerId: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function newOfferEvent( + filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "offerId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "totalPrice"; readonly type: "uint256" }, + { + readonly name: "expirationTimestamp"; + readonly type: "uint256"; + }, + { readonly name: "offeror"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + ]; + readonly name: "offer"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewOffer"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "offerId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "totalPrice"; readonly type: "uint256" }, + { + readonly name: "expirationTimestamp"; + readonly type: "uint256"; + }, + { readonly name: "offeror"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + ]; + readonly name: "offer"; + readonly type: "tuple"; + }, + ]; + readonly name: "NewOffer"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## newSaleEvent + + Creates an event object for the NewSale event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { newSaleEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + newSaleEvent({ + listingCreator: ..., + listingId: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function newSaleEvent( + filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "buyer"; readonly type: "address" }, + { readonly name: "quantityBought"; readonly type: "uint256" }, + { readonly name: "totalPricePaid"; readonly type: "uint256" }, + ]; + readonly name: "NewSale"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "buyer"; readonly type: "address" }, + { readonly name: "quantityBought"; readonly type: "uint256" }, + { readonly name: "totalPricePaid"; readonly type: "uint256" }, + ]; + readonly name: "NewSale"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## totalAuctions + + Calls the "totalAuctions" function on the contract. + +### Example + +```ts +import { totalAuctions } from "thirdweb/extensions/marketplace"; + +const result = await totalAuctions({ + contract, +}); +``` + +```ts +function totalAuctions( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalAuctions function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## totalListings + + Calls the "totalListings" function on the contract. + +### Example + +```ts +import { totalListings } from "thirdweb/extensions/marketplace"; + +const result = await totalListings({ + contract, +}); +``` + +```ts +function totalListings( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalListings function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## totalOffers + + Calls the "totalOffers" function on the contract. + +### Example + +```ts +import { totalOffers } from "thirdweb/extensions/marketplace"; + +const result = await totalOffers({ + contract, +}); +``` + +```ts +function totalOffers( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalOffers function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## updatedListingEvent + + Creates an event object for the UpdatedListing event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { updatedListingEvent } from "thirdweb/extensions/marketplace"; + +const events = await getContractEvents({ +contract, +events: [ + updatedListingEvent({ + listingCreator: ..., + listingId: ..., + assetContract: ..., +}) +], +}); +``` + +```ts +function updatedListingEvent( + filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "listingId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "startTimestamp"; readonly type: "uint128" }, + { readonly name: "endTimestamp"; readonly type: "uint128" }, + { readonly name: "listingCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + { readonly name: "reserved"; readonly type: "bool" }, + ]; + readonly name: "listing"; + readonly type: "tuple"; + }, + ]; + readonly name: "UpdatedListing"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "listingCreator"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "listingId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "assetContract"; + readonly type: "address"; + }, + { + readonly components: readonly [ + { readonly name: "listingId"; readonly type: "uint256" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "quantity"; readonly type: "uint256" }, + { readonly name: "pricePerToken"; readonly type: "uint256" }, + { readonly name: "startTimestamp"; readonly type: "uint128" }, + { readonly name: "endTimestamp"; readonly type: "uint128" }, + { readonly name: "listingCreator"; readonly type: "address" }, + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "currency"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "status"; readonly type: "uint8" }, + { readonly name: "reserved"; readonly type: "bool" }, + ]; + readonly name: "listing"; + readonly type: "tuple"; + }, + ]; + readonly name: "UpdatedListing"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## updateListing + + Updates an existing direct listing. + +### Example + +```typescript +import { updateListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; + +const transaction = updateListing({...}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function updateListing( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for updating the direct listing. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The result of updating the direct listing. +--- +## MULTICALL3 +--- + +## aggregate + + Prepares a transaction to call the "aggregate" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { aggregate } from "thirdweb/extensions/multicall3"; + +const transaction = aggregate({ + contract, + calls: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function aggregate( + options: BaseTransactionOptions< + AggregateParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "aggregate" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + AggregateParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## aggregate3 + + Prepares a transaction to call the "aggregate3" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { aggregate3 } from "thirdweb/extensions/multicall3"; + +const transaction = aggregate3({ + contract, + calls: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function aggregate3( + options: BaseTransactionOptions< + | Aggregate3Params + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "aggregate3" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + Aggregate3Params | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## aggregate3Value + + Prepares a transaction to call the "aggregate3Value" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { aggregate3Value } from "thirdweb/extensions/multicall3"; + +const transaction = aggregate3Value({ + contract, + calls: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function aggregate3Value( + options: BaseTransactionOptions< + | Aggregate3ValueParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "aggregate3Value" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | Aggregate3ValueParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## blockAndAggregate + + Prepares a transaction to call the "blockAndAggregate" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { blockAndAggregate } from "thirdweb/extensions/multicall3"; + +const transaction = blockAndAggregate({ + contract, + calls: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function blockAndAggregate( + options: BaseTransactionOptions< + | BlockAndAggregateParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "blockAndAggregate" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | BlockAndAggregateParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## getBasefee + + Calls the "getBasefee" function on the contract. + +### Example + +```ts +import { getBasefee } from "thirdweb/extensions/multicall3"; + +const result = await getBasefee({ + contract, +}); +``` + +```ts +function getBasefee(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the getBasefee function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getBlockHash + + Calls the "getBlockHash" function on the contract. + +### Example + +```ts +import { getBlockHash } from "thirdweb/extensions/multicall3"; + +const result = await getBlockHash({ + contract, + blockNumber: ..., +}); +``` + +```ts +function getBlockHash( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the getBlockHash function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## getBlockNumber + + Calls the "getBlockNumber" function on the contract. + +### Example + +```ts +import { getBlockNumber } from "thirdweb/extensions/multicall3"; + +const result = await getBlockNumber({ + contract, +}); +``` + +```ts +function getBlockNumber( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getBlockNumber function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getChainId + + Calls the "getChainId" function on the contract. + +### Example + +```ts +import { getChainId } from "thirdweb/extensions/multicall3"; + +const result = await getChainId({ + contract, +}); +``` + +```ts +function getChainId(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the getChainId function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getCurrentBlockCoinbase + + Calls the "getCurrentBlockCoinbase" function on the contract. + +### Example + +```ts +import { getCurrentBlockCoinbase } from "thirdweb/extensions/multicall3"; + +const result = await getCurrentBlockCoinbase({ + contract, +}); +``` + +```ts +function getCurrentBlockCoinbase( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getCurrentBlockCoinbase function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getCurrentBlockDifficulty + + Calls the "getCurrentBlockDifficulty" function on the contract. + +### Example + +```ts +import { getCurrentBlockDifficulty } from "thirdweb/extensions/multicall3"; + +const result = await getCurrentBlockDifficulty({ + contract, +}); +``` + +```ts +function getCurrentBlockDifficulty( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getCurrentBlockDifficulty function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getCurrentBlockGasLimit + + Calls the "getCurrentBlockGasLimit" function on the contract. + +### Example + +```ts +import { getCurrentBlockGasLimit } from "thirdweb/extensions/multicall3"; + +const result = await getCurrentBlockGasLimit({ + contract, +}); +``` + +```ts +function getCurrentBlockGasLimit( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getCurrentBlockGasLimit function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getCurrentBlockTimestamp + + Calls the "getCurrentBlockTimestamp" function on the contract. + +### Example + +```ts +import { getCurrentBlockTimestamp } from "thirdweb/extensions/multicall3"; + +const result = await getCurrentBlockTimestamp({ + contract, +}); +``` + +```ts +function getCurrentBlockTimestamp( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getCurrentBlockTimestamp function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getEthBalance + + Calls the "getEthBalance" function on the contract. + +### Example + +```ts +import { getEthBalance } from "thirdweb/extensions/multicall3"; + +const result = await getEthBalance({ + contract, + addr: ..., +}); +``` + +```ts +function getEthBalance( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getEthBalance function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getLastBlockHash + + Calls the "getLastBlockHash" function on the contract. + +### Example + +```ts +import { getLastBlockHash } from "thirdweb/extensions/multicall3"; + +const result = await getLastBlockHash({ + contract, +}); +``` + +```ts +function getLastBlockHash( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; +``` + +### Parameters + + The options for the getLastBlockHash function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + The parsed result of the function call. +--- + +## tryAggregate + + Prepares a transaction to call the "tryAggregate" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { tryAggregate } from "thirdweb/extensions/multicall3"; + +const transaction = tryAggregate({ + contract, + requireSuccess: ..., + calls: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function tryAggregate( + options: BaseTransactionOptions< + | TryAggregateParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "tryAggregate" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | TryAggregateParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## tryBlockAndAggregate + + Prepares a transaction to call the "tryBlockAndAggregate" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { tryBlockAndAggregate } from "thirdweb/extensions/multicall3"; + +const transaction = tryBlockAndAggregate({ + contract, + requireSuccess: ..., + calls: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function tryBlockAndAggregate( + options: BaseTransactionOptions< + | TryBlockAndAggregateParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "tryBlockAndAggregate" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | TryBlockAndAggregateParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## PACK +--- + +## createNewPack + +### Example + +```ts +import { createNewPack } from "thirdweb/extensions/pack"; + +const transaction = createNewPack({ + contract: packContract, + client, + recipient: "0x...", + tokenOwner: "0x...", + packMetadata: { + name: "Pack #1", + image: "image-of-pack-1", + }, + openStartTimestamp: new Date(), + erc20Rewards: [ + { + contractAddress: "0x...", + quantityPerReward: 1, + totalRewards: 1, + }, + ], + erc721Rewards: [ + { + contractAddress: "0x...", + tokenId: 0n, + }, + ], + erc1155Rewards: [ + { + contractAddress: "0x...", + tokenId: 0n, + quantityPerReward: 1, + totalRewards: 1, + }, + ], +}); +``` + +```ts +function createNewPack( + options: WithOverrides>, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: WithOverrides< + BaseTransactionOptions +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` +--- + +## createPack + + Prepares a transaction to call the "createPack" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { createPack } from "thirdweb/extensions/pack"; + +const transaction = createPack({ + contract, + contents: ..., + numOfRewardUnits: ..., + packUri: ..., + openStartTimestamp: ..., + amountDistributedPerOpen: ..., + recipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function createPack( + options: BaseTransactionOptions< + | CreatePackParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "createPack" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + CreatePackParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## getPackContents + + Calls the "getPackContents" function on the contract. + +### Example + +```ts +import { getPackContents } from "thirdweb/extensions/pack"; + +const result = await getPackContents({ + contract, + packId: ..., +}); +``` + +```ts +function getPackContents(options: BaseTransactionOptions) : Promise, readonly Array]> +``` + +### Parameters + + The options for the getPackContents function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise, readonly Array]> +``` + + The parsed result of the function call. +--- + +## getTokenCountOfBundle + + Calls the "getTokenCountOfBundle" function on the contract. + +### Example + +```ts +import { getTokenCountOfBundle } from "thirdweb/extensions/pack"; + +const result = await getTokenCountOfBundle({ + contract, + bundleId: ..., +}); +``` + +```ts +function getTokenCountOfBundle( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getTokenCountOfBundle function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## openPack + + Prepares a transaction to call the "openPack" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { openPack } from "thirdweb/extensions/pack"; + +const transaction = openPack({ + contract, + packId: ..., + amountToOpen: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function openPack( + options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "openPack" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## packCreatedEvent + + Creates an event object for the PackCreated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { packCreatedEvent } from "thirdweb/extensions/pack"; + +const events = await getContractEvents({ +contract, +events: [ + packCreatedEvent({ + packId: ..., +}) +], +}); +``` + +```ts +function packCreatedEvent( + filters: Partial<{ packId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackCreated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ packId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackCreated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## packOpenedEvent + + Creates an event object for the PackOpened event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { packOpenedEvent } from "thirdweb/extensions/pack"; + +const events = await getContractEvents({ +contract, +events: [ + packOpenedEvent({ + packId: ..., + opener: ..., +}) +], +}); +``` + +```ts +function packOpenedEvent( + filters: Partial<{ opener: string; packId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "opener"; + readonly type: "address"; + }, + { readonly name: "numOfPacksOpened"; readonly type: "uint256" }, + { + readonly components: readonly [ + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "totalAmount"; readonly type: "uint256" }, + ]; + readonly name: "rewardUnitsDistributed"; + readonly type: "tuple[]"; + }, + ]; + readonly name: "PackOpened"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ opener: string; packId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { + readonly indexed: true; + readonly name: "opener"; + readonly type: "address"; + }, + { readonly name: "numOfPacksOpened"; readonly type: "uint256" }, + { + readonly components: readonly [ + { readonly name: "assetContract"; readonly type: "address" }, + { readonly name: "tokenType"; readonly type: "uint8" }, + { readonly name: "tokenId"; readonly type: "uint256" }, + { readonly name: "totalAmount"; readonly type: "uint256" }, + ]; + readonly name: "rewardUnitsDistributed"; + readonly type: "tuple[]"; + }, + ]; + readonly name: "PackOpened"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## packUpdatedEvent + + Creates an event object for the PackUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { packUpdatedEvent } from "thirdweb/extensions/pack"; + +const events = await getContractEvents({ +contract, +events: [ + packUpdatedEvent({ + packId: ..., +}) +], +}); +``` + +```ts +function packUpdatedEvent( + filters: Partial<{ packId: bigint }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackUpdated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ packId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "packId"; + readonly type: "uint256"; + }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, + ]; + readonly name: "PackUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- +## PERMISSIONS +--- + +## getAllRoleMembers + + Retrieves all members of a specific role. + +### Example + +```ts +import { getAllRoleMembers } from "thirdweb/extensions/permissions"; + +const result = await getAllRoleMembers({ + contract, + role: "admin", +}); +``` + +```ts +function getAllRoleMembers( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving role members. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to an array of strings representing the role members. +--- + +## getRoleAdmin + + Gets the admin of a role. + +### Example + +```ts +import { getRoleAdmin } from "thirdweb/extensions/permissions"; + +const result = await getRoleAdmin({ + contract, + role: "admin", +}); +``` + +```ts +function getRoleAdmin( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for getting the role's admin. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The address of the role's admin. +--- + +## getRoleHash + + Get a hex value of a smart contract role You need the hex value to interact with the smart contracts. + +### Example + +```ts +const adminRoleHash = getRoleHash("admin"); // 0x0000000...000000 +``` + +```ts +function getRoleHash(role: RoleInput): `0x${string}`; +``` + +### Parameters + + string + +#### Type + +```ts +let role: RoleInput; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + hex value of the contract role +--- + +## getRoleMember + + Retrieves a specific member of a specific role. + +### Example + +```ts +import { getRoleMember } from "thirdweb/extensions/permissions"; + +const address = await getRoleMember({ + contract, + role: "admin", + index: 0n, +}); +``` + +```ts +function getRoleMember( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the role member. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the address of the role member. +--- + +## getRoleMemberCount + + Retrieves the number of members of a specific role. + +### Example + +```ts +import { getRoleMemberCount } from "thirdweb/extensions/permissions"; + +const result = await getRoleMemberCount({ + contract, + role: "admin", +}); +``` + +```ts +function getRoleMemberCount( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for retrieving role member count. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the number of members of the role. +--- + +## grantRole + + Grants a role to a target account. + +### Example + +```ts +import { grantRole } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; + +const transaction = grantRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function grantRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for granting the role. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that grants the role when sent. +--- + +## hasRole + + Checks if the target account has the role. + +### Example + +```ts +import { hasRole } from "thirdweb/extensions/permissions"; + +const result = await hasRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", +}); +``` + +```ts +function hasRole( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for checking the role. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A boolean that is true if the target account has the role. +--- + +## isGetAllRoleMembersSupported + + Checks if the `getAllRoleMembers` method is supported by the given contract. + +### Example + +```ts +import { isGetAllRoleMembersSupported } from "thirdweb/extensions/permissions"; + +const supported = isGetAllRoleMembersSupported(["0x..."]); +``` + +```ts +function isGetAllRoleMembersSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getAllRoleMembers` method is supported. +--- + +## isGetRoleAdminSupported + + Checks if the `getRoleAdmin` method is supported by the given contract. + +### Example + +```ts +import { isGetRoleAdminSupported } from "thirdweb/extensions/permissions"; +const supported = isGetRoleAdminSupported(["0x..."]); +``` + +```ts +function isGetRoleAdminSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getRoleAdmin` method is supported. +--- + +## isGetRoleMemberCountSupported + + Checks if the `getRoleMemberCount` method is supported by the given contract. + +### Example + +```ts +import { isGetRoleMemberCountSupported } from "thirdweb/extensions/permissions"; +const supported = isGetRoleMemberCountSupported(["0x..."]); +``` + +```ts +function isGetRoleMemberCountSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getRoleMemberCount` method is supported. +--- + +## isGetRoleMemberSupported + + Checks if the `getRoleMember` method is supported by the given contract. + +### Example + +```ts +import { isGetRoleMemberSupported } from "thirdweb/extensions/permissions"; +const supported = isGetRoleMemberSupported(["0x..."]); +``` + +```ts +function isGetRoleMemberSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getRoleMember` method is supported. +--- + +## isGrantRoleSupported + + Checks if the `grantRole` method is supported by the given contract. + +### Example + +```ts +import { isGrantRoleSupported } from "thirdweb/extensions/permissions"; + +const supported = isGrantRoleSupported(["0x..."]); +``` + +```ts +function isGrantRoleSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `grantRole` method is supported. +--- + +## isHasRoleSupported + + Checks if the `hasRole` method is supported by the given contract. + +### Example + +```ts +import { isHasRoleSupported } from "thirdweb/extensions/permissions"; +const supported = isHasRoleSupported(["0x..."]); +``` + +```ts +function isHasRoleSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `hasRole` method is supported. +--- + +## isRenounceRoleSupported + + Checks if the `renounceRole` method is supported by the given contract. + +### Example + +```ts +import { isRenounceRoleSupported } from "thirdweb/extensions/permissions"; + +const supported = isRenounceRoleSupported(["0x..."]); +``` + +```ts +function isRenounceRoleSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `renounceRole` method is supported. +--- + +## isRevokeRoleSupported + + Checks if the `revokeRole` method is supported by the given contract. + +### Example + +```ts +import { isRevokeRoleSupported } from "thirdweb/extensions/permissions"; + +const supported = isRevokeRoleSupported(["0x..."]); +``` + +```ts +function isRevokeRoleSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `revokeRole` method is supported. +--- + +## renounceRole + + Lets the target account renounce the role. (The target account must be the sender of the transaction.) + +### Example + +```ts +import { renounceRole } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; + +const transaction = renounceRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function renounceRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for renouncing the role. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that revokes the role when sent. +--- + +## revokeRole + + Revokes a role from a target account. + +### Example + +```ts +import { revokeRole } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; + +const transaction = revokeRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function revokeRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for revoking the role. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction that revokes the role when sent. +--- + +## roleAdminChangedEvent + + Creates an event object for the RoleAdminChanged event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { roleAdminChangedEvent } from "thirdweb/extensions/permissions"; + +const events = await getContractEvents({ +contract, +events: [ + roleAdminChangedEvent({ + role: ..., + previousAdminRole: ..., + newAdminRole: ..., +}) +], +}); +``` + +```ts +function roleAdminChangedEvent( + filters: Partial<{ + newAdminRole: `0x${string}`; + previousAdminRole: `0x${string}`; + role: `0x${string}`; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "role"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "previousAdminRole"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "newAdminRole"; + readonly type: "bytes32"; + }, + ]; + readonly name: "RoleAdminChanged"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + newAdminRole: `0x${string}`; + previousAdminRole: `0x${string}`; + role: `0x${string}`; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "role"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "previousAdminRole"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "newAdminRole"; + readonly type: "bytes32"; + }, + ]; + readonly name: "RoleAdminChanged"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## roleGrantedEvent + + Creates an event object for the RoleGranted event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { roleGrantedEvent } from "thirdweb/extensions/permissions"; + +const events = await getContractEvents({ +contract, +events: [ + roleGrantedEvent({ + role: ..., + account: ..., + sender: ..., +}) +], +}); +``` + +```ts +function roleGrantedEvent( + filters: Partial<{ + account: string; + role: `0x${string}`; + sender: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "role"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "account"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + ]; + readonly name: "RoleGranted"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + account: string; + role: `0x${string}`; + sender: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "role"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "account"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + ]; + readonly name: "RoleGranted"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## roleRevokedEvent + + Creates an event object for the RoleRevoked event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { roleRevokedEvent } from "thirdweb/extensions/permissions"; + +const events = await getContractEvents({ +contract, +events: [ + roleRevokedEvent({ + role: ..., + account: ..., + sender: ..., +}) +], +}); +``` + +```ts +function roleRevokedEvent( + filters: Partial<{ + account: string; + role: `0x${string}`; + sender: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "role"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "account"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + ]; + readonly name: "RoleRevoked"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + account: string; + role: `0x${string}`; + sender: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "role"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "account"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + ]; + readonly name: "RoleRevoked"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- +## SPLIT +--- + +## distribute + + Prepares a transaction to call the "distribute" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { distribute } from "thirdweb/extensions/split"; + +const transaction = distribute(); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function distribute( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the "distribute" function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## distributeByToken + + This extension is similar to the `distribute` extension, however it require you to specify the token (address) that you want to distribute + +### Example + +```ts +import { distributeByToken } from "thirdweb/extensions/split"; + +const transaction = distributeByToken(); + +// Send the transaction +... +``` + +```ts +function distributeByToken( + options: BaseTransactionOptions<{ tokenAddress: string }>, +): PreparedTransaction< + any, + { + readonly inputs: readonly [ + { readonly name: "token"; readonly type: "address" }, + ]; + readonly name: "distribute"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, + PrepareTransactionOptions +>; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions<{ tokenAddress: string }>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + { + readonly inputs: readonly [ + { readonly name: "token"; readonly type: "address" }, + ]; + readonly name: "distribute"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## getAllRecipientsAddresses + + Get the addresses of all recipients of a [thirdweb Split contract](https://thirdweb.com/thirdweb.eth/Split) + +### Example + +```ts +import { getAllRecipientsAddresses } from "thirdweb/extensions/split"; + +const addresses = await getAllRecipientsAddresses({ contract }); +``` + +```ts +function getAllRecipientsAddresses( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + an array of wallet addresses +--- + +## getAllRecipientsPercentages + + Get all the recipients of a Split contracts + +### Example + +```ts +import { getAllRecipientsPercentages } from "thirdweb/extensions/split"; + +const allRecipients = await getAllRecipientsPercentages({ contract }); +// Example result: +[ + { + address: "0x1...", + splitPercentage: 25, // 25% + }, + { + address: "0x2...", + splitPercentage: 75, // 75% + }, +]; +``` + +```ts +function getAllRecipientsPercentages( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: { address: string; splitPercentage: number }; +``` + + an array of recipients' addresses and split percentage of each +--- + +## getRecipientSplitPercentage + + Get the split percentage of a recipient + +### Example + +```ts +import { getRecipientSplitPercentage } from "thirdweb/extensions/split"; + +const percentage = await getRecipientSplitPercentage({ + recipientAddress: "0x...", +}); +``` + +```ts +function getRecipientSplitPercentage( + options: BaseTransactionOptions<{ recipientAddress: string }>, +): Promise; +``` + +### Parameters + + The options for the transaction + +#### Type + +```ts +let options: BaseTransactionOptions<{ recipientAddress: string }>; +``` + +### Returns + +```ts +let returnType: { address: string; splitPercentage: number }; +``` + + The split percentage of the recipient +--- + +## payee + + Calls the "payee" function on the contract. + +### Example + +```ts +import { payee } from "thirdweb/extensions/split"; + +const result = await payee({ + contract, + index: ..., +}); +``` + +```ts +function payee( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the payee function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## payeeCount + + Calls the "payeeCount" function on the contract. + +### Example + +```ts +import { payeeCount } from "thirdweb/extensions/split"; + +const result = await payeeCount({ + contract, +}); +``` + +```ts +function payeeCount(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the payeeCount function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## releasable + + Calls the "releasable" function on the contract. + +### Example + +```ts +import { releasable } from "thirdweb/extensions/split"; + +const result = await releasable({ + contract, + account: ..., +}); +``` + +```ts +function releasable( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the releasable function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## releasableByToken + + Calls the "releasable" function on the contract. + +### Example + +```ts +import { releasableByToken } from "thirdweb/extensions/split"; + +const result = await releasableByToken({ + contract, + account: ..., +}); +``` + +```ts +function releasableByToken( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the releasable function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## release + + Prepares a transaction to call the "release" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { release } from "thirdweb/extensions/split"; + +const transaction = release({ + contract, + account: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function release( + options: BaseTransactionOptions< + ReleaseParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "release" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + ReleaseParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## releaseByToken + + Similar to the `release` extension, however this one requires you to specify a tokenAddress to release + +### Example + +```ts +import { releaseByToken } from "thirdweb/extensions/split"; + +const transaction = releaseByToken({ + contract, + account: ..., + overrides: { + ... + } +}); + +// Send the transaction +... +``` + +```ts +function releaseByToken( + options: BaseTransactionOptions, +): PreparedTransaction< + any, + { + readonly inputs: readonly [ + { readonly name: "token"; readonly type: "address" }, + { readonly name: "account"; readonly type: "address" }, + ]; + readonly name: "release"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, + PrepareTransactionOptions +>; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + { + readonly inputs: readonly [ + { readonly name: "token"; readonly type: "address" }, + { readonly name: "account"; readonly type: "address" }, + ]; + readonly name: "release"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, + PrepareTransactionOptions +>; +``` +--- + +## released + + Calls the "released" function on the contract. + +### Example + +```ts +import { released } from "thirdweb/extensions/split"; + +const result = await released({ + contract, + account: ..., +}); +``` + +```ts +function released( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the released function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## releasedByToken + + Calls the "released" function on the contract. Similar to the `released` extension, however this one requires you to specify a tokenAddress + +### Example + +```ts +import { releasedByToken } from "thirdweb/extensions/split"; + +const result = await releasedByToken({ + contract, + account: "0x...", + tokenAddress: "0x...", +}); +``` + +```ts +function releasedByToken( + options: BaseTransactionOptions< + ReleasedParams & { tokenAddress: string } + >, +): Promise; +``` + +### Parameters + + The options for the released function. + +#### Type + +```ts +let options: BaseTransactionOptions< + ReleasedParams & { tokenAddress: string } +>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## shares + + Calls the "shares" function on the contract. + +### Example + +```ts +import { shares } from "thirdweb/extensions/split"; + +const result = await shares({ + contract, + account: ..., +}); +``` + +```ts +function shares( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the shares function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## totalReleased + + Calls the "totalReleased" function on the contract. + +### Example + +```ts +import { totalReleased } from "thirdweb/extensions/split"; + +const result = await totalReleased({ + contract, +}); +``` + +```ts +function totalReleased( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the totalReleased function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## totalReleasedByToken + + Calls the "totalReleased" function on the contract. Similar to the `release` extension, however this one requires you to specify a tokenAddress + +### Example + +```ts +import { totalReleasedByToken } from "thirdweb/extensions/split"; + +const result = await totalReleasedByToken({ + contract, + tokenAddress: "0x...", +}); +``` + +```ts +function totalReleasedByToken( + options: BaseTransactionOptions<{ tokenAddress: string }>, +): Promise; +``` + +### Parameters + + The options for the totalReleased function. + +#### Type + +```ts +let options: BaseTransactionOptions<{ tokenAddress: string }>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- +## THIRDWEB +--- + +## add + + Prepares a transaction to call the "add" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { add } from "thirdweb/extensions/thirdweb"; + +const transaction = add({ + contract, + deployer: ..., + deployment: ..., + chainId: ..., + metadataUri: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function add( + options: BaseTransactionOptions< + AddParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "add" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + AddParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## contractType + + Calls the "contractType" function on the contract. + +### Example + +```ts +import { contractType } from "thirdweb/extensions/thirdweb"; + +const result = await contractType({ + contract, +}); +``` + +```ts +function contractType( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the contractType function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## count + + Calls the "count" function on the contract. + +### Example + +```ts +import { count } from "thirdweb/extensions/thirdweb"; + +const result = await count({ + contract, + deployer: ..., +}); +``` + +```ts +function count( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the count function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## deployProxyByImplementation + + Prepares a transaction to call the "deployProxyByImplementation" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { deployProxyByImplementation } from "thirdweb/extensions/thirdweb"; + +const transaction = deployProxyByImplementation({ + contract, + implementation: ..., + data: ..., + salt: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function deployProxyByImplementation( + options: BaseTransactionOptions< + | DeployProxyByImplementationParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "deployProxyByImplementation" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | DeployProxyByImplementationParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## getAll + + Calls the "getAll" function on the contract. + +### Example + +```ts +import { getAll } from "thirdweb/extensions/thirdweb"; + +const result = await getAll({ + contract, + deployer: ..., +}); +``` + +```ts +function getAll(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getAll function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getAllPublishedContracts + + Calls the "getAllPublishedContracts" function on the contract. + +### Example + +```ts +import { getAllPublishedContracts } from "thirdweb/extensions/thirdweb"; + +const result = await getAllPublishedContracts({ + contract, + publisher: ..., +}); +``` + +```ts +function getAllPublishedContracts(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getAllPublishedContracts function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getMetadataUri + + Calls the "getMetadataUri" function on the contract. + +### Example + +```ts +import { getMetadataUri } from "thirdweb/extensions/thirdweb"; + +const result = await getMetadataUri({ + contract, + chainId: ..., + deployment: ..., +}); +``` + +```ts +function getMetadataUri( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getMetadataUri function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getPublishedContract + + Calls the "getPublishedContract" function on the contract. + +### Example + +```ts +import { getPublishedContract } from "thirdweb/extensions/thirdweb"; + +const result = await getPublishedContract({ + contract, + publisher: ..., + contractId: ..., +}); +``` + +```ts +function getPublishedContract( + options: BaseTransactionOptions, +): Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; +``` + +### Parameters + + The options for the getPublishedContract function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; +``` + + The parsed result of the function call. +--- + +## getPublishedContractVersions + + Calls the "getPublishedContractVersions" function on the contract. + +### Example + +```ts +import { getPublishedContractVersions } from "thirdweb/extensions/thirdweb"; + +const result = await getPublishedContractVersions({ + contract, + publisher: ..., + contractId: ..., +}); +``` + +```ts +function getPublishedContractVersions(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getPublishedContractVersions function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getPublishedUriFromCompilerUri + + Calls the "getPublishedUriFromCompilerUri" function on the contract. + +### Example + +```ts +import { getPublishedUriFromCompilerUri } from "thirdweb/extensions/thirdweb"; + +const result = await getPublishedUriFromCompilerUri({ + contract, + compilerMetadataUri: ..., +}); +``` + +```ts +function getPublishedUriFromCompilerUri(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getPublishedUriFromCompilerUri function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## getPublisherProfileUri + + Calls the "getPublisherProfileUri" function on the contract. + +### Example + +```ts +import { getPublisherProfileUri } from "thirdweb/extensions/thirdweb"; + +const result = await getPublisherProfileUri({ + contract, + publisher: ..., +}); +``` + +```ts +function getPublisherProfileUri( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getPublisherProfileUri function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isContractTypeSupported + + Checks if the `contractType` method is supported by the given contract. + +### Example + +```ts +import { isContractTypeSupported } from "thirdweb/extensions/thirdweb"; + +const supported = isContractTypeSupported(["0x..."]); +``` + +```ts +function isContractTypeSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `contractType` method is supported. +--- + +## remove + + Prepares a transaction to call the "remove" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { remove } from "thirdweb/extensions/thirdweb"; + +const transaction = remove({ + contract, + deployer: ..., + deployment: ..., + chainId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function remove( + options: BaseTransactionOptions< + RemoveParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "remove" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RemoveParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setPublisherProfileUri + + Prepares a transaction to call the "setPublisherProfileUri" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setPublisherProfileUri } from "thirdweb/extensions/thirdweb"; + +const transaction = setPublisherProfileUri({ + contract, + publisher: ..., + uri: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setPublisherProfileUri( + options: BaseTransactionOptions< + | SetPublisherProfileUriParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setPublisherProfileUri" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetPublisherProfileUriParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## unpublishContract + + Prepares a transaction to call the "unpublishContract" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { unpublishContract } from "thirdweb/extensions/thirdweb"; + +const transaction = unpublishContract({ + contract, + publisher: ..., + contractId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function unpublishContract( + options: BaseTransactionOptions< + | UnpublishContractParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "unpublishContract" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | UnpublishContractParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## thirdweb +--- + +## publishContract + + Publish a contract to the contract publisher. + +### Example + +```ts +const tx = publishContract({ + contract, + account, + metadata, +}); +``` + +```ts +function publishContract( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for publishing the contract. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction to publish the contract. +--- +## UNISWAP +--- + +## createPool + + Prepares a transaction to call the "createPool" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { createPool } from "thirdweb/extensions/uniswap"; + +const transaction = createPool({ + contract, + tokenA: ..., + tokenB: ..., + fee: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function createPool( + options: BaseTransactionOptions< + | CreatePoolParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "createPool" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + CreatePoolParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## enableFeeAmount + + Prepares a transaction to call the "enableFeeAmount" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { enableFeeAmount } from "thirdweb/extensions/uniswap"; + +const transaction = enableFeeAmount({ + contract, + fee: ..., + tickSpacing: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function enableFeeAmount( + options: BaseTransactionOptions< + | EnableFeeAmountParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "enableFeeAmount" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | EnableFeeAmountParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## exactInput + + Prepares a transaction to call the "exactInput" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { exactInput } from "thirdweb/extensions/uniswap"; + +const transaction = exactInput({ + contract, + params: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function exactInput( + options: BaseTransactionOptions< + | ExactInputParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "exactInput" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + ExactInputParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## exactInputSingle + + Prepares a transaction to call the "exactInputSingle" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { exactInputSingle } from "thirdweb/extensions/uniswap"; + +const transaction = exactInputSingle({ + contract, + params: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function exactInputSingle( + options: BaseTransactionOptions< + | ExactInputSingleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "exactInputSingle" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | ExactInputSingleParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## exactOutput + + Prepares a transaction to call the "exactOutput" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { exactOutput } from "thirdweb/extensions/uniswap"; + +const transaction = exactOutput({ + contract, + params: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function exactOutput( + options: BaseTransactionOptions< + | ExactOutputParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "exactOutput" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | ExactOutputParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## exactOutputSingle + + Prepares a transaction to call the "exactOutputSingle" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { exactOutputSingle } from "thirdweb/extensions/uniswap"; + +const transaction = exactOutputSingle({ + contract, + params: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function exactOutputSingle( + options: BaseTransactionOptions< + | ExactOutputSingleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "exactOutputSingle" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | ExactOutputSingleParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## feeAmountEnabledEvent + + Creates an event object for the FeeAmountEnabled event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { feeAmountEnabledEvent } from "thirdweb/extensions/uniswap"; + +const events = await getContractEvents({ + contract, + events: [feeAmountEnabledEvent()], +}); +``` + +```ts +function feeAmountEnabledEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "fee"; readonly type: "uint24" }, + { readonly name: "tickSpacing"; readonly type: "int24" }, + ]; + readonly name: "FeeAmountEnabled"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "fee"; readonly type: "uint24" }, + { readonly name: "tickSpacing"; readonly type: "int24" }, + ]; + readonly name: "FeeAmountEnabled"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## feeAmountTickSpacing + + Calls the "feeAmountTickSpacing" function on the contract. + +### Example + +```ts +import { feeAmountTickSpacing } from "thirdweb/extensions/uniswap"; + +const result = await feeAmountTickSpacing({ + contract, + fee: ..., +}); +``` + +```ts +function feeAmountTickSpacing( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the feeAmountTickSpacing function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getPool + + Calls the "getPool" function on the contract. + +### Example + +```ts +import { getPool } from "thirdweb/extensions/uniswap"; + +const result = await getPool({ + contract, + tokenA: ..., + tokenB: ..., + fee: ..., +}); +``` + +```ts +function getPool( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getPool function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getUniswapV3Pool + + Finds the Uniswap V3 pools for the two tokens. + +### Example + +```ts +import { getUniswapV3Pool } from "thirdweb/extensions/uniswap"; +const pools = await getUniswapV3Pool({ + tokenA: "0x...", + tokenB: "0x...", + contract: factoryContract, +}); +``` + +```ts +function getUniswapV3Pool( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + + The token pair to find any pools for any Uniswap contract that implements getPool. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: { + poolAddress: Address; + poolFee: (typeof UniswapFee)[keyof typeof UniswapFee]; +}; +``` + + The pools' addresses and fees. +--- + +## owner + + Calls the "owner" function on the contract. + +### Example + +```ts +import { owner } from "thirdweb/extensions/uniswap"; + +const result = await owner({ + contract, +}); +``` + +```ts +function owner(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the owner function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## ownerChangedEvent + + Creates an event object for the OwnerChanged event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { ownerChangedEvent } from "thirdweb/extensions/uniswap"; + +const events = await getContractEvents({ +contract, +events: [ + ownerChangedEvent({ + oldOwner: ..., + newOwner: ..., +}) +], +}); +``` + +```ts +function ownerChangedEvent( + filters: Partial<{ newOwner: string; oldOwner: string }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "oldOwner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "newOwner"; + readonly type: "address"; + }, + ]; + readonly name: "OwnerChanged"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ newOwner: string; oldOwner: string }>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "oldOwner"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "newOwner"; + readonly type: "address"; + }, + ]; + readonly name: "OwnerChanged"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## poolCreatedEvent + + Creates an event object for the PoolCreated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { poolCreatedEvent } from "thirdweb/extensions/uniswap"; + +const events = await getContractEvents({ +contract, +events: [ + poolCreatedEvent({ + token0: ..., + token1: ..., + sender: ..., +}) +], +}); +``` + +```ts +function poolCreatedEvent( + filters: Partial<{ + sender: string; + token0: string; + token1: string; + }>, +): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "token0"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "token1"; + readonly type: "address"; + }, + { readonly name: "fee"; readonly type: "uint24" }, + { readonly name: "tickLower"; readonly type: "int24" }, + { readonly name: "tickUpper"; readonly type: "int24" }, + { readonly name: "liquidity"; readonly type: "uint128" }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + ]; + readonly name: "PoolCreated"; + readonly type: "event"; +}>; +``` + +### Parameters + + Optional filters to apply to the event. + +#### Type + +```ts +let filters: Partial<{ + sender: string; + token0: string; + token1: string; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly indexed: true; + readonly name: "token0"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "token1"; + readonly type: "address"; + }, + { readonly name: "fee"; readonly type: "uint24" }, + { readonly name: "tickLower"; readonly type: "int24" }, + { readonly name: "tickUpper"; readonly type: "int24" }, + { readonly name: "liquidity"; readonly type: "uint128" }, + { + readonly indexed: true; + readonly name: "sender"; + readonly type: "address"; + }, + ]; + readonly name: "PoolCreated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## quoteExactInput + + Prepares a transaction to call the "quoteExactInput" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { quoteExactInput } from "thirdweb/extensions/uniswap"; + +const transaction = quoteExactInput({ + contract, + path: ..., + amountIn: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function quoteExactInput( + options: BaseTransactionOptions< + | QuoteExactInputParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "quoteExactInput" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | QuoteExactInputParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## quoteExactInputSingle + + Prepares a transaction to call the "quoteExactInputSingle" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { quoteExactInputSingle } from "thirdweb/extensions/uniswap"; + +const transaction = quoteExactInputSingle({ + contract, + tokenIn: ..., + tokenOut: ..., + fee: ..., + amountIn: ..., + sqrtPriceLimitX96: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function quoteExactInputSingle( + options: BaseTransactionOptions< + | QuoteExactInputSingleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "quoteExactInputSingle" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | QuoteExactInputSingleParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## quoteExactOutput + + Prepares a transaction to call the "quoteExactOutput" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { quoteExactOutput } from "thirdweb/extensions/uniswap"; + +const transaction = quoteExactOutput({ + contract, + path: ..., + amountOut: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function quoteExactOutput( + options: BaseTransactionOptions< + | QuoteExactOutputParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "quoteExactOutput" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | QuoteExactOutputParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## quoteExactOutputSingle + + Prepares a transaction to call the "quoteExactOutputSingle" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { quoteExactOutputSingle } from "thirdweb/extensions/uniswap"; + +const transaction = quoteExactOutputSingle({ + contract, + tokenIn: ..., + tokenOut: ..., + fee: ..., + amountOut: ..., + sqrtPriceLimitX96: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function quoteExactOutputSingle( + options: BaseTransactionOptions< + | QuoteExactOutputSingleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "quoteExactOutputSingle" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | QuoteExactOutputSingleParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setOwner + + Prepares a transaction to call the "setOwner" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setOwner } from "thirdweb/extensions/uniswap"; + +const transaction = setOwner({ + contract, + newOwner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setOwner( + options: BaseTransactionOptions< + SetOwnerParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setOwner" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + SetOwnerParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## UNSTOPPABLE-DOMAINS +--- + +## namehash + + Calls the "namehash" function on the contract. + +### Example + +```ts +import { namehash } from "thirdweb/extensions/unstoppable-domains"; + +const result = await namehash({ + contract, + labels: ..., +}); +``` + +```ts +function namehash( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the namehash function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## resolveAddress + + Resolve an Unstoppable-Domain domain to an Ethereum address + +### Example + +#### Basic usage + +```ts +import { resolveAddress } from "thirdweb/extension/unstoppable-domains"; + +const address = await resolveAddress({ + client, + name: "thirdweb.crypto", +}); +``` + +#### Custom resolver + + By default this extension will try to resolve the name on Polygon mainnet, you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain` + +```ts +import { ethereum } from "thirdweb/chains"; + +const address = await resolveAddress({ + client, + name: "thirdweb.crypto", + resolverAddress: "0x...", + resolverChain: ethereum, +}); +``` + +```ts +function resolveAddress( + options: ResolveAddressOptions, +): Promise; +``` + +### Parameters + + The options for resolving an UD domain + +#### Type + +```ts +let options: { + client: ThirdwebClient; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The Ethereum address associated with the domain name. [ Learn more](https://docs.unstoppabledomains.com/reverse-resolution/) +--- + +## resolveName + + Resolves the primary Untoppable-Domains name for a specified address. + +### Example + +#### Basic usage + +```ts +import { resolveName } from "thirdweb/extension/unstoppable-domains"; + +const name = await resolveName({ + client, + address: "0x...", +}); +``` + +#### Custom resolver + + By default this extension will try to resolve the address on Polygon mainnet, you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain` + +```ts +import { ethereum } from "thirdweb/chains"; + +const address = await resolveName({ + client, + address: "0x...", + resolverAddress: "0x...", + resolverChain: ethereum, +}); +``` + +```ts +function resolveName(options: ResolveUDNameOptions): Promise; +``` + +### Parameters + + The options for resolving an UD domain + +#### Type + +```ts +let options: { + address: string; + client: ThirdwebClient; + resolverAddress?: string; + resolverChain?: Chain; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## reverseNameOf + + Calls the "reverseNameOf" function on the contract. + +### Example + +```ts +import { reverseNameOf } from "thirdweb/extensions/unstoppable-domains"; + +const result = await reverseNameOf({ + contract, + addr: ..., +}); +``` + +```ts +function reverseNameOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the reverseNameOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- +## VOTE +--- + +## canExecute + + Simulate the `execute` method of the Vote contract, to check if you can execute a proposal + +### Example + +```ts +import { canExecute } from "thirdweb/extensions/vote"; + +const executable = await canExecute({ contract, proposalId }); +``` + +```ts +function canExecute( + options: BaseTransactionOptions<{ proposalId: bigint }>, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions<{ proposalId: bigint }>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + boolean - `true` if the proposal is executable, else `false` +--- + +## castVote + + Prepares a transaction to call the "castVote" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { castVote } from "thirdweb/extensions/vote"; + +const transaction = castVote({ + contract, + proposalId: ..., + support: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function castVote( + options: BaseTransactionOptions< + CastVoteParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "castVote" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + CastVoteParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## castVoteBySig + + Prepares a transaction to call the "castVoteBySig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { castVoteBySig } from "thirdweb/extensions/vote"; + +const transaction = castVoteBySig({ + contract, + proposalId: ..., + support: ..., + v: ..., + r: ..., + s: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function castVoteBySig( + options: BaseTransactionOptions< + | CastVoteBySigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "castVoteBySig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CastVoteBySigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## castVoteWithReason + + Prepares a transaction to call the "castVoteWithReason" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { castVoteWithReason } from "thirdweb/extensions/vote"; + +const transaction = castVoteWithReason({ + contract, + proposalId: ..., + support: ..., + reason: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function castVoteWithReason( + options: BaseTransactionOptions< + | CastVoteWithReasonParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "castVoteWithReason" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CastVoteWithReasonParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## castVoteWithReasonAndParams + + Prepares a transaction to call the "castVoteWithReasonAndParams" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { castVoteWithReasonAndParams } from "thirdweb/extensions/vote"; + +const transaction = castVoteWithReasonAndParams({ + contract, + proposalId: ..., + support: ..., + reason: ..., + params: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function castVoteWithReasonAndParams( + options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "castVoteWithReasonAndParams" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## castVoteWithReasonAndParamsBySig + + Prepares a transaction to call the "castVoteWithReasonAndParamsBySig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { castVoteWithReasonAndParamsBySig } from "thirdweb/extensions/vote"; + +const transaction = castVoteWithReasonAndParamsBySig({ + contract, + proposalId: ..., + support: ..., + reason: ..., + params: ..., + v: ..., + r: ..., + s: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function castVoteWithReasonAndParamsBySig( + options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsBySigParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "castVoteWithReasonAndParamsBySig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsBySigParams + | { + asyncParams: () => Promise; + } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## execute + + Prepares a transaction to call the "execute" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { execute } from "thirdweb/extensions/vote"; + +const transaction = execute({ + contract, + targets: ..., + values: ..., + calldatas: ..., + descriptionHash: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function execute( + options: BaseTransactionOptions< + ExecuteParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "execute" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + ExecuteParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## executeProposal + + Execute a Proposal + +### Example + +```ts +import { executeProposal } from "thirdweb/extensions/vote"; + +const transaction = executeProposal({ contract, proposalId }); +const tx = await sendTransaction({ transaction, account }); +``` + +```ts +function executeProposal( + options: BaseTransactionOptions<{ proposalId: bigint }>, +): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions<{ proposalId: bigint }>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + a prepared transaction for the `execute` method +--- + +## getAll + + Get all proposals from a Vote contract with some extra info attached for each proposal (current state and votes) + +### Example + +```ts +import { getAll } from "thirdweb/extension/getAll"; + +const allProposals = await getAll({ contract }); +``` + +```ts +function getAll( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: { + description: string; + endBlock: bigint; + executions: Array<{ + nativeTokenValue: bigint | undefined; + toAddress: string | undefined; + transactionData: Hex | undefined; + }>; + proposalId: bigint; + proposer: string; + startBlock: bigint; + state: number; + stateLabel: string | undefined; + votes: ProposalVoteInfo; +}; +``` + + An array containing proposals data +--- + +## getAllProposals + + Calls the "getAllProposals" function on the contract. + +### Example + +```ts +import { getAllProposals } from "thirdweb/extensions/vote"; + +const result = await getAllProposals({ + contract, +}); +``` + +```ts +function getAllProposals(options: BaseTransactionOptions) : Promise; description: string; endBlock: bigint; proposalId: bigint; proposer: string; signatures: readonly Array; startBlock: bigint; targets: readonly Array; values: readonly Array }>> +``` + +### Parameters + + The options for the getAllProposals function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; description: string; endBlock: bigint; proposalId: bigint; proposer: string; signatures: readonly Array; startBlock: bigint; targets: readonly Array; values: readonly Array }>> +``` + + The parsed result of the function call. +--- + +## getProposalVoteCounts + + Get the info about Against, For and Abstain votes of a proposal + +### Example + +```ts +import { getProposalVoteCounts } from "thirdweb/extensions/vote"; + +const data = await getProposalVoteCounts({ contract, proposalId }); + +// Example result +{ + for: 12000000000000000000n, // 12 tokens (with a decimals of 18) were used to vote "for" + against: 7000000000000000000n, // 7 tokens (with a decimals of 18) were used to vote "against" + abstain: 0n, // no user has voted abstain on this proposal +} +``` + +```ts +function getProposalVoteCounts( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + the object containing the info about Against, For and Abstain votes of a proposal Note: the count is displayed in "wei" +--- + +## getVotes + + Calls the "getVotes" function on the contract. + +### Example + +```ts +import { getVotes } from "thirdweb/extensions/vote"; + +const result = await getVotes({ + contract, + account: ..., + blockNumber: ..., +}); +``` + +```ts +function getVotes( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getVotes function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getVotesWithParams + + Calls the "getVotesWithParams" function on the contract. + +### Example + +```ts +import { getVotesWithParams } from "thirdweb/extensions/vote"; + +const result = await getVotesWithParams({ + contract, + account: ..., + blockNumber: ..., + params: ..., +}); +``` + +```ts +function getVotesWithParams( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getVotesWithParams function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## hashProposal + + Calls the "hashProposal" function on the contract. + +### Example + +```ts +import { hashProposal } from "thirdweb/extensions/vote"; + +const result = await hashProposal({ + contract, + targets: ..., + values: ..., + calldatas: ..., + descriptionHash: ..., +}); +``` + +```ts +function hashProposal( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the hashProposal function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## hasVoted + + Calls the "hasVoted" function on the contract. + +### Example + +```ts +import { hasVoted } from "thirdweb/extensions/vote"; + +const result = await hasVoted({ + contract, + proposalId: ..., + account: ..., +}); +``` + +```ts +function hasVoted( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the hasVoted function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## proposalDeadline + + Calls the "proposalDeadline" function on the contract. + +### Example + +```ts +import { proposalDeadline } from "thirdweb/extensions/vote"; + +const result = await proposalDeadline({ + contract, + proposalId: ..., +}); +``` + +```ts +function proposalDeadline( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the proposalDeadline function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## proposalExists + + Check if a proposal exists based on a given proposalId + +### Example + +```ts +import { proposalExists } from "thirdweb/extensions/vote"; + +// Check if the proposal with proposalId `4` exists +const exists = await proposalExists({ contract, proposalId: 4n }); // either `true` or `false` +``` + +```ts +function proposalExists( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + +`true` if the proposal exists, else `false` +--- + +## proposalIndex + + Calls the "proposalIndex" function on the contract. + +### Example + +```ts +import { proposalIndex } from "thirdweb/extensions/vote"; + +const result = await proposalIndex({ + contract, +}); +``` + +```ts +function proposalIndex( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the proposalIndex function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## proposals + + Calls the "proposals" function on the contract. + +### Example + +```ts +import { proposals } from "thirdweb/extensions/vote"; + +const result = await proposals({ + contract, + key: ..., +}); +``` + +```ts +function proposals( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the proposals function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise< + readonly [bigint, string, bigint, bigint, string] +>; +``` + + The parsed result of the function call. +--- + +## proposalSnapshot + + Calls the "proposalSnapshot" function on the contract. + +### Example + +```ts +import { proposalSnapshot } from "thirdweb/extensions/vote"; + +const result = await proposalSnapshot({ + contract, + proposalId: ..., +}); +``` + +```ts +function proposalSnapshot( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the proposalSnapshot function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## proposalThreshold + + Calls the "proposalThreshold" function on the contract. + +### Example + +```ts +import { proposalThreshold } from "thirdweb/extensions/vote"; + +const result = await proposalThreshold({ + contract, +}); +``` + +```ts +function proposalThreshold( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the proposalThreshold function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## proposalVotes + + Calls the "proposalVotes" function on the contract. + +### Example + +```ts +import { proposalVotes } from "thirdweb/extensions/vote"; + +const result = await proposalVotes({ + contract, + proposalId: ..., +}); +``` + +```ts +function proposalVotes( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the proposalVotes function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## propose + + Prepares a transaction to call the "propose" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { propose } from "thirdweb/extensions/vote"; + +const transaction = propose({ + contract, + targets: ..., + values: ..., + calldatas: ..., + description: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function propose( + options: BaseTransactionOptions< + ProposeParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "propose" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + ProposeParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## quorum + + Calls the "quorum" function on the contract. + +### Example + +```ts +import { quorum } from "thirdweb/extensions/vote"; + +const result = await quorum({ + contract, + blockNumber: ..., +}); +``` + +```ts +function quorum( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the quorum function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## quorumDenominator + + Calls the "quorumDenominator" function on the contract. + +### Example + +```ts +import { quorumDenominator } from "thirdweb/extensions/vote"; + +const result = await quorumDenominator({ + contract, +}); +``` + +```ts +function quorumDenominator( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the quorumDenominator function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## quorumNumeratorByBlockNumber + + Calls the "quorumDenominator" function on the contract with an extra param called `blockNumber` . This extension is similar to the `quorumDenominator` extension, except that it takes in a bigint (blockNumber) + +### Example + +```ts +import { quorumNumeratorByBlockNumber } from "thirdweb/extensions/vote"; + +const result = await quorumNumeratorByBlockNumber({ + contract, + blockNumber: 13232234232n, +}); +``` + +```ts +function quorumNumeratorByBlockNumber( + options: BaseTransactionOptions<{ blockNumber: bigint }>, +): Promise; +``` + +### Parameters + + The options for the quorumDenominator function. + +#### Type + +```ts +let options: BaseTransactionOptions<{ blockNumber: bigint }>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## relay + + Prepares a transaction to call the "relay" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { relay } from "thirdweb/extensions/vote"; + +const transaction = relay({ + contract, + target: ..., + value: ..., + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function relay( + options: BaseTransactionOptions< + RelayParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "relay" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + RelayParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setProposalThreshold + + Prepares a transaction to call the "setProposalThreshold" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setProposalThreshold } from "thirdweb/extensions/vote"; + +const transaction = setProposalThreshold({ + contract, + newProposalThreshold: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setProposalThreshold( + options: BaseTransactionOptions< + | SetProposalThresholdParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setProposalThreshold" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetProposalThresholdParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setVotingDelay + + Prepares a transaction to call the "setVotingDelay" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setVotingDelay } from "thirdweb/extensions/vote"; + +const transaction = setVotingDelay({ + contract, + newVotingDelay: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setVotingDelay( + options: BaseTransactionOptions< + | SetVotingDelayParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setVotingDelay" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetVotingDelayParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setVotingPeriod + + Prepares a transaction to call the "setVotingPeriod" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { setVotingPeriod } from "thirdweb/extensions/vote"; + +const transaction = setVotingPeriod({ + contract, + newVotingPeriod: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setVotingPeriod( + options: BaseTransactionOptions< + | SetVotingPeriodParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setVotingPeriod" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetVotingPeriodParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## state + + Calls the "state" function on the contract. + +### Example + +```ts +import { state } from "thirdweb/extensions/vote"; + +const result = await state({ + contract, + proposalId: ..., +}); +``` + +```ts +function state( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the state function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## token + + Calls the "token" function on the contract. + +### Example + +```ts +import { token } from "thirdweb/extensions/vote"; + +const result = await token({ + contract, +}); +``` + +```ts +function token(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the token function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## updateQuorumNumerator + + Prepares a transaction to call the "updateQuorumNumerator" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { updateQuorumNumerator } from "thirdweb/extensions/vote"; + +const transaction = updateQuorumNumerator({ + contract, + newQuorumNumerator: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function updateQuorumNumerator( + options: BaseTransactionOptions< + | UpdateQuorumNumeratorParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "updateQuorumNumerator" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | UpdateQuorumNumeratorParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## votingDelay + + Calls the "votingDelay" function on the contract. + +### Example + +```ts +import { votingDelay } from "thirdweb/extensions/vote"; + +const result = await votingDelay({ + contract, +}); +``` + +```ts +function votingDelay( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the votingDelay function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## votingPeriod + + Calls the "votingPeriod" function on the contract. + +### Example + +```ts +import { votingPeriod } from "thirdweb/extensions/vote"; + +const result = await votingPeriod({ + contract, +}); +``` + +```ts +function votingPeriod( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the votingPeriod function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- +## MODULES +--- + +## cancelOwnershipHandover + + Prepares a transaction to call the "cancelOwnershipHandover" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { cancelOwnershipHandover } from "thirdweb/extensions/modules"; + +const transaction = cancelOwnershipHandover(); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function cancelOwnershipHandover( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the "cancelOwnershipHandover" function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## completeOwnershipHandover + + Prepares a transaction to call the "completeOwnershipHandover" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { completeOwnershipHandover } from "thirdweb/extensions/modules"; + +const transaction = completeOwnershipHandover({ + contract, + pendingOwner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function completeOwnershipHandover( + options: BaseTransactionOptions< + | CompleteOwnershipHandoverParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "completeOwnershipHandover" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | CompleteOwnershipHandoverParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## getInstalledModules + + Calls the "getInstalledModules" function on the contract. + +### Example + +```ts +import { getInstalledModules } from "thirdweb/extensions/modules"; + +const result = await getInstalledModules({ + contract, +}); +``` + +```ts +function getInstalledModules(options: BaseTransactionOptions) : Promise; fallbackFunctions: readonly Array<{ permissionBits: bigint; selector: `0x${string}` }>; registerInstallationCallback: boolean; requiredInterfaces: readonly Array<`0x${string}`>; supportedInterfaces: readonly Array<`0x${string}`> }; implementation: string }>> +``` + +### Parameters + + The options for the getInstalledModules function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; fallbackFunctions: readonly Array<{ permissionBits: bigint; selector: `0x${string}` }>; registerInstallationCallback: boolean; requiredInterfaces: readonly Array<`0x${string}`>; supportedInterfaces: readonly Array<`0x${string}`> }; implementation: string }>> +``` + + The parsed result of the function call. +--- + +## getModuleConfig + + Calls the "getModuleConfig" function on the contract. + +### Example + +```ts +import { getModuleConfig } from "thirdweb/extensions/modules"; + +const result = await getModuleConfig({ + contract, +}); +``` + +```ts +function getModuleConfig(options: BaseTransactionOptions) : Promise<{ callbackFunctions: readonly Array<{ selector: `0x${string}` }>; fallbackFunctions: readonly Array<{ permissionBits: bigint; selector: `0x${string}` }>; registerInstallationCallback: boolean; requiredInterfaces: readonly Array<`0x${string}`>; supportedInterfaces: readonly Array<`0x${string}`> }> +``` + +### Parameters + + The options for the getModuleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<{ callbackFunctions: readonly Array<{ selector: `0x${string}` }>; fallbackFunctions: readonly Array<{ permissionBits: bigint; selector: `0x${string}` }>; registerInstallationCallback: boolean; requiredInterfaces: readonly Array<`0x${string}`>; supportedInterfaces: readonly Array<`0x${string}`> }> +``` + + The parsed result of the function call. +--- + +## getSupportedCallbackFunctions + + Calls the "getSupportedCallbackFunctions" function on the contract. + +### Example + +```ts +import { getSupportedCallbackFunctions } from "thirdweb/extensions/modules"; + +const result = await getSupportedCallbackFunctions({ + contract, +}); +``` + +```ts +function getSupportedCallbackFunctions(options: BaseTransactionOptions) : Promise> +``` + +### Parameters + + The options for the getSupportedCallbackFunctions function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise> +``` + + The parsed result of the function call. +--- + +## grantRoles + + Prepares a transaction to call the "grantRoles" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { grantRoles } from "thirdweb/extensions/modules"; + +const transaction = grantRoles({ + contract, + user: ..., + roles: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function grantRoles( + options: BaseTransactionOptions< + | GrantRolesParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "grantRoles" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + GrantRolesParams | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## hasAllRoles + + Calls the "hasAllRoles" function on the contract. + +### Example + +```ts +import { hasAllRoles } from "thirdweb/extensions/modules"; + +const result = await hasAllRoles({ + contract, + user: ..., + roles: ..., +}); +``` + +```ts +function hasAllRoles( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the hasAllRoles function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## hasAnyRole + + Calls the "hasAnyRole" function on the contract. + +### Example + +```ts +import { hasAnyRole } from "thirdweb/extensions/modules"; + +const result = await hasAnyRole({ + contract, + user: ..., + roles: ..., +}); +``` + +```ts +function hasAnyRole( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the hasAnyRole function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## installModule + + Prepares a transaction to call the "installModule" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { installModule } from "thirdweb/extensions/modules"; + +const transaction = installModule({ + contract, + moduleContract: ..., + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function installModule( + options: BaseTransactionOptions< + | InstallModuleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "installModule" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | InstallModuleParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## isGetInstalledModulesSupported + + Checks if the `getInstalledModules` method is supported by the given contract. + +### Example + +```ts +import { isGetInstalledModulesSupported } from "thirdweb/extensions/modules"; +const supported = isGetInstalledModulesSupported(["0x..."]); +``` + +```ts +function isGetInstalledModulesSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getInstalledModules` method is supported. +--- + +## isGetModuleConfigSupported + + Checks if the `getModuleConfig` method is supported by the given contract. + +### Example + +```ts +import { isGetModuleConfigSupported } from "thirdweb/extensions/modules"; +const supported = isGetModuleConfigSupported(["0x..."]); +``` + +```ts +function isGetModuleConfigSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getModuleConfig` method is supported. +--- + +## isGetSupportedCallbackFunctionsSupported + + Checks if the `getSupportedCallbackFunctions` method is supported by the given contract. + +### Example + +```ts +import { isGetSupportedCallbackFunctionsSupported } from "thirdweb/extensions/modules"; +const supported = isGetSupportedCallbackFunctionsSupported(["0x..."]); +``` + +```ts +function isGetSupportedCallbackFunctionsSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `getSupportedCallbackFunctions` method is supported. +--- + +## isInstallModuleSupported + + Checks if the `installModule` method is supported by the given contract. + +### Example + +```ts +import { isInstallModuleSupported } from "thirdweb/extensions/modules"; + +const supported = isInstallModuleSupported(["0x..."]); +``` + +```ts +function isInstallModuleSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `installModule` method is supported. +--- + +## isUninstallModuleSupported + + Checks if the `uninstallModule` method is supported by the given contract. + +### Example + +```ts +import { isUninstallModuleSupported } from "thirdweb/extensions/modules"; + +const supported = isUninstallModuleSupported(["0x..."]); +``` + +```ts +function isUninstallModuleSupported( + availableSelectors: Array, +): boolean; +``` + +### Parameters + + An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors. + +#### Type + +```ts +let availableSelectors: Array; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A boolean indicating if the `uninstallModule` method is supported. +--- + +## owner + + Calls the "owner" function on the contract. + +### Example + +```ts +import { owner } from "thirdweb/extensions/modules"; + +const result = await owner({ + contract, +}); +``` + +```ts +function owner(options: BaseTransactionOptions): Promise; +``` + +### Parameters + + The options for the owner function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## ownershipHandoverExpiresAt + + Calls the "ownershipHandoverExpiresAt" function on the contract. + +### Example + +```ts +import { ownershipHandoverExpiresAt } from "thirdweb/extensions/modules"; + +const result = await ownershipHandoverExpiresAt({ + contract, + pendingOwner: ..., +}); +``` + +```ts +function ownershipHandoverExpiresAt( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the ownershipHandoverExpiresAt function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## renounceOwnership + + Prepares a transaction to call the "renounceOwnership" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { renounceOwnership } from "thirdweb/extensions/modules"; + +const transaction = renounceOwnership(); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function renounceOwnership( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the "renounceOwnership" function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## renounceRoles + + Prepares a transaction to call the "renounceRoles" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { renounceRoles } from "thirdweb/extensions/modules"; + +const transaction = renounceRoles({ + contract, + roles: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function renounceRoles( + options: BaseTransactionOptions< + | RenounceRolesParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "renounceRoles" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | RenounceRolesParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## requestOwnershipHandover + + Prepares a transaction to call the "requestOwnershipHandover" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { requestOwnershipHandover } from "thirdweb/extensions/modules"; + +const transaction = requestOwnershipHandover(); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function requestOwnershipHandover( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the "requestOwnershipHandover" function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## revokeRoles + + Prepares a transaction to call the "revokeRoles" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { revokeRoles } from "thirdweb/extensions/modules"; + +const transaction = revokeRoles({ + contract, + user: ..., + roles: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function revokeRoles( + options: BaseTransactionOptions< + | RevokeRolesParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "revokeRoles" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | RevokeRolesParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## rolesOf + + Calls the "rolesOf" function on the contract. + +### Example + +```ts +import { rolesOf } from "thirdweb/extensions/modules"; + +const result = await rolesOf({ + contract, + user: ..., +}); +``` + +```ts +function rolesOf( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the rolesOf function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## transferOwnership + + Prepares a transaction to call the "transferOwnership" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { transferOwnership } from "thirdweb/extensions/modules"; + +const transaction = transferOwnership({ + contract, + newOwner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function transferOwnership( + options: BaseTransactionOptions< + | TransferOwnershipParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "transferOwnership" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | TransferOwnershipParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## uninstallModule + + Prepares a transaction to call the "uninstallModule" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { uninstallModule } from "thirdweb/extensions/modules"; + +const transaction = uninstallModule({ + contract, + moduleContract: ..., + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function uninstallModule( + options: BaseTransactionOptions< + | UninstallModuleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "uninstallModule" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | UninstallModuleParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## encodeMintParams + + Encodes the parameters for the "encodeBytesBeforeMintERC20" function. + +### Example + +```ts +import { encodeEncodeBytesBeforeMintERC20Params } "thirdweb/extensions/modules"; +const result = encodeEncodeBytesBeforeMintERC20Params({ + params: ..., +}); +``` + +```ts +function encodeMintParams( + options: EncodeBytesBeforeMintERC20Params, +): `0x${string}`; +``` + +### Parameters + + The options for the encodeBytesBeforeMintERC20 function. + +#### Type + +```ts +let options: EncodeBytesBeforeMintERC20Params; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + The encoded ABI parameters. +--- + +## encodeMintParams + + Encodes the parameters for the "encodeBytesBeforeMintERC20" function. + +### Example + +```ts +import { encodeEncodeBytesBeforeMintERC20Params } "thirdweb/extensions/modules"; +const result = encodeEncodeBytesBeforeMintERC20Params({ + params: ..., +}); +``` + +```ts +function encodeMintParams( + options: EncodeBytesBeforeMintERC20Params, +): `0x${string}`; +``` + +### Parameters + + The options for the encodeBytesBeforeMintERC20 function. + +#### Type + +```ts +let options: EncodeBytesBeforeMintERC20Params; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + The encoded ABI parameters. +--- + +## encodeMintParams + + Encodes the parameters for the "encodeBytesBeforeMintERC721" function. + +### Example + +```ts +import { encodeEncodeBytesBeforeMintERC721Params } "thirdweb/extensions/modules"; +const result = encodeEncodeBytesBeforeMintERC721Params({ + params: ..., +}); +``` + +```ts +function encodeMintParams( + options: EncodeBytesBeforeMintERC721Params, +): `0x${string}`; +``` + +### Parameters + + The options for the encodeBytesBeforeMintERC721 function. + +#### Type + +```ts +let options: EncodeBytesBeforeMintERC721Params; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + The encoded ABI parameters. +--- +## EIP5792 +--- + +## getCallsStatus + + Get the status of an [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle. + + This function is dependent on the wallet's support for EIP-5792 and could fail. + +### Example + +```ts +import { createThirdwebClient } from "thirdweb"; + import { sendCalls, getCallsStatus } from "thirdweb/wallets/eip5792"; + + const client = createThirdwebClient({ clientId: ... }); + + const bundleId = await sendCalls({ wallet, client, calls }); + + let result; + while (result.status !== "CONFIRMED") { + result = await getCallsStatus({ wallet, client, bundleId }); + } +``` + +```ts +function getCallsStatus( + options: GetCallsStatusOptions, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + bundleId: WalletSendCallsId; + client: ThirdwebClient; + wallet: Wallet; +}; +``` + +### Returns + +```ts +let returnType: { + receipts: Array>; + status: "PENDING" | "CONFIRMED"; +}; +``` + +* A promise that resolves to the bundle's status and receipts (if available). GetCallsStatusResponse +--- + +## getCapabilities + + Get the capabilities of a wallet based on the [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) specification. + + This function is dependent on the wallet's support for EIP-5792, but will not throw. _The returned object contains a `message` field detailing any issues with the wallet's support for EIP-5792._ + +### Example + +```ts +import { getCapabilities } from "thirdweb/wallets/eip5792"; + +const wallet = createWallet("com.coinbase.wallet"); +const capabilities = await getCapabilities({ wallet }); +``` + +```ts +function getCapabilities( + options: GetCapabilitiesOptions, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: GetCapabilitiesOptions; +``` + +### Returns + +```ts +let returnType: Prettify< + WalletCapabilitiesRecord +>; +``` + +* A promise that resolves to the capabilities of the wallet based on the [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) spec. +--- + +## sendCalls + + Send [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) calls to a wallet. This function works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792\. Transactions will be bundled and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions. + + This function is dependent on the wallet's support for EIP-5792 and could fail. + +* getCallsStatus for how to retrieve the status of the bundle. +* getCapabilities for how to retrieve the capabilities of the wallet. + +### Example + +```ts +import { createThirdwebClient } from "thirdweb"; +import { sendCalls } from "thirdweb/wallets/eip5792"; + +const client = createThirdwebClient({ clientId: ... }); +const wallet = createWallet("com.coinbase.wallet"); + +const sendTx1 = approve({ + contract: USDT_CONTRACT, + amount: 100, + spender: "0x33d9B8BEfE81027E2C859EDc84F5636cbb202Ed6", + }); +const sendTx2 = approve({ + contract: USDT_CONTRACT, + amount: 100, + spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709", + }); +const bundleId = await sendCalls({ + wallet, + client, + calls: [sendTx1, sendTx2], +}); +``` + + Sponsor transactions with a paymaster: + +```ts +const bundleId = await sendCalls({ + wallet, + client, + calls: [send1, send2], + capabilities: { + paymasterService: { + url: `https://${CHAIN.id}.bundler.thirdweb.com/${client.clientId}` + } + } +}); + We recommend proxying any paymaster calls via an API route you setup and control. +``` + +```ts +function sendCalls( + options: SendCallsOptions, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: SendCallsOptions; +``` + +### Returns + +```ts +let returnType: WalletSendCallsId; +``` + + The ID of the bundle of the calls. +--- + +## waitForBundle + + Waits for the [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle to be confirmed. + + This function is dependent on the wallet's support for EIP-5792 and could fail. + +### Example + +```ts +import { waitForBundle } from "thirdweb/wallets/eip5792"; +const result = await waitForBundle({ + client, + chain, + wallet, + bundleId: "0x123...", +}); +``` + +```ts +function waitForBundle(options: { + bundleId: string; + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + wallet: Wallet; +}): Promise; +``` + +### Parameters + + The options for waiting for the bundle. By default, the max wait time is 100 blocks. + +#### Type + +```ts +let options: { + bundleId: string; + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + wallet: Wallet; +}; +``` + +### Returns + +```ts +let returnType: { + receipts: Array>; + status: "PENDING" | "CONFIRMED"; +}; +``` + + A promise that resolves with the final getCallsStatus result. +--- +# Modules +--- +## Common +--- + +## checkModulesCompatibility + + Check if the given modules are compatible with the given core contract + +```ts +function checkModulesCompatibility(options: { + chain: Readonly; + client: ThirdwebClient; + coreBytecode: string; + moduleBytecodes: Array; +}): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + chain: Readonly; + client: ThirdwebClient; + coreBytecode: string; + moduleBytecodes: Array; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## deployModularContract + + Deploys an thirdweb ERC20 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. + +### Example + +```ts +import { deployModularContract } from "thirdweb/modules"; +const contractAddress = await deployModularContract({ + chain, + client, + account, + core: "ERC20", + params: { + name: "MyToken", + description: "My Token contract", + symbol: "MT", + }, + modules: [ + ClaimableERC721.module({ + primarySaleRecipient: "0x...", + }), + RoyaltyERC721.module({ + royaltyRecipient: "0x...", + royaltyBps: 500n, + }), + ], +}); +``` + +```ts +function deployModularContract(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + core: CoreType; + modules?: Array; + params: ModularContractParams; + publisher?: string; + salt?: string; +}): Promise; +``` + +### Parameters + + The deployment options. + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + core: CoreType; + modules?: Array; + params: ModularContractParams; + publisher?: string; + salt?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The deployed contract address. +--- + +## getDeployedModule + + Gets a deployed module implementation contract. + +### Example + +```ts +import { getDeployedModule } from "thirdweb/modules"; + +const module = await getDeployedModule({ + client, + chain, + contractId, + publisher, +}); +``` + +```ts +function getDeployedModule(options: { + chain: Readonly; + client: ThirdwebClient; + contractId: string; + publisher?: string; +}): Promise>>; +``` + +### Parameters + + The options to use. + +#### Type + +```ts +let options: { + chain: Readonly; + client: ThirdwebClient; + contractId: string; + publisher?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise>>; +``` + + The module. +--- + +## getOrDeployModule + + Gets or deploys a module implementation contract. + +### Example + +```ts +import { getOrDeployModule } from "thirdweb/modules"; + +const module = await getOrDeployModule({ + client, + chain, + account, + contractId, + publisher, +}); +``` + +```ts +function getOrDeployModule(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + contractId: string; + publisher?: string; +}): Promise>>; +``` + +### Parameters + + The options to use. + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + contractId: string; + publisher?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise>>; +``` + + The module. +--- + +## grantMinterRole + + Grants the minter role to a user. + +### Example + +```ts +import { grantMinterRole } from "thirdweb/modules"; + +const tx = await grantMinterRole({ + contract, + user: userAddress, +}); +``` + +```ts +function grantMinterRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction to send. +--- + +## installPublishedModule + + Install a published module on a modular contract + +### Example + +```ts +import { installPublishedModule } from "thirdweb/modules"; +const transaction = installPublishedModule({ + client, + chain, + account, + contract, + moduleName: "MyModule", + publisherAddress: "0x...", +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function installPublishedModule( + options: InstallPublishedModuleOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for installing a published module + +#### Type + +```ts +let options: { + account: Account; + constructorParams?: Record; + contract: ThirdwebContract; + moduleData?: `0x${string}`; + moduleName: string; + publisher?: string; + version?: string; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction to send +--- + +## uninstallModuleByProxy + + Uninstall an module by proxy + +### Example + +```ts +import { uninstallModuleByProxy } from "thirdweb/modules"; +const transaction = uninstallModuleByProxy({ + client, + chain, + contract, + moduleProxyAddress: "0x...", +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function uninstallModuleByProxy( + options: UninstallModuleByProxyOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for uninstalling an module by proxy + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; + contract: ThirdwebContract; + moduleData?: `0x${string}`; + moduleProxyAddress: string; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction to send +--- + +## uninstallPublishedModule + + Uninstall a published module + +### Example + +```ts +import { uninstallPublishedModule } from "thirdweb/modules"; +const transaction = uninstallPublishedModule({ + client, + chain, + contract, + moduleName: "MyModule", + publisherAddress: "0x...", +}); +await sendTransaction({ transaction, account }); +``` + +```ts +function uninstallPublishedModule( + options: UninstallPublishedModuleOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for uninstalling a published module + +#### Type + +```ts +let options: { + contract: ThirdwebContract; + moduleData?: `0x${string}`; + moduleName: string; + publisherAddress?: string; + version?: string; +}; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction to send +--- +## BatchMetadataERC1155 +--- + +## batchMetadataUpdateEvent + + Creates an event object for the BatchMetadataUpdate event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { BatchMetadataERC1155 } from "thirdweb/modules"; + +const events = await getContractEvents({ + contract, + events: [BatchMetadataERC1155.batchMetadataUpdateEvent()], +}); +``` + +```ts +function batchMetadataUpdateEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly name: "startTokenIdIncluside"; + readonly type: "uint256"; + }, + { + readonly name: "endTokenIdInclusive"; + readonly type: "uint256"; + }, + { readonly name: "baseURI"; readonly type: "string" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly name: "startTokenIdIncluside"; + readonly type: "uint256"; + }, + { + readonly name: "endTokenIdInclusive"; + readonly type: "uint256"; + }, + { readonly name: "baseURI"; readonly type: "string" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## encodeInstall + + Encodes the install data for the BatchMetadataERC1155 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## install + + Installs the BatchMetadataERC1155 module on a core contract. + +### Example + +```ts +import { BatchMetadataERC1155 } from "thirdweb/modules"; + +const transaction = BatchMetadataERC1155.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## module + + Convenience function to add the BatchMetadataERC1155 module as a default module on a core contract. + +### Example + +```ts +import { + BatchMetadataERC1155, + deployModularContract, +} from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC1155", + params: { + name: "My Modular Contract", + }, + modules: [BatchMetadataERC1155.module()], +}); +``` + +```ts +function module(params?: { + publisher?: string; +}): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +* The module function. +--- + +## uploadMetadata + + Uploads metadata for a batch of NFTs. + +### Example + +```ts +import { BatchMetadataERC1155 } from "thirdweb/modules"; + +const transaction = BatchMetadataERC1155.uploadMetadata({ + contract, + metadatas: [{ name: "My NFT", description: "This is my NFT" }], +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function uploadMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction to upload the metadata. +--- +## BatchMetadataERC721 +--- + +## batchMetadataUpdateEvent + + Creates an event object for the BatchMetadataUpdate event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { BatchMetadataERC721 } from "thirdweb/modules"; + +const events = await getContractEvents({ + contract, + events: [BatchMetadataERC721.batchMetadataUpdateEvent()], +}); +``` + +```ts +function batchMetadataUpdateEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { + readonly name: "startTokenIdIncluside"; + readonly type: "uint256"; + }, + { + readonly name: "endTokenIdInclusive"; + readonly type: "uint256"; + }, + { readonly name: "baseURI"; readonly type: "string" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { + readonly name: "startTokenIdIncluside"; + readonly type: "uint256"; + }, + { + readonly name: "endTokenIdInclusive"; + readonly type: "uint256"; + }, + { readonly name: "baseURI"; readonly type: "string" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## encodeInstall + + Encodes the install data for the BatchMetadataERC721 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## install + + Installs the BatchMetadataERC721 module on a core contract. + +### Example + +```ts +import { BatchMetadataERC721 } from "thirdweb/modules"; + +const transaction = BatchMetadataERC721.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## module + + Convenience function to add the BatchMetadataERC721 module as a default module on a core contract. + +### Example + +```ts +import { + BatchMetadataERC721, + deployModularContract, +} from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [BatchMetadataERC721.module()], +}); +``` + +```ts +function module(params?: { + publisher?: string; +}): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +* The module function. +--- + +## uploadMetadata + + Uploads metadata for a batch of NFTs. + +### Example + +```ts +import { BatchMetadataERC721 } from "thirdweb/modules"; + +const transaction = BatchMetadataERC721.uploadMetadata({ + contract, + metadatas: [{ name: "My NFT", description: "This is my NFT" }], +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function uploadMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for the transaction. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + The transaction to upload the metadata. +--- +## ClaimableERC1155 +--- + +## encodeInstall + + Encodes the install data for the ClaimableERC1155 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## getClaimCondition + + Calls the "getClaimConditionByTokenId" function on the contract. + +### Example + +```ts +import { ClaimableERC1155 } from "thirdweb/modules"; + +const result = await ClaimableERC1155.getClaimConditionByTokenId({ + contract, + tokenId: ..., +}); +``` + +```ts +function getClaimCondition( + options: BaseTransactionOptions, +): Promise<{ + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; +}>; +``` + +### Parameters + + The options for the getClaimConditionByTokenId function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; +}>; +``` + + The parsed result of the function call. +--- + +## getSaleConfig + + Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { ClaimableERC1155 } from "thirdweb/modules"; + +const result = await ClaimableERC1155.getSaleConfig({ + contract, +}); +``` + +```ts +function getSaleConfig( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getSaleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the ClaimableERC1155 module on a core contract. + +### Example + +```ts +import { ClaimableERC1155 } from "thirdweb/modules"; + +const transaction = ClaimableERC1155.install({ + contract: coreContract, + account: account, + params: { + primarySaleRecipient: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## mint + + Mints ERC1155 tokens to a specified address via a ClaimableERC1155 module. + +### Example + +```typescript +import { ClaimableERC1155 } from "thirdweb/modules"; + +const transaction = ClaimableERC1155.mint({ + contract, + to: "0x...", // Address to mint tokens to + quantity: 2, // Amount of tokens to mint +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mint( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## module + + Convenience function to add the ClaimableERC1155 module as a default module on a core contract. + +### Example + +```ts +import { ClaimableERC1155, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC1155", + params: { + name: "My Modular Contract", + }, + modules: [ + ClaimableERC1155.module({ + primarySaleRecipient: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setClaimCondition + + Sets the claim conditions for a given token ID. + +### Example + +```ts +import { ClaimableERC1155 } from "thirdweb/modules"; + +const transaction = ClaimableERC1155.setClaimCondition({ + contract: contract, + tokenId: 0n, + pricePerToken: "1", // in ETH + maxClaimableSupply: "1000000", + maxClaimablePerWallet: "1", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function setClaimCondition( + options: BaseTransactionOptions< + ClaimConditionInput & { tokenId: bigint } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for setting the claim conditions. + +#### Type + +```ts +let options: BaseTransactionOptions< + ClaimConditionInput & { tokenId: bigint } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to set the claim conditions. +--- + +## setSaleConfig + + Prepares a transaction to call the "setSaleConfig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { ClaimableERC1155 } from "thirdweb/modules"; + +const transaction = ClaimableERC1155.setSaleConfig({ + contract, + primarySaleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSaleConfig( + options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSaleConfig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## ClaimableERC20 +--- + +## encodeInstall + + Encodes the install data for the ClaimableERC20 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## getClaimCondition + + Calls the "getClaimCondition" function on the contract. + +### Example + +```ts +import { ClaimableERC20 } from "thirdweb/modules"; + +const result = await ClaimableERC20.getClaimCondition({ + contract, +}); +``` + +```ts +function getClaimCondition( + options: BaseTransactionOptions, +): Promise<{ + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; +}>; +``` + +### Parameters + + The options for the getClaimCondition function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<{ + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; +}>; +``` + + The parsed result of the function call. +--- + +## getSaleConfig + + Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { ClaimableERC20 } from "thirdweb/modules"; + +const result = await ClaimableERC20.getSaleConfig({ + contract, +}); +``` + +```ts +function getSaleConfig( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getSaleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the ClaimableERC20 module on a core contract. + +### Example + +```ts +import { ClaimableERC20 } from "thirdweb/modules"; + +const transaction = ClaimableERC20.install({ + contract: coreContract, + account: account, + params: { + primarySaleRecipient: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## mint + + Mints tokens to a specified address via a ClaimableERC20 module. + +### Example + +```typescript +import { ClaimableERC20 } from "thirdweb/modules"; + +const transaction = ClaimableERC20.mint({ + contract, + to: "0x...", // Address to mint tokens to + quantity: "0.1", // Amount of tokens to mint (in decimals) +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mint( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## module + + Convenience function to add the ClaimableERC20 module as a default module on a core contract. + +### Example + +```ts +import { ClaimableERC20, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC20", + params: { + name: "My Modular Contract", + }, + modules: [ + ClaimableERC20.module({ + primarySaleRecipient: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setClaimCondition + + Sets the claim conditions for a given token ID. + +### Example + +```ts +import { ClaimableERC20 } from "thirdweb/modules"; + +const transaction = ClaimableERC20.setClaimCondition({ + contract: contract, + pricePerToken: "1", // in ETH + maxClaimableSupply: "1000000", + maxClaimablePerWallet: "1", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function setClaimCondition( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for setting the claim conditions. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to set the claim conditions. +--- + +## setSaleConfig + + Prepares a transaction to call the "setSaleConfig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { ClaimableERC20 } from "thirdweb/modules"; + +const transaction = ClaimableERC20.setSaleConfig({ + contract, + primarySaleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSaleConfig( + options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSaleConfig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## ClaimableERC721 +--- + +## encodeInstall + + Encodes the install data for the ClaimableERC721 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## getClaimCondition + + Calls the "getClaimCondition" function on the contract. + +### Example + +```ts +import { ClaimableERC721 } from "thirdweb/modules"; + +const result = await ClaimableERC721.getClaimCondition({ + contract, +}); +``` + +```ts +function getClaimCondition( + options: BaseTransactionOptions, +): Promise<{ + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; +}>; +``` + +### Parameters + + The options for the getClaimCondition function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise<{ + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; +}>; +``` + + The parsed result of the function call. +--- + +## getSaleConfig + + Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { ClaimableERC721 } from "thirdweb/modules"; + +const result = await ClaimableERC721.getSaleConfig({ + contract, +}); +``` + +```ts +function getSaleConfig( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getSaleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the ClaimableERC721 module on a core contract. + +### Example + +```ts +import { ClaimableERC721 } from "thirdweb/modules"; + +const transaction = ClaimableERC721.install({ + contract: coreContract, + account: account, + params: { + primarySaleRecipient: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## mint + + Mints ERC721 tokens to a specified address via a ClaimableERC721 module. + +### Example + +```typescript +import { ClaimableERC721 } from "thirdweb/modules"; + +const transaction = ClaimableERC721.mint({ + contract, + to: "0x...", // Address to mint tokens to + quantity: 2, // Amount of tokens to mint +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mint( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## module + + Convenience function to add the ClaimableERC721 module as a default module on a core contract. + +### Example + +```ts +import { ClaimableERC721, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [ + ClaimableERC721.module({ + primarySaleRecipient: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setClaimCondition + + Sets the claim conditions for a given token ID. + +### Example + +```ts +import { ClaimableERC721 } from "thirdweb/modules"; + +const transaction = ClaimableERC721.setClaimCondition({ + contract: contract, + pricePerToken: "1", // in ETH + maxClaimableSupply: "1000000", + maxClaimablePerWallet: "1", +}); + +await sendTransaction({ transaction, account }); +``` + +```ts +function setClaimCondition( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for setting the claim conditions. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to set the claim conditions. +--- + +## setSaleConfig + + Prepares a transaction to call the "setSaleConfig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { ClaimableERC721 } from "thirdweb/modules"; + +const transaction = ClaimableERC721.setSaleConfig({ + contract, + primarySaleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSaleConfig( + options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSaleConfig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## MintableERC1155 +--- + +## encodeInstall + + Encodes the install data for the MintableERC1155 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## generateMintSignature + + Generates a payload and signature for minting ERC1155 tokens with a signature. + +### Example + +```typescript +import { MintableERC1155 } from "thirdweb/modules"; + +// generate the payload and signature, this is typically done on the server +// requires to be generated with a wallet that has the MINTER_ROLE +const { payload, signature } = + await MintableERC1155.generateMintSignature({ + account, + contract, + nft: { + name: "My NFT", + description: "This is my NFT", + image: "ipfs://...", + }, + mintRequest: { + recipient: "0x...", + quantity: "10", + }, + }); + +// prepare the transaction, this is typically done on the client +// can be executed by any wallet +const transaction = MintableERC1155.mintWithSignature({ + contract, + payload, + signature, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + tokenId: bigint; + }; + signature: `0x${string}`; +}>; +``` + +### Parameters + + The options for generating the payload and signature. + +#### Type + +```ts +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + tokenId: bigint; + }; + signature: `0x${string}`; +}>; +``` + + The payload and signature. +--- + +## getSaleConfig + + Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { MintableERC1155 } from "thirdweb/modules"; + +const result = await MintableERC1155.getSaleConfig({ + contract, +}); +``` + +```ts +function getSaleConfig( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getSaleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the MintableERC1155 module on a core contract. + +### Example + +```ts +import { MintableERC1155 } from "thirdweb/modules"; + +const transaction = MintableERC1155.install({ + contract: coreContract, + account: account, + params: { + primarySaleRecipient: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## mintWithRole + + Mints ERC1155 tokens to a specified address via a MintableERC1155 module. + +### Example + +```typescript +import { MintableERC1155 } from "thirdweb/modules"; + +const transaction = MintableERC1155.mintWithRole({ + contract, + to: "0x...", // Address to mint tokens to + amount: 2, // Amount of tokens to mint + nft: { + name: "My NFT", + description: "This is my NFT", + image: "ipfs://...", + }, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## mintWithSignature + + Mints ERC1155 tokens to a specified address with a signature via a MintableERC1155 module. + +### Example + +```typescript +import { MintableERC1155 } from "thirdweb/modules"; + +// generate the payload and signature, this is typically done on the server +// requires to be generated with a wallet that has the MINTER_ROLE +const { payload, signature } = + await MintableERC1155.generateMintSignature({ + account, + contract, + nft: { + name: "My NFT", + description: "This is my NFT", + image: "ipfs://...", + }, + mintRequest: { + recipient: "0x...", + quantity: "10", + }, + }); + +// prepare the transaction, this is typically done on the client +// can be executed by any wallet +const transaction = MintableERC1155.mintWithSignature({ + contract, + payload, + signature, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithSignature( + options: BaseTransactionOptions<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + tokenId: bigint; + }; + signature: `0x${string}`; + }>, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + tokenId: bigint; + }; + signature: `0x${string}`; +}>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## module + + Convenience function to add the MintableERC1155 module as a default module on a core contract. + +### Example + +```ts +import { MintableERC1155, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC1155", + params: { + name: "My Modular Contract", + }, + modules: [ + MintableERC1155.module({ + primarySaleRecipient: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setSaleConfig + + Prepares a transaction to call the "setSaleConfig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { MintableERC1155 } from "thirdweb/modules"; + +const transaction = MintableERC1155.setSaleConfig({ + contract, + primarySaleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSaleConfig( + options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSaleConfig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## MintableERC20 +--- + +## encodeInstall + + Encodes the install data for the MintableERC20 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## generateMintSignature + + Generates a mint signature for a given mint request to be used with a MintableERC20 module. + +### Example + +```typescript +import { MintableERC20 } from "thirdweb/modules"; + +// generate the payload and signature, this is typically done on the server +// requires to be generated with a wallet that has the MINTER_ROLE +const { payload, signature } = + await MintableERC20.generateMintSignature({ + account, + contract, + mintRequest: { + recipient: "0x...", + quantity: "10", + }, + }); + +// prepare the transaction, this is typically done on the client +// can be executed by any wallet +const transaction = MintableERC20.mintWithSignature({ + contract, + payload, + signature, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise<{ + payload: { amount: bigint; data: `0x${string}`; to: `0x${string}` }; + signature: `0x${string}`; +}>; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ + payload: { amount: bigint; data: `0x${string}`; to: `0x${string}` }; + signature: `0x${string}`; +}>; +``` + + A transaction to mint tokens. +--- + +## getSaleConfig + + Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { MintableERC20 } from "thirdweb/modules"; + +const result = await MintableERC20.getSaleConfig({ + contract, +}); +``` + +```ts +function getSaleConfig( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getSaleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the MintableERC20 module on a core contract. + +### Example + +```ts +import { MintableERC20 } from "thirdweb/modules"; + +const transaction = MintableERC20.install({ + contract: coreContract, + account: account, + params: { + primarySaleRecipient: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## mintWithRole + + Mints ERC20 tokens to a specified address via a MintableERC20 module. + +### Example + +```typescript +import { MintableERC20 } from "thirdweb/modules"; + +const transaction = MintableERC20.mintWithRole({ + contract, + to: "0x...", // Address to mint tokens to + quantity: 2, // Amount of tokens to mint (in decimals) +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## mintWithSignature + + Mints ERC20 tokens to a specified address with a signature via a MintableERC20 module. + +### Example + +```typescript +import { MintableERC20 } from "thirdweb/modules"; + +// generate the payload and signature, this is typically done on the server +// requires to be generated with a wallet that has the MINTER_ROLE +const { payload, signature } = + await MintableERC20.generateMintSignature({ + account, + contract, + mintRequest: { + recipient: "0x...", + quantity: "10", + }, + }); + +// prepare the transaction, this is typically done on the client +// can be executed by any wallet +const transaction = MintableERC20.mintWithSignature({ + contract, + payload, + signature, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithSignature( + options: BaseTransactionOptions<{ + payload: { + amount: bigint; + data: `0x${string}`; + to: `0x${string}`; + }; + signature: `0x${string}`; + }>, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions<{ + payload: { amount: bigint; data: `0x${string}`; to: `0x${string}` }; + signature: `0x${string}`; +}>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## module + + Convenience function to add the MintableERC20 module as a default module on a core contract. + +### Example + +```ts +import { MintableERC20, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC20", + params: { + name: "My Modular Contract", + }, + modules: [ + MintableERC20.module({ + primarySaleRecipient: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setSaleConfig + + Prepares a transaction to call the "setSaleConfig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { MintableERC20 } from "thirdweb/modules"; + +const transaction = MintableERC20.setSaleConfig({ + contract, + primarySaleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSaleConfig( + options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSaleConfig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## MintableERC721 +--- + +## encodeInstall + + Encodes the install data for the MintableERC721 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## generateMintSignature + + Generates a payload and signature for minting ERC721 tokens via a MintableERC721 module. + +### Example + +```typescript +import { MintableERC20 } from "thirdweb/modules"; + +// generate the payload and signature, this is typically done on the server +// requires to be generated with a wallet that has the MINTER_ROLE +const { payload, signature } = + await MintableERC721.generateMintSignature({ + account, + contract, + nfts: [ + { + name: "My NFT", + description: "My NFT", + image: "https://example.com/image.png", + }, + ], + mintRequest: { + recipient: "0x...", + }, + }); + +// prepare the transaction, this is typically done on the client +// can be executed by any wallet +const transaction = MintableERC20.mintWithSignature({ + contract, + payload, + signature, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + }; + signature: `0x${string}`; +}>; +``` + +### Parameters + + The options for generating the payload and signature. + +#### Type + +```ts +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + }; + signature: `0x${string}`; +}>; +``` + + The payload and signature. +--- + +## getSaleConfig + + Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { MintableERC721 } from "thirdweb/modules"; + +const result = await MintableERC721.getSaleConfig({ + contract, +}); +``` + +```ts +function getSaleConfig( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getSaleConfig function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the MintableERC721 module on a core contract. + +### Example + +```ts +import { MintableERC721 } from "thirdweb/modules"; + +const transaction = MintableERC721.install({ + contract: coreContract, + account: account, + params: { + primarySaleRecipient: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## mintWithRole + + Mints ERC721 tokens to a specified address via a MintableERC721 module. + +### Example + +```typescript +import { MintableERC721 } from "thirdweb/modules"; + +const transaction = MintableERC721.mintWithRole({ + contract, + to: "0x...", // Address to mint tokens to + nfts: [ + { + name: "My NFT", + description: "This is my NFT", + image: "ipfs://...", + }, + ], +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithRole( + options: BaseTransactionOptions, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## mintWithSignature + + Mints ERC721 tokens to a specified address with a signature via a MintableERC721 module. + +### Example + +```typescript +import { MintableERC721 } from "thirdweb/modules"; + +// generate the payload and signature, this is typically done on the server +// requires to be generated with a wallet that has the MINTER_ROLE +const { payload, signature } = + await MintableERC721.generateMintSignature({ + account, + contract, + nfts: [ + { + name: "My NFT", + description: "My NFT", + image: "https://example.com/image.png", + }, + ], + mintRequest: { + recipient: "0x...", + }, + }); + +// prepare the transaction, this is typically done on the client +// can be executed by any wallet +const transaction = MintableERC721.mintWithSignature({ + contract, + payload, + signature, +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function mintWithSignature( + options: BaseTransactionOptions<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + }; + signature: `0x${string}`; + }>, +): PreparedTransaction; +``` + +### Parameters + + The options for minting tokens. + +#### Type + +```ts +let options: BaseTransactionOptions<{ + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + }; + signature: `0x${string}`; +}>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A transaction to mint tokens. +--- + +## module + + Convenience function to add the MintableERC721 module as a default module on a core contract. + +### Example + +```ts +import { MintableERC721, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [ + MintableERC721.module({ + primarySaleRecipient: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setSaleConfig + + Prepares a transaction to call the "setSaleConfig" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { MintableERC721 } from "thirdweb/modules"; + +const transaction = MintableERC721.setSaleConfig({ + contract, + primarySaleRecipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSaleConfig( + options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSaleConfig" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSaleConfigParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## OpenEditionMetadataERC721 +--- + +## batchMetadataUpdateEvent + + Creates an event object for the BatchMetadataUpdate event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { OpenEditionMetadataERC721 } from "thirdweb/modules"; + +const events = await getContractEvents({ + contract, + events: [OpenEditionMetadataERC721.batchMetadataUpdateEvent()], +}); +``` + +```ts +function batchMetadataUpdateEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_fromTokenId"; readonly type: "uint256" }, + { readonly name: "_toTokenId"; readonly type: "uint256" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_fromTokenId"; readonly type: "uint256" }, + { readonly name: "_toTokenId"; readonly type: "uint256" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- + +## encodeInstall + + Encodes the install data for the OpenEditionMetadataERC721 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## install + + Installs the OpenEditionMetadataERC721 module on a core contract. + +### Example + +```ts +import { OpenEditionMetadataERC721 } from "thirdweb/modules"; + +const transaction = OpenEditionMetadataERC721.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## module + + Convenience function to add the OpenEditionMetadataERC721 module as a default module on a core contract. + +### Example + +```ts +import { + OpenEditionMetadataERC721, + deployModularContract, +} from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [OpenEditionMetadataERC721.module()], +}); +``` + +```ts +function module(params?: { + publisher?: string; +}): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setSharedMetadata + + Prepares a transaction to call the "setSharedMetadata" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { OpenEditionMetadataERC721 } from "thirdweb/modules"; + +const transaction = OpenEditionMetadataERC721.setSharedMetadata({ + contract, + metadata: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setSharedMetadata( + options: BaseTransactionOptions< + | SetSharedMetadataParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setSharedMetadata" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetSharedMetadataParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## sharedMetadataUpdatedEvent + + Creates an event object for the SharedMetadataUpdated event. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +import { OpenEditionMetadataERC721 } from "thirdweb/modules"; + +const events = await getContractEvents({ + contract, + events: [OpenEditionMetadataERC721.sharedMetadataUpdatedEvent()], +}); +``` + +```ts +function sharedMetadataUpdatedEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "name"; readonly type: "string" }, + { readonly name: "description"; readonly type: "string" }, + { readonly name: "imageURI"; readonly type: "string" }, + { readonly name: "animationURI"; readonly type: "string" }, + ]; + readonly name: "SharedMetadataUpdated"; + readonly type: "event"; +}>; +``` + +### Returns + +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "name"; readonly type: "string" }, + { readonly name: "description"; readonly type: "string" }, + { readonly name: "imageURI"; readonly type: "string" }, + { readonly name: "animationURI"; readonly type: "string" }, + ]; + readonly name: "SharedMetadataUpdated"; + readonly type: "event"; +}>; +``` + + The prepared event object. +--- +## RoyaltyERC1155 +--- + +## encodeInstall + + Encodes the install data for the RoyaltyERC1155 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## getDefaultRoyaltyInfo + + Calls the "getDefaultRoyaltyInfo" function on the contract. + +### Example + +```ts +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const result = await RoyaltyERC1155.getDefaultRoyaltyInfo({ + contract, +}); +``` + +```ts +function getDefaultRoyaltyInfo( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getDefaultRoyaltyInfo function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getRoyaltyInfoForToken + + Calls the "getRoyaltyInfoForToken" function on the contract. + +### Example + +```ts +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const result = await RoyaltyERC1155.getRoyaltyInfoForToken({ + contract, + tokenId: ..., +}); +``` + +```ts +function getRoyaltyInfoForToken( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getRoyaltyInfoForToken function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getTransferValidationFunction + + Calls the "getTransferValidationFunction" function on the contract. + +### Example + +```ts +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const result = await RoyaltyERC1155.getTransferValidationFunction({ + contract, +}); +``` + +```ts +function getTransferValidationFunction( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getTransferValidationFunction function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getTransferValidator + + Calls the "getTransferValidator" function on the contract. + +### Example + +```ts +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const result = await RoyaltyERC1155.getTransferValidator({ + contract, +}); +``` + +```ts +function getTransferValidator( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getTransferValidator function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the RoyaltyERC1155 module on a core contract. + +### Example + +```ts +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const transaction = RoyaltyERC1155.install({ + contract: coreContract, + account: account, + params: { + royaltyRecipient: ..., + royaltyBps: ..., + transferValidator: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## module + + Convenience function to add the RoyaltyERC1155 module as a default module on a core contract. + +### Example + +```ts +import { RoyaltyERC1155, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC1155", + params: { + name: "My Modular Contract", + }, + modules: [ + RoyaltyERC1155.module({ + royaltyRecipient: ..., + royaltyBps: ..., + transferValidator: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## royaltyInfo + + Calls the "royaltyInfo" function on the contract. + +### Example + +```ts +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const result = await RoyaltyERC1155.royaltyInfo({ + contract, + tokenId: ..., + salePrice: ..., +}); +``` + +```ts +function royaltyInfo( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the royaltyInfo function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## setDefaultRoyaltyInfo + + Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const transaction = RoyaltyERC1155.setDefaultRoyaltyInfo({ + contract, + royaltyRecipient: ..., + royaltyBps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setDefaultRoyaltyInfo( + options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setDefaultRoyaltyInfo" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setRoyaltyInfoForToken + + Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const transaction = RoyaltyERC1155.setRoyaltyInfoForToken({ + contract, + tokenId: ..., + recipient: ..., + bps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setRoyaltyInfoForToken( + options: BaseTransactionOptions< + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setRoyaltyInfoForToken" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setTransferValidator + + Prepares a transaction to call the "setTransferValidator" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { RoyaltyERC1155 } from "thirdweb/modules"; + +const transaction = RoyaltyERC1155.setTransferValidator({ + contract, + validator: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferValidator( + options: BaseTransactionOptions< + | SetTransferValidatorParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferValidator" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferValidatorParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## RoyaltyERC721 +--- + +## encodeInstall + + Encodes the install data for the RoyaltyERC721 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## getDefaultRoyaltyInfo + + Calls the "getDefaultRoyaltyInfo" function on the contract. + +### Example + +```ts +import { RoyaltyERC721 } from "thirdweb/modules"; + +const result = await RoyaltyERC721.getDefaultRoyaltyInfo({ + contract, +}); +``` + +```ts +function getDefaultRoyaltyInfo( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getDefaultRoyaltyInfo function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getRoyaltyInfoForToken + + Calls the "getRoyaltyInfoForToken" function on the contract. + +### Example + +```ts +import { RoyaltyERC721 } from "thirdweb/modules"; + +const result = await RoyaltyERC721.getRoyaltyInfoForToken({ + contract, + tokenId: ..., +}); +``` + +```ts +function getRoyaltyInfoForToken( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getRoyaltyInfoForToken function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getTransferValidationFunction + + Calls the "getTransferValidationFunction" function on the contract. + +### Example + +```ts +import { RoyaltyERC721 } from "thirdweb/modules"; + +const result = await RoyaltyERC721.getTransferValidationFunction({ + contract, +}); +``` + +```ts +function getTransferValidationFunction( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getTransferValidationFunction function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## getTransferValidator + + Calls the "getTransferValidator" function on the contract. + +### Example + +```ts +import { RoyaltyERC721 } from "thirdweb/modules"; + +const result = await RoyaltyERC721.getTransferValidator({ + contract, +}); +``` + +```ts +function getTransferValidator( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the getTransferValidator function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## install + + Installs the RoyaltyERC721 module on a core contract. + +### Example + +```ts +import { RoyaltyERC721 } from "thirdweb/modules"; + +const transaction = RoyaltyERC721.install({ + contract: coreContract, + account: account, + params: { + royaltyRecipient: ..., + royaltyBps: ..., + transferValidator: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## module + + Convenience function to add the RoyaltyERC721 module as a default module on a core contract. + +### Example + +```ts +import { RoyaltyERC721, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [ + RoyaltyERC721.module({ + royaltyRecipient: ..., + royaltyBps: ..., + transferValidator: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- + +## royaltyInfo + + Calls the "royaltyInfo" function on the contract. + +### Example + +```ts +import { RoyaltyERC721 } from "thirdweb/modules"; + +const result = await RoyaltyERC721.royaltyInfo({ + contract, + tokenId: ..., + salePrice: ..., +}); +``` + +```ts +function royaltyInfo( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the royaltyInfo function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## setDefaultRoyaltyInfo + + Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { RoyaltyERC721 } from "thirdweb/modules"; + +const transaction = RoyaltyERC721.setDefaultRoyaltyInfo({ + contract, + royaltyRecipient: ..., + royaltyBps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setDefaultRoyaltyInfo( + options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setDefaultRoyaltyInfo" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setRoyaltyInfoForToken + + Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { RoyaltyERC721 } from "thirdweb/modules"; + +const transaction = RoyaltyERC721.setRoyaltyInfoForToken({ + contract, + tokenId: ..., + recipient: ..., + bps: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setRoyaltyInfoForToken( + options: BaseTransactionOptions< + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setRoyaltyInfoForToken" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setTransferValidator + + Prepares a transaction to call the "setTransferValidator" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { RoyaltyERC721 } from "thirdweb/modules"; + +const transaction = RoyaltyERC721.setTransferValidator({ + contract, + validator: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferValidator( + options: BaseTransactionOptions< + | SetTransferValidatorParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferValidator" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferValidatorParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## SequentialTokenIdERC1155 +--- + +## encodeInstall + + Encodes the install data for the SequentialTokenIdERC1155 module. + +```ts +function encodeInstall( + params: EncodeBytesOnInstallParams, +): `0x${string}`; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + +* The encoded data. +--- + +## install + + Installs the SequentialTokenIdERC1155 module on a core contract. + +### Example + +```ts +import { SequentialTokenIdERC1155 } from "thirdweb/modules"; + +const transaction = SequentialTokenIdERC1155.install({ + contract: coreContract, + account: account, + params: { + startTokenId: ..., + }, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params: EncodeBytesOnInstallParams & { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## module + + Convenience function to add the SequentialTokenIdERC1155 module as a default module on a core contract. + +### Example + +```ts +import { SequentialTokenIdERC1155, deployModularContract } from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC1155", + params: { + name: "My Modular Contract", + }, + modules: [ + SequentialTokenIdERC1155.module({ + startTokenId: ..., + }), + ], +}); +``` + +```ts +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: EncodeBytesOnInstallParams & { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +``` + +* The module function. +--- +## TransferableERC1155 +--- + +## encodeInstall + + Encodes the install data for the TransferableERC1155 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## install + + Installs the TransferableERC1155 module on a core contract. + +### Example + +```ts +import { TransferableERC1155 } from "thirdweb/modules"; + +const transaction = TransferableERC1155.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## isTransferEnabled + + Calls the "isTransferEnabled" function on the contract. + +### Example + +```ts +import { TransferableERC1155 } from "thirdweb/modules"; + +const result = await TransferableERC1155.isTransferEnabled({ + contract, +}); +``` + +```ts +function isTransferEnabled( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isTransferEnabled function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isTransferEnabledFor + + Calls the "isTransferEnabledFor" function on the contract. + +### Example + +```ts +import { TransferableERC1155 } from "thirdweb/modules"; + +const result = await TransferableERC1155.isTransferEnabledFor({ + contract, + target: ..., +}); +``` + +```ts +function isTransferEnabledFor( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isTransferEnabledFor function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## module + + Convenience function to add the TransferableERC1155 module as a default module on a core contract. + +### Example + +```ts +import { + TransferableERC1155, + deployModularContract, +} from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC1155", + params: { + name: "My Modular Contract", + }, + modules: [TransferableERC1155.module()], +}); +``` + +```ts +function module(params?: { + publisher?: string; +}): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setTransferable + + Prepares a transaction to call the "setTransferable" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { TransferableERC1155 } from "thirdweb/modules"; + +const transaction = TransferableERC1155.setTransferable({ + contract, + enableTransfer: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferable( + options: BaseTransactionOptions< + | SetTransferableParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferable" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferableParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setTransferableFor + + Prepares a transaction to call the "setTransferableFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { TransferableERC1155 } from "thirdweb/modules"; + +const transaction = TransferableERC1155.setTransferableFor({ + contract, + target: ..., + enableTransfer: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferableFor( + options: BaseTransactionOptions< + | SetTransferableForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferableFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferableForParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## TransferableERC20 +--- + +## encodeInstall + + Encodes the install data for the TransferableERC20 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## install + + Installs the TransferableERC20 module on a core contract. + +### Example + +```ts +import { TransferableERC20 } from "thirdweb/modules"; + +const transaction = TransferableERC20.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## isTransferEnabled + + Calls the "isTransferEnabled" function on the contract. + +### Example + +```ts +import { TransferableERC20 } from "thirdweb/modules"; + +const result = await TransferableERC20.isTransferEnabled({ + contract, +}); +``` + +```ts +function isTransferEnabled( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isTransferEnabled function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isTransferEnabledFor + + Calls the "isTransferEnabledFor" function on the contract. + +### Example + +```ts +import { TransferableERC20 } from "thirdweb/modules"; + +const result = await TransferableERC20.isTransferEnabledFor({ + contract, + target: ..., +}); +``` + +```ts +function isTransferEnabledFor( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isTransferEnabledFor function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## module + + Convenience function to add the TransferableERC20 module as a default module on a core contract. + +### Example + +```ts +import { + TransferableERC20, + deployModularContract, +} from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC20", + params: { + name: "My Modular Contract", + }, + modules: [TransferableERC20.module()], +}); +``` + +```ts +function module(params?: { + publisher?: string; +}): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setTransferable + + Prepares a transaction to call the "setTransferable" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { TransferableERC20 } from "thirdweb/modules"; + +const transaction = TransferableERC20.setTransferable({ + contract, + enableTransfer: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferable( + options: BaseTransactionOptions< + | SetTransferableParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferable" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferableParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setTransferableFor + + Prepares a transaction to call the "setTransferableFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { TransferableERC20 } from "thirdweb/modules"; + +const transaction = TransferableERC20.setTransferableFor({ + contract, + target: ..., + enableTransfer: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferableFor( + options: BaseTransactionOptions< + | SetTransferableForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferableFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferableForParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +## TransferableERC721 +--- + +## encodeInstall + + Encodes the install data for the TransferableERC721 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## install + + Installs the TransferableERC721 module on a core contract. + +### Example + +```ts +import { TransferableERC721 } from "thirdweb/modules"; + +const transaction = TransferableERC721.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); +``` + +```ts +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; +``` + +### Parameters + +#### Type + +```ts +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + the transaction to install the module +--- + +## isTransferEnabled + + Calls the "isTransferEnabled" function on the contract. + +### Example + +```ts +import { TransferableERC721 } from "thirdweb/modules"; + +const result = await TransferableERC721.isTransferEnabled({ + contract, +}); +``` + +```ts +function isTransferEnabled( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isTransferEnabled function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## isTransferEnabledFor + + Calls the "isTransferEnabledFor" function on the contract. + +### Example + +```ts +import { TransferableERC721 } from "thirdweb/modules"; + +const result = await TransferableERC721.isTransferEnabledFor({ + contract, + target: ..., +}); +``` + +```ts +function isTransferEnabledFor( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + + The options for the isTransferEnabledFor function. + +#### Type + +```ts +let options: BaseTransactionOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The parsed result of the function call. +--- + +## module + + Convenience function to add the TransferableERC721 module as a default module on a core contract. + +### Example + +```ts +import { + TransferableERC721, + deployModularContract, +} from "thirdweb/modules"; + +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [TransferableERC721.module()], +}); +``` + +```ts +function module(params?: { + publisher?: string; +}): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +### Parameters + + The parameters for the module. + +#### Type + +```ts +let params: { publisher?: string }; +``` + +### Returns + +```ts +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; +``` + +* The module function. +--- + +## setTransferable + + Prepares a transaction to call the "setTransferable" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { TransferableERC721 } from "thirdweb/modules"; + +const transaction = TransferableERC721.setTransferable({ + contract, + enableTransfer: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferable( + options: BaseTransactionOptions< + | SetTransferableParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferable" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferableParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- + +## setTransferableFor + + Prepares a transaction to call the "setTransferableFor" function on the contract. + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { TransferableERC721 } from "thirdweb/modules"; + +const transaction = TransferableERC721.setTransferableFor({ + contract, + target: ..., + enableTransfer: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` + +```ts +function setTransferableFor( + options: BaseTransactionOptions< + | SetTransferableForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + + The options for the "setTransferableFor" function. + +#### Type + +```ts +let options: BaseTransactionOptions< + | SetTransferableForParams + | { asyncParams: () => Promise } +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; +``` + + A prepared transaction object. +--- +# Client +--- + +## createThirdwebClient + + Creates a Thirdweb client using the provided client ID (client-side) or secret key (server-side). + + Get your client ID and secret key from the Thirdweb dashboard [ here](https://thirdweb.com/create-api-key) . \*\*Never share your secret key with anyone. + + A client is necessary for most functions in the thirdweb SDK. It provides access to thirdweb APIs including built-in RPC, storage, and more. + +### Example + + Create a client on the client side (client ID): + +```ts +import { createThirdwebClient } from "thirdweb"; + +const client = createThirdwebClient({ clientId: "..." }); +``` + + Create a client on the server (secret key): + +```ts +import { createThirdwebClient } from "thirdweb"; + +const client = createThirdwebClient({ secretKey: "..." }); +``` + +```ts +function createThirdwebClient( + options: CreateThirdwebClientOptions, +): ThirdwebClient; +``` + +### Parameters + + The options for creating the client. + +#### Type + +```ts +let options: Prettify< + ( + | { clientId: string; secretKey?: string } + | { clientId?: string; secretKey: string } + ) & + ClientOptions +>; +``` + +### Returns + +```ts +let returnType: { + readonly clientId: string; + readonly secretKey: string | undefined; +} & Readonly; +``` + + The created Thirdweb client. +--- +# Wallets +--- + +## AccountAvatar + + The component for showing the avatar of the account. If fetches all the social profiles linked to your wallet, including: Farcaster, ENS, Lens (more to be added) You can choose which social profile you want to display. Defaults to the first item in the list. + +### Example + +#### Basic usage + +```tsx +import { AccountProvider, AccountAvatar } from "thirdweb/react"; + + + +; +``` + + Result: An `` component, if the avatar is resolved successfully + +```html + +``` + +#### Show a loading sign when the avatar is being resolved + +```tsx +import { AccountProvider, AccountAvatar } from "thirdweb/react"; + + + } /> +; +``` + +#### Fallback to something when the avatar fails to resolve + +```tsx +import { AccountProvider, AccountAvatar } from "thirdweb/react"; + + + } /> +; +``` + +#### Select a social profile to display + + If you wallet associates with more than one social profiles (Lens, Farcaster, ENS, etc.) You can specify which service you want to prioritize using the `socialType` props + +```tsx +import { AccountProvider, AccountAvatar } from "thirdweb/react"; + + + +; +``` + +#### Custom ENS resolver chain + + This component shares the same props with the ENS extension `resolveAvatar` + +```tsx +import { AccountProvider, AccountAvatar } from "thirdweb/react"; +import { base } from "thirdweb/chains"; + + + +; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx +; +``` + +```ts +function AccountAvatar( + __namedParameters: AccountAvatarProps, +): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,alt : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,children : ReactNode,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,crossOrigin : CrossOrigin,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,decoding : "auto" | "async" | "sync",defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,fetchPriority : "auto" | "high" | "low",height : string | number,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loading : "eager" | "lazy",loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,referrerPolicy : HTMLAttributeReferrerPolicy,rel : string,resolverAddress : string,resolverChain : Readonly<(ChainOptions) & ({ rpc: string })>,resource : string,results : number,rev : string,role : AriaRole,security : string,sizes : string,slot : string,socialType : "farcaster" | "ens" | "lens",spellCheck : Booleanish,srcSet : string,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",useMap : string,vocab : string,width : string | number} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + An `` if the avatar is resolved successfully +--- + +## AccountBalance + + This component fetches and shows the balance of the wallet address on a given chain. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` + +### Example + +#### Basic usage + +```tsx +import { AccountProvider, AccountBalance } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + +; +``` + + Result: + +```html +1.091435 ETH +``` + +#### Format the balance (round up, shorten etc.) + + The AccountBalance component accepts a `formatFn` which takes in an object of type `AccountBalanceInfo` and outputs a string The function is used to modify the display value of the wallet balance (either in crypto or fiat) + +```tsx +import type { AccountBalanceInfo } from "thirdweb/react"; +import { formatNumber } from "thirdweb/utils"; + +const format = (props: AccountInfoBalance):string => `${formatNumber(props.balance, 1)} ${props.symbol.toLowerCase()}` + + +``` + + Result: + +```html +1.1 eth // the balance is rounded up to 1 decimal and the symbol is lowercased +``` + +#### Show a loading sign when the balance is being fetched + +```tsx +import { AccountProvider, AccountBalance } from "thirdweb/react"; + + + } /> +; +``` + +#### Fallback to something when the balance fails to resolve + +```tsx + + +; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx +; +``` + +```ts +function AccountBalance( + __namedParameters: AccountBalanceProps, +): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,chain : Readonly<(ChainOptions) & ({ rpc: string })>,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,formatFn : (props: AccountBalanceInfo) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,showBalanceInFiat : "USD",slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,tokenAddress : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` +--- + +## AccountName + + This component is used to display the name of the account. A "name" in this context is the username, or account of the social profiles that the wallet may have. In case a name is not found or failed to resolve, you can always fallback to displaying the wallet address instead by using the `fallbackComponent` prop. + + This component inherits all attribute of a native HTML `` element, so you can style it just like how you would style a `` . + +### Example + +#### Basic usage + +```tsx +import { AccountProvider, AccountName } from "thirdweb/react"; + + + +; +``` + +#### Show wallet address while social name is being loaded + +```tsx +} />; +``` + +#### Fallback to showing wallet address if fail to resolve social name + +```tsx +} />; +``` + +#### Transform the account name using `formatFn` prop + +```tsx +import { isAddress, shortenAddress } from "thirdweb/utils"; +import { AccountProvider, AccountName } from "thirdweb/react"; + +// Let's say we want the name to be capitalized without using CSS +const formatName = (name: string) => name.toUpperCase(); + +return ; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx +; +``` + +```ts +function AccountName(props: AccountNameProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let props: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,formatFn : (str: string) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resolverAddress : string,resolverChain : Readonly<(ChainOptions) & ({ rpc: string })>,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,socialType : "farcaster" | "ens" | "lens",spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + A `` containing the name of the account + +```html +{name} +``` +--- + +## WalletIcon + + This component tries to resolve the icon of a given wallet, then return an image. + +### Example + +#### Basic usage + +```tsx +import { WalletProvider, WalletIcon } from "thirdweb/react"; + + + +; +``` + + Result: An `` component with the src of the icon + +```html + +``` + +#### Show a loading sign while the icon is being loaded + +```tsx +} />; +``` + +#### Fallback to a dummy image if the wallet icon fails to resolve + +```tsx +} />; +``` + +#### Usage with queryOptions + + WalletIcon uses useQuery() from tanstack query internally. It allows you to pass a custom queryOptions of your choice for more control of the internal fetching logic + +```tsx +; +``` + +```ts +function WalletIcon( + __namedParameters: WalletIconProps, +): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,alt : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,children : ReactNode,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,crossOrigin : CrossOrigin,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,decoding : "auto" | "async" | "sync",defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,fetchPriority : "auto" | "high" | "low",height : string | number,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loading : "eager" | "lazy",loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,referrerPolicy : HTMLAttributeReferrerPolicy,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,sizes : string,slot : string,spellCheck : Booleanish,srcSet : string,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",useMap : string,vocab : string,width : string | number} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + an `` with the src of the wallet icon +--- + +## deploySmartAccount + + Deployes a smart account via a dummy transaction. + +### Example + +```ts +import { deploySmartAccount } from "thirdweb"; + +const account = await deploySmartAccount({ + smartAccount, + chain, + client, + accountContract, +}); +``` + +```ts +function deploySmartAccount(args: { + accountContract: Readonly>; + chain: Readonly; + client: ThirdwebClient; + smartAccount: Account; +}): Promise< + | undefined + | { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + } +>; +``` + +### Parameters + + Arguments for the deployment. + +#### Type + +```ts +let args: { + accountContract: Readonly>; + chain: Readonly; + client: ThirdwebClient; + smartAccount: Account; +}; +``` + +### Returns + +```ts +let returnType: Promise< + | undefined + | { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + } +>; +``` +--- + +## getUser + + Gets user based on the provided query parameters. This function is only available on the server (a secret key is required in the client). + +### Example + +```ts +import { getUser } from "thirdweb/wallets"; + +const user = await getUser({ + client, + walletAddress: "0x123...", +}); +``` + +```ts +function getUser(options: { + client: ThirdwebClient; + ecosystem?: Ecosystem; + email?: string; + externalWalletAddress?: string; + id?: string; + phone?: string; + walletAddress?: string; +}): Promise; +``` + +### Parameters + + The options for the get user function. + +#### Type + +```ts +let options: { + client: ThirdwebClient; + ecosystem?: Ecosystem; + email?: string; + externalWalletAddress?: string; + id?: string; + phone?: string; + walletAddress?: string; +}; +``` + +### Returns + +```ts +let returnType: { + createdAt: string; + email?: string; + phone?: string; + profiles: Array; + userId: string; + walletAddress: string; +}; +``` + + A user object or null if not found. +--- + +## authenticate + + Authenticates the user based on the provided authentication arguments. + +### Example + +```ts +import { authenticate } from "thirdweb/wallets/in-app"; + +const result = await authenticate({ + client, + strategy: "email", + email: "example@example.org", + verificationCode: "123456", +}); +``` + + Authenticate to a backend account (only do this on your backend): + +```ts +import { authenticate } from "thirdweb/wallets/in-app"; + +const result = await authenticate({ + client, + strategy: "backend", + walletSecret: "...", // Provided by your app +}); +``` + +```ts +function authenticate( + args: AuthArgsType, +): Promise; +``` + +### Parameters + + The authentication arguments. + +#### Type + +```ts +let args: AuthArgsType; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the authentication result. +--- + +## authenticateWithRedirect + + Authenticates the user based on the provided authentication arguments using a redirect. + +### Example + +```ts +import { authenticateWithRedirect } from "thirdweb/wallets/in-app"; + +const result = await authenticateWithRedirect({ + client, + strategy: "google", + mode: "redirect", + redirectUrl: "https://example.org", +}); +``` + +```ts +function authenticateWithRedirect( + args: SocialAuthArgsType & { + client: ThirdwebClient; + ecosystem?: Ecosystem; + }, +): Promise; +``` + +### Parameters + + The authentication arguments. + +#### Type + +```ts +let args: SocialAuthArgsType & { + client: ThirdwebClient; + ecosystem?: Ecosystem; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the authentication result. +--- + +## createWallet + + Creates a wallet based on the provided ID and arguments. + +* Supports 500+ wallets +* Handles both injected browser wallets and WalletConnect sessions + +[ View all available wallets](https://portal.thirdweb.com/typescript/v5/supported-wallets) + +### Example + +### Connecting the wallet + + Once created, you can connect the wallet to your app by calling the `connect` method. + + The `connect` method returns a promise that resolves to the connected account. + + Each wallet type can have different connect options. [ View the different connect options](https://portal.thirdweb.com/references/typescript/v5/WalletConnectionOption) + +### Connecting to an injected wallet + +```ts +import { createWallet } from "thirdweb/wallets"; + +const metamaskWallet = createWallet("io.metamask"); + +const account = await metamaskWallet.connect({ + client, +}); +``` + + You can check if a wallet is installed by calling the [ injectedProvider](https://portal.thirdweb.com/references/typescript/v5/injectedProvider) method. + +### Connecting via WalletConnect modal + +```ts +import { createWallet } from "thirdweb/wallets"; + +const metamaskWallet = createWallet("io.metamask"); + +await metamask.connect({ + client, + walletConnect: { + projectId: "YOUR_PROJECT_ID", + showQrModal: true, + appMetadata: { + name: "My App", + url: "https://my-app.com", + description: "my app description", + logoUrl: "https://path/to/my-app/logo.svg", + }, + }, +}); +``` + +[ View ConnectWallet connection options](https://portal.thirdweb.com/references/typescript/v5/WCConnectOptions) + +### Connecting with coinbase wallet + +```ts +import { createWallet } from "thirdweb/wallets"; + +const cbWallet = createWallet("com.coinbase.wallet", { + appMetadata: { + name: "My App", + url: "https://my-app.com", + description: "my app description", + logoUrl: "https://path/to/my-app/logo.svg", + }, + walletConfig: { + // options: 'all' | 'smartWalletOnly' | 'eoaOnly' + options: "all", + }, +}); + +const account = await cbWallet.connect({ + client, +}); +``` + +[ View Coinbase wallet creation options](https://portal.thirdweb.com/references/typescript/v5/CoinbaseWalletCreationOptions) + +### Connecting with a smart wallet + +```ts +import { createWallet } from "thirdweb/wallets"; + +const wallet = createWallet("smart", { + chain: sepolia, + sponsorGas: true, +}); + +const account = await wallet.connect({ + client, + personalAccount, // pass the admin account +}); +``` + +```ts +function createWallet(...args: CreateWalletArgs): Wallet; +``` + +### Parameters + + The arguments for creating the wallet. + +#### Type + +```ts +let args: CreateWalletArgs; +``` + +### Returns + +```ts +let returnType: Wallet; +``` + +* The created wallet. +--- + +## createWalletAdapter + + Creates a wallet from the given account. + + You can use this to: + +* convert a third party library wallet (wagmi, viem, ethers) into a thirdweb wallet. +* connect with a private key (for automated tests) + + Available wallet adatpers: + +* [ Viem](https://portal.thirdweb.com/references/typescript/v5/viemAdapter) +* [ Ethers 6](https://portal.thirdweb.com/references/typescript/v5/ethers6Adapter) +* [ Ethers 5](https://portal.thirdweb.com/references/typescript/v5/ethers5Adapter) + +### Example + +```ts +import { createWalletAdapter } from "thirdweb"; + +const wallet = createWalletAdapter({ + client, + adaptedAccount, + chain, + onDisconnect: () => { + // disconnect logic + }, + switchChain: async (chain) => { + // switch chain logic + }, +}); +``` + +```ts +function createWalletAdapter( + options: AdapterWalletOptions, +): Wallet<"adapter">; +``` + +### Parameters + + The options for the adapter wallet. + +#### Type + +```ts +let options: { + adaptedAccount: Account; + chain: Chain; + client: ThirdwebClient; + onDisconnect: () => Promise | void; + switchChain: (chain: Chain) => Promise | void; +}; +``` + +### Returns + +```ts +let returnType: Wallet<"adapter">; +``` + + a wallet instance. +--- + +## createWalletConnectClient + + Creates a new WalletConnect client for interacting with another application. + +### Example + +```ts +import { createWalletConnectClient } from "thirdweb/wallets"; + +const client = await createWalletConnectClient({ + wallet: wallet, + client: client, +}); +``` + + Pass custom handlers: + +```ts +import { createWalletConnectClient } from "thirdweb/wallets"; + +const client = await createWalletConnectClient({ + wallet: wallet, + client: client, + requestHandlers: { + eth_signTransaction: ({ account, chainId, params }) => { + // handle transaction signing + }, + }, +}); +``` + + Pass connect and disconnect callbacks: + +```ts +import { createWalletConnectClient } from "thirdweb/wallets"; + +const client = await createWalletConnectClient({ + wallet: wallet, + client: client, + onConnect: (session) => { + console.log("Connected to WalletConnect", session); + }, + onDisconnect: (session) => { + console.log("Disconnected from WalletConnect", session); + }, +}); +``` + +```ts +function createWalletConnectClient(options: { + appMetadata?: AppMetadata; + chains?: Array>; + client: ThirdwebClient; + onConnect?: (session: WalletConnectSession) => void; + onDisconnect?: (session: WalletConnectSession) => void; + onError?: (error: Error) => void; + projectId?: string; + requestHandlers?: { + eth_sendRawTransaction?: (_: { + account: Account; + chainId: number; + params: WalletConnectRawTransactionRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_sendTransaction?: (_: { + account: Account; + chainId: number; + params: WalletConnectTransactionRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_sign?: (_: { + account: Account; + params: WalletConnectSignRequestPrams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_signTransaction?: (_: { + account: Account; + params: WalletConnectTransactionRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_signTypedData?: (_: { + account: Account; + params: WalletConnectSignTypedDataRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_signTypedData_v4?: (_: { + account: Account; + params: WalletConnectSignTypedDataRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + personal_sign?: (_: { + account: Account; + params: WalletConnectSignRequestPrams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + wallet_addEthereumChain?: (_: { + params: WalletConnectAddEthereumChainRequestParams; + wallet: Wallet; + }) => Promise<`0x${string}`>; + wallet_switchEthereumChain?: (_: { + params: WalletConnectSwitchEthereumChainRequestParams; + wallet: Wallet; + }) => Promise<`0x${string}`>; + }; + wallet: Wallet; +}): Promise; +``` + +### Parameters + + The options to use to create the WalletConnect client. + +#### Type + +```ts +let options: { + appMetadata?: AppMetadata; + chains?: Array>; + client: ThirdwebClient; + onConnect?: (session: WalletConnectSession) => void; + onDisconnect?: (session: WalletConnectSession) => void; + onError?: (error: Error) => void; + projectId?: string; + requestHandlers?: { + eth_sendRawTransaction?: (_: { + account: Account; + chainId: number; + params: WalletConnectRawTransactionRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_sendTransaction?: (_: { + account: Account; + chainId: number; + params: WalletConnectTransactionRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_sign?: (_: { + account: Account; + params: WalletConnectSignRequestPrams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_signTransaction?: (_: { + account: Account; + params: WalletConnectTransactionRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_signTypedData?: (_: { + account: Account; + params: WalletConnectSignTypedDataRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + eth_signTypedData_v4?: (_: { + account: Account; + params: WalletConnectSignTypedDataRequestParams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + personal_sign?: (_: { + account: Account; + params: WalletConnectSignRequestPrams; + }) => Promise<`0x${string}` | WalletConnectRequestError>; + wallet_addEthereumChain?: (_: { + params: WalletConnectAddEthereumChainRequestParams; + wallet: Wallet; + }) => Promise<`0x${string}`>; + wallet_switchEthereumChain?: (_: { + params: WalletConnectSwitchEthereumChainRequestParams; + wallet: Wallet; + }) => Promise<`0x${string}`>; + }; + wallet: Wallet; +}; +``` + +### Returns + +```ts +let returnType: Awaited>; +``` + + The WalletConnect client. Use this client to connect to a WalletConnect URI with createWalletConnectSession. +--- + +## createWalletConnectSession + + Initiates a new WalletConnect session for interacting with another application. + +### Example + +```ts +import { + createWalletConnectClient, + createWalletConnectSession, +} from "thirdweb/wallets"; + +const client = await createWalletConnectClient({ + wallet: wallet, + client: client, +}); + +const session = createWalletConnectSession({ + walletConnectClient: client, + uri: "wc:...", +}); +``` + +```ts +function createWalletConnectSession( + options: CreateWalletConnectSessionOptions, +): void; +``` + +### Parameters + + The options to use to create the WalletConnect session. + +#### Type + +```ts +let options: CreateWalletConnectSessionOptions; +``` + +### Returns + +```ts +let returnType: void; +``` +--- + +## disconnectWalletConnectSession + + Disconnects a WalletConnect session. + +### Example + +```ts +import { disconnectWalletConnectSession } from "thirdweb/wallets"; + +await disconnectWalletConnectSession({ + session: mySession, + walletConnectClient: wcClient, +}); +``` + +```ts +function disconnectWalletConnectSession(options: { + session: WalletConnectSession; + walletConnectClient: SignClient; +}): Promise; +``` + +### Parameters + + The options to use to disconnect the WalletConnect session. + +#### Type + +```ts +let options: { + session: WalletConnectSession; + walletConnectClient: SignClient; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## ecosystemWallet + + Creates an [ Ecosystem Wallet](https://portal.thirdweb.com/connect/wallet/overview) based on various authentication methods. Full list of available authentication methods [ here](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure) . + + Can also be configured to use Account Abstraction to directly connect to a ERC4337 smart account based on those authentication methods. + + Refer to [ inAppWallet](https://portal.thirdweb.com/typescript/v5/inAppWallet) for detailed usage examples. + +### Example + +#### Logging into an ecosystem wallet + + Below is the general code snippet needed to connect via a given auth strategy to an ecosystem wallet. For more variants on the various auth strategies, refer to [ inAppWallet](https://portal.thirdweb.com/typescript/v5/inAppWallet) . + +```ts +import { ecosystemWallet } from "thirdweb/wallets"; + +const wallet = ecosystemWallet("ecosystem.hooli"); + +const account = await wallet.connect({ + client, + chain, + strategy: "google", +}); +``` + +[ View all connection options](https://portal.thirdweb.com/references/typescript/v5/EcosystemWalletConnectionOptions) . + +#### Connect to a restricted ecosystem wallet with your designated partner ID + + The parnter ID will be provided to you by the ecosystem with which you're integrating. + +```ts +import { ecosystemWallet } from "thirdweb/wallets"; +const wallet = ecosystemWallet("ecosystem.hooli", { + partnerId: "...", +}); +``` + +```ts +function ecosystemWallet( + id: `ecosystem.${string}`, + options: EcosystemWalletCreationOptions, +): Wallet; +``` + +### Parameters + +#### Type + +```ts +let id: `ecosystem.${string}`; +``` + +#### Type + +```ts +let options: { + auth?: { + defaultSmsCountryCode?: SupportedSmsCountry; + mode?: "popup" | "redirect" | "window"; + redirectUrl?: string; + }; + partnerId?: string; +}; +``` + +### Returns + +```ts +let returnType: Wallet; +``` + + The created ecosystem wallet. +--- + +## getActiveWalletConnectSessions + + Retrieves all active WalletConnect sessions. + +### Example + +```ts +import { getActiveWalletConnectSessions } from "thirdweb/wallets"; + +const sessions = await getActiveWalletConnectSessions(); +``` + +```ts +function getActiveWalletConnectSessions(): Promise< + Array +>; +``` + +### Returns + +```ts +let returnType: { origin?: string; topic: string }; +``` + + All active WalletConnect sessions. +--- + +## getProfiles + + Gets the linked profiles for the connected in-app or ecosystem wallet. + +### Example + +```ts +import { getProfiles } from "thirdweb/wallets"; + +const profiles = await getProfiles({ + client, +}); + +console.log(profiles[0].type); // will be "email", "phone", "google", "discord", etc +console.log(profiles[0].details.email); +console.log(profiles[0].details.phone); +``` + +#### Getting profiles for a ecosystem user + +```ts +import { getProfiles } from "thirdweb/wallets/in-app"; + +const profiles = await getProfiles({ + client, + ecosystem: { + id: "ecosystem.your-ecosystem-id", + }, +}); +``` + +```ts +function getProfiles( + args: GetAuthenticatedUserParams, +): Promise>; +``` + +### Parameters + +#### Type + +```ts +let args: { client: ThirdwebClient; ecosystem?: Ecosystem }; +``` + +### Returns + +```ts +let returnType: { + details: { + address?: Address; + email?: string; + id?: string; + phone?: string; + }; + type: AuthOption; +}; +``` + + An array of accounts user profiles linked to the connected wallet. +--- + +## getUserEmail + + Retrieves the authenticated user email for the active in-app wallet. + +### Example + +```ts +import { getUserEmail } from "thirdweb/wallets/in-app"; + +const email = await getUserEmail({ client }); +console.log(email); +``` + +```ts +function getUserEmail( + options: GetAuthenticatedUserParams, +): Promise; +``` + +### Parameters + + The arguments for retrieving the authenticated user. + +#### Type + +```ts +let options: { client: ThirdwebClient; ecosystem?: Ecosystem }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The authenticated user email if logged in and wallet initialized, otherwise undefined. +--- + +## getUserPhoneNumber + + Retrieves the authenticated user phone number for the active embedded wallet. + +### Example + +```ts +import { getUserPhoneNumber } from "thirdweb/wallets/embedded"; + +const phoneNumber = await getUserPhoneNumber({ client }); +console.log(phoneNumber); +``` + +```ts +function getUserPhoneNumber( + options: GetAuthenticatedUserParams, +): Promise; +``` + +### Parameters + + The arguments for retrieving the authenticated user. + +#### Type + +```ts +let options: { client: ThirdwebClient; ecosystem?: Ecosystem }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The authenticated user phone number if authenticated with phone number, otherwise undefined. +--- + +## inAppWallet + + Creates an app scoped wallet for users based on various authentication methods. Full list of available authentication methods [ here](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure) . + + Can also be configured to use Account Abstraction to directly connect to a ERC4337 smart account based on those authentication methods. + +### Example + +#### Login with socials + +```ts +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + chain, + strategy: "google", +}); +``` + +[ View all available social auth methods](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure) + +#### Enable smart accounts and sponsor gas for your users: + +```ts +import { inAppWallet } from "thirdweb/wallets"; +import { sepolia } from "thirdweb/chains"; + +const wallet = inAppWallet({ + smartAccount: { + chain: sepolia, + sponsorGas: true, + }, +}); + +// account will be a smart account with sponsored gas enabled +const account = await wallet.connect({ + client, + strategy: "google", +}); +``` + +#### Login with email + +```ts +import { + inAppWallet, + preAuthenticate, +} from "thirdweb/wallets/in-app"; + +const wallet = inAppWallet(); + +// sends a verification code to the provided email +await preAuthenticate({ + client, + strategy: "email", + email: "example@example.com", +}); + +// login with the verification code +const account = await wallet.connect({ + client, + chain, + strategy: "email", + email: "example@example.com", + verificationCode: "123456", +}); +``` + +#### Login with SIWE + +```ts +import { inAppWallet, createWallet } from "thirdweb/wallets"; + +const rabby = createWallet("io.rabby"); +const inAppWallet = inAppWallet(); + +const account = await inAppWallet.connect({ + strategy: "wallet", + chain: mainnet, + wallet: rabby, + client: MY_CLIENT, +}); +``` + +#### Login with phone number + +```ts +import { + inAppWallet, + preAuthenticate, +} from "thirdweb/wallets/in-app"; + +const wallet = inAppWallet(); + +// sends a verification code to the provided phone number +await preAuthenticate({ + client, + strategy: "phone", + phoneNumber: "+1234567890", +}); + +// login with the verification code +const account = await wallet.connect({ + client, + chain, + strategy: "phone", + honeNumber: "+1234567890", + verificationCode: "123456", +}); +``` + +#### Login with passkey + +```ts +import { + inAppWallet, + hasStoredPasskey, +} from "thirdweb/wallets/in-app"; + +const wallet = inAppWallet(); + +const wallet = inAppWallet(); +const hasPasskey = await hasStoredPasskey(client); +await wallet.connect({ + client, + strategy: "passkey", + type: hasPasskey ? "sign-in" : "sign-up", +}); +``` + +#### Connect to a guest account + +```ts +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "guest", +}); +``` + +#### Connect to a backend account + +```ts +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "backend", + walletSecret: "...", // Provided by your app +}); +``` + +#### Connect with custom JWT (any OIDC provider) + + You can use any OIDC provider to authenticate your users. Make sure to configure it in your dashboard under in-app wallet settings. + +```ts +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "jwt", + jwt: "your_jwt_here", +}); +``` + +#### Connect with custom endpoint + + You can also use your own endpoint to authenticate your users. Make sure to configure it in your dashboard under in-app wallet settings. + +```ts +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "auth_endpoint", + payload: "your_auth_payload_here", +}); +``` + +#### Specify a logo for your login page (Connect UI) + +```ts +import { inAppWallet } from "thirdweb/wallets"; +const wallet = inAppWallet({ + metadata: { + image: { + src: "https://example.com/logo.png", + alt: "My logo", + width: 100, + height: 100, + }, + }, +}); +``` + +#### Hide the ability to export the private key within the Connect Modal UI + +```ts +import { inAppWallet } from "thirdweb/wallets"; +const wallet = inAppWallet({ + hidePrivateKeyExport: true, +}); +``` + +#### Open the Oauth window in the same tab + + By default, the Oauth window will open in a popup window. You can change this behavior by setting the `auth.mode` option to `"redirect"` . + +```ts +import { inAppWallet } from "thirdweb/wallets"; +const wallet = inAppWallet({ + auth: { + mode: "redirect", + }, +}); +``` + +```ts +function inAppWallet( + createOptions?: InAppWalletCreationOptions, +): Wallet<"inApp">; +``` + +### Parameters + + configuration options Refer to [ InAppWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/InAppWalletCreationOptions) to see the available options. + +#### Type + +```ts +let createOptions: + | { + auth?: { + defaultSmsCountryCode?: SupportedSmsCountry; + mode?: "popup" | "redirect" | "window"; + options: Array; + passkeyDomain?: string; + redirectUrl?: string; + }; + hidePrivateKeyExport?: boolean; + metadata?: { + image?: { + alt?: string; + height?: number; + src: string; + width?: number; + }; + }; + partnerId?: string; + smartAccount?: SmartWalletOptions; + } + | undefined; +``` + +### Returns + +```ts +let returnType: Wallet<"inApp">; +``` + + The created in-app wallet. +--- + +## linkProfile + + Connects a new profile (and new authentication method) to the current user. + + Requires a connected in-app or ecosystem account. + + _When a profile is linked to the account, that profile can then be used to sign into the same account._ + +### Example + +```ts +import { linkProfile } from "thirdweb/wallets"; + +// optionally specify the ecosystem if you're linking an ecosystem wallet +await linkProfile({ client, strategy: "discord" }); +``` + +```ts +function linkProfile(args: AuthArgsType): Promise>; +``` + +### Parameters + +#### Type + +```ts +let args: AuthArgsType; +``` + +### Returns + +```ts +let returnType: { + details: { + address?: Address; + email?: string; + id?: string; + phone?: string; + }; + type: AuthOption; +}; +``` + + A promise that resolves to the currently linked profiles when the connection is successful. +--- + +## preAuthenticate + + Pre-authenticates the user based on the provided authentication strategy. Use this function to send a verification code to the user's email or phone number. + +### Example + +```ts +import { preAuthenticate } from "thirdweb/wallets/in-app"; + +const result = await preAuthenticate({ + client, + strategy: "email", + email: "example@example.org", +}); +``` + +```ts +function preAuthenticate(args: PreAuthArgsType): Promise; +``` + +### Parameters + + The arguments required for pre-authentication. + +#### Type + +```ts +let args: PreAuthArgsType; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the pre-authentication result. +--- + +## privateKeyToAccount + + Get an `Account` object from a private key. + +### Example + +```ts +import { privateKeyToAccount } from "thirdweb/wallets"; + +const wallet = privateKeyToAccount({ + client, + privateKey: "...", +}); +``` + +```ts +function privateKeyToAccount( + options: PrivateKeyToAccountOptions, +): Account; +``` + +### Parameters + + The options for `privateKeyToAccount`Refer to the type [PrivateKeyToAccountOptions](https://portal.thirdweb.com/references/typescript/v5/PrivateKeyToAccountOptions) + +#### Type + +```ts +let options: { client: ThirdwebClient; privateKey: string }; +``` + +### Returns + +```ts +let returnType: { + address: Address; + estimateGas?: (tx: PreparedTransaction) => Promise; + onTransactionRequested?: ( + transaction: PreparedTransaction, + ) => Promise; + sendBatchTransaction?: ( + txs: Array, + ) => Promise; + sendRawTransaction?: ( + tx: SendRawTransactionOptions, + ) => Promise; + sendTransaction: ( + tx: SendTransactionOption, + ) => Promise; + signAuthorization?: ( + authorization: AuthorizationRequest, + ) => Promise; + signMessage: ({ + message, + }: { + message: SignableMessage; + }) => Promise; + signTransaction?: (tx: SerializableTransaction) => Promise; + signTypedData: ( + _typedData: ox__TypedData.Definition, + ) => Promise; + watchAsset?: (asset: WatchAssetParams) => Promise; +}; +``` + + The `Account` object that represents the private key +--- + +## smartWallet + + Creates a ERC4337 smart wallet based on a admin account. + + Smart wallets are smart contract wallets that enable multiple benefits for users: + +* Sponsor gas fees for transactions +* Multiple owners +* Session keys +* Batch transactions +* Predictable addresses +* Programmable features + +[ Learn more about account abstraction](https://portal.thirdweb.com/connect/account-abstraction/how-it-works) + +### Example + +### Connect to a smart wallet + + To connect to a smart wallet, you need to provide an admin account as the `personalAccount` option. + + Any wallet can be used as an admin account, including an in-app wallets. + + The `sponsorGas` option is used to enable sponsored gas for transactions automatically. + +```ts +import { smartWallet, inAppWallet } from "thirdweb/wallets"; +import { sepolia } from "thirdweb/chains"; +import { sendTransaction } from "thirdweb"; + +const wallet = smartWallet({ + chain: sepolia, + sponsorGas: true, // enable sponsored transactions +}); + +// any wallet can be used as an admin account +// in this example we use an in-app wallet +const adminWallet = inAppWallet(); +const personalAccount = await adminWallet.connect({ + client, + chain: sepolia, + strategy: "google", +}); + +const smartAccount = await wallet.connect({ + client, + personalAccount, // pass the admin account +}); + +// sending sponsored transactions with the smartAccount +await sendTransaction({ + account: smartAccount, + transaction, +}); +``` + +### Using a custom account factory + + You can pass a custom account factory to the `smartWallet` function to use a your own account factory. + +```ts +import { smartWallet } from "thirdweb/wallets"; +import { sepolia } from "thirdweb/chains"; + +const wallet = smartWallet({ + chain: sepolia, + sponsorGas: true, // enable sponsored transactions + factoryAddress: "0x...", // custom factory address +}); +``` + +### Using v0.7 Entrypoint + + Both v0.6 (default) and v0.7 ERC4337 Entrypoints are supported. To use the v0.7 Entrypoint, simply pass in a compatible account factory. + + You can use the predeployed `DEFAULT_ACCOUNT_FACTORY_V0_7` or deploy your own [ AccountFactory v0.7](https://thirdweb.com/thirdweb.eth/AccountFactory%5F0%5F7) . + +```ts +import { + smartWallet, + DEFAULT_ACCOUNT_FACTORY_V0_7, +} from "thirdweb/wallets/smart"; +import { sepolia } from "thirdweb/chains"; + +const wallet = smartWallet({ + chain: sepolia, + sponsorGas: true, // enable sponsored transactions + factoryAddress: DEFAULT_ACCOUNT_FACTORY_V0_7, // 0.7 factory address +}); +``` + +### Configuring the smart wallet + + You can pass options to the `smartWallet` function to configure the smart wallet. + +```ts +import { smartWallet } from "thirdweb/wallets"; +import { sepolia } from "thirdweb/chains"; + +const wallet = smartWallet({ + chain: sepolia, + sponsorGas: true, // enable sponsored transactions + factoryAddress: "0x...", // custom factory address + overrides: { + accountAddress: "0x...", // override account address + accountSalt: "0x...", // override account salt + entrypointAddress: "0x...", // override entrypoint address + tokenPaymaster: TokenPaymaster.BASE_USDC, // enable erc20 paymaster + bundlerUrl: "https://...", // override bundler url + paymaster: (userOp) => { ... }, // override paymaster + ... + } +}); +``` + + Refer to [ SmartWalletOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletOptions) for more details. + +```ts +function smartWallet( + createOptions: SmartWalletOptions, +): Wallet<"smart">; +``` + +### Parameters + + The options for creating the wallet. Refer to [ SmartWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletCreationOptions) for more details. + +#### Type + +```ts +let createOptions: Prettify< + { + chain: Chain; + factoryAddress?: string; + overrides?: { + accountAddress?: string; + accountSalt?: string; + bundlerUrl?: string; + createAccount?: ( + factoryContract: ThirdwebContract, + admin: string, + ) => PreparedTransaction; + entrypointAddress?: string; + execute?: ( + accountContract: ThirdwebContract, + transaction: SendTransactionOption, + ) => PreparedTransaction; + executeBatch?: ( + accountContract: ThirdwebContract, + transactions: Array, + ) => PreparedTransaction; + getAccountNonce?: ( + accountContract: ThirdwebContract, + ) => Promise; + paymaster?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + predictAddress?: ( + factoryContract: ThirdwebContract, + admin: string, + ) => Promise; + signMessage?: (options: { + accountContract: ThirdwebContract; + adminAccount: Account; + factoryContract: ThirdwebContract; + message: SignableMessage; + }) => Promise; + signTypedData?: (options: { + accountContract: ThirdwebContract; + adminAccount: Account; + factoryContract: ThirdwebContract; + typedData: ox__TypedData.Definition; + }) => Promise; + tokenPaymaster?: TokenPaymasterConfig; + }; + } & ({ gasless: boolean } | { sponsorGas: boolean }) +>; +``` + +### Returns + +```ts +let returnType: Wallet<"smart">; +``` + + The created smart wallet. +--- + +## unlinkProfile + + Disconnects an existing profile (authentication method) from the current user. Once disconnected, that profile can no longer be used to sign into the account. + +### Example + +```ts +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); +wallet.connect({ strategy: "google" }); + +const profiles = await getProfiles({ + client, +}); + +const updatedProfiles = await unlinkProfile({ + client, + profileToUnlink: profiles[0], +}); +``` + +```ts +function unlinkProfile(args: UnlinkParams): Promise>; +``` + +### Parameters + + The object containing the profile that we want to unlink. + +#### Type + +```ts +let args: UnlinkParams; +``` + +### Returns + +```ts +let returnType: { + details: { + address?: Address; + email?: string; + id?: string; + phone?: string; + }; + type: AuthOption; +}; +``` + + A promise that resolves to the updated linked profiles. +--- + +## walletConnect + + Creates a wallet that allows connecting to any wallet that supports the WalletConnect protocol. + +### Example + +```ts +import { walletConnect } from "thirdweb/wallets"; + +const wallet = walletConnect(); + +const account = await wallet.connect({ + client, +}); +``` + +```ts +function walletConnect(): Wallet<"walletConnect">; +``` + +### Returns + +```ts +let returnType: Wallet<"walletConnect">; +``` + + The created smart wallet. +--- + +## engineAccount + + Creates an account that uses your engine backend wallet for sending transactions and signing messages. + +### Example + +```ts +import { engineAccount } from "thirdweb/wallets/engine"; + +const engineAcc = engineAccount({ + engineUrl: "https://engine.thirdweb.com", + authToken: "your-auth-token", + walletAddress: "0x...", +}); + +// then use the account as you would any other account +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 1n, +}); +const result = await sendTransaction({ + transaction, + account: engineAcc, +}); +console.log("Transaction sent:", result.transactionHash); +``` + +```ts +function engineAccount(options: EngineAccountOptions): Account; +``` + +### Parameters + + The options for the engine account. + +#### Type + +```ts +let options: { + authToken: string; + chain?: Chain; + engineUrl: string; + walletAddress: string; +}; +``` + +### Returns + +```ts +let returnType: { + address: Address; + estimateGas?: (tx: PreparedTransaction) => Promise; + onTransactionRequested?: ( + transaction: PreparedTransaction, + ) => Promise; + sendBatchTransaction?: ( + txs: Array, + ) => Promise; + sendRawTransaction?: ( + tx: SendRawTransactionOptions, + ) => Promise; + sendTransaction: ( + tx: SendTransactionOption, + ) => Promise; + signAuthorization?: ( + authorization: AuthorizationRequest, + ) => Promise; + signMessage: ({ + message, + }: { + message: SignableMessage; + }) => Promise; + signTransaction?: (tx: SerializableTransaction) => Promise; + signTypedData: ( + _typedData: ox__TypedData.Definition, + ) => Promise; + watchAsset?: (asset: WatchAssetParams) => Promise; +}; +``` + + An account that uses your engine backend wallet. +--- + +## erc7579 + + Config for a ERC7579 modular smart wallet. + + This configuration is in BETA, expect breaking changes. + +### Example + +```typescript +import { sepolia } from "thirdweb/chains"; +import { smartWallet, Config } from "thirdweb/wallets/smart"; + +const modularSmartWallet = smartWallet( + Config.erc7579({ + chain: sepolia, + sponsorGas: true, + factoryAddress: "0x...", // the 7579 factory address + validatorAddress: "0x...", // the default validator module address + }), +}); +``` + +```ts +function erc7579(options: ERC7579Config): SmartWalletOptions; +``` + +### Parameters + + Optional overrides for the smart wallet. + +#### Type + +```ts +let options: SmartWalletOptions & { + factoryAddress: string; + validatorAddress: string; +}; +``` + +### Returns + +```ts +let returnType: Prettify< + { + chain: Chain; + factoryAddress?: string; + overrides?: { + accountAddress?: string; + accountSalt?: string; + bundlerUrl?: string; + createAccount?: ( + factoryContract: ThirdwebContract, + admin: string, + ) => PreparedTransaction; + entrypointAddress?: string; + execute?: ( + accountContract: ThirdwebContract, + transaction: SendTransactionOption, + ) => PreparedTransaction; + executeBatch?: ( + accountContract: ThirdwebContract, + transactions: Array, + ) => PreparedTransaction; + getAccountNonce?: ( + accountContract: ThirdwebContract, + ) => Promise; + paymaster?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + predictAddress?: ( + factoryContract: ThirdwebContract, + admin: string, + ) => Promise; + signMessage?: (options: { + accountContract: ThirdwebContract; + adminAccount: Account; + factoryContract: ThirdwebContract; + message: SignableMessage; + }) => Promise; + signTypedData?: (options: { + accountContract: ThirdwebContract; + adminAccount: Account; + factoryContract: ThirdwebContract; + typedData: ox__TypedData.Definition; + }) => Promise; + tokenPaymaster?: TokenPaymasterConfig; + }; + } & ({ gasless: boolean } | { sponsorGas: boolean }) +>; +``` + + The smart wallet options. +--- +# Wallet Utilities +--- + +## generateAccount + + Generates a new account with a random private key. + +### Example + +```ts +import { generateAccount } from "thirdweb/wallets"; +const account = await generateAccount({ client }); +``` + +```ts +function generateAccount( + options: GenerateAccountOptions, +): Promise; +``` + +### Parameters + + The options for generating the account. + +#### Type + +```ts +let options: { client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: { + address: Address; + estimateGas?: (tx: PreparedTransaction) => Promise; + onTransactionRequested?: ( + transaction: PreparedTransaction, + ) => Promise; + sendBatchTransaction?: ( + txs: Array, + ) => Promise; + sendRawTransaction?: ( + tx: SendRawTransactionOptions, + ) => Promise; + sendTransaction: ( + tx: SendTransactionOption, + ) => Promise; + signAuthorization?: ( + authorization: AuthorizationRequest, + ) => Promise; + signMessage: ({ + message, + }: { + message: SignableMessage; + }) => Promise; + signTransaction?: (tx: SerializableTransaction) => Promise; + signTypedData: ( + _typedData: ox__TypedData.Definition, + ) => Promise; + watchAsset?: (asset: WatchAssetParams) => Promise; +}; +``` + + A Thirdweb account. +--- + +## getWalletBalance + + Retrieves the balance of a token or native currency for a given wallet. + +### Example + +```ts +import { getWalletBalance } from "thirdweb/wallets"; +const balance = await getWalletBalance({ + address, + client, + chain, + tokenAddress, +}); +``` + +```ts +function getWalletBalance( + options: GetWalletBalanceOptions, +): Promise; +``` + +### Parameters + + The options for retrieving the token balance. + +#### Type + +```ts +let options: { + address: string; + chain: Chain; + client: ThirdwebClient; + tokenAddress?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the token balance result. +--- + +## injectedProvider + + Get Injected Provider for given wallet by passing a wallet ID (rdns) using [ EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) Provider Discovery. + +### Example + +```ts +import { injectedProvider } from "thirdweb/wallets"; + +const metamaskProvider = injectedProvider("io.metamask"); + +if (metamaskProvider) { + console.log("Metamask is installed"); +} +``` + +```ts +function injectedProvider(walletId: WalletId): Ethereum | undefined; +``` + +### Parameters + + The Wallet Id (rdns) to check. + +#### Type + +```ts +let walletId: + | "walletConnect" + | "inApp" + | "embedded" + | "smart" + | "adapter" + | EcosystemWalletId + | WCSupportedWalletIds + | InjectedSupportedWalletIds; +``` + +### Returns + +```ts +let returnType: Ethereum | undefined; +``` + + The details of the Injected Provider if it exists. `undefined` otherwise. +--- + +## getSocialIcon + + Gets the icon URI for a given social authentication provider + +### Example + +```tsx +const googleIcon = getSocialIcon("google"); +const appleIcon = getSocialIcon("apple"); +``` + +```ts +function getSocialIcon( + provider: + | "google" + | "apple" + | "facebook" + | "discord" + | "line" + | "x" + | "coinbase" + | "farcaster" + | "telegram" + | "github" + | "twitch" + | "steam" + | "guest" + | "backend" + | "email" + | "phone" + | "passkey" + | "wallet" + | ({} & string), +): string; +``` + +### Parameters + + The authentication provider to get the icon for + +#### Type + +```ts +let provider: + | "google" + | "apple" + | "facebook" + | "discord" + | "line" + | "x" + | "coinbase" + | "farcaster" + | "telegram" + | "github" + | "twitch" + | "steam" + | "guest" + | "backend" + | "email" + | "phone" + | "passkey" + | "wallet" + | ({} & string); +``` + +### Returns + +```ts +let returnType: string; +``` + + A data URI containing the SVG icon for the provider, or a generic wallet icon if the provider is not recognized +--- + +## hasStoredPasskey + + Returns whether this device has a stored passkey ready to be used for sign-in + +```ts +function hasStoredPasskey( + client: ThirdwebClient, + ecosystemId?: `ecosystem.${string}`, +): Promise; +``` + +### Parameters + + the thirdweb client + +#### Type + +```ts +let client: { + readonly clientId: string; + readonly secretKey: string | undefined; +} & Readonly; +``` + +#### Type + +```ts +let ecosystemId: `ecosystem.${string}`; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + whether the device has a stored passkey +--- + +## bundleUserOp + + Bundle a user operation. + +### Example + +```ts +import { bundleUserOp } from "thirdweb/wallets/smart"; + +const userOpHash = await bundleUserOp({ + userOp, + options, +}); +``` + +```ts +function bundleUserOp(args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; +}): Promise; +``` + +### Parameters + + The options for bundling a user operation. + +#### Type + +```ts +let args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; +}; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The bundle hash of the user operation. +--- + +## createAndSignUserOp + + Create and sign a user operation. + +### Example + +```ts +import { createAndSignUserOp } from "thirdweb/wallets/smart"; + +const userOp = await createAndSignUserOp({ + client, + adminAccount, + smartWalletOptions, + transactions, +}); +``` + +```ts +function createAndSignUserOp(options: { + adminAccount: Account; + client: ThirdwebClient; + smartWalletOptions: SmartWalletOptions; + transactions: Array; + waitForDeployment?: boolean; +}): Promise; +``` + +### Parameters + + The options for creating and signing the user operation + +#### Type + +```ts +let options: { + adminAccount: Account; + client: ThirdwebClient; + smartWalletOptions: SmartWalletOptions; + transactions: Array; + waitForDeployment?: boolean; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + +* The signed user operation +--- + +## createUnsignedUserOp + + Creates an unsigned user operation from a prepared transaction. + +### Example + +```ts +import { createUnsignedUserOp } from "thirdweb/wallets/smart"; + +const transaction = prepareContractCall(...); + +const userOp = await createUnsignedUserOp({ + transaction, + factoryContract, + accountContract, + adminAddress, + sponsorGas, + overrides, +}); +``` + +```ts +function createUnsignedUserOp(args: { + accountContract: Readonly>; + adminAddress: string; + factoryContract: Readonly>; + overrides?: { + accountAddress?: string; + accountSalt?: string; + bundlerUrl?: string; + createAccount?: ( + factoryContract: Readonly>, + admin: string, + ) => PreparedTransaction; + entrypointAddress?: string; + execute?: ( + accountContract: Readonly>, + transaction: SendTransactionOption, + ) => PreparedTransaction; + executeBatch?: ( + accountContract: Readonly>, + transactions: Array, + ) => PreparedTransaction; + getAccountNonce?: ( + accountContract: Readonly>, + ) => Promise; + paymaster?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + predictAddress?: ( + factoryContract: Readonly>, + admin: string, + ) => Promise; + signMessage?: (options: { + accountContract: Readonly>; + adminAccount: Account; + factoryContract: Readonly>; + message: SignableMessage; + }) => Promise<`0x${string}`>; + signTypedData?: (options: { + accountContract: Readonly>; + adminAccount: Account; + factoryContract: Readonly>; + typedData: Definition< + typedData, + primaryType, + typedData extends { + address?: undefined; + bool?: undefined; + bytes?: undefined; + bytes1?: undefined; + bytes10?: undefined; + bytes11?: undefined; + bytes12?: undefined; + bytes13?: undefined; + bytes14?: undefined; + bytes15?: undefined; + bytes16?: undefined; + bytes17?: undefined; + bytes18?: undefined; + bytes19?: undefined; + bytes2?: undefined; + bytes20?: undefined; + bytes21?: undefined; + bytes22?: undefined; + bytes23?: undefined; + bytes24?: undefined; + bytes25?: undefined; + bytes26?: undefined; + bytes27?: undefined; + bytes28?: undefined; + bytes29?: undefined; + bytes3?: undefined; + bytes30?: undefined; + bytes31?: undefined; + bytes32?: undefined; + bytes4?: undefined; + bytes5?: undefined; + bytes6?: undefined; + bytes7?: undefined; + bytes8?: undefined; + bytes9?: undefined; + int104?: undefined; + int112?: undefined; + int120?: undefined; + int128?: undefined; + int136?: undefined; + int144?: undefined; + int152?: undefined; + int16?: undefined; + int160?: undefined; + int168?: undefined; + int176?: undefined; + int184?: undefined; + int192?: undefined; + int200?: undefined; + int208?: undefined; + int216?: undefined; + int224?: undefined; + int232?: undefined; + int24?: undefined; + int240?: undefined; + int248?: undefined; + int256?: undefined; + int32?: undefined; + int40?: undefined; + int48?: undefined; + int56?: undefined; + int64?: undefined; + int72?: undefined; + int8?: undefined; + int80?: undefined; + int88?: undefined; + int96?: undefined; + string?: undefined; + uint104?: undefined; + uint112?: undefined; + uint120?: undefined; + uint128?: undefined; + uint136?: undefined; + uint144?: undefined; + uint152?: undefined; + uint16?: undefined; + uint160?: undefined; + uint168?: undefined; + uint176?: undefined; + uint184?: undefined; + uint192?: undefined; + uint200?: undefined; + uint208?: undefined; + uint216?: undefined; + uint224?: undefined; + uint232?: undefined; + uint24?: undefined; + uint240?: undefined; + uint248?: undefined; + uint256?: undefined; + uint32?: undefined; + uint40?: undefined; + uint48?: undefined; + uint56?: undefined; + uint64?: undefined; + uint72?: undefined; + uint8?: undefined; + uint80?: undefined; + uint88?: undefined; + uint96?: undefined; + } + ? keyof typedData + : string + >; + }) => Promise<`0x${string}`>; + tokenPaymaster?: TokenPaymasterConfig; + }; + sponsorGas: boolean; + transaction: PreparedTransaction; + waitForDeployment?: boolean; +}): Promise; +``` + +### Parameters + + The prepared transaction and options + +#### Type + +```ts +let args: { + accountContract: Readonly>; + adminAddress: string; + factoryContract: Readonly>; + overrides?: { + accountAddress?: string; + accountSalt?: string; + bundlerUrl?: string; + createAccount?: ( + factoryContract: Readonly>, + admin: string, + ) => PreparedTransaction; + entrypointAddress?: string; + execute?: ( + accountContract: Readonly>, + transaction: SendTransactionOption, + ) => PreparedTransaction; + executeBatch?: ( + accountContract: Readonly>, + transactions: Array, + ) => PreparedTransaction; + getAccountNonce?: ( + accountContract: Readonly>, + ) => Promise; + paymaster?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + predictAddress?: ( + factoryContract: Readonly>, + admin: string, + ) => Promise; + signMessage?: (options: { + accountContract: Readonly>; + adminAccount: Account; + factoryContract: Readonly>; + message: SignableMessage; + }) => Promise<`0x${string}`>; + signTypedData?: (options: { + accountContract: Readonly>; + adminAccount: Account; + factoryContract: Readonly>; + typedData: Definition< + typedData, + primaryType, + typedData extends { + address?: undefined; + bool?: undefined; + bytes?: undefined; + bytes1?: undefined; + bytes10?: undefined; + bytes11?: undefined; + bytes12?: undefined; + bytes13?: undefined; + bytes14?: undefined; + bytes15?: undefined; + bytes16?: undefined; + bytes17?: undefined; + bytes18?: undefined; + bytes19?: undefined; + bytes2?: undefined; + bytes20?: undefined; + bytes21?: undefined; + bytes22?: undefined; + bytes23?: undefined; + bytes24?: undefined; + bytes25?: undefined; + bytes26?: undefined; + bytes27?: undefined; + bytes28?: undefined; + bytes29?: undefined; + bytes3?: undefined; + bytes30?: undefined; + bytes31?: undefined; + bytes32?: undefined; + bytes4?: undefined; + bytes5?: undefined; + bytes6?: undefined; + bytes7?: undefined; + bytes8?: undefined; + bytes9?: undefined; + int104?: undefined; + int112?: undefined; + int120?: undefined; + int128?: undefined; + int136?: undefined; + int144?: undefined; + int152?: undefined; + int16?: undefined; + int160?: undefined; + int168?: undefined; + int176?: undefined; + int184?: undefined; + int192?: undefined; + int200?: undefined; + int208?: undefined; + int216?: undefined; + int224?: undefined; + int232?: undefined; + int24?: undefined; + int240?: undefined; + int248?: undefined; + int256?: undefined; + int32?: undefined; + int40?: undefined; + int48?: undefined; + int56?: undefined; + int64?: undefined; + int72?: undefined; + int8?: undefined; + int80?: undefined; + int88?: undefined; + int96?: undefined; + string?: undefined; + uint104?: undefined; + uint112?: undefined; + uint120?: undefined; + uint128?: undefined; + uint136?: undefined; + uint144?: undefined; + uint152?: undefined; + uint16?: undefined; + uint160?: undefined; + uint168?: undefined; + uint176?: undefined; + uint184?: undefined; + uint192?: undefined; + uint200?: undefined; + uint208?: undefined; + uint216?: undefined; + uint224?: undefined; + uint232?: undefined; + uint24?: undefined; + uint240?: undefined; + uint248?: undefined; + uint256?: undefined; + uint32?: undefined; + uint40?: undefined; + uint48?: undefined; + uint56?: undefined; + uint64?: undefined; + uint72?: undefined; + uint8?: undefined; + uint80?: undefined; + uint88?: undefined; + uint96?: undefined; + } + ? keyof typedData + : string + >; + }) => Promise<`0x${string}`>; + tokenPaymaster?: TokenPaymasterConfig; + }; + sponsorGas: boolean; + transaction: PreparedTransaction; + waitForDeployment?: boolean; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + +* The unsigned user operation +--- + +## estimateUserOpGas + + Estimate the gas cost of a user operation. + +### Example + +```ts +import { estimateUserOpGas } from "thirdweb/wallets/smart"; + +const gasCost = await estimateUserOpGas({ + userOp, + options, +}); +``` + +```ts +function estimateUserOpGas( + args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; + }, + stateOverrides?: {}, +): Promise; +``` + +### Parameters + + The options for estimating the gas cost of a user operation. + +#### Type + +```ts +let args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The estimated gas cost of the user operation. +--- + +## getPaymasterAndData + + Get paymaster and data details for a user operation. + +### Example + +```ts +import { getPaymasterAndData } from "thirdweb/wallets/smart"; + +const userOp = createUnsignedUserOp(...); + +const paymasterAndData = await getPaymasterAndData({ + userOp, + client, + chain, +}); +``` + +```ts +function getPaymasterAndData(args: { + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + paymasterOverride?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + userOp: UserOperationV06 | UserOperationV07; +}): Promise; +``` + +### Parameters + + The userOp and options + +#### Type + +```ts +let args: { + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + paymasterOverride?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + userOp: UserOperationV06 | UserOperationV07; +}; +``` + +### Returns + +```ts +let returnType: { + callGasLimit?: bigint; + preVerificationGas?: bigint; + verificationGasLimit?: bigint; +} & ( + | { paymasterAndData: string } + | { + paymaster: string; + paymasterData: string; + paymasterPostOpGasLimit?: bigint; + paymasterVerificationGasLimit?: bigint; + } +); +``` + +* The paymaster and data details for the user operation. +--- + +## getUserOpGasFees + + Get the gas fees of a user operation. + +### Example + +```ts +import { getUserOpGasPrice } from "thirdweb/wallets/smart"; + +const fees = await getUserOpGasPrice({ + options, +}); +``` + +```ts +function getUserOpGasFees(args: { + options: BundlerOptions; +}): Promise; +``` + +### Parameters + + The options for getting the gas price of a user operation. + +#### Type + +```ts +let args: { options: BundlerOptions }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The gas price of the user operation. +--- + +## getUserOpReceipt + + Get the receipt of a user operation. + +### Example + +```ts +import { getUserOpReceipt } from "thirdweb/wallets/smart"; + +const receipt = await getUserOpReceipt({ + client, + chain, + userOpHash, +}); +``` + +```ts +function getUserOpReceipt( + args: BundlerOptions & { userOpHash: `0x${string}` }, +): Promise; +``` + +### Parameters + + The options for getting the receipt of a user operation. + +#### Type + +```ts +let args: BundlerOptions & { userOpHash: `0x${string}` }; +``` + +### Returns + +```ts +let returnType: { + blobGasPrice?: quantity; + blobGasUsed?: quantity; + blockHash: Hash; + blockNumber: quantity; + contractAddress: Address | null | undefined; + cumulativeGasUsed: quantity; + effectiveGasPrice: quantity; + from: Address; + gasUsed: quantity; + logs: Array>; + logsBloom: Hex; + root?: Hash; + status: status; + to: Address | null; + transactionHash: Hash; + transactionIndex: index; + type: type; +}; +``` + + The receipt of the user operation. +--- + +## getUserOpReceiptRaw + + Get the receipt of a user operation. + +### Example + +```ts +import { getUserOpReceiptRaw } from "thirdweb/wallets/smart"; + +const receipt = await getUserOpReceiptRaw({ + client, + chain, + userOpHash, +}); +``` + +```ts +function getUserOpReceiptRaw( + args: BundlerOptions & { userOpHash: `0x${string}` }, +): Promise; +``` + +### Parameters + + The options for getting the receipt of a user operation. + +#### Type + +```ts +let args: BundlerOptions & { userOpHash: `0x${string}` }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The raw receipt of the user operation. +--- + +## predictAddress + +Deprecated + + Use `predictSmartAccountAddress` instead. + + Predict the address of a smart account. + +### Example + +```ts +import { predictAddress } from "thirdweb/wallets/smart"; + +const predictedAddress = await predictAddress({ + factoryContract, + adminAddress, + accountSalt, +}); +``` + +```ts +function predictAddress(args: { + accountAddress?: string; + accountSalt?: string; + adminAddress: string; + factoryContract: Readonly>; + predictAddressOverride?: ( + factoryContract: Readonly>, + admin: string, + ) => Promise; +}): Promise; +``` + +### Parameters + + The options for predicting the address of a smart account. + +#### Type + +```ts +let args: { + accountAddress?: string; + accountSalt?: string; + adminAddress: string; + factoryContract: Readonly>; + predictAddressOverride?: ( + factoryContract: Readonly>, + admin: string, + ) => Promise; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The predicted address of the smart account. +--- + +## predictSmartAccountAddress + + Predict the address of a smart account. + +### Example + +```ts +import { predictSmartAccountAddress } from "thirdweb/wallets/smart"; + +const predictedAddress = await predictSmartAccountAddress({ + client, + chain, + adminAddress, +}); +``` + +```ts +function predictSmartAccountAddress(args: { + accountSalt?: string; + adminAddress: string; + chain: Readonly; + client: ThirdwebClient; + factoryAddress?: string; +}): Promise; +``` + +### Parameters + + The options for predicting the address of a smart account. + +#### Type + +```ts +let args: { + accountSalt?: string; + adminAddress: string; + chain: Readonly; + client: ThirdwebClient; + factoryAddress?: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The predicted address of the smart account. +--- + +## signUserOp + + Sign a user operation. + +### Example + +```ts +import { signUserOp } from "thirdweb/wallets/smart"; + +const userOp = await createUnsignedUserOp(...); + +const signedUserOp = await signUserOp({ + client, + userOp, + chain, + adminAccount, +}); +``` + +```ts +function signUserOp(args: { + adminAccount: Account; + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + userOp: UserOperationV06 | UserOperationV07; +}): Promise; +``` + +### Parameters + +#### Type + +```ts +let args: { + adminAccount: Account; + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + userOp: UserOperationV06 | UserOperationV07; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + +* The user operation with the signature field populated +--- + +## waitForUserOpReceipt + + Wait for the user operation to be mined. + +### Example + +```ts +import { waitForUserOpReceipt } from "thirdweb/wallets/smart"; + +const receipt = await waitForUserOpReceipt({ + chain, + client, + userOpHash, +}); +``` + +```ts +function waitForUserOpReceipt( + args: BundlerOptions & { + intervalMs?: number; + timeoutMs?: number; + userOpHash: `0x${string}`; + }, +): Promise; +``` + +### Parameters + + The options and user operation hash + +#### Type + +```ts +let args: BundlerOptions & { + intervalMs?: number; + timeoutMs?: number; + userOpHash: `0x${string}`; +}; +``` + +### Returns + +```ts +let returnType: { + blobGasPrice?: quantity; + blobGasUsed?: quantity; + blockHash: Hash; + blockNumber: quantity; + contractAddress: Address | null | undefined; + cumulativeGasUsed: quantity; + effectiveGasPrice: quantity; + from: Address; + gasUsed: quantity; + logs: Array>; + logsBloom: Hex; + root?: Hash; + status: status; + to: Address | null; + transactionHash: Hash; + transactionIndex: index; + type: type; +}; +``` + +* The transaction receipt +--- +# Chain +--- + +## defineChain + + Defines a chain with the given options. + +### Example + + Just pass the chain ID to connect to: + +```ts +const chain = defineChain(1); +``` + + Or pass your own RPC or custom values: + +```ts +const chain = defineChain({ + id: 1, + rpc: "https://my-rpc.com", + nativeCurrency: { + name: "Ether", + symbol: "ETH", + decimals: 18, + }, +}); +``` + +```ts +function defineChain( + options: number | ChainOptions | LegacyChain | Chain, +): Chain; +``` + +### Parameters + + The options for the chain. + +#### Type + +```ts +let options: number | ChainOptions | LegacyChain | Chain; +``` + +### Returns + +```ts +let returnType: Readonly; +``` + + The defined chain. +--- + +## getChainMetadata + + Retrieves chain data for a given chain. + +### Example + +```ts +const chain = defineChain({ id: 1 }); +const chainData = await getChainMetadata(chain); +console.log(chainData); +``` + +```ts +function getChainMetadata( + chain: Readonly, +): Promise; +``` + +### Parameters + + The chain object containing the chain ID. + +#### Type + +```ts +let chain: Readonly; +``` + +### Returns + +```ts +let returnType: { chain: string; chainId: number; ens?: { registry: string }; explorers?: Readonly>; faucets?: readonly Array; features?: Readonly>; icon?: Icon; infoURL?: string; name: string; nativeCurrency: { decimals: number; name: string; symbol: string }; networkId?: number; parent?: { bridges?: Readonly>; chain: string; type: string }; redFlags?: readonly Array; rpc: readonly Array; shortName: string; slip44?: number; slug: string; stackType: string; status?: string; testnet: boolean; title?: string } +``` + + A Promise that resolves to the chain data. +--- + +## getRpcUrlForChain + + Retrieves the RPC URL for the specified chain. If a custom RPC URL is defined in the options, it will be used. Otherwise, a thirdweb RPC URL will be constructed using the chain ID and client ID. + +### Example + +```ts +import { getRpcUrlForChain } from "thirdweb/chains"; +const rpcUrl = getRpcUrlForChain({ chain: 1, client }); +console.log(rpcUrl); // "https://1.rpc.thirdweb.com/... +``` + +```ts +function getRpcUrlForChain(options: GetRpcUrlForChainOptions): string; +``` + +### Parameters + + The options object containing the chain and client information. + +#### Type + +```ts +let options: GetRpcUrlForChainOptions; +``` + +### Returns + +```ts +let returnType: string; +``` + + The RPC URL for the specified chain. +--- + +## ChainIcon + + This component tries to resolve the icon of a given chain, then return an image. + +### Example + +#### Basic usage + +```tsx +import { ChainProvider, ChainIcon } from "thirdweb/react"; + + + +; +``` + + Result: An `` component with the src of the icon + +```html + +``` + +#### Override the icon with the `iconResolver` prop + + If you already have the icon url, you can skip the network requests and pass it directly to the ChainIcon + +```tsx +; +``` + + You can also pass in your own custom (async) function that retrieves the icon url + +```tsx +const getIcon = async () => { + const icon = getIconFromCoinMarketCap(chainId, etc); + return icon; +}; + +; +``` + +#### Show a loading sign while the icon is being loaded + +```tsx +} />; +``` + +#### Fallback to a dummy image if the chain icon fails to resolve + +```tsx +} />; +``` + +#### Usage with queryOptions + + ChainIcon uses useQuery() from tanstack query internally. It allows you to pass a custom queryOptions of your choice for more control of the internal fetching logic + +```tsx +; +``` + +```ts +function ChainIcon(__namedParameters: ChainIconProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,alt : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,children : ReactNode,className : string,client : ThirdwebClient,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,crossOrigin : CrossOrigin,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,decoding : "auto" | "async" | "sync",defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,fetchPriority : "auto" | "high" | "low",height : string | number,hidden : boolean,iconResolver : string | (() => string) | (() => Promise),id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loading : "eager" | "lazy",loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,referrerPolicy : HTMLAttributeReferrerPolicy,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,sizes : string,slot : string,spellCheck : Booleanish,srcSet : string,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",useMap : string,vocab : string,width : string | number} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + an `` with the src of the chain icon +--- + +## ChainName + + This component fetches then shows the name of a chain. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` + +### Example + +#### Basic usage + +```tsx +import { ChainProvider, ChainName } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + +; +``` + + Result: + +```html +Ethereum Mainnet +``` + +#### Custom name resolver + + By default ChainName will call the thirdweb API to retrieve the chain name. However if you have a different way to fetch the name, you can pass the function to the `nameResolver` prop. Note: nameResolver should either be a string or a function (async) that returns a string. + +```tsx +async function fetchNameMethod() { + // your own fetching logic + return "the chain name"; +} + +; +``` + + Alternatively you can also pass in a string directly: + +```tsx +; +``` + +#### Format the name (capitalize, truncate, etc.) + + The ChainName component accepts a `formatFn` which takes in a string and outputs a string The function is used to modify the name of the chain + +```tsx +const concatStr = (str: string):string => str + "Network" + + + + +``` + + Result: + +```html +Ethereum Mainnet Network +``` + +#### Show a loading sign when the name is being fetched + +```tsx +import { ChainProvider, ChainName } from "thirdweb/react"; + + + } /> +; +``` + +#### Fallback to something when the name fails to resolve + +```tsx + + +; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx +; +``` + +```ts +function ChainName(__namedParameters: ChainNameProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,formatFn : (str: string) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nameResolver : string | (() => string) | (() => Promise),nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` +--- + +## isZkSyncChain + + Checks whether the given chain is part of the zksync stack + +```ts +function isZkSyncChain( + chain: Readonly, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let chain: Readonly; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- +# Contract +--- + +## checkVerificationStatus + + Checks the verification status of a contract. + +### Example + +```ts +import { checkVerificationStatus } from "thirdweb/contract"; +const verificationStatus = await checkVerificationStatus({ + explorerApiUrl: "https://api.polygonscan.com/api", + explorerApiKey: "YOUR_API_KEY", + guid: "YOUR_GUID", +}); +console.log(verificationStatus); +``` + +```ts +function checkVerificationStatus( + options: CheckVerificationStatusOptions, +): Promise; +``` + +### Parameters + + The options for checking the verification status. + +#### Type + +```ts +let options: CheckVerificationStatusOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves with the verification status data. +--- + +## fetchPublishedContract + + Fetches the published contract based on the provided options. + +### Example + +```ts +const publishedContract = await fetchPublishedContract({ + publisherAddress: "0x1234", + contractName: "MyContract", + version: "1.0.0", + client: client, +}); +``` + +```ts +function fetchPublishedContract( + options: FetchPublishedContractOptions, +): Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; +``` + +### Parameters + + The options for fetching the published contract. + +#### Type + +```ts +let options: FetchPublishedContractOptions; +``` + +### Returns + +```ts +let returnType: Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; +``` + + The published contract. +--- + +## getBytecode + + Retrieves the bytecode of a contract. + +### Example + +```ts +import { getBytecode } from "thirdweb/contract"; +const bytecode = await getBytecode(contract); +``` + +```ts +function getBytecode( + contract: Readonly>, +): Promise; +``` + +### Parameters + + The ThirdwebContract instance. + +#### Type + +```ts +let contract: Readonly>; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A Promise that resolves to the bytecode of the contract. +--- + +## getCompilerMetadata + + Down the compiled metadata from thirdweb contract api and format it + +### Example + +```ts +import { getCompilerMetadata, getContract } from "thirdweb/contracts"; + +const contract = getContract({ + address: "0x...", + chain: ethereum, + client: "", +}); +const metadata = await getCompilerMetadata(contract); +``` + +```ts +function getCompilerMetadata( + contract: Readonly>, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let contract: Readonly>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The compiler metadata for the contract +--- + +## getContract + + Creates a Thirdweb contract by combining the Thirdweb client and contract options. + +### Example + +```ts +import { createThirdwebClient, getContract } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; + +const client = createThirdwebClient({ clientId: "..." }); +const contract = getContract({ + client, + chain: sepolia, + address: "0x123...", + // optional ABI + abi: [...], +}); +``` + +```ts +function getContract( + options: ContractOptions, +): ThirdwebContract; +``` + +### Parameters + + The options for creating the contract. + +#### Type + +```ts +let options: ContractOptions; +``` + +### Returns + +```ts +let returnType: ThirdwebContract; +``` + + The Thirdweb contract. +--- + +## prepareMethod + + Prepares a method for usage by converting it into a prepared method object. + +### Example + +```ts +import { prepareMethod } from "thirdweb/utils"; +const method = "function transfer(address to, uint256 value)"; +const preparedMethod = prepareMethod(method); +``` + +```ts +function prepareMethod(method: TMethod): PreparedMethod; +``` + +### Parameters + + The method to prepare. + +#### Type + +```ts +let method: TMethod; +``` + +### Returns + +```ts +let returnType: PreparedMethod; +``` + + The prepared method object. +--- + +## resolveAbiFromBytecode + + Resolves the ABI (Application Binary Interface) from the bytecode of a contract. + +### Example + +```ts +import { createThirdwebClient, getContract } from "thirdweb"; +import { resolveAbiFromBytecode } from "thirdweb/contract"; +import { ethereum } from "thirdweb/chains"; +const client = createThirdwebClient({ clientId: "..." }); +const myContract = getContract({ + client, + address: "...", + chain: ethereum, +}); +const abi = await resolveAbiFromBytecode(myContract); +``` + +```ts +function resolveAbiFromBytecode( + contract: Readonly>, +): Promise; +``` + +### Parameters + + The ThirdwebContract instance. + +#### Type + +```ts +let contract: Readonly>; +``` + +### Returns + +```ts +let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +``` + + The resolved ABI as a generic type. +--- + +## resolveAbiFromContractApi + + Resolves the ABI (Application Binary Interface) for a contract from the contract API. + +### Example + +```ts +import { createThirdwebClient, getContract } from "thirdweb"; +import { resolveAbiFromContractApi } from "thirdweb/contract"; +import { ethereum } from "thirdweb/chains"; +const client = createThirdwebClient({ clientId: "..." }); +const myContract = getContract({ + client, + address: "...", + chain: ethereum, +}); +const abi = await resolveAbiFromContractApi(myContract); +``` + +```ts +function resolveAbiFromContractApi( + contract: Readonly>, + contractApiBaseUrl: string, +): Promise; +``` + +### Parameters + + The ThirdwebContract instance representing the contract. + +#### Type + +```ts +let contract: Readonly>; +``` + + The base URL of the contract API. Defaults to "https://contract.thirdweb.com/abi". + +#### Type + +```ts +let contractApiBaseUrl: string; +``` + +### Returns + +```ts +let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +``` + + A promise that resolves to the ABI of the contract. +--- + +## resolveCompositeAbi + + Resolves the ABI for a contract based on its bytecode. If the contract follows the plugin-pattern or dynamic pattern, it resolves the ABIs for the plugins and merges them with the root ABI. If the contract follows the base router pattern, it resolves the ABIs for the plugins and merges them with the root ABI. If the contract follows the diamond pattern, it resolves the ABIs for the facets and merges them with the root ABI. + +### Example + +```ts +import { createThirdwebClient, getContract } from "thirdweb"; +import { resolveCompositeAbiFromBytecode } from "thirdweb/contract"; +import { ethereum } from "thirdweb/chains"; +const client = createThirdwebClient({ clientId: "..." }); +const myContract = getContract({ + client, + address: "...", + chain: ethereum, +}); +const abi = await resolveCompositeAbiFromBytecode(myContract); +``` + +```ts +function resolveCompositeAbi( + contract: Readonly>, + rootAbi?: Abi, + resolveSubAbi?: ( + contract: Readonly>, + ) => Promise, +): Promise; +``` + +### Parameters + + The contract for which to resolve the ABI. + +#### Type + +```ts +let contract: Readonly>; +``` + + The root ABI to use for the contract. If not provided, it resolves the ABI from the contract's bytecode. + +#### Type + +```ts +let rootAbi: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +``` + + A function to resolve the ABI for a sub-contract. If not provided, it uses the default ABI resolution logic. + +#### Type + +```ts +let resolveSubAbi: ( + contract: Readonly>, +) => Promise; +``` + +### Returns + +```ts +let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +``` + + The resolved ABI for the contract. +--- + +## resolveContractAbi + + Resolves the ABI (Application Binary Interface) for a given contract. If the ABI is already cached, it returns the cached value. Otherwise, it tries to resolve the ABI from the contract's API. If that fails, it resolves the ABI from the contract's bytecode. + +### Example + +```ts +import { createThirdwebClient, getContract } from "thirdweb"; +import { resolveContractAbi } from "thirdweb/contract"; +import { ethereum } from "thirdweb/chains"; +const client = createThirdwebClient({ clientId: "..." }); +const myContract = getContract({ + client, + address: "...", + chain: ethereum, +}); +const abi = await resolveContractAbi(myContract); +``` + +```ts +function resolveContractAbi( + contract: Readonly>, + contractApiBaseUrl: string, +): Promise; +``` + +### Parameters + + The contract for which to resolve the ABI. + +#### Type + +```ts +let contract: Readonly>; +``` + + The base URL of the contract API. Defaults to "https://contract.thirdweb.com/abi". + +#### Type + +```ts +let contractApiBaseUrl: string; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the ABI of the contract. +--- + +## verifyContract + + Verifies a contract by performing the following steps: + +* Resolves the implementation of the contract. +* Extracts the IPFS URI from the contract bytecode. +* Downloads the contract source code from the IPFS URI. +* Fetches the source files from the compiler metadata. +* Compiles the contract source code using the Solidity compiler. +* Fetches the constructor parameters if not provided. +* Sends a request to the contract verification API to verify the contract source code. + +### Example + +```ts +import { getContract } from "thirdweb/contract"; +import { verifyContract } from "thirdweb/contract"; + +const contract = getContract({ ... }); +const verificationResult = await verifyContract({ + contract, + explorerApiUrl: "https://api.polygonscan.com/api", + explorerApiKey: "YOUR_API_KEY", +}); +console.log(verificationResult); +``` + +```ts +function verifyContract( + options: VerifyContractOptions, +): Promise>; +``` + +### Parameters + + The options for contract verification. + +#### Type + +```ts +let options: VerifyContractOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to the verification result. +--- + +## getInitializeTransaction + + Prepares the initialization transaction for a contract deployment + +```ts +function getInitializeTransaction(options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + deployMetadata: FetchDeployMetadataResult; + implementationContract: Readonly>; + initializeParams?: Record; + modules?: Array<{ + deployMetadata: FetchDeployMetadataResult; + initializeParams?: Record; + }>; +}): Promise< + PreparedTransaction<[], AbiFunction, PrepareTransactionOptions> +>; +``` + +### Parameters + + The options for generating the initialize transaction + +#### Type + +```ts +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + deployMetadata: FetchDeployMetadataResult; + implementationContract: Readonly>; + initializeParams?: Record; + modules?: Array<{ + deployMetadata: FetchDeployMetadataResult; + initializeParams?: Record; + }>; +}; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + The prepared transaction for contract initialization +--- + +## getOrDeployInfraForPublishedContract + + Gets or deploys the infrastructure contracts needed for a published contract deployment + +```ts +function getOrDeployInfraForPublishedContract( + args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + } & { + constructorParams?: Record; + contractId: string; + publisher?: string; + version?: string; + }, +): Promise<{ + cloneFactoryContract: ThirdwebContract; + implementationContract: ThirdwebContract; +}>; +``` + +### Parameters + + The arguments object + +#### Type + +```ts +let args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +} & { + constructorParams?: Record; + contractId: string; + publisher?: string; + version?: string; +}; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` + + An object containing: + +* cloneFactoryContract: The factory contract used for creating clones +* implementationContract: The deployed implementation contract +--- + +## getContractEvents + + Retrieves events from a contract based on the provided options. + +### Example + +```ts +import { getContractEvents } from "thirdweb"; +const events = await getContractEvents({ + contract: myContract, + fromBlock: 123456n, + toBlock: 123456n, + events: [preparedEvent, preparedEvent2], +}); +``` + +```ts +function getContractEvents( + options: GetContractEventsOptions, +): Promise>; +``` + +### Parameters + + The options for retrieving events. + +#### Type + +```ts +let options: GetContractEventsOptions; +``` + +### Returns + +```ts +let returnType: ParseEventLogsResult; +``` + + A promise that resolves to an array of parsed event logs. Note: toBlock and fromBlock are both inclusive. +--- + +## parseEventLogs + + Parses logs and returns the corresponding events. + +### Example + +```ts +import { parseEventLogs } from "thirdweb"; +const events = parseEventLogs({ + logs, + events: [preparedEvent, preparedEvent2], +}); +``` + +```ts +function parseEventLogs( + options: ParseEventLogsOptions, +): ParseEventLogsResult; +``` + +### Parameters + + The options for parsing logs. + +#### Type + +```ts +let options: ParseEventLogsOptions; +``` + +### Returns + +```ts +let returnType: ParseEventLogsResult; +``` + + The parsed events. +--- + +## prepareEvent + + Prepares an event by parsing the signature, generating the event hash, and encoding the event topics. + +### Example + +```ts +import { prepareEvent } from "thirdweb"; +const myEvent = prepareEvent({ + signature: "event MyEvent(uint256 myArg)", +}); +``` + +```ts +function prepareEvent( + options: PrepareEventOptions, +): PreparedEvent>; +``` + +### Parameters + + The options for preparing the event. + +#### Type + +```ts +let options: PrepareEventOptions; +``` + +### Returns + +```ts +let returnType: PreparedEvent>; +``` + + The prepared event object. +--- + +## watchContractEvents + + Listens for contract events from the blockchain. + +### Example + +#### Listen to all events for a contract + +```ts +import { watchContractEvents } from "thirdweb"; +const unwatch = watchContractEvents({ + contract: myContract, + onEvents: (events) => { + // do something with the events + }, +}); +``` + +#### Listen to specific events for a contract + +```ts +import { prepareEvent, watchContractEvents } from "thirdweb"; +const myEvent = prepareEvent({ + event: "event MyEvent(uint256 myArg)", +}); +const events = await watchContractEvents({ + contract: myContract, + events: [myEvent], + onEvents: (events) => { + // do something with the events + }, +}); +``` + +```ts +function watchContractEvents(options: { + contract: Readonly>; + events?: abiEvents; + latestBlockNumber?: bigint; + onEvents: ( + events: ParseEventLogsResult, + ) => void; + strict?: TStrict; +}): () => void; +``` + +### Parameters + + The options for retrieving contract events. + +#### Type + +```ts +let options: { + contract: Readonly>; + events?: abiEvents; + latestBlockNumber?: bigint; + onEvents: ( + events: ParseEventLogsResult, + ) => void; + strict?: TStrict; +}; +``` + +### Returns + +```ts +let returnType: () => void; +``` + + The unwatch function. +--- + +## resolveMethod + + Resolves and returns the ABI function with the specified method name. Throws an error if the function is not found in the ABI. + +### Example + +```ts +import { resolveMethod, prepareContractCall } from "thirdweb"; +const tx = prepareContractCall({ + contract, + // automatically resolves the necessary abi to encode the transaction + method: resolveMethod("transfer"), + // however there is no type completion for params in this case (as the resolution is async and happens at runtime) + params: [to, value], +}); +``` + +```ts +function resolveMethod( + method: string, +): ( + contract: Readonly>, +) => Promise; +``` + +### Parameters + + The name of the method to resolve. + +#### Type + +```ts +let method: string; +``` + +### Returns + +```ts +let returnType: ( + contract: Readonly>, +) => Promise; +``` + + The resolved ABI function. +--- + +## detectMethod + + Detects if the specified method is present in the contract bytecode. + +### Example + +```ts +import { detectMethod } from "thirdweb/utils/extensions/detect.js"; +const hasDecimals = await detectMethod({ + method: "function decimals() view returns (uint8)", + availableSelectors: ["0x313ce567"], +}); +``` + +```ts +function detectMethod(options: DetectExtensionOptions): boolean; +``` + +### Parameters + + The options for detecting the extension. + +#### Type + +```ts +let options: DetectExtensionOptions; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + A promise that resolves to a boolean indicating if the extension is detected. +--- + +## isContractDeployed + + Checks if a contract is deployed by verifying its bytecode. + +### Example + +```ts +import { getContract } from "thirdweb/contract"; +import { isContractDeployed } from "thirdweb/contract/utils"; + +const contract = getContract({ ... }); +const isDeployed = await isContractDeployed(contract); +console.log(isDeployed); +``` + +```ts +function isContractDeployed( + contract: Readonly>, +): Promise; +``` + +### Parameters + + The contract to check. + +#### Type + +```ts +let contract: Readonly>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to a boolean indicating whether the contract is deployed or not. +--- + +## resolveImplementation + + Resolves the implementation address and bytecode for a given proxy contract. + +### Example + +```ts +import { resolveImplementation } from "thirdweb"; +const implementation = await resolveImplementation(contract); +``` + +```ts +function resolveImplementation( + contract: Readonly>, +): Promise<{ address: string; bytecode: Hex }>; +``` + +### Parameters + + The contract to resolve the implementation for. + +#### Type + +```ts +let contract: Readonly>; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to an object containing the implementation address and bytecode. +--- +# Transactions +--- + +## getApprovalForTransaction + + When dealing with transactions that involve ERC20 tokens (Airdropping ERC20, buy NFTs with ERC20, etc.) you often have to do a pre-check to see if the targeted contract has the sufficient allowance to "take" the ERC20 tokens from the caller's wallet. + + This extension is a handy method that checks for the allowance and requests to approve for more if current allowance is insufficient + +### Example + +```ts +import { getApprovalForTransaction } from "thirdweb/extensions/erc20"; +import { sendAndConfirmTransaction } from "thirdweb"; + +async function buyNFT() { + const buyTransaction = ... // could be a marketplacev3's buyFromListing + + // Check if you need to approve spending for the involved ERC20 contract + const approveTx = await getApprovalForTransaction({ + transaction: buyTransaction, + account, // the connected account + }); + if (approveTx) { + await sendAndConfirmTransaction({ + transaction: approveTx, + account, + }) + } + // Once approved, you can finally perform the buy transaction + await sendAndConfirmTransaction({ + transaction: buyTransaction, + account, + }); +} +``` + +```ts +function getApprovalForTransaction( + options: GetApprovalForTransactionParams, +): Promise; +``` + +### Parameters + + GetApprovalForTransactionParams + +#### Type + +```ts +let options: { account: Account; transaction: PreparedTransaction }; +``` + +### Returns + +```ts +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; +``` + + a PreparedTransaction +--- + +## createContractQuery + + Creates a `useQuery` hook for a contract call. + +### Example + +```jsx +import { createContractQuery } from "thirdweb/react"; +import { totalSupply } from "thirdweb/extensions/erc20"; +const useTotalSupply = createContractQuery(totalSupply); +const { data, isLoading } = useTotalSupply({ contract }); +``` + +```ts +function createContractQuery( + readCall: ( + options: BaseTransactionOptions, + ) => Promise, +): ( + options: BaseTransactionOptions & { + queryOptions?: Partial<{ enabled: boolean }>; + }, +) => UseQueryResult; +``` + +### Parameters + + A function that performs the contract function call and returns the result. + +#### Type + +```ts +let readCall: ( + options: BaseTransactionOptions, +) => Promise; +``` + +### Returns + +```ts +let returnType: ( + options: BaseTransactionOptions & { + queryOptions?: Partial<{ enabled: boolean }>; + }, +) => UseQueryResult; +``` + + An object containing the created `useRead` hook. +--- + +## encode + + Encodes a transaction object into a hexadecimal string representation of the encoded data. + +### Example + +```ts +import { encode } from "thirdweb"; +const encodedData = await encode(transaction); +``` + +```ts +function encode( + transaction: PreparedTransaction, +): Promise; +``` + +### Parameters + + The transaction object to encode. + +#### Type + +```ts +let transaction: PreparedTransaction; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the encoded data as a hexadecimal string. +--- + +## estimateGas + + Estimates the gas required to execute a transaction. The gas is returned as a `bigint` and in gwei units. + +### Example + +```ts +import { estimateGas } from "thirdweb"; +const gas = await estimateGas({ + transaction, + from: "0x...", +}); +``` + +```ts +function estimateGas( + options: EstimateGasOptions, +): Promise; +``` + +### Parameters + + The options for estimating gas. + +#### Type + +```ts +let options: Prettify< + { transaction: PreparedTransaction } & ( + | { account: Account; from?: never } + | { account?: never; from?: string | Account } + ) +>; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + A promise that resolves to the estimated gas as a bigint. +--- + +## estimateGasCost + + Estimate the gas cost of a transaction in ether and wei. + +### Example + +```ts +import { estimateGasCost } from "thirdweb"; + +const gasCost = await estimateGasCost({ transaction }); +``` + +```ts +function estimateGasCost( + options: EstimateGasOptions, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: Prettify< + { transaction: PreparedTransaction } & ( + | { account: Account; from?: never } + | { account?: never; from?: string | Account } + ) +>; +``` + +### Returns + +```ts +let returnType: { ether: string; wei: bigint }; +``` +--- + +## prepareContractCall + + Prepares a contract call by resolving the ABI function, parameters and encoded data. Optionally specify other properties such as value or gas price. + +### Example + +#### Usage with a human-readable method signature: + +```ts +import { prepareContractCall } from "thirdweb"; + +const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [to, value], +}); +``` + +#### Usage with explicit gas price and/or value: + +```ts +import { prepareContractCall } from "thirdweb"; +import { toWei } from "thirdweb/utils"; + +const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [to, value], + maxFeePerGas: 30n, + maxPriorityFeePerGas: 1n, + value: toWei("0.01"), +}); +``` + +#### Usage with ERC20 value: + + For transactions that transfer ERC20 tokens, you can specify the value as the amount of tokens to transfer. + + You can use this in conjuction with the [getApprovalForTransaction](https://portal.thirdweb.com/references/typescript/v5/getApprovalForTransaction) function to easily create approval transactions for ERC20 tokens. + + This value will also be read by the react hooks and UI components to present to total cost to the user. + +```ts +import { prepareContractCall } from "thirdweb"; +import { toWei } from "thirdweb/utils"; + +const transaction = prepareContractCall({ + contract, + method: "function payWithCoin()", + params: [], + erc20Value: { + tokenAddress: "0x...", // the address of the ERC20 token + amountWei: toWei("0.1"), // the amount of tokens to transfer in wei + }, +}); +``` + +#### Usage with a JSON ABI function object: + +```ts +import { prepareContractCall } from "thirdweb"; + +const transaction = prepareContractCall({ + contract, + method: { + name: "transfer", + type: "function", + inputs: [ + { name: "to", type: "address" }, + { name: "value", type: "uint256" }, + ], + outputs: [], + stateMutability: "payable", + }, + params: [to, value], +}); +``` + +#### Usage with the ABI defined on the contract: + +```ts +import { getContract, prepareContractCall } from "thirdweb"; +const contract = getContract({ + ..., // chain, address, client + abi: [...] // ABI with a "transfer" method +}); +const transaction = prepareContractCall({ + contract, + method: "transfer", // <- this gets inferred from the contract + params: [to, value], +}); +``` + +#### Passing extra call data to the transaction + +```ts +import { getContract, prepareContractCall } from "thirdweb"; +const contract = getContract({ + ..., // chain, address, client +}); + +const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [...], + // The extra call data MUST be encoded to hex before passing + extraCallData: "0x......." +}); +``` + +```ts +function prepareContractCall( + options: PrepareContractCallOptions, +): PreparedTransaction< + TAbi, + ParseMethod, + PrepareTransactionOptions +>; +``` + +### Parameters + + The options for preparing the contract call. + +#### Type + +```ts +let options: PrepareContractCallOptions< + TAbi, + TMethod, + TPreparedMethod +>; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + TAbi, + ParseMethod, + PrepareTransactionOptions +>; +``` + + A promise that resolves to the prepared transaction. +--- + +## prepareTransaction + + Prepares a transaction with the given options. + +### Example + +```ts +import { prepareTransaction, toWei } from "thirdweb"; +import { ethereum } from "thirdweb/chains"; +const transaction = prepareTransaction({ + to: "0x1234567890123456789012345678901234567890", + chain: ethereum, + client: thirdwebClient, + value: toWei("1.0"), + gasPrice: 30n, +}); +``` + +```ts +function prepareTransaction( + options: PrepareTransactionOptions, + info?: Additional, +): PreparedTransaction; +``` + +### Parameters + + The options for preparing the transaction. + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; +} & PromisedObject< + Omit +>; +``` + + Additional information about the ABI function. + +#### Type + +```ts +let info: Additional; +``` + +### Returns + +```ts +let returnType: PreparedTransaction< + abi, + abiFn, + PrepareTransactionOptions +>; +``` + + The prepared transaction. +--- + +## readContract + +#### Reads state from a deployed smart contract. + + Use this for raw read calls from a contract, but you can also use read [ extensions](https://portal.thirdweb.com/typescript/v5/extensions/use) for predefined methods for common standards. + +### Example + +#### Raw contract call (recommended) + + You can read from any contract by using the solidity signature of the function you want to call. + +```ts +import { getContract } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; +import { useReadContract } from "thirdweb/react"; + +const contract = getContract({ + client, + address: "0x...", + chain: sepolia, +}); + +const { data, isLoading } = useReadContract({ + contract, + method: "function tokenURI(uint256 tokenId) returns (string)", + params: [1n], +}); +``` + + Note that this is type safe, the params types will be enforced based on the signature. + +#### Raw contract call with `resolveMethod` + + If you don't have the solidity signature of the function you want to call, you can use the `resolveMethod` helper to resolve the method from any deployed contract. + + Note that this is not type safe, and will also have a 1 time overhead of resolving the contract ABI. + +```ts +import { getContract, resolveMethod } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; +import { useReadContract } from "thirdweb/react"; + +const contract = getContract({ + client, + address: "0x...", + chain: sepolia, +}); + +const { data, isLoading } = useReadContract({ + contract, + method: resolveMethod("tokenURI"), + params: [1n], +}); +``` + +```ts +function readContract( + options: ReadContractOptions, +): Promise>; +``` + +### Parameters + + The transaction options. + +#### Type + +```ts +let options: ReadContractOptions; +``` + +### Returns + +```ts +let returnType: outputs extends { length: 0 } + ? never + : outputs extends { length: 1 } + ? AbiParametersToPrimitiveTypes[0] + : AbiParametersToPrimitiveTypes; +``` + + A promise that resolves with the result of the read call. +--- + +## sendAndConfirmTransaction + + Sends a transaction using the provided wallet. + +### Example + +#### Basic usage + +```ts +import { sendAndConfirmTransaction } from "thirdweb"; + +const transactionReceipt = await sendAndConfirmTransaction({ + account, + transaction, +}); +``` + +#### Gasless usage with [ thirdweb Engine](https://portal.thirdweb.com/engine) + +```ts +const transactionReceipt = await sendAndConfirmTransaction({ + account, + transaction, + gasless: { + provider: "engine", + relayerUrl: + "https://thirdweb.engine-***.thirdweb.com/relayer/***", + relayerForwarderAddress: "0x...", + }, +}); +``` + +#### Gasless usage with OpenZeppelin + +```ts +const transactionReceipt = await sendAndConfirmTransaction({ + account, + transaction, + gasless: { + provider: "openzeppelin", + relayerUrl: "https://...", + relayerForwarderAddress: "0x...", + }, +}); +``` + +```ts +function sendAndConfirmTransaction( + options: SendTransactionOptions, +): Promise; +``` + +### Parameters + + The options for sending the transaction. + +#### Type + +```ts +let options: { + account: Account; + gasless: GaslessOptions; + transaction: PreparedTransaction; +}; +``` + +### Returns + +```ts +let returnType: { + blobGasPrice?: quantity; + blobGasUsed?: quantity; + blockHash: Hash; + blockNumber: quantity; + contractAddress: Address | null | undefined; + cumulativeGasUsed: quantity; + effectiveGasPrice: quantity; + from: Address; + gasUsed: quantity; + logs: Array>; + logsBloom: Hex; + root?: Hash; + status: status; + to: Address | null; + transactionHash: Hash; + transactionIndex: index; + type: type; +}; +``` + + A promise that resolves to the confirmed transaction receipt. +--- + +## sendBatchTransaction + + Sends a batch transaction using the provided options. + +### Example + +```ts +import { sendBatchTransaction } from "thirdweb"; + +const waitForReceiptOptions = await sendBatchTransaction({ + account, + transactions, +}); +``` + +```ts +function sendBatchTransaction( + options: SendBatchTransactionOptions, +): Promise; +``` + +### Parameters + + The options for sending the batch transaction. + +#### Type + +```ts +let options: { + account: Account; + transactions: Array; +}; +``` + +### Returns + +```ts +let returnType: Prettify< + SendTransactionResult & { + chain: Chain; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + } +>; +``` + + A promise that resolves to the options for waiting for the receipt of the first transaction in the batch. +--- + +## sendTransaction + + Sends a transaction using the provided account. + + You can send a transaction with a [ prepared contract call](https://portal.thirdweb.com/references/typescript/v5/prepareContractCall) , a [ prepared transaction](https://portal.thirdweb.com/references/typescript/v5/prepareTransaction) , or using a write [ Extension](https://portal.thirdweb.com/typescript/v5/extensions/use) . + +### Example + +#### Using a prepared contract call + +```ts +import { + sendTransaction, + getContract, + prepareContractCall, +} from "thirdweb"; +import { sepolia } from "thirdweb/chains"; + +const contract = getContract({ + address: "0x...", + chain: sepolia, + client, +}); + +const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [to, value], +}); + +const { transactionHash } = await sendTransaction({ + account, + transaction, +}); +``` + +#### Using a write extension + +```ts +import { sendTransaction, getContract } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; +import { mintTo } from "thirdweb/extensions/erc721"; + +const contract = getContract({ + address: "0x...", + chain: sepolia, + client, +}); + +const transaction = mintTo({ + contract, + to: "0x...", + nft: { + name: "NFT Name", + description: "NFT Description", + image: "https://example.com/image.png", + }, +}); + +const { transactionHash } = await sendTransaction({ + account, + transaction, +}); +``` + +#### Using a prepared transaction + +```ts +import { + sendTransaction, + getContract, + prepareTransaction, +} from "thirdweb"; +import { sepolia } from "thirdweb/chains"; + +const contract = getContract({ + address: "0x...", + chain: sepolia, + client, +}); + +const transaction = prepareTransaction({ + contract, + to: "0x...", + value: toWei("0.1"), +}); + +const { transactionHash } = await sendTransaction({ + account, + transaction, +}); +``` + +#### Send an EIP-7702 Transaction + + _Note: This feature is in beta and is subject to breaking changes_ + +```ts +import { + sendTransaction, + prepareTransaction, + signAuthorization, +} from "thirdweb"; +import { sepolia } from "thirdweb/chains"; + +const authorization = await signAuthorization({ + request: { + address: "0x...", + chainId: 1, + nonce: 0n, + }, + account: myAccount, +}); + +const transaction = prepareTransaction({ + chain: sepolia, + client: client, + to: "0x...", + value: 0n, + authorizationList: [authorization], +}); + +const { transactionHash } = await sendTransaction({ + account, + transaction, +}); +``` + +#### Gasless usage with [ thirdweb Engine](https://portal.thirdweb.com/engine) + +```ts +const { transactionHash } = await sendTransaction({ + account, + transaction, + gasless: { + provider: "engine", + relayerUrl: + "https://thirdweb.engine-***.thirdweb.com/relayer/***", + relayerForwarderAddress: "0x...", + }, +}); +``` + +#### Gasless usage with OpenZeppelin + +```ts +const { transactionHash } = await sendTransaction({ + account, + transaction, + gasless: { + provider: "openzeppelin", + relayerUrl: "https://...", + relayerForwarderAddress: "0x...", + }, +}); +``` + +```ts +function sendTransaction( + options: SendTransactionOptions, +): Promise; +``` + +### Parameters + + The options for sending the transaction. + +#### Type + +```ts +let options: { + account: Account; + gasless: GaslessOptions; + transaction: PreparedTransaction; +}; +``` + +### Returns + +```ts +let returnType: Prettify< + SendTransactionResult & { + chain: Chain; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + } +>; +``` + + A promise that resolves to the transaction result. +--- + +## serializeTransaction + + Serializes a legacy, EIP-1559, EIP-2930, EIP-4844, or EIP-7702 transaction object. + +### Example + +```ts +import { serializeTransaction } from "thirdweb"; + +const serializedTransaction = serializeTransaction({ + transaction: { + to: "0x", + value: 0n, + }, +}); +``` + +```ts +function serializeTransaction( + options: SerializeTransactionOptions, +): Hex; +``` + +### Parameters + + The serialization options. + +#### Type + +```ts +let options: { + signature?: + | ox__Signature.Signature + | ox__Signature.Legacy; + transaction: SerializableTransaction; +}; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The serialized transaction. +--- + +## signAuthorization + + Sign the given EIP-7702 authorization object. + +```ts +function signAuthorization(options: { + account: Account; + request: AuthorizationRequest; +}): Promise; +``` + +### Parameters + + The options for `signAuthorization`Refer to the type [SignAuthorizationOptions](https://portal.thirdweb.com/references/typescript/v5/SignAuthorizationOptions) + +#### Type + +```ts +let options: { account: Account; request: AuthorizationRequest }; +``` + +### Returns + +```ts +let returnType: ox__Authorization.ListSigned[number]; +``` + + The signed authorization object + +```ts +import { signAuthorization } from "thirdweb"; + +const authorization = await signAuthorization({ + request: { + address: "0x...", + chainId: 911867, + nonce: 100n, + }, + account: myAccount, +}); +``` +--- + +## signTransaction + + Signs a transaction to be sent to a node. + +### Example + +```ts +import { signTransaction } from "thirdweb"; +signTransaction({ + transaction: { + ... + }, + privateKey: "0x...", +}); +``` + +```ts +function signTransaction(options: SignTransactionOptions): Hex; +``` + +### Parameters + + The options for signing. + +#### Type + +```ts +let options: { + privateKey: Hex; + transaction: SerializableTransaction; +}; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The signed transaction as a hex string +--- + +## simulateTransaction + + Simulates the execution of a transaction. + +### Example + +```ts +import { simulateTransaction } from "thirdweb"; +const result = await simulateTransaction({ + transaction, +}); +``` + +```ts +function simulateTransaction( + options: SimulateOptions, +): Promise; +``` + +### Parameters + + The options for simulating the transaction. + +#### Type + +```ts +let options: SimulateOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the result of the simulation. +--- + +## toSerializableTransaction + + Converts a prepared transaction to a transaction with populated options. + +### Example + +```ts +import { + prepareTransaction, + toSerializableTransaction, +} from "thirdweb"; + +const transaction = await prepareTransaction({ + transaction: { + to: "0x...", + value: 100, + }, +}); +const finalTx = await toSerializableTransaction({ + transaction, +}); + +account.sendTransaction(finalTx); +``` + +```ts +function toSerializableTransaction( + options: ToSerializableTransactionOptions, +): Promise< + | { + accessList: undefined | AccessList; + authorizationList: + | undefined + | Array<{ + address: string; + chainId: number; + nonce: bigint; + r: bigint; + s: bigint; + yParity: number; + }>; + chainId: number; + data: `0x${string}`; + gas: bigint; + gasPrice?: undefined; + maxFeePerGas?: bigint; + maxPriorityFeePerGas?: bigint; + nonce: undefined | number; + to: undefined | string; + value: undefined | bigint; + } + | { + accessList: undefined | AccessList; + authorizationList: + | undefined + | Array<{ + address: string; + chainId: number; + nonce: bigint; + r: bigint; + s: bigint; + yParity: number; + }>; + chainId: number; + data: `0x${string}`; + gas: bigint; + gasPrice?: bigint; + maxFeePerGas?: undefined; + maxPriorityFeePerGas?: undefined; + nonce: undefined | number; + to: undefined | string; + value: undefined | bigint; + } +>; +``` + +### Parameters + + The transaction and additional options for conversion + +#### Type + +```ts +let options: { + from?: string | Account; + transaction: PreparedTransaction; +}; +``` + +### Returns + +```ts +let returnType: Promise< + | { + accessList: undefined | AccessList; + authorizationList: + | undefined + | Array<{ + address: string; + chainId: number; + nonce: bigint; + r: bigint; + s: bigint; + yParity: number; + }>; + chainId: number; + data: `0x${string}`; + gas: bigint; + gasPrice?: undefined; + maxFeePerGas?: bigint; + maxPriorityFeePerGas?: bigint; + nonce: undefined | number; + to: undefined | string; + value: undefined | bigint; + } + | { + accessList: undefined | AccessList; + authorizationList: + | undefined + | Array<{ + address: string; + chainId: number; + nonce: bigint; + r: bigint; + s: bigint; + yParity: number; + }>; + chainId: number; + data: `0x${string}`; + gas: bigint; + gasPrice?: bigint; + maxFeePerGas?: undefined; + maxPriorityFeePerGas?: undefined; + nonce: undefined | number; + to: undefined | string; + value: undefined | bigint; + } +>; +``` + + A serializable transaction for inspection or submission to an account. + + For easier transaction sending, sendTransaction +--- + +## waitForReceipt + + Waits for the transaction receipt of a given transaction hash on a specific contract. + +### Example + +```ts +import { waitForReceipt } from "thirdweb"; +const receipt = await waitForReceipt({ + client, + chain, + transactionHash: "0x123...", +}); +``` + +```ts +function waitForReceipt(options: { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; +}): Promise; +``` + +### Parameters + + The options for waiting for the receipt. By default, it's 100 blocks. + +#### Type + +```ts +let options: { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; +}; +``` + +### Returns + +```ts +let returnType: { + blobGasPrice?: quantity; + blobGasUsed?: quantity; + blockHash: Hash; + blockNumber: quantity; + contractAddress: Address | null | undefined; + cumulativeGasUsed: quantity; + effectiveGasPrice: quantity; + from: Address; + gasUsed: quantity; + logs: Array>; + logsBloom: Hex; + root?: Hash; + status: status; + to: Address | null; + transactionHash: Hash; + transactionIndex: index; + type: type; +}; +``` + + A promise that resolves with the transaction receipt. +--- + +## getTransactionStore + + Retrieve the transaction store for a given address. + +### Example + +```ts +import { getTransactionStore } from "thirdweb/transaction"; + +const store = getTransactionStore("0x..."); +store.subscribe((transactions) => { + console.log(transactions); +}); +``` + +```ts +function getTransactionStore( + address: string, +): Store>; +``` + +### Parameters + + The address to retrieve the transaction store for. + +#### Type + +```ts +let address: string; +``` + +### Returns + +```ts +let returnType: Store>; +``` + + A store of transactions for the given account to subscribe to. +--- +# Nebula +--- + +## chat + + Chat with Nebula. + +### Example + +```ts +import { Nebula } from "thirdweb/ai"; + +const response = await Nebula.chat({ + client: TEST_CLIENT, + message: + "What's the symbol of this contract: 0xe2cb0eb5147b42095c2FfA6F7ec953bb0bE347D8", + contextFilter: { + chains: [sepolia], + }, +}); +``` + + Multi message prompt: + +```ts +const response = await Nebula.chat({ + client, + messages: [ + { role: "user", content: "What's my balance?" }, + { role: "assistant", content: "Your balance is 0.023 ETH" }, + { role: "user", content: "What about my NFTs?" }, + ], + contextFilter: { + chains: [sepolia], + }, +}); +``` + + Extracting and sending transactions from a chat response: + +```ts +const response = await Nebula.chat({ ... }); +const transactions = response.transactions; +for (const transaction of transactions) { + await sendTransaction({ transaction, account }); +} +``` + +```ts +function chat(input: Input): Promise; +``` + +### Parameters + + The input for the chat. + +#### Type + +```ts +let input: { + account?: Account; + client: ThirdwebClient; + contextFilter?: { + chains?: Array; + contractAddresses?: Array; + walletAddresses?: Array; + }; + sessionId?: string; +} & ( + | { + messages: Array<{ + content: string; + role: "user" | "assistant"; + }>; + } + | { message: string } +); +``` + +### Returns + +```ts +let returnType: { + message: string; + sessionId: string; + transactions: Array; +}; +``` + + The chat response. This API is in early access and might change in the future. +--- + +## execute + + Execute a transaction based on a prompt. + +### Example + +```ts +import { Nebula } from "thirdweb/ai"; + +const wallet = createWallet("io.metamask"); +const account = wallet.connect({ client }); + +const result = await Nebula.execute({ + client, + account, // transactions will be sent from this account + message: "send 0.0001 ETH to vitalik.eth", + contextFilter: { + chains: [sepolia], + }, +}); +``` + + Multi message prompt: + +```ts +Nebula.execute({ + client, + account, + messages: [ + { role: "user", content: "What's the address of vitalik.eth" }, + { + role: "assistant", + content: + "The address of vitalik.eth is 0xd8dA6BF26964aF8E437eEa5e3616511D7G3a3298", + }, + { role: "user", content: "Send them 0.0001 ETH" }, + ], + contextFilter: { + chains: [sepolia], + }, +}); +``` + +```ts +function execute( + input: Input & { account: Account }, +): Promise; +``` + +### Parameters + + The input for the transaction. + +#### Type + +```ts +let input: Input & { account: Account }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The transaction hash. This API is in early access and might change in the future. +--- +# Social API +--- + +## getSocialProfiles + + Fetches the wallet's available social profiles. + +### Example + +```ts +import { getSocialProfiles } from "thirdweb/social"; +const profiles = await getSocialProfiles({ + address: "0x...", + client, +}); +``` + +```ts +function getSocialProfiles(args: { + address: string; + client: ThirdwebClient; +}): Promise>; +``` + +### Parameters + + The arguments to use when fetching the social profiles. + +#### Type + +```ts +let args: { address: string; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: { + avatar?: string; + bio?: string; + metadata?: FarcasterProfile | LensProfile | EnsProfile; + name?: string; + type: "farcaster" | "lens" | "ens"; +}; +``` + + A promise resolving to the array of social profiles for the given address. +--- +# Auth +--- + +## createAuth + + Creates an authentication object with the given options. + +### Example + +```ts +import { createAuth } from 'thirdweb/auth'; + +const auth = createAuth({...}); + +// 1. generate a login payload for a client on the server side +const loginPayload = await auth.generatePayload({ address: '0x123...' }); + +// 2. send the login payload to the client + +// 3. verify the login payload that the client sends back later +const verifiedPayload = await auth.verifyPayload({ payload: loginPayload, signature: '0x123...' }); + +// 4. generate a JWT for the client +const jwt = await auth.generateJWT({ payload: verifiedPayload }); + +// 5. set the JWT as a cookie or otherwise provide it to the client + +// 6. authenticate the client based on the JWT on subsequent calls + const { valid, parsedJWT } = await auth.verifyJWT({ jwt }); +``` + +```ts +function createAuth(options: AuthOptions): { + generateJWT: ( + params: GenerateJWTParams, + ) => Promise; + generatePayload: ( + __namedParameters: GenerateLoginPayloadParams, + ) => Promise; + verifyJWT: (params: VerifyJWTParams) => Promise; + verifyPayload: ( + __namedParameters: VerifyLoginPayloadParams, + ) => Promise; +}; +``` + +### Parameters + + The options for creating the authentication object. + +#### Type + +```ts +let options: { + adminAccount?: Account; + client?: ThirdwebClient; + domain: string; + jwt?: { + expirationTimeSeconds?: number; + jwtId?: { + generate: () => string | Promise; + validate: (jwtId: string) => boolean | Promise; + }; + }; + login?: { + nonce?: { + generate: () => string | Promise; + validate: (nonce: string) => boolean | Promise; + }; + payloadExpirationTimeSeconds?: number; + resources?: Array; + statement?: string; + uri?: string; + version?: string; + }; +}; +``` + +### Returns + +```ts +let returnType: { + generateJWT: ( + params: GenerateJWTParams, + ) => Promise; + generatePayload: ( + __namedParameters: GenerateLoginPayloadParams, + ) => Promise; + verifyJWT: (params: VerifyJWTParams) => Promise; + verifyPayload: ( + __namedParameters: VerifyLoginPayloadParams, + ) => Promise; +}; +``` + + The created authentication object. +--- + +## isErc6492Signature + +### Example + +```ts +import { isErc6492Signature } from "thirdweb/auth"; + +const isErc6492 = isErc6492Signature( + "0x1234567890123456789012345678901234567890", +); +``` + +```ts +function isErc6492Signature(signature: `0x${string}`): boolean; +``` + +### Parameters + + The signature to check for ERC6492 compatibility + +#### Type + +```ts +let signature: `0x${string}`; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + True if the signature is compatible with ERC6492, false otherwise +--- + +## parseErc6492Signature + +### Example + +```ts +import { parseErc6492Signature } from "thirdweb/auth"; + +const parsedSignature = parseErc6492Signature( + "0x1234567890123456789012345678901234567890", +); +``` + +```ts +function parseErc6492Signature( + signature: `0x${string}`, +): ParseErc6492SignatureReturnType; +``` + +### Parameters + + The signature to parse + +#### Type + +```ts +let signature: `0x${string}`; +``` + +### Returns + +```ts +let returnType: OneOf; +``` + + ParseErc6492SignatureReturnType The parsed (or original) signature +--- + +## serializeErc6492Signature + +### Example + +```ts +import { serializeErc6492Signature } from "thirdweb/auth"; + +const serializedSignature = serializeErc6492Signature({ + address: "0x...", + data: "0x...", + signature: "0x...", +}); +// 0x000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492 +``` + +```ts +function serializeErc6492Signature( + __namedParameters: Erc6492Signature, +): Hex; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: { address: string; data: Hex; signature: Hex }; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The serialized signature +--- + +## signLoginPayload + + Signs the login payload using the provided account. + +### Example + +```ts +import { signLoginPayload } from "thirdweb/auth"; + +const { signature, payload } = await signLoginPayload({ + payload: loginPayload, + account: account, +}); +``` + +```ts +function signLoginPayload( + options: SignLoginPayloadParams, +): Promise<{ payload: LoginPayload; signature: `0x${string}` }>; +``` + +### Parameters + + The options for signing the login payload. + +#### Type + +```ts +let options: { account: Account; payload: LoginPayload }; +``` + +### Returns + +```ts +let returnType: { + address: string; + chain_id?: string; + domain: string; + expiration_time: string; + invalid_before: string; + issued_at: string; + nonce: string; + resources?: Array; + statement: string; + uri?: string; + version: string; +}; +``` + + An object containing the signature and the payload. +--- + +## verifyContractWalletSignature + +### Example + +```ts +import { verifyContractWalletSignature } from 'thirdweb/auth'; + +const isValid = await verifyContractWalletSignature({ + message: '0x..', + signature: '0x..', + address: '0x...', + chain: ..., + client: ..., +}); +``` + +```ts +function verifyContractWalletSignature(__namedParameters: { + accountFactory?: { + address: string; + verificationCalldata: `0x${string}`; + }; + address: string; + chain: Readonly; + client: ThirdwebClient; + message: Message; + signature: string | Uint8Array; +}): Promise; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: { + accountFactory?: { + address: string; + verificationCalldata: `0x${string}`; + }; + address: string; + chain: Readonly; + client: ThirdwebClient; + message: Message; + signature: string | Uint8Array; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A boolean indicating whether the signature is valid. +--- + +## verifyEOASignature + + Verifies the signature of a message using an Ethereum account's EOA (Externally Owned Account). + +### Example + +```ts +import { verifyEOASignature } from "thirdweb/auth"; + +const isValid = await verifyEOASignature({ + message: "0x1234567890123456789012345678901234567890", + signature: "0x1234567890123456789012345678901234567890", + address: "0x1234567890123456789012345678901234567890", +}); +``` + +```ts +function verifyEOASignature( + options: VerifyEOASignatureParams, +): Promise; +``` + +### Parameters + + The options for verifying the signature. + +#### Type + +```ts +let options: { + address: string; + message: string | Message; + signature: string | Uint8Array; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A boolean indicating whether the signature is valid. +--- + +## verifySignature + + Verifies the signature based on the provided options. Handles smart contract wallet signatures and EOA signatures. _IMPORTANT: in order to check smart contract signatures, a chain and client must be provided. Or, you can use the `verifyContractWalletSignature` function directly if all signatures will be from smart accounts._ + + verifyContractWalletSignature + +### Example + +```ts +import { verifySignature } from "thirdweb/auth"; + +const isValid = await verifySignature({ + message: "Your message to sign", + signature: + "0x91db0222ec371a8c18d3b187a6d2e77789bffca1b96826ef6b8708e0d4a66c80312fc3ae95b8fbc147265abf539bb6f360152be61a0e1411d7f5771a599e769a1c", + address: "0xda9C7A86AeE76701FC1c23ae548e8E93Ba3e42A5", + client: thirdwebClient, + chain: chain, +}); +``` + +```ts +function verifySignature(options: { + accountFactory?: { + address: string; + verificationCalldata: `0x${string}`; + }; + address: string; + chain?: Readonly; + client?: ThirdwebClient; + message: Message & (Message | undefined); + signature: (string | Uint8Array) & + (undefined | string | Uint8Array); +}): Promise; +``` + +### Parameters + + The options for signature verification. + +#### Type + +```ts +let options: { + accountFactory?: { + address: string; + verificationCalldata: `0x${string}`; + }; + address: string; + chain?: Readonly; + client?: ThirdwebClient; + message: Message & (Message | undefined); + signature: (string | Uint8Array) & + (undefined | string | Uint8Array); +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A boolean indicating whether the signature is valid or not. +--- + +## verifyTypedData + +### Example + +```ts +import { verifyTypedData } from "thirdweb/utils"; +const isValid = await verifyTypedData({ + address: "0x...", + signature: "0x...", + client, + chain, + domain: { + name: "Ether Mail", + version: "1", + chainId: 1, + verifyingContract: "0x0000000000000000000000000000000000000000", + }, + primaryType: "Mail", + types: { + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" }, + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" }, + ], + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", + }, + contents: "Hello, Bob!", + }, +}); +``` + +```ts +function verifyTypedData( + __namedParameters: VerifyTypedDataParams, +): Promise; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: VerifyTypedDataParams; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to `true` if the signature is valid, or `false` otherwise. +--- + +## decodeJWT + + Decodes a JSON Web Token (JWT) and returns the decoded payload and signature. + +### Example + +```ts +import { decodeJWT } from "thirdweb/utils"; + +const { payload, signature } = decodeJWT(jwt); +``` + +```ts +function decodeJWT(jwt: string): { + payload: JWTPayload; + signature: `0x${string}`; +}; +``` + +### Parameters + + The JWT string to decode. + +#### Type + +```ts +let jwt: string; +``` + +### Returns + +```ts +let returnType: { payload: JWTPayload; signature: `0x${string}` }; +``` + + An object containing the decoded payload and signature. +--- + +## encodeJWT + + Builds a JSON Web Token (JWT) using the provided options. + +### Example + +```ts +import { encodeJWT } from "thirdweb/utils"; + +const jwt = await encodeJWT({ + payload: { + iss: "0x1234567890123456789012345678901234567890", + sub: "0x1234567890123456789012345678901234567890", + aud: "0x1234567890123456789012345678901234567890", + exp: new Date(Date.now() + 1000 * 60 * 60), + nbf: new Date(), + iat: new Date(), + jti: "1234567890", + ctx: { + example: "example", + }, + }, + wallet, +}); +``` + +```ts +function encodeJWT(options: EncodeJWTParams): Promise; +``` + +### Parameters + + The options for building the JWT. + +#### Type + +```ts +let options: EncodeJWTParams; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The generated JWT. +--- + +## refreshJWT + + Refreshes a JSON Web Token (JWT) by encoding a new payload with updated expiration time. + +### Example + +```ts +import { refreshJWT } from "thirdweb/utils"; + +const jwt = await refreshJWT({ + account, + jwt, + expirationTime: 1000 * 60 * 60, +}); +``` + +```ts +function refreshJWT(options: RefreshJWTParams): Promise; +``` + +### Parameters + + The options for refreshing the JWT. + +#### Type + +```ts +let options: { + account: Account; + expirationTime?: number; + jwt: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A Promise that resolves to the refreshed JWT. +--- +# NFT +--- + +## NFTDescription + + This component fetches and displays an NFT's description. It inherits all the attributes of a ``so you can style it just like how you would style a `` element. + +### Example + +#### Basic usage + +```tsx +import { NFTProvider, NFTDescription } from "thirdweb/react"; + + + +; +``` + +#### Show a loading sign while the description is being fetched + +```tsx +import { NFTProvider, NFTDescription } from "thirdweb/react"; + + + } /> +; +``` + +#### Show something in case the description failed to resolve + +```tsx +import { NFTProvider, NFTDescription } from "thirdweb/react"; + + + Failed to load description} + /> +; +``` + +#### Custom query options for useQuery (tanstack-query) + +```tsx +import { NFTProvider, NFTDescription } from "thirdweb/react"; + + + +; +``` + +#### Override the description with the `descriptionResolver` prop + + If you already have the url, you can skip the network requests and pass it directly to the NFTDescription + +```tsx +; +``` + + You can also pass in your own custom (async) function that retrieves the description + +```tsx +const getDescription = async () => { + // ... + return description; +}; + +; +``` + +```ts +function NFTDescription( + __namedParameters: NFTDescriptionProps, +): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),descriptionResolver : string | (() => string) | (() => Promise),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + A `` element containing the description of the NFT +--- + +## NFTMedia + + This component fetches and displays an NFT's media. It uses thirdweb [MediaRenderer](https://portal.thirdweb.com/refernces/typescript/v5/MediaRenderer) under the hood so you can style it just like how you would style a MediaRenderer. + +### Example + +#### Basic usage + +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; + + + +; +``` + +#### Show a loading sign while the media is being fetched + +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; + + + } /> +; +``` + +#### Show something in case the media failed to resolve + +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; + + + Failed to load media} /> +; +``` + +#### Custom query options for useQuery (tanstack-query) + +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; + + + +; +``` + +#### Basic stylings + + You can style NFTMedia with the `style` and `className` props. + +```tsx +; +``` + +#### Override the media with the `mediaResolver` prop + + If you already have the url, you can skip the network requests and pass it directly to the NFTMedia + +```tsx +; +``` + + You can also pass in your own custom (async) function that retrieves the media url + +```tsx +const getMedia = async () => { + const url = getNFTMedia(props); + return url; +}; + +; +``` + +```ts +function NFTMedia(__namedParameters: NFTMediaProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: Omit< + MediaRendererProps, + "src" | "poster" | "client" +> & { + fallbackComponent?: JSX.Element; + loadingComponent?: JSX.Element; + mediaResolver?: + | NFTMediaInfo + | (() => NFTMediaInfo) + | (() => Promise); + queryOptions?: Omit< + UseQueryOptions, + "queryFn" | "queryKey" + >; +}; +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + A MediaRenderer component +--- + +## NFTName + + This component fetches and displays an NFT's name. It takes in a `className` and `style` props so you can style it just like how you would style a `` element. + +### Example + +#### Basic usage + +```tsx +import { NFTProvider, NFTName } from "thirdweb/react"; + + + +; +``` + +#### Show a loading sign while the name is being fetched + +```tsx +import { NFTProvider, NFTName } from "thirdweb/react"; + + + } /> +; +``` + +#### Show something in case the name failed to resolve + +```tsx +import { NFTProvider, NFTName } from "thirdweb/react"; + + + Failed to load name} /> +; +``` + +#### Custom query options for useQuery (tanstack-query) + +```tsx +import { NFTProvider, NFTName } from "thirdweb/react"; + + + +; +``` + +#### Override the name with the `nameResolver` prop + + If you already have the name, you can skip the network requests and pass it directly to the NFTName + +```tsx +; +``` + + You can also pass in your own custom (async) function that retrieves the name + +```tsx +const getName = async () => { + // ... + return name; +}; + +; +``` + +```ts +function NFTName(__namedParameters: NFTNameProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nameResolver : string | (() => string) | (() => Promise),nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + A `` element containing the name of the NFT +--- +# Buy Crypto +--- + +## convertCryptoToFiat + + Get a price of a token (using tokenAddress + chainId) in fiat. Only USD is supported at the moment. + +### Example + +#### Basic usage + + For native token (non-ERC20), you should use NATIVE\_TOKEN\_ADDRESS as the value for `tokenAddress` + +```ts +import { convertCryptoToFiat } from "thirdweb/pay"; + +// Get Ethereum price +const result = convertCryptoToFiat({ + fromTokenAddress: NATIVE_TOKEN_ADDRESS, + to: "USD", + chain: ethereum, + fromAmount: 1, +}); + +// Result: `{ result: 3404.11 }` +``` + +```ts +function convertCryptoToFiat( + options: ConvertCryptoToFiatParams, +): Promise<{ result: number }>; +``` + +### Parameters + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; + fromAmount: number; + fromTokenAddress: Address; + to: SupportedFiatCurrency; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ result: number }>; +``` + + a number representing the price (in selected fiat) of "x" token, with "x" being the `fromAmount` . +--- + +## convertFiatToCrypto + + Convert a fiat value to a token. Currently only USD is supported. + +### Example + +#### Basic usage + +```ts +import { convertFiatToCrypto } from "thirdweb/pay"; + +// Convert 2 cents to ETH +const result = await convertFiatToCrypto({ + from: "USD", + // the token address. For native token, use NATIVE_TOKEN_ADDRESS + to: "0x...", + // the chain (of the chain where the token belong to) + chain: ethereum, + // 2 cents + fromAmount: 0.02, +}); +``` + + Result: `{ result: 0.0000057 }` + +```ts +function convertFiatToCrypto( + options: ConvertFiatToCryptoParams, +): Promise<{ result: number }>; +``` + +### Parameters + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; + from: SupportedFiatCurrency; + fromAmount: number; + to: Address; +}; +``` + +### Returns + +```ts +let returnType: Promise<{ result: number }>; +``` +--- + +## getBuyHistory + + Get Buy transaction history for a given wallet address. + + This includes both "Buy with Cryto" and "Buy with Fiat" transactions + +### Example + +```ts +import { createThirdwebClient } from "thirdweb"; +import { getBuyHistory } from "thirdweb/pay"; + +const client = createThirdwebClient({ clientId: "..." }); + +const history = await getBuyHistory({ + client, + walletAddress: "0x...", +}); +``` + +```ts +function getBuyHistory( + params: BuyHistoryParams, +): Promise; +``` + +### Parameters + + Object of type [BuyHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyHistoryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; +``` + +### Returns + +```ts +let returnType: { + hasNextPage: boolean; + page: Array< + | { buyWithFiatStatus: BuyWithFiatStatus } + | { buyWithCryptoStatus: BuyWithCryptoStatus } + >; +}; +``` +--- + +## getBuyWithCryptoHistory + + Gets the History of purchases for a given wallet address + +### Example + +```ts +import { createThirdwebClient } from "thirdweb"; +import { BuyWithCryptoHistoryData } from "thirdweb/pay"; + +const client = createThirdwebClient({ clientId: "..." }); +const walletAddress = "0x..."; +const params = { + client, + walletAddress, +}; + +// grabs the history of purchase transactions for the wallet address +const status = await getBuyWithCryptoHistory(params); +``` + +```ts +function getBuyWithCryptoHistory( + params: BuyWithCryptoHistoryParams, +): Promise; +``` + +### Parameters + + Object of type [BuyWithCryptoHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; +``` + +### Returns + +```ts +let returnType: { + hasNextPage: boolean; + page: Array; +}; +``` + + Object of type [BuyWithCryptoHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryData) +--- + +## getBuyWithCryptoQuote + + Get a quote of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) to buy any given token with crypto. This quote contains the information about the swap such as token amounts, processing fees, estimated time etc. + + Once you have the quote, you can use `prepareTransaction` and prepare the transaction for submission. + +### Example + +```ts +import { getBuyWithCryptoQuote } from "thirdweb/pay"; + +const quote = await getBuyWithCryptoQuote({ + client, + fromAddress: "0x...", // wallet address + fromChainId: 137, // chain id of the source token + fromTokenAddress: "0x...", // token address of the source token + fromAmount: "10", // amount of source token to swap + // optionally, you can use `toAmount` instead if you only want a certain amount of destination token + toChainId: 10, // chain id of the destination token + toTokenAddress: "0x...", // token address of the destination token + toAddress: "0x...", // optional: send the tokens to a different address + maxSlippageBPS: 50, // optional: max 0.5% slippage +}); +``` + +```ts +function getBuyWithCryptoQuote( + params: GetBuyWithCryptoQuoteParams, +): Promise; +``` + +### Parameters + + object of type [GetBuyWithCryptoQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoQuoteParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + fromAddress: string; + fromChainId: number; + fromTokenAddress: string; + intentId?: string; + maxSlippageBPS?: number; + purchaseData?: object; + toAddress: string; + toChainId: number; + toTokenAddress: string; +} & ( + | { fromAmount: string; toAmount?: never } + | { fromAmount?: never; toAmount: string } +); +``` + +### Returns + +```ts +let returnType: { + approval?: PrepareTransactionOptions; + client: ThirdwebClient; + paymentTokens: Array; + processingFees: Array; + swapDetails: { + estimated: { + durationSeconds?: number; + feesUSDCents: number; + fromAmountUSDCents: number; + gasCostUSDCents?: number; + slippageBPS: number; + toAmountMinUSDCents: number; + toAmountUSDCents: number; + }; + fromAddress: string; + fromAmount: string; + fromAmountWei: string; + fromToken: QuoteTokenInfo; + maxSlippageBPS: number; + toAddress: string; + toAmount: string; + toAmountMin: string; + toAmountMinWei: string; + toAmountWei: string; + toToken: QuoteTokenInfo; + }; + transactionRequest: PrepareTransactionOptions; +}; +``` + + Object of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) which contains the information about the quote such as processing fees, estimated time, converted token amounts, etc. +--- + +## getBuyWithCryptoStatus + + Gets the status of a buy with crypto transaction + +### Example + +```ts +import { sendTransaction } from "thirdweb"; +import { getBuyWithCryptoStatus, getBuyWithCryptoQuote } from "thirdweb/pay"; + +// get a quote between two tokens +const quote = await getBuyWithCryptoQuote(quoteParams); + +// if approval is required, send the approval transaction +if (quote.approval) { + const txResult = await sendTransaction({ + transaction: quote.approval, + account: account, // account from connected wallet + }); + + await waitForReceipt(txResult); +} + +// send the quoted transaction +const swapTxResult = await sendTransaction({ + transaction: quote.transactionRequest, + account: account, // account from connected wallet + }); + +await waitForReceipt(swapTxResult); + +// keep polling the status of the quoted transaction until it returns a success or failure status +const status = await getBuyWithCryptoStatus({ + client, + transactionHash: swapTxResult.transactionHash, +}}); +``` + +```ts +function getBuyWithCryptoStatus( + buyWithCryptoTransaction: BuyWithCryptoTransaction, +): Promise; +``` + +### Parameters + + Object of type [BuyWithCryptoTransaction](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransaction) + +#### Type + +```ts +let buyWithCryptoTransaction: { + client: ThirdwebClient; + transactionHash: string; +}; +``` + +### Returns + +```ts +let returnType: + | { status: "NOT_FOUND" } + | { + bridge?: string; + destination?: PayOnChainTransactionDetails; + failureMessage?: string; + fromAddress: string; + purchaseData?: object; + quote: BuyWithCryptoQuoteSummary; + source?: PayOnChainTransactionDetails; + status: BuyWithCryptoStatuses; + subStatus: BuyWithCryptoSubStatuses; + swapType: SwapType; + toAddress: string; + }; +``` + + Object of type [BuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoStatus) +--- + +## getBuyWithCryptoTransfer + + Get a quote of type [BuyWithCryptoTransfer](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) to facilitate a token transfer transaction. Using this instead of a native transfer allows you to receive status and webhooks about successful or failed payments. + + Once you have the quote, you can use `prepareTransaction` and prepare the transaction for submission. + +### Example + +```ts +import { getBuyWithCryptoTransfer } from "thirdweb/pay"; + +const transfer = await getBuyWithCryptoTransfer({ + client, + fromAddress: "0x...", // wallet address + toAddress: "0x...", // recipient address - likely to be your wallet + chainId: 10, // chain id of the token + tokenAddress: "0x...", // address of the token + amount: "10", // amount of token to transfer + purchaseData: { + // any metadata for you to attribute this purchase + customerId: "yourId", + }, +}); +``` + +```ts +function getBuyWithCryptoTransfer( + params: GetBuyWithCryptoTransferParams, +): Promise; +``` + +### Parameters + + object of type [GetBuyWithCryptoTransferParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoTransferParams) + +#### Type + +```ts +let params: { + amount: string; + chainId: number; + client: ThirdwebClient; + fromAddress: string; + purchaseData?: object; + toAddress: string; + tokenAddress: string; +}; +``` + +### Returns + +```ts +let returnType: { + approval?: PrepareTransactionOptions; + client: ThirdwebClient; + estimatedGasCostUSDCents: number; + fromAddress: string; + paymentToken: QuotePaymentToken; + processingFee: QuotePaymentToken; + toAddress: string; + transactionRequest: PrepareTransactionOptions; +}; +``` + + Object of type [BuyWithCryptoTransfer](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) which contains the information about the transfer +--- + +## getBuyWithFiatHistory + + Get the "Buy with fiat" transaction history for a given wallet address + +### Example + +```ts +import { createThirdwebClient } from "thirdweb"; +import { getBuyWithFiatHistory } from "thirdweb/pay"; + +const client = createThirdwebClient({ clientId: "..." }); + +// get the 10 latest "Buy with fiat" transactions dony by the wallet +const history = await getBuyWithFiatHistory({ + client: client, + walletAddress: "0x...", + start: 0, + count: 10, +}); +``` + +```ts +function getBuyWithFiatHistory( + params: BuyWithFiatHistoryParams, +): Promise; +``` + +### Parameters + + Object of type [BuyWithFiatHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; +``` + +### Returns + +```ts +let returnType: { + hasNextPage: boolean; + page: Array; +}; +``` + + Object of type [BuyWithFiatHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryData) +--- + +## getBuyWithFiatQuote + + Get a quote of type [BuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatQuote) to buy given token with fiat currency. This quote contains the information about the swap such as token amounts, processing fees, estimated time etc. + +#### Rendering the On-Ramp provider UI + + Once you have the `quote` , you can open the `quote.onRampLink` in a new tab - This will prompt the user to buy the token with fiat currency + +#### Determining the steps required + + If `quote.onRampToken.token` is same as `quote.toToken` ( same chain + same token address ) - This means that the token can be directly bought from the on-ramp provider. But if they are different, On-ramp provider will send the `quote.onRampToken` to the user's wallet address and a swap is required to swap it to the desired token onchain. + + You can use the [isSwapRequiredPostOnramp](https://portal.thirdweb.com/references/typescript/v5/isSwapRequiredPostOnramp) utility function to check if a swap is required after the on-ramp is done. + +#### Polling for the status + + Once you open the `quote.onRampLink` in a new tab, you can start polling for the status using [getBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatStatus) to get the status of the transaction. + +`getBuyWithFiatStatus` returns a status object of type [BuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatStatus) . + +* If no swap is required - the status will become `"ON_RAMP_TRANSFER_COMPLETED"` once the on-ramp provider has sent the desired token to the user's wallet address. Once you receive this status, the process is complete. +* If a swap is required - the status will become `"CRYPTO_SWAP_REQUIRED"` once the on-ramp provider has sent the tokens to the user's wallet address. Once you receive this status, you need to start the swap process. + +#### Swap Process + + On receiving the `"CRYPTO_SWAP_REQUIRED"` status, you can use the [getPostOnRampQuote](https://portal.thirdweb.com/references/typescript/v5/getPostOnRampQuote) function to get the quote for the swap of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) . + + Once you have this quote - You can follow the same steps as mentioned in the [getBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoQuote) documentation to perform the swap. + +### Example + + Get a quote for buying 10 USDC on polygon chain (chainId: 137) with USD fiat currency: + +```ts +import { getBuyWithFiatQuote } from "thirdweb/pay"; + +const quote = await getBuyWithFiatQuote({ + client: client, // thirdweb client + fromCurrencySymbol: "USD", // fiat currency symbol + toChainId: 137, // polygon chain id + toAmount: "10", // amount of USDC to buy + toTokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" // USDC token address in polygon chain + toAddress: "0x...", // user's wallet address + isTestMode: false, // whether to use onramp in test mode for testing purpose (defaults to false) +}); + +window.open(quote.onRampLink, "_blank"); +``` + +```ts +function getBuyWithFiatQuote( + params: GetBuyWithFiatQuoteParams, +): Promise; +``` + +### Parameters + + object of type [GetBuyWithFiatQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatQuoteParams) + +#### Type + +```ts +let params: { + client: ThirdwebClient; + fromAddress: string; + fromAmount?: string; + fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR" | "JPY"; + isTestMode?: boolean; + maxSlippageBPS?: number; + preferredProvider?: FiatProvider; + purchaseData?: object; + toAddress: string; + toAmount?: string; + toChainId: number; + toGasAmountWei?: string; + toTokenAddress: string; +}; +``` + +### Returns + +```ts +let returnType: { + estimatedDurationSeconds: number; + estimatedToAmountMin: string; + estimatedToAmountMinWei: string; + fromAddress: string; + fromCurrency: { + amount: string; + amountUnits: string; + currencySymbol: string; + decimals: number; + }; + fromCurrencyWithFees: { + amount: string; + amountUnits: string; + currencySymbol: string; + decimals: number; + }; + gasToken?: { + amount: string; + amountUSDCents: number; + amountWei: string; + token: { + chainId: number; + decimals: number; + name: string; + priceUSDCents: number; + symbol: string; + tokenAddress: string; + }; + }; + intentId: string; + maxSlippageBPS: number; + onRampLink: string; + onRampToken: { + amount: string; + amountUSDCents: number; + amountWei: string; + token: { + chainId: number; + decimals: number; + name: string; + priceUSDCents: number; + symbol: string; + tokenAddress: string; + }; + }; + processingFees: Array<{ + amount: string; + amountUnits: string; + currencySymbol: string; + decimals: number; + feeType: "ON_RAMP" | "NETWORK"; + }>; + toAddress: string; + toAmountMin: string; + toAmountMinWei: string; + toToken: { + chainId: number; + decimals: number; + name?: string; + priceUSDCents?: number; + symbol?: string; + tokenAddress: string; + }; +}; +``` + + Object of type [BuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatQuote) which contains the information about the quote such as processing fees, estimated time, converted token amounts, etc. +--- + +## getBuyWithFiatStatus + + Once you get a `quote` from [getBuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatQuote)and open the `quote.onRampLink` in a new tab, you can start polling for the transaction status using `getBuyWithFiatStatus` + + You should keep calling this function at regular intervals while the status is in one of the pending states such as - "PENDING\_PAYMENT", "PENDING\_ON\_RAMP\_TRANSFER", "ON\_RAMP\_TRANSFER\_IN\_PROGRESS", "CRYPTO\_SWAP\_IN\_PROGRESS" etc.. + + If `quote.onRampToken` is same as `quote.toToken` (same chain + same token address) - This means that the token can be directly bought from the on-ramp provider. But if they are different - On-ramp provider will send the `quote.onRampToken` to the user's wallet address and a swap is required to convert it to the desired token. You can use the [isSwapRequiredPostOnramp](https://portal.thirdweb.com/references/typescript/v5/isSwapRequiredPostOnramp) utility function to check if a swap is required after the on-ramp is done. + +##### When no swap is required + + If there is no swap required - the status will become `"ON_RAMP_TRANSFER_COMPLETED"` once the on-ramp provider has sent the tokens to the user's wallet address. Once you receive this status, the process is complete. + +#### When a swap is required + + If a swap is required - the status will become `"CRYPTO_SWAP_REQUIRED"` once the on-ramp provider has sent the tokens to the user's wallet address. Once you receive this status, you need to start the swap process. + + On receiving the `"CRYPTO_SWAP_REQUIRED"` status, you can use the [getPostOnRampQuote](https://portal.thirdweb.com/references/typescript/v5/getPostOnRampQuote) function to get the quote for the swap of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) . + + Once you have this quote - You can follow the same steps as mentioned in the [getBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoQuote) documentation to perform the swap. + +### Example + +```ts +// step 1 - get a quote +const fiatQuote = await getBuyWithFiatQuote(fiatQuoteParams); + +// step 2 - open the on-ramp provider UI +window.open(quote.onRampLink, "_blank"); + +// step 3 - keep calling getBuyWithFiatStatus while the status is in one of the pending states +const fiatStatus = await getBuyWithFiatStatus({ + client, + intentId: fiatQuote.intentId, +}); + +// when the fiatStatus.status is "ON_RAMP_TRANSFER_COMPLETED" - the process is complete +// when the fiatStatus.status is "CRYPTO_SWAP_REQUIRED" - start the swap process +``` + +```ts +function getBuyWithFiatStatus( + params: GetBuyWithFiatStatusParams, +): Promise; +``` + +### Parameters + + Object of type [GetBuyWithFiatStatusParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatStatusParams) + +#### Type + +```ts +let params: { client: ThirdwebClient; intentId: string }; +``` + +### Returns + +```ts +let returnType: + | { status: "NOT_FOUND" } + | { + destination?: PayOnChainTransactionDetails; + failureMessage?: string; + fromAddress: string; + intentId: string; + purchaseData?: object; + quote: { + createdAt: string; + estimatedDurationSeconds?: number; + estimatedOnRampAmount: string; + estimatedOnRampAmountWei: string; + estimatedToTokenAmount: string; + estimatedToTokenAmountWei: string; + fromCurrency: { + amount: string; + amountUnits: string; + currencySymbol: string; + decimals: number; + }; + fromCurrencyWithFees: { + amount: string; + amountUnits: string; + currencySymbol: string; + decimals: number; + }; + onRampToken: PayTokenInfo; + toToken: PayTokenInfo; + }; + source?: PayOnChainTransactionDetails; + status: + | "NONE" + | "PENDING_PAYMENT" + | "PAYMENT_FAILED" + | "PENDING_ON_RAMP_TRANSFER" + | "ON_RAMP_TRANSFER_IN_PROGRESS" + | "ON_RAMP_TRANSFER_COMPLETED" + | "ON_RAMP_TRANSFER_FAILED" + | "CRYPTO_SWAP_REQUIRED" + | "CRYPTO_SWAP_COMPLETED" + | "CRYPTO_SWAP_FALLBACK" + | "CRYPTO_SWAP_IN_PROGRESS" + | "CRYPTO_SWAP_FAILED"; + toAddress: string; + }; +``` +--- + +## getPostOnRampQuote + + When buying a token with fiat currency - It only involes doing on-ramp if the on-ramp provider supports buying the given destination token directly. + + If the on-ramp provider does not support buying the destination token directly, user can be sent an intermediate token with fiat currency from the on-ramp provider which can be swapped to destination token onchain. + +`getPostOnRampQuote` function is used to get the quote for swapping the on-ramp token to destination token. + + When you get a "Buy with Fiat" status of type "CRYPTO\_SWAP\_REQUIRED" from the [getBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatStatus) function, you can use `getPostOnRampQuote` function to get the quote of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) for swapping the on-ramp token to destination token + + Once you have the quote, you can start the Swap process by following the same steps as mentioned in the [getBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoQuote) documentation. + +### Example + +```ts +import { + getPostOnRampQuote, + getBuyWithFiatStatus, +} from "thirdweb/pay"; + +// previous steps +const fiatQuote = await getBuyWithFiatQuote(fiatQuoteParams); +window.open(fiatQuote.onRampLink, "_blank"); +const buyWithFiatStatus = await getBuyWithFiatStatus({ + client, + intentId, +}); // keep calling this until status is "settled" state + +// when a swap is required after onramp +if (buyWithFiatStatus.status === "CRYPTO_SWAP_REQUIRED") { + const buyWithCryptoQuote = await getPostOnRampQuote({ + client, + buyWithFiatStatus, + }); +} +``` + +```ts +function getPostOnRampQuote( + params: GetPostOnRampQuoteParams, +): Promise; +``` + +### Parameters + + object of type [GetPostOnRampQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetPostOnRampQuoteParams) + +#### Type + +```ts +let params: { + buyWithFiatStatus: BuyWithFiatStatus; + client: ThirdwebClient; +}; +``` + +### Returns + +```ts +let returnType: { + approval?: PrepareTransactionOptions; + client: ThirdwebClient; + paymentTokens: Array; + processingFees: Array; + swapDetails: { + estimated: { + durationSeconds?: number; + feesUSDCents: number; + fromAmountUSDCents: number; + gasCostUSDCents?: number; + slippageBPS: number; + toAmountMinUSDCents: number; + toAmountUSDCents: number; + }; + fromAddress: string; + fromAmount: string; + fromAmountWei: string; + fromToken: QuoteTokenInfo; + maxSlippageBPS: number; + toAddress: string; + toAmount: string; + toAmountMin: string; + toAmountMinWei: string; + toAmountWei: string; + toToken: QuoteTokenInfo; + }; + transactionRequest: PrepareTransactionOptions; +}; +``` + + Object of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) which contains the information about the quote such as processing fees, estimated time, converted token amounts, etc. +--- + +## isSwapRequiredPostOnramp + + Check if a Swap is required after on-ramp when buying a token with fiat currency. + + If `quote.toToken` and `quote.onRampToken` are the same (same token and chain), it means on-ramp provider can directly send the desired token to the user's wallet and no swap is required. + + If `quote.toToken` and `quote.onRampToken` are different (different token or chain), A swap is required to swap the on-ramp token to the desired token. + +```ts +function isSwapRequiredPostOnramp( + buyWithFiatQuote: Pick, +): boolean; +``` + +### Parameters + + The quote of type [BuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatQuote) returned by the [getBuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatQuote) function. + +#### Type + +```ts +let buyWithFiatQuote: Pick< + BuyWithFiatQuote, + "toToken" | "onRampToken" +>; +``` + +### Returns + +```ts +let returnType: boolean; +``` +--- +# Tokens +--- + +## TokenIcon + + This component tries to resolve the icon of a given token, then return an image. + +### Example + +#### Basic usage + +```tsx +import { TokenProvider, TokenIcon } from "thirdweb/react"; + + + +; +``` + + Result: An `` component with the src of the icon + +```html + +``` + +#### Override the icon with the `iconResolver` prop + + If you already have the icon url, you can skip the network requests and pass it directly to the TokenIcon + +```tsx +; +``` + + You can also pass in your own custom (async) function that retrieves the icon url + +```tsx +const getIcon = async () => { + const icon = getIconFromCoinMarketCap(tokenAddress, etc); + return icon; +}; + +; +``` + +#### Show a loading sign while the icon is being loaded + +```tsx +} />; +``` + +#### Fallback to a dummy image if the token icon fails to resolve + +```tsx +} />; +``` + +#### Usage with queryOptions + + TokenIcon uses useQuery() from tanstack query internally. It allows you to pass a custom queryOptions of your choice for more control of the internal fetching logic + +```tsx +; +``` + +```ts +function TokenIcon(__namedParameters: TokenIconProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,alt : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,children : ReactNode,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,crossOrigin : CrossOrigin,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,decoding : "auto" | "async" | "sync",defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,fetchPriority : "auto" | "high" | "low",height : string | number,hidden : boolean,iconResolver : string | (() => string) | (() => Promise),id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loading : "eager" | "lazy",loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,referrerPolicy : HTMLAttributeReferrerPolicy,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,sizes : string,slot : string,spellCheck : Booleanish,srcSet : string,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",useMap : string,vocab : string,width : string | number} +``` + +### Returns + +```ts +let returnType: null | Element; +``` + + an `` with the src of the token icon +--- + +## TokenName + + This component fetches then shows the name of a token. For ERC20 tokens, it calls the `name` function in the ERC20 contract. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` + +### Example + +#### Basic usage + +```tsx +import { TokenProvider, TokenName } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + +; +``` + + Result: + +```html +Ether +``` + +#### Custom name resolver + + By default TokenName will call the `name` method of the token contract. However if you have a different way to fetch the name, you can pass the function to the `nameResolver` prop. Note: nameResolver should either be a string or a function (async) that returns a string. + +```tsx +async function fetchNameMethod() { + // your own fetching logic + return "the token name"; +} + +; +``` + + Alternatively you can also pass in a string directly: + +```tsx +; +``` + +#### Format the name (capitalize, truncate, etc.) + + The TokenName component accepts a `formatFn` which takes in a string and outputs a string The function is used to modify the name of the token + +```tsx +const concatStr = (str: string):string => str + "Token" + + +``` + + Result: + +```html +Ether Token +``` + +#### Show a loading sign when the name is being fetched + +```tsx +import { TokenProvider, TokenName } from "thirdweb/react"; + + + } /> +; +``` + +#### Fallback to something when the name fails to resolve + +```tsx + + +; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx +; +``` + +```ts +function TokenName(__namedParameters: TokenNameProps): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,formatFn : (str: string) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nameResolver : string | (() => string) | (() => Promise),nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` +--- + +## TokenSymbol + + This component fetches then shows the symbol of a token. For ERC20 tokens, it calls the `symbol` function in the ERC20 contract. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` + +### Example + +#### Basic usage + +```tsx +import { TokenProvider, TokenSymbol } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + + + +; +``` + + Result: + +```html +ETH +``` + +#### Custom symbol resolver + + By default, TokenSymbol calls the `symbol` function of your contract, however, if your token as an unconventional way to fetch the symbol, you can pass the custom logic to the `symbolResolver` prop. It can either be a string or a function (async) that returns or resolves to a string. + +```tsx +async function getSymbol() { + // your own fetching logic + return "the symbol"; +} + +; +``` + + Alternatively, you can pass in a string directly: + +```tsx +; +``` + +#### Format the symbol (capitalize, truncate, etc.) + + The TokenSymbol component accepts a `formatFn` which takes in a string and outputs a string The function is used to modify the symbol of the token + +```tsx +const concatStr = (str: string):string => str + "Token" + + +``` + + Result: + +```html +Ether Token +``` + +#### Show a loading sign when the symbol is being fetched + +```tsx +import { TokenProvider, TokenSymbol } from "thirdweb/react"; + + + } /> +; +``` + +#### Fallback to something when the symbol fails to resolve + +```tsx + + +; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx +; +``` + +```ts +function TokenSymbol( + __namedParameters: TokenSymbolProps, +): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,formatFn : (str: string) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,symbolResolver : string | (() => string) | (() => Promise),tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` +--- +# Storage +--- + +## download + +### Example + + Download a file from IPFS: + +```ts +import { download } from "thirdweb/storage"; +import { createThirdwebClient } from "@thirdweb-dev/sdk"; + +const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); + +const file = await download({ + client, + uri: "ipfs://Qm...", +}); +``` + + Download a file from Arweave: + +```ts +import { download } from "thirdweb/storage"; +import { createThirdwebClient } from "@thirdweb-dev/sdk"; + +const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); + +const file = await download({ + client, + uri: "ar://{arweave-transaction-id}", +}); +``` + + Download a file from HTTP: + +```ts +import { download } from "thirdweb/storage"; +import { createThirdwebClient } from "@thirdweb-dev/sdk"; + +const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); + +const file = await download({ + client, + uri: "https://example.com/file.txt", +}); +``` + +```ts +function download(options: { + client: ThirdwebClient; + requestTimeoutMs?: number; + uri: string; +}): Promise; +``` + +### Parameters + + The download options. + +#### Type + +```ts +let options: { + client: ThirdwebClient; + requestTimeoutMs?: number; + uri: string; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + Asynchronously returns the network response from fetching the file. +--- + +## resolveArweaveScheme + + Resolves the scheme of a given Arweave URI and returns the corresponding URL. + +### Example + +```ts +import { resolveArweaveScheme } from "thirdweb/storage"; +const url = resolveArweaveScheme({ uri: "ar://" }); +``` + +```ts +function resolveArweaveScheme( + options: ResolveArweaveSchemeOptions, +): string; +``` + +### Parameters + + The options object containing the Arweave URI + +#### Type + +```ts +let options: { gatewayUrl?: string; uri: string }; +``` + +### Returns + +```ts +let returnType: string; +``` + + The resolved URL +--- + +## resolveScheme + + Resolves the scheme of a given URI and returns the corresponding URL. If the URI starts with "ipfs://", it constructs a URL using the IPFS client ID and the IPFS gateway. If the URI starts with "http", it returns the URI as is. Otherwise, it throws an error indicating an invalid URI scheme. + +### Example + +```ts +import { resolveScheme } from "thirdweb/storage"; +const url = resolveScheme({ + client, + uri: "ipfs://Qm...", +}); +``` + +```ts +function resolveScheme(options: ResolveSchemeOptions): string; +``` + +### Parameters + + The options object containing the URI and the IPFS client. + +#### Type + +```ts +let options: { client: ThirdwebClient; uri: string }; +``` + +### Returns + +```ts +let returnType: string; +``` + + The resolved URL. +--- + +## unpin + + Unpins a file from IPFS. For security purposes, this method requires a secret key to be set in the ThirdwebClient instance. + +### Example + +```ts +import { unpin } from "thirdweb"; + +const result = await unpin({ + client: thirdwebClient, + cid: "QmTzQ1N1z1Q1N1z1Q1N1z1Q1N1z1Q1N1z1Q1N1z1Q1N1z1", +}); +``` + +```ts +function unpin(options: UnpinOptions): Promise; +``` + +### Parameters + + The options for unpinning the file. + +#### Type + +```ts +let options: { cid: string; client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Promise; +``` +--- + +## upload + + Uploads files based on the provided options. + +### Example + +#### Uploading JSON objects + +```ts +import { upload } from "thirdweb/storage"; +const uri = await upload({ + client, + files: [ + { + name: "something", + data: { + hello: "world", + }, + }, + ], +}); +``` + +#### Uploading files + +```ts +import { upload } from "thirdweb/storage"; +const uri = await upload({ + client, + files: [new File(["hello world"], "hello.txt")], +}); +``` + +```ts +function upload( + options: UploadOptions, +): Promise>; +``` + +### Parameters + + The upload options. + +#### Type + +```ts +let options: UploadOptions; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to the uploaded file URI or URIs (when passing multiple files). +--- + +## uploadMobile + + Batch upload arbitrary file or JSON data using the configured decentralized storage system. Automatically uploads any file data within JSON objects and replaces them with hashes. + +### Example + +```jsx +// Upload an image +launchImageLibrary({ mediaType: "photo" }, async (response) => { + if (response.assets?.[0]) { + const { fileName, type, uri } = response.assets[0]; + if (!uri) { + throw new Error("No uri"); + } + const resp = await uploadMobile({ + uri, + type, + name: fileName, + }); + } +}); + +// Upload an array of JSON objects +const objects = [ + { name: "JSON 1", text: "Hello World" }, + { name: "JSON 2", trait: "Awesome" }, +]; +const jsonUris = await uploadMobile(objects); +``` + +```ts +function uploadMobile( + options: UploadMobileOptions, +): Promise>; +``` + +### Parameters + + Options to pass through to the storage uploader class + +#### Type + +```ts +let options: InternalUploadMobileOptions & { client: ThirdwebClient }; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + The URIs of the uploaded data +--- +# RPC +--- + +## eth\_blockNumber + + Retrieves the current block number from the Ethereum blockchain. + +### Example + +```ts +import { getRpcClient, eth_blockNumber } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const blockNumber = await eth_blockNumber(rpcRequest); +``` + +```ts +function eth_blockNumber( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the current block number as a bigint. +--- + +## eth\_call + + Executes a call or a transaction on the Ethereum network. + +### Example + +```ts +import { getRpcClient, eth_call } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const result = await eth_call(rpcRequest, { + to: "0x...", + ... +}); +``` + +```ts +function eth_call( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: Partial & { + blockNumber?: number | bigint; + blockTag?: BlockTag | undefined; + stateOverrides?: StateOverride; + }, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for the call or transaction. + +#### Type + +```ts +let params: Partial & { + blockNumber?: number | bigint; + blockTag?: BlockTag | undefined; + stateOverrides?: StateOverride; +}; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the result of the call or transaction. +--- + +## eth\_estimateGas + + Estimates the gas required to execute a transaction on the Ethereum network. + +### Example + +```ts +import { getRpcClient, eth_estimateGas } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const gas = await eth_estimateGas(rpcRequest, { + to: "0x...", + ... +}); +``` + +```ts +function eth_estimateGas( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + transactionRequest: RpcTransactionRequest, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The transaction request object. + +#### Type + +```ts +let transactionRequest: RpcTransactionRequest; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the estimated gas as a bigint. +--- + +## eth\_gasPrice + + Retrieves the current gas price from the Ethereum network. + +### Example + +```ts +import { getRpcClient, eth_gasPrice } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const gasPrice = await eth_gasPrice(rpcRequest); +``` + +```ts +function eth_gasPrice( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the gas price as a bigint. +--- + +## eth\_getBalance + + Retrieves the balance of the specified Ethereum address. + +### Example + +```ts +import { getRpcClient, eth_getBalance } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const balance = await eth_getBalance(rpcRequest, { + address: "0x...", +}); +``` + +```ts +function eth_getBalance( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetBalanceParams, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for retrieving the balance. + +#### Type + +```ts +let params: { address: string }; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the balance of the address in wei as bigint. +--- + +## eth\_getBlockByHash + + Retrieves a block by its hash. + +### Example + +```ts +import { getRpcClient, eth_getBlockByHash } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const block = await eth_getBlockByHash(rpcRequest, { + blockHash: "0x...", + includeTransactions: true, +}); +``` + +```ts +function eth_getBlockByHash( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetBlockByHashParams, +): Promise>; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for the block retrieval. + +#### Type + +```ts +let params: GetBlockByHashParams; +``` + +### Returns + +```ts +let returnType: Promise< + GetBlockReturnType +>; +``` + + A promise that resolves to the retrieved block. +--- + +## eth\_getBlockByNumber + + Retrieves a block by its number or tag from the Ethereum blockchain. + +### Example + +```ts +import { getRpcClient, eth_getBlockByNumber } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const block = await eth_getBlockByNumber(rpcRequest, { + blockNumber: 123456, + includeTransactions: true, +}); +``` + +```ts +function eth_getBlockByNumber( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetBlockParameters, +): Promise< + GetBlockReturnType +>; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for retrieving the block. + +#### Type + +```ts +let params: GetBlockParameters; +``` + +### Returns + +```ts +let returnType: Promise< + GetBlockReturnType +>; +``` + + A promise that resolves to the requested block. +--- + +## eth\_getCode + + Retrieves the bytecode of a smart contract at the specified address. + +### Example + +```ts +import { getRpcClient, eth_getCode } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const bytecode = await eth_getCode(rpcRequest, { + address: "0x...", +}); +``` + +```ts +function eth_getCode( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetCodeParams, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for the eth\_getCode method. + +#### Type + +```ts +let params: GetCodeParams; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the bytecode of the smart contract. +--- + +## eth\_getLogs + + Retrieves logs from the Ethereum blockchain based on the specified parameters. + +### Example + +```ts +import { getRpcClient, eth_getLogs } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const logs = await eth_getLogs(rpcRequest, { + address: "0x...", + fromBlock: 123456n, + toBlock: 123456n, +}); +``` + +```ts +function eth_getLogs( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetLogsParams, +): Promise>; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for retrieving logs. + +#### Type + +```ts +let params: GetLogsParams; +``` + +### Returns + +```ts +let returnType: Promise>; +``` + + A promise that resolves to the retrieved logs. +--- + +## eth\_getStorageAt + + Retrieves the value stored at a specific position in the storage of a contract. + +### Example + +```ts +import { getRpcClient, eth_getStorageAt } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const storageValue = await eth_getStorageAt(rpcRequest, { + address: "0x...", + position: 0n, +}); +``` + +```ts +function eth_getStorageAt( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetStorageAtParams, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for the eth\_getStorageAt method. + +#### Type + +```ts +let params: GetStorageAtParams; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + A promise that resolves to the value stored at the specified position. +--- + +## eth\_getTransactionByHash + + Retrieves a transaction by its hash. + +### Example + +```ts +import { getRpcClient, eth_getTransactionByHash } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const transaction = await eth_getTransactionByHash(rpcRequest, { + hash: "0x...", +}); +``` + +```ts +function eth_getTransactionByHash( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetTransactionByHashParameters, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for retrieving the transaction. + +#### Type + +```ts +let params: GetTransactionByHashParameters; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the transaction. +--- + +## eth\_getTransactionCount + + Retrieves the transaction count (nonce) for a given Ethereum address. + +### Example + +```ts +import { getRpcClient, eth_getTransactionCount } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const transactionCount = await eth_getTransactionCount(rpcRequest, { + address: "0x...", +}); +``` + +```ts +function eth_getTransactionCount( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetTransactionCountParameters, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for retrieving the transaction count. + +#### Type + +```ts +let params: GetTransactionCountParameters; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the transaction count as a number. +--- + +## eth\_getTransactionReceipt + + Retrieves the transaction receipt for a given transaction hash. Throws an error if the receipt is not found. + +### Example + +```ts +import { + getRpcClient, + eth_getTransactionReceipt, +} from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const transactionReceipt = await eth_getTransactionReceipt( + rpcRequest, + { + hash: "0x...", + }, +); +``` + +```ts +function eth_getTransactionReceipt( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + params: GetTransactionReceiptParameters, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The parameters for retrieving the transaction receipt. + +#### Type + +```ts +let params: GetTransactionReceiptParameters; +``` + +### Returns + +```ts +let returnType: { + blobGasPrice?: quantity; + blobGasUsed?: quantity; + blockHash: Hash; + blockNumber: quantity; + contractAddress: Address | null | undefined; + cumulativeGasUsed: quantity; + effectiveGasPrice: quantity; + from: Address; + gasUsed: quantity; + logs: Array>; + logsBloom: Hex; + root?: Hash; + status: status; + to: Address | null; + transactionHash: Hash; + transactionIndex: index; + type: type; +}; +``` + + A promise that resolves to the transaction receipt. +--- + +## eth\_maxPriorityFeePerGas + + Retrieves the maximum priority fee per gas from the Ethereum network. + +### Example + +```ts +import { getRpcClient, eth_maxPriorityFeePerGas } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const maxPriorityFeePerGas = + await eth_maxPriorityFeePerGas(rpcRequest); +``` + +```ts +function eth_maxPriorityFeePerGas( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, +): Promise; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to a bigint representing the maximum priority fee per gas. +--- + +## eth\_sendRawTransaction + + Sends a raw transaction to the Ethereum network. + +### Example + +```ts +import { getRpcClient, eth_sendRawTransaction } from "thirdweb/rpc"; +const rpcRequest = getRpcClient({ client, chain }); +const transactionHash = await eth_sendRawTransaction( + rpcRequest, + "0x...", +); +``` + +```ts +function eth_sendRawTransaction( + request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] + >, + signedTransaction: `0x${string}`, +): Promise<`0x${string}`>; +``` + +### Parameters + + The EIP1193 request function. + +#### Type + +```ts +let request: EIP1193RequestFn< + [ + { + Method: "web3_clientVersion"; + Parameters?: undefined; + ReturnType: string; + }, + { + Method: "web3_sha3"; + Parameters: [data: `0x${string}`]; + ReturnType: string; + }, + { + Method: "net_listening"; + Parameters?: undefined; + ReturnType: boolean; + }, + { + Method: "net_peerCount"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + { + Method: "net_version"; + Parameters?: undefined; + ReturnType: `0x${string}`; + }, + ] +>; +``` + + The signed transaction in hex format. + +#### Type + +```ts +let signedTransaction: `0x${string}`; +``` + +### Returns + +```ts +let returnType: Promise<`0x${string}`>; +``` + + A promise that resolves to the transaction hash. +--- + +## getRpcClient + + Returns an RPC request that can be used to make JSON-RPC requests. + +### Example + +```ts +import { createThirdwebClient } from "thirdweb"; +import { getRpcClient } from "thirdweb/rpc"; +import { ethereum } from "thirdweb/chains"; +const client = createThirdwebClient({ clientId: "..." }); +const rpcRequest = getRpcClient({ client, chain: ethereum }); +const blockNumber = await rpcRequest({ + method: "eth_blockNumber", +}); +``` + +```ts +function getRpcClient( + options: Readonly<{ + chain: Readonly; + client: ThirdwebClient; + config?: { + batchTimeoutMs?: number; + maxBatchSize?: number; + requestTimeoutMs?: number; + }; + }>, +): EIP1193RequestFn; +``` + +### Parameters + + The RPC options. + +#### Type + +```ts +let options: Readonly<{ + chain: Readonly; + client: ThirdwebClient; + config?: { + batchTimeoutMs?: number; + maxBatchSize?: number; + requestTimeoutMs?: number; + }; +}>; +``` + +### Returns + +```ts +let returnType: EIP1193RequestFn; +``` + + The RPC request function. +--- + +## watchBlockNumber + + Watches the block number for a specific chain. + +### Example + +```ts +import { watchBlockNumber } from "thirdweb"; +const unwatch = watchBlockNumber({ + client, + chainId, + onNewBlockNumber: (blockNumber) => { + // do something with the block number + }, + onError: (err) => { + // do something if getting the block number fails + }, +}); + +// later stop watching +unwatch(); +``` + +```ts +function watchBlockNumber(opts: WatchBlockNumberOptions): () => void; +``` + +### Parameters + + The options for watching the block number. + +#### Type + +```ts +let opts: { + chain: Chain; + client: ThirdwebClient; + latestBlockNumber?: bigint; + onError?: (error: Error) => void; + onNewBlockNumber: (blockNumber: bigint) => void; + overPollRatio?: number; +}; +``` + +### Returns + +```ts +let returnType: () => void; +``` + + The unwatch function. +--- +# Theme +--- + +## darkTheme + + Create a custom dark theme object by using the default dark theme as a base and applying overrides. + +### Example + +#### Get the default dark theme + +```ts +const defaultDarkTheme = darkTheme(); +``` + +#### Create a custom dark theme + +```ts +const customTheme = darkTheme({ + colors: { + modalBg: "red", + }, +}); +``` + +```ts +function darkTheme(overrides?: ThemeOverrides): Theme; +``` + +### Parameters + + The overrides to apply to the default dark theme. + +#### Type + +```ts +let overrides: { + [key in Exclude]: Partial; +}; +``` + +### Returns + +```ts +let returnType: { + colors: { + accentButtonBg: string; + accentButtonText: string; + accentText: string; + borderColor: string; + connectedButtonBg: string; + connectedButtonBgHover: string; + danger: string; + inputAutofillBg: string; + modalBg: string; + modalOverlayBg: string; + primaryButtonBg: string; + primaryButtonText: string; + primaryText: string; + scrollbarBg: string; + secondaryButtonBg: string; + secondaryButtonHoverBg: string; + secondaryButtonText: string; + secondaryIconColor: string; + secondaryIconHoverBg: string; + secondaryIconHoverColor: string; + secondaryText: string; + selectedTextBg: string; + selectedTextColor: string; + separatorLine: string; + skeletonBg: string; + success: string; + tertiaryBg: string; + tooltipBg: string; + tooltipText: string; + }; + fontFamily: string; + type: "light" | "dark"; +}; +``` + + Theme object +--- + +## lightTheme + + Create a custom light theme object by using the default dark theme as a base and applying overrides. + +### Example + +#### Get the default light theme + +```ts +const defaultLightTheme = lightTheme(); +``` + +#### Create a custom light theme + +```ts +const customTheme = lightTheme({ + colors: { + modalBg: "red", + }, +}); +``` + +```ts +function lightTheme(overrides?: ThemeOverrides): Theme; +``` + +### Parameters + + The overrides to apply to the default light theme. + +#### Type + +```ts +let overrides: { + [key in Exclude]: Partial; +}; +``` + +### Returns + +```ts +let returnType: { + colors: { + accentButtonBg: string; + accentButtonText: string; + accentText: string; + borderColor: string; + connectedButtonBg: string; + connectedButtonBgHover: string; + danger: string; + inputAutofillBg: string; + modalBg: string; + modalOverlayBg: string; + primaryButtonBg: string; + primaryButtonText: string; + primaryText: string; + scrollbarBg: string; + secondaryButtonBg: string; + secondaryButtonHoverBg: string; + secondaryButtonText: string; + secondaryIconColor: string; + secondaryIconHoverBg: string; + secondaryIconHoverColor: string; + secondaryText: string; + selectedTextBg: string; + selectedTextColor: string; + separatorLine: string; + skeletonBg: string; + success: string; + tertiaryBg: string; + tooltipBg: string; + tooltipText: string; + }; + fontFamily: string; + type: "light" | "dark"; +}; +``` + + Theme object +--- +# Utils +--- + +## getContractPublisher + + Returns the default publisher contract on polygon + +```ts +function getContractPublisher( + client: ThirdwebClient, +): Readonly>; +``` + +### Parameters + +#### Type + +```ts +let client: { + readonly clientId: string; + readonly secretKey: string | undefined; +} & Readonly; +``` + +### Returns + +```ts +let returnType: Readonly>; +``` +--- + +## getDefaultToken + + Get the default token for a given chain and symbol + +### Example + +```ts +import { getDefaultToken } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; + +const token = getDefaultToken(ethereum, "USDC"); +``` + +```ts +function getDefaultToken( + chain: Readonly, + symbol: + | "WETH" + | "USDT" + | "USDC" + | "WBTC" + | "WMATIC" + | "WBNB" + | "BUSD" + | "WFTM" + | "WAVAX", +): undefined | TokenInfo; +``` + +### Parameters + + The chain to get the token for + +#### Type + +```ts +let chain: Readonly; +``` + + The symbol of the token to get + +#### Type + +```ts +let symbol: + | "WETH" + | "USDT" + | "USDC" + | "WBTC" + | "WMATIC" + | "WBNB" + | "BUSD" + | "WFTM" + | "WAVAX"; +``` + +### Returns + +```ts +let returnType: undefined | TokenInfo; +``` + + The default token for the given chain and symbol +--- + +## getLastAuthProvider + + Retrieves the last authentication provider used from local storage. + + This function is designed to work only in a browser environment. + +### Example + +```typescript +import { getLastAuthProvider } from "thirdweb/react"; + +const lastAuthProvider = await getLastAuthProvider(); +``` + +```ts +function getLastAuthProvider(): Promise< + | null + | OAuthOption + | "backend" + | "email" + | "phone" + | "passkey" + | "wallet" + | "jwt" + | "auth_endpoint" + | "iframe_email_verification" + | "iframe" +>; +``` + +### Returns + +```ts +let returnType: Promise< + | null + | OAuthOption + | "backend" + | "email" + | "phone" + | "passkey" + | "wallet" + | "jwt" + | "auth_endpoint" + | "iframe_email_verification" + | "iframe" +>; +``` + + A promise that resolves to the last authentication provider strategy used, or `null` if none is found. +--- + +## boolToBytes + + Converts a boolean value to a Uint8Array of bytes. + +### Example + +```ts +import { boolToBytes } from "thirdweb/utils"; +const bytes = boolToBytes(true); +console.log(bytes); // Uint8Array(1) [ 1 ] +``` + +```ts +function boolToBytes( + value: boolean, + opts: Options, +): Uint8Array; +``` + +### Parameters + + The boolean value to convert. + +#### Type + +```ts +let value: boolean; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: Uint8Array; +``` + + The Uint8Array of bytes representing the boolean value. +--- + +## boolToHex + + Converts a boolean value to a hexadecimal string representation. + +### Example + +```ts +import { boolToHex } from "thirdweb/utils"; +const hex = boolToHex(true); +console.log(hex); // "0x01" +``` + +```ts +function boolToHex(value: boolean, opts: Options): Hex; +``` + +### Parameters + + The boolean value to convert. + +#### Type + +```ts +let value: boolean; +``` + + Optional options for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The hexadecimal string representation of the boolean value. +--- + +## bytesToBigInt + + Converts a Uint8Array of bytes to a bigint. + +### Example + +```ts +import { bytesToBigInt } from "thirdweb/utils"; +const bytes = new Uint8Array([1, 164]); +const bigInt = bytesToBigInt(bytes); +console.log(bigInt); // 420n +``` + +```ts +function bytesToBigInt( + bytes: Uint8Array, + opts: BytesToBigIntOpts, +): bigint; +``` + +### Parameters + + The Uint8Array of bytes to convert. + +#### Type + +```ts +let bytes: Uint8Array; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: { signed?: boolean; size?: number }; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The converted bigint. +--- + +## bytesToBool + + Converts a byte array to a boolean value. + +### Example + +```ts +import { bytesToBool } from "thirdweb/utils"; +const bytes = new Uint8Array([1]); +const bool = bytesToBool(bytes); +console.log(bool); // true +``` + +```ts +function bytesToBool( + bytes_: Uint8Array, + opts: Options, +): boolean; +``` + +### Parameters + + The byte array to convert. + +#### Type + +```ts +let bytes_: Uint8Array; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + The boolean value converted from the byte array. +--- + +## bytesToNumber + + Converts a Uint8Array of bytes to a number. + +### Example + +```ts +import { bytesToNumber } from "thirdweb/utils"; +const bytes = new Uint8Array([1, 164]); +const number = bytesToNumber(bytes); +console.log(number); // 420 +``` + +```ts +function bytesToNumber( + bytes: Uint8Array, + opts: BytesToBigIntOpts, +): number; +``` + +### Parameters + + The Uint8Array of bytes to convert. + +#### Type + +```ts +let bytes: Uint8Array; +``` + + Optional configuration options. + +#### Type + +```ts +let opts: { signed?: boolean; size?: number }; +``` + +### Returns + +```ts +let returnType: number; +``` + + The converted number. +--- + +## bytesToString + + Converts an array of bytes to a string using UTF-8 encoding. + +### Example + +```ts +import { bytesToString } from "thirdweb/utils"; +const bytes = new Uint8Array([72, 101, 108, 108, 111]); +const string = bytesToString(bytes); +console.log(string); // "Hello" +``` + +```ts +function bytesToString( + bytes_: Uint8Array, + opts: Options, +): string; +``` + +### Parameters + + The array of bytes to convert. + +#### Type + +```ts +let bytes_: Uint8Array; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: string; +``` + + The resulting string. +--- + +## concatHex + + Concatenates an array of hexadecimal values into a single hexadecimal value. + +```ts +function concatHex(values: readonly Array<`0x${string}`>) : Hex +``` + +### Parameters + + An array of hexadecimal values to concatenate. + +#### Type + +```ts +let values: readonly Array<`0x${string}`> +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The concatenated hexadecimal value. +--- + +## fromBytes + + Converts a Uint8Array to the specified type. + +### Example + +```ts +import { fromBytes } from "thirdweb/utils"; +const bytes = new Uint8Array([1, 164]); +const number = fromBytes(bytes, "number"); +console.log(number); // 420 +``` + +```ts +function fromBytes( + bytes: Uint8Array, + toOrOpts: FromBytesParameters, +): FromBytesReturnType; +``` + +### Parameters + + The Uint8Array to convert. + +#### Type + +```ts +let bytes: Uint8Array; +``` + + The target type or conversion options. + +#### Type + +```ts +let toOrOpts: FromBytesParameters; +``` + +### Returns + +```ts +let returnType: FromBytesReturnType; +``` + + The converted value of the specified type. +--- + +## fromGwei + + Converts the specified number from gwei to wei. + +### Example + +```ts +import { fromGwei } from "thirdweb/utils"; +fromGwei("1"); +// 1000000000n +``` + +```ts +function fromGwei(gwei: string): bigint; +``` + +### Parameters + + The number of gwei to convert. + +#### Type + +```ts +let gwei: string; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The converted value in wei. +--- + +## fromHex + + Converts a hexadecimal string to the specified type. + +### Example + +```ts +import { fromHex } from "thirdweb/utils"; +const string = fromHex("0x48656c6c6f2c20776f726c6421", "string"); +console.log(string); // "Hello, world!" +``` + +```ts +function fromHex( + hex: `0x${string}`, + toOrOpts: FromHexParameters, +): FromHexReturnType; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex: `0x${string}`; +``` + + The target type or conversion options. + +#### Type + +```ts +let toOrOpts: FromHexParameters; +``` + +### Returns + +```ts +let returnType: FromHexReturnType; +``` + + The converted value of the specified type. +--- + +## getAddress + + Retrieves the address after performing validation and checksumming. + +### Example + +```ts +import { getAddress } from "thirdweb/utils"; + +getAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"); +//=> '0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed' +``` + +```ts +function getAddress(address: string): Address; +``` + +### Parameters + + The address to be validated and checksummed. + +#### Type + +```ts +let address: string; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + The validated and checksummed address. +--- + +## getGasPrice + + Retrieves the gas price for a transaction on a specific chain. + +### Example + +```ts +import { getGasPrice } from "thirdweb"; + +const gasPrice = await getGasPrice({ client, chain }); +``` + +```ts +function getGasPrice(options: GetGasPriceOptions): Promise; +``` + +### Parameters + +#### Type + +```ts +let options: { + chain: Chain; + client: ThirdwebClient; + percentMultiplier?: number; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to the gas price as a bigint. +--- + +## hexToBigInt + + Converts a hexadecimal string to a BigInt. + +### Example + +```ts +import { hexToBigInt } from "thirdweb/utils"; +const bigInt = hexToBigInt("0x1a4"); +console.log(bigInt); // 420n +``` + +```ts +function hexToBigInt(hex: `0x${string}`, opts: Options): bigint; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex: `0x${string}`; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The BigInt representation of the hexadecimal string. +--- + +## hexToBool + + Converts a hexadecimal string to a boolean value. + +### Example + +```ts +import { hexToBool } from "thirdweb/utils"; +const bool = hexToBool("0x01"); +console.log(bool); // true +``` + +```ts +function hexToBool(hex: `0x${string}`, opts: Options): boolean; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex: `0x${string}`; +``` + + Optional options for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: boolean; +``` + + The boolean value corresponding to the hexadecimal string. +--- + +## hexToBytes + + Converts a hexadecimal string to a Uint8Array of bytes. + +### Example + +```ts +import { hexToBytes } from "thirdweb/utils"; +const bytes = hexToBytes("0x1a4"); +console.log(bytes); // Uint8Array(2) [ 1, 164 ] +``` + +```ts +function hexToBytes(hex_: `0x${string}`, opts: Options): Uint8Array; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex_: `0x${string}`; +``` + + Options for converting the hexadecimal string. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: Uint8Array; +``` + + The Uint8Array of bytes. +--- + +## hexToNumber + + Converts a hexadecimal string to a number. + +### Example + +```ts +import { hexToNumber } from "thirdweb/utils"; +const number = hexToNumber("0x1a4"); +console.log(number); // 420 +``` + +```ts +function hexToNumber(hex: `0x${string}`, opts: Options): number; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex: `0x${string}`; +``` + + Optional options for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: number; +``` + + The converted number. +--- + +## hexToString + + Converts a hexadecimal string to a UTF-8 string. + +### Example + +```ts +import { hexToString } from "thirdweb/utils"; +const string = hexToString("0x48656c6c6f2c20776f726c6421"); +console.log(string); // "Hello, world!" +``` + +```ts +function hexToString(hex: `0x${string}`, opts: Options): string; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex: `0x${string}`; +``` + + The options for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: string; +``` + + The UTF-8 string representation of the hexadecimal string. +--- + +## hexToUint8Array + + Converts a hexadecimal string to a Uint8Array. + +### Example + +```ts +import { hexToUint8Array } from "thirdweb/utils"; +const bytes = hexToUint8Array("0x48656c6c6f2c20776f726c6421"); +console.log(bytes); // Uint8Array([72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33]) +``` + +```ts +function hexToUint8Array( + hex: `0x${string}`, + opts: Options, +): Uint8Array; +``` + +### Parameters + + The hexadecimal string to convert. + +#### Type + +```ts +let hex: `0x${string}`; +``` + + Options for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: Uint8Array; +``` + + The Uint8Array representation of the hexadecimal string. +--- + +## isAddress + + Checks if a given string is a valid address. + +### Example + +```ts +import { isAddress } from "thirdweb/utils"; + +isAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"); +//=> true +``` + +```ts +function isAddress(address: string): address is `0x${string}`; +``` + +### Parameters + + The address to check. + +#### Type + +```ts +let address: string; +``` + +### Returns + +```ts +let returnType: address is (`0x${string}`) +``` + + True if the address is valid, false otherwise. +--- + +## isHex + + Checks if a value is a valid hexadecimal string. + +### Example + +```ts +import { isHex } from "thirdweb/utils"; +const result = isHex("0x1a4"); +console.log(result); // true +``` + +```ts +function isHex( + value: unknown, + options: Options, +): value is `0x${string}`; +``` + +### Parameters + + The value to be checked. + +#### Type + +```ts +let value: unknown; +``` + + Optional configuration for the validation. + +#### Type + +```ts +let options: Options; +``` + +### Returns + +```ts +let returnType: value is (`0x${string}`) +``` + + True if the value is a valid hexadecimal string, false otherwise. +--- + +## keccak256 + + Calculates the Keccak-256 hash of the given value. + +### Example + +```ts +import { keccak256 } from "thirdweb/utils"; +const hash = keccak256("0x1234"); +``` + +```ts +function keccak256( + value: `0x${string}` | Uint8Array, + to?: TTo, +): Keccak256Hash; +``` + +### Parameters + + The value to hash, either as a hexadecimal string or a Uint8Array. + +#### Type + +```ts +let value: `0x${string}` | Uint8Array; +``` + + The desired output format of the hash (optional). Defaults to 'hex'. + +#### Type + +```ts +let to: TTo; +``` + +### Returns + +```ts +let returnType: Keccak256Hash; +``` + + The Keccak-256 hash of the value in the specified format. +--- + +## numberToBytes + + Converts a number to bytes. + +### Example + +```ts +import { numberToBytes } from "thirdweb/utils"; +const bytes = numberToBytes(420); +console.log(bytes); // Uint8Array(2) [ 1, 164 ] +``` + +```ts +function numberToBytes( + value: number | bigint, + opts?: Options, +): Uint8Array; +``` + +### Parameters + + The number to convert. + +#### Type + +```ts +let value: number | bigint; +``` + + Options for converting the number to hex. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: Uint8Array; +``` + + The bytes representation of the number. +--- + +## numberToHex + + Converts a number or bigint to a hexadecimal string. + +### Example + +```ts +import { numberToHex } from "thirdweb/utils"; +const hex = numberToHex(420); +console.log(hex); // "0x1a4" +``` + +```ts +function numberToHex(value_: number | bigint, opts: Options): Hex; +``` + +### Parameters + + The number or bigint value to convert. + +#### Type + +```ts +let value_: number | bigint; +``` + + Optional configuration options. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The hexadecimal representation of the input value. +--- + +## padHex + + Pads a hexadecimal string with zeros to a specified size. + +### Example + +```ts +import { padHex } from "thirdweb/utils"; +const paddedHex = padHex("0x1a4", { size: 32 }); +console.log(paddedHex); // "0x000000000000000000000000000001a4" +``` + +```ts +function padHex( + hex_: `0x${string}`, + options: PadOptions, +): `0x${string}`; +``` + +### Parameters + + The hexadecimal string to pad. + +#### Type + +```ts +let hex_: `0x${string}`; +``` + + The padding options. + +#### Type + +```ts +let options: PadOptions; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + The padded hexadecimal string. +--- + +## sha256 + + Calculates the SHA256 hash of the given value. + +### Example + +```ts +import { sha256 } from "thirdweb/utils"; +const hash = sha256("0x1234"); +``` + +```ts +function sha256( + value: `0x${string}` | Uint8Array, + to?: TTo, +): Sha256Hash; +``` + +### Parameters + + The value to hash. It can be either a hexadecimal string or a Uint8Array. + +#### Type + +```ts +let value: `0x${string}` | Uint8Array; +``` + + (Optional) The desired output format of the hash. Defaults to 'hex'. + +#### Type + +```ts +let to: TTo; +``` + +### Returns + +```ts +let returnType: Sha256Hash; +``` + + The SHA256 hash of the value in the specified format. +--- + +## stringToBytes + + Converts a string to an array of bytes. + +### Example + +```ts +import { stringToBytes } from "thirdweb/utils"; +const bytes = stringToBytes("Hello, world!"); +console.log(bytes); // Uint8Array(13) [ 72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 ] +``` + +```ts +function stringToBytes( + value: string, + opts: StringToBytesOpts, +): Uint8Array; +``` + +### Parameters + + The string to convert. + +#### Type + +```ts +let value: string; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: { size?: number }; +``` + +### Returns + +```ts +let returnType: Uint8Array; +``` + + The array of bytes representing the string. +--- + +## stringToHex + + Converts a string to its hexadecimal representation. + +### Example + +```ts +import { stringToHex } from "thirdweb/utils"; +const hex = stringToHex("Hello, world!"); +console.log(hex); // "0x48656c6c6f2c20776f726c6421" +``` + +```ts +function stringToHex(value_: string, opts: Options): Hex; +``` + +### Parameters + + The string to convert to hexadecimal. + +#### Type + +```ts +let value_: string; +``` + + Options for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The hexadecimal representation of the input string. +--- + +## toBytes + + Converts a value to an array of bytes. + +### Example + +```ts +import { toBytes } from "thirdweb/utils"; +const bytes = toBytes("0x1a4"); +console.log(bytes); // Uint8Array(2) [ 1, 164 ] +``` + +```ts +function toBytes( + value: string | number | bigint | boolean, + opts: ToBytesParameters, +): Uint8Array; +``` + +### Parameters + + The value to convert. + +#### Type + +```ts +let value: string | number | bigint | boolean; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: { size?: number }; +``` + +### Returns + +```ts +let returnType: Uint8Array; +``` + + The array of bytes representing the value. +--- + +## toEther + + Converts a value from wei to ether. + +### Example + +```ts +import { toEther } from "thirdweb/utils"; +toEther(1000000000000000000n); +// '1' +``` + +```ts +function toEther(wei: bigint): string; +``` + +### Parameters + + The value in wei to be converted. + +#### Type + +```ts +let wei: bigint; +``` + +### Returns + +```ts +let returnType: string; +``` + + The converted value in ether. +--- + +## toHex + + Converts a value to its hexadecimal representation. + +### Example + +```ts +import { toHex } from "thirdweb/utils"; +const hex = toHex(420); +console.log(hex); // "0x1a4" +``` + +```ts +function toHex( + value: + | string + | number + | bigint + | boolean + | Uint8Array, + opts: ToHexParameters, +): Hex; +``` + +### Parameters + + The value to convert to hexadecimal. + +#### Type + +```ts +let value: + | string + | number + | bigint + | boolean + | Uint8Array; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: { size?: number }; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The hexadecimal representation of the value. +--- + +## toTokens + + Converts a given number of units to a string representation with a specified number of decimal places. + +### Example + +```ts +import { toTokens } from "thirdweb/utils"; +toTokens(1000000000000000000n, 18); +// '1' +``` + +```ts +function toTokens(units: bigint, decimals: number): string; +``` + +### Parameters + + The number of units to convert. + +#### Type + +```ts +let units: bigint; +``` + + The number of decimal places to include in the string representation. + +#### Type + +```ts +let decimals: number; +``` + +### Returns + +```ts +let returnType: string; +``` + + The string representation of the converted units. +--- + +## toUnits + + Converts a string representation of a number with decimal places to a BigInt representation. + +### Example + +```ts +import { toUnits } from "thirdweb/utils"; +toUnits("1", 18); +// 1000000000000000000n +``` + +```ts +function toUnits(tokens: string, decimals: number): bigint; +``` + +### Parameters + + The string representation of the number, including the integer and fraction parts. + +#### Type + +```ts +let tokens: string; +``` + + The number of decimal places to include in the BigInt representation. + +#### Type + +```ts +let decimals: number; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The BigInt representation of the number. +--- + +## toWei + + Converts the specified number of tokens to Wei. + +### Example + +```ts +import { toWei } from "thirdweb/utils"; +toWei("1"); +// 1000000000000000000n +``` + +```ts +function toWei(tokens: string): bigint; +``` + +### Parameters + + The number of tokens to convert. + +#### Type + +```ts +let tokens: string; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The converted value in Wei. +--- + +## uint8ArrayToHex + + Converts an array of bytes to a hexadecimal string. + +### Example + +```ts +import { uint8arrayToHex } from "thirdweb/utils"; +const hex = uint8arrayToHex( + new Uint8Array([ + 72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, + ]), +); +console.log(hex); // "0x48656c6c6f2c20776f726c64" +``` + +```ts +function uint8ArrayToHex( + value: Uint8Array, + opts: Options, +): Hex; +``` + +### Parameters + + The array of bytes to convert. + +#### Type + +```ts +let value: Uint8Array; +``` + + Optional parameters for the conversion. + +#### Type + +```ts +let opts: Options; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The hexadecimal string representation of the bytes. +--- + +## checksumAddress + + Calculates the checksum address for the given address. + +### Example + +```ts +import { checksumAddress } from "thirdweb/utils"; + +checksumAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"); +//=> '0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed' +``` + +```ts +function checksumAddress(address: string): Address; +``` + +### Parameters + + The address to calculate the checksum for. + +#### Type + +```ts +let address: string; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` + + The checksum address. +--- + +## computeDeploymentAddress + + Computes the deployment address for a contract based on the given options. + +### Example + +```ts +import { computeDeploymentAddress } from "thirdweb/utils"; +const deploymentAddress = computeDeploymentAddress({ + bytecode, + encodedArgs, + create2FactoryAddress, + salt, +}); +``` + +```ts +function computeDeploymentAddress( + options: ComputeDeploymentAddressOptions, +): string; +``` + +### Parameters + + The options for computing the deployment address. + +#### Type + +```ts +let options: ComputeDeploymentAddressOptions; +``` + +### Returns + +```ts +let returnType: string; +``` + + The computed deployment address. +--- + +## decodeError + + Decodes an error. + +### Example + +```ts +import { decodeError } from "thirdweb/utils"; + +const data = "0x..."; +const error = await decodeError({ contract, data }); +``` + +```ts +function decodeError(options: { + contract: Readonly>; + data: `0x${string}`; +}): Promise; +``` + +### Parameters + + The options object. + +#### Type + +```ts +let options: { + contract: Readonly>; + data: `0x${string}`; +}; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + The decoded error. +--- + +## decodeFunctionData + + Decodes the data of a function call. + +### Example + +```ts +import { decodeFunctionData } from "thirdweb/utils"; + +const data = "0x..."; +const decodedData = await decodeFunctionData({ contract, data }); +``` + +```ts +function decodeFunctionData(options: { + contract: Readonly>; + data: `0x${string}`; +}): Promise< + ReturnType, undefined, AbiFunction>> +>; +``` + +### Parameters + + The options object. + +#### Type + +```ts +let options: { + contract: Readonly>; + data: `0x${string}`; +}; +``` + +### Returns + +```ts +let returnType: Promise< + ReturnType, undefined, AbiFunction>> +>; +``` + + The decoded data. +--- + +## decodeFunctionResult + + Decodes the result of a function call. + +### Example + +```ts +import { decodeFunctionResult } from "thirdweb/utils"; + +const data = "0x..."; +const result = await decodeFunctionResult({ contract, data }); +``` + +```ts +function decodeFunctionResult(options: { + contract: Readonly>; + data: `0x${string}`; +}): Promise< + ReturnType< + ReturnType, undefined, AbiFunction>, + "Array" + > +>; +``` + +### Parameters + + The options object. + +#### Type + +```ts +let options: { + contract: Readonly>; + data: `0x${string}`; +}; +``` + +### Returns + +```ts +let returnType: Promise< + ReturnType< + ReturnType, undefined, AbiFunction>, + "Array" + > +>; +``` + + The decoded result. +--- + +## encodeAbiParameters + + Encodes the given ABI parameters and values into a hexadecimal string. + +### Example + +```ts +import { encodeAbiParameters } from "viem"; + +const params = [ + { name: "param1", type: "uint256" }, + { name: "param2", type: "string" }, +]; +const values = [123, "hello"]; + +const data = encodeAbiParameters(params, values); +console.log(data); +``` + +```ts +function encodeAbiParameters(params: TParams, values: TParams extends readonly Array ? {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType[key], AbiParameterKind>}[key]} : never) : Hex +``` + +### Parameters + + The ABI parameters. + +#### Type + +```ts +let params: TParams; +``` + + The corresponding values for the ABI parameters. + +#### Type + +```ts +let values: TParams extends readonly Array ? {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType[key], AbiParameterKind>}[key]} : never +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + +* The encoded ABI parameters as a hexadecimal string. +--- + +## ensureBytecodePrefix + + Ensures that the given bytecode has the correct prefix. If the bytecode already starts with "0x", it is returned as is. Otherwise, the prefix "0x" is added to the bytecode. + +### Example + +```ts +import { ensureBytecodePrefix } from "thirdweb/utils/bytecode/prefix"; +const bytecode = + "363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3"; +const prefixedBytecode = ensureBytecodePrefix(bytecode); +console.log(prefixedBytecode); +``` + +```ts +function ensureBytecodePrefix(bytecode: string): Hex; +``` + +### Parameters + + The bytecode to ensure the prefix for. + +#### Type + +```ts +let bytecode: string; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The bytecode with the correct prefix. +--- + +## extractIPFSUri + + Extracts the IPFS URI from the given bytecode. + +### Example + +```ts +import { extractIPFSUri } from "thirdweb/utils/bytecode/extractIPFS"; +const bytecode = + "0x363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3"; +const ipfsHash = extractIPFSUri(bytecode); +console.log(ipfsHash); +``` + +```ts +function extractIPFSUri(bytecode: string): string | undefined; +``` + +### Parameters + + The bytecode to extract the IPFS URI from. + +#### Type + +```ts +let bytecode: string; +``` + +### Returns + +```ts +let returnType: string | undefined; +``` + + The IPFS URI if found, otherwise undefined. +--- + +## extractMinimalProxyImplementationAddress + + Extracts the implementation address from a given bytecode string if it matches any of the known minimal proxy patterns. + +### Example + +```ts +import { extractMinimalProxyImplementationAddress } from "thirdweb/utils"; +const bytecode = "0x363d3d373d3d3d363d73..."; +const implementationAddress = + extractMinimalProxyImplementationAddress(bytecode); +``` + +```ts +function extractMinimalProxyImplementationAddress( + bytecode: string, +): string | undefined; +``` + +### Parameters + + The bytecode string to extract the implementation address from. + +#### Type + +```ts +let bytecode: string; +``` + +### Returns + +```ts +let returnType: string | undefined; +``` + + The implementation address as a string if a match is found, otherwise undefined. +--- + +## formatNumber + + Round up a number to a certain decimal place + +### Example + +```ts +import { formatNumber } from "thirdweb/utils"; +const value = formatNumber(12.1214141, 1); // 12.1 +``` + +```ts +function formatNumber(value: number, decimalPlaces: number): number; +``` + +### Parameters + +#### Type + +```ts +let value: number; +``` + +#### Type + +```ts +let decimalPlaces: number; +``` + +### Returns + +```ts +let returnType: number; +``` +--- + +## getClaimParams + + Get the claim parameters for a given drop + +### Example + +```ts +import { getClaimParams } from "thirdweb/utils"; + +const claimParams = await getClaimParams({ + contract, + to: "0x...", + quantity: 1n, + type: "erc1155", + tokenId: 0n, +}); +``` + +```ts +function getClaimParams( + options: GetClaimParamsOptions, +): Promise<{ + allowlistProof: OverrideProof; + currency: string; + data: `0x${string}`; + overrides: { + erc20Value: + | undefined + | { amountWei: bigint; tokenAddress: string }; + value: bigint; + }; + pricePerToken: bigint; + quantity: bigint; + receiver: string; + tokenId: undefined | bigint; +}>; +``` + +### Parameters + + The options for getting the claim parameters + +#### Type + +```ts +let options: { + contract: ThirdwebContract; + from?: string; + quantity: bigint; + singlePhaseDrop?: boolean; + to: string; +} & ( + | { type: "erc721" } + | { tokenDecimals: number; type: "erc20" } + | { tokenId: bigint; type: "erc1155" } +); +``` + +### Returns + +```ts +let returnType: Promise<{ + allowlistProof: OverrideProof; + currency: string; + data: `0x${string}`; + overrides: { + erc20Value: + | undefined + | { amountWei: bigint; tokenAddress: string }; + value: bigint; + }; + pricePerToken: bigint; + quantity: bigint; + receiver: string; + tokenId: undefined | bigint; +}>; +``` + + The claim parameters +--- + +## getInitBytecodeWithSalt + + Generates the initialization bytecode with salt for a contract deployment. + +### Example + +```ts +import { getInitBytecodeWithSalt } from "thirdweb/utils"; +const initBytecodeWithSalt = getInitBytecodeWithSalt({ + bytecode, + encodedArgs, + salt, +}); +``` + +```ts +function getInitBytecodeWithSalt( + options: GetInitiBytecodeWithSaltOptions, +): Hex; +``` + +### Parameters + + The options for generating the initialization bytecode. + +#### Type + +```ts +let options: GetInitiBytecodeWithSaltOptions; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The initialization bytecode with salt. +--- + +## getSaltHash + + Calculates the salt hash for a given bytecode. + +### Example + +```ts +import { getSaltHash } from "thirdweb"; +const saltHash = getSaltHash(bytecode); +``` + +```ts +function getSaltHash(bytecode: string): Hex; +``` + +### Parameters + + The bytecode to calculate the salt hash for. + +#### Type + +```ts +let bytecode: string; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The salt hash of the bytecode. +--- + +## hashMessage + + Ethereum Signed Message hashing + +### Example + +```ts +import { hashMessage } from "thirdweb/utils"; +const hash = hashMessage("hello world"); +``` + +```ts +function hashMessage( + message: SignableMessage, + to_?: TTo, +): HashMessage; +``` + +### Parameters + + The message to hash, either as a string, a Uint8Array, or an object with a `raw` property containing a Uint8Array. + +#### Type + +```ts +let message: SignableMessage; +``` + + The desired output format of the hash (optional). Defaults to 'hex'. + +#### Type + +```ts +let to_: TTo; +``` + +### Returns + +```ts +let returnType: HashMessage; +``` + + The Ethereum Signed Message hash of the message in the specified format. +--- + +## isEIP155Enforced + + Checks whether EIP-155 is enforced by sending a random transaction of legacy type (pre-EIP-155) and parsing the error message. + +### Example + +```ts +import { isEIP155Enforced } from "thirdweb/utils"; +const isEIP155 = await isEIP155Enforced({ chain, client }); +``` + +```ts +function isEIP155Enforced( + options: IsEIP155EnforcedOptions, +): Promise; +``` + +### Parameters + + The options for checking EIP-155 enforcement. + +#### Type + +```ts +let options: IsEIP155EnforcedOptions; +``` + +### Returns + +```ts +let returnType: Promise; +``` + + A promise that resolves to a boolean indicating whether EIP-155 is enforced. +--- + +## keccakId + + Calculates the keccak ID of the given input. + +### Example + +```ts +import { keccackId } from "thirdweb/utils"; +const keccakId = keccackId(input); +``` + +```ts +function keccakId(input: string): Hex; +``` + +### Parameters + + The input value to calculate the keccak ID for. + +#### Type + +```ts +let input: string; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The keccak ID as a Hex string. +--- + +## max + + Returns the maximum of two BigInt values. + +### Example + +```ts +max(1n, 2n); +// 2n +``` + +```ts +function max(a: bigint, b: bigint): bigint; +``` + +### Parameters + + The first BigInt value. + +#### Type + +```ts +let a: bigint; +``` + + The second BigInt value. + +#### Type + +```ts +let b: bigint; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The larger of the two BigInt values. +--- + +## min + + Returns the minimum of two BigInt values. + +### Example + +```ts +min(1n, 2n); +// 1n +``` + +```ts +function min(a: bigint, b: bigint): bigint; +``` + +### Parameters + + The first BigInt value. + +#### Type + +```ts +let a: bigint; +``` + + The second BigInt value. + +#### Type + +```ts +let b: bigint; +``` + +### Returns + +```ts +let returnType: bigint; +``` + + The smaller of the two BigInt values. +--- + +## parseAbiParams + + Converts an array of parameter values to their respective types based on the provided type array. + + This utility function is particularly useful for ensuring that parameter values are correctly formatted according to the expected types before they are used in further processing or passed to a Solidity smart contract. + +### Example + +```ts +import { parseAbiParams } from "thirdweb/utils"; + +const example1 = parseAbiParams( + ["address", "uint256"], + ["0x.....", "1200000"], +); // result: ["0x......", 1200000n] + +const example2 = parseAbiParams( + ["address", "bool"], + ["0x.....", "true"], +); // result: ["0x......", true] +``` + +```ts +function parseAbiParams( + constructorParamTypes: Array, + constructorParamValues: Array, +): Array; +``` + +### Parameters + + An array of type strings indicating the expected types of the values, following Solidity type conventions (e.g., "address", "uint256", "bool"). + +#### Type + +```ts +let constructorParamTypes: Array; +``` + + An array of values to be converted according to the types. + +#### Type + +```ts +let constructorParamValues: Array; +``` + +### Returns + +```ts +let returnType: Array; +``` + +* An array of values converted to their respective types. +--- + +## resolveSignature + + Resolves a signature by converting a hexadecimal string into a function or event signature. + +### Example + +```ts +import { resolveSignature } from "thirdweb/utils"; +const res = await resolveSignature("0x1f931c1c"); +console.log(res); +``` + +```ts +function resolveSignature( + hexSig: string, +): Promise<{ + event: EventString | null; + function: FunctionString | null; +}>; +``` + +### Parameters + + The hexadecimal signature to resolve. + +#### Type + +```ts +let hexSig: string; +``` + +### Returns + +```ts +let returnType: Promise<{ + event: EventString | null; + function: FunctionString | null; +}>; +``` + + A promise that resolves to an object containing the function and event signatures. +--- + +## resolveSignatures + + Resolves the signatures of the given hexadecimal signatures. + +### Example + +```ts +import { resolveSignatures } from "thirdweb/utils"; +const res = await resolveSignatures(["0x1f931c1c", "0x1f931c1c"]); +console.log(res); +``` + +```ts +function resolveSignatures( + hexSigs: Array, +): Promise<{ + events: Array; + functions: Array; +}>; +``` + +### Parameters + + An array of hexadecimal signatures. + +#### Type + +```ts +let hexSigs: Array; +``` + +### Returns + +```ts +let returnType: Promise<{ + events: Array; + functions: Array; +}>; +``` + + A promise that resolves to an object containing the resolved functions and events. +--- + +## shortenAddress + + Checksums and formats an address if valid. Note this function does not check if the provided address is an ENS. + +### Example + +```ts +import { shortenAddress } from "thirdweb/utils"; + +shortenAddress("0xa0cf798816d4b9b9866b5330eea46a18382f251e"); +//=> '0xA0Cf...251e' +``` + +```ts +function shortenAddress(address: string, length: number): string; +``` + +### Parameters + + The address to shorten. + +#### Type + +```ts +let address: string; +``` + + The number of characters to keep from the start and end of the address. + +#### Type + +```ts +let length: number; +``` + +### Returns + +```ts +let returnType: string; +``` + + The shortened address. +--- + +## shortenHex + + Shortens a hexadecimal string without performing any validation or checksumming. + +### Example + +```ts +import { shortenHex } from "thirdweb/utils"; + +shortenHex("0xa0cf798816d4b9b9866b5330eea46a18382f251e"); +//=> '0xa0cf...251e' +``` + +```ts +function shortenHex(hex: string, length: number): string; +``` + +### Parameters + + The hexadecimal string to shorten. + +#### Type + +```ts +let hex: string; +``` + + The number of characters to keep from the start and end of the string. + +#### Type + +```ts +let length: number; +``` + +### Returns + +```ts +let returnType: string; +``` + + The shortened hexadecimal string. +--- + +## shortenLargeNumber + + Shorten the string for large value Mainly used for Examples: 10\_000 -> 10k 1\_000\_000 -> 1M 1\_000\_000\_000 -> 1B + +### Example + +```ts +import { shortenLargeNumber } from "thirdweb/utils"; +const numStr = shortenLargeNumber(1_000_000_000); +``` + +```ts +function shortenLargeNumber(value: number): string; +``` + +### Parameters + +#### Type + +```ts +let value: number; +``` + +### Returns + +```ts +let returnType: string; +``` +--- + +## sign + + Generates the signature for the provided transaction hash. + +### Example + +```ts +import { sign } from "thirdweb/utils"; + +const signature = sign({ + hash: "0x", + privateKey: "0x", +}); +``` + +```ts +function sign(options: SignOptions): { + r: `0x${string}`; + s: `0x${string}`; + v: bigint; + yParity: number; +}; +``` + +### Parameters + + The options for signing. + +#### Type + +```ts +let options: { hash: Hex; privateKey: Hex }; +``` + +### Returns + +```ts +let returnType: { + r: `0x${string}`; + s: `0x${string}`; + v: bigint; + yParity: number; +}; +``` + + The transaction signature. +--- + +## signatureToHex + + Converts a signature to a hex string. + +### Example + +```ts +import { signatureToHex } from "thirdweb/utils"; + +const hex = signatureToHex({ + r: toHex( + 49782753348462494199823712700004552394425719014458918871452329774910450607807n, + ), + s: toHex( + 33726695977844476214676913201140481102225469284307016937915595756355928419768n, + ), + v: 28n, +}); + +console.log(hex); +// "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c" +``` + +```ts +function signatureToHex(signature: { + r: `0x${string}`; + s: `0x${string}`; + v?: number | bigint | `0x${string}`; + yParity?: number | bigint | `0x${string}`; +}): Hex; +``` + +### Parameters + + The signature to convert. + +#### Type + +```ts +let signature: { + r: `0x${string}`; + s: `0x${string}`; + v?: number | bigint | `0x${string}`; + yParity?: number | bigint | `0x${string}`; +}; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The hex string representation of the signature. +--- + +## signMessage + +### Signature#1 + + Signs a string message with a given private key. + +#### Example + +```ts +import { signMessage } from "thirdweb/utils"; +signMessage({ + message: "Hello, world!", + privateKey: "0x...", +}); +``` + +```ts +function signMessage(options: SignMessageOptions): Hex; +``` + +#### Parameters + + The options for signing. + +##### Type + +```ts +let options: { message: Message; privateKey: Hex }; +``` + +#### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The signature as a hex string + +### Signature#2 + + Signs a string message with a given account. + +#### Example + +```ts +import { signMessage } from "thirdweb/utils"; +await signMessage({ + message: "Hello, world!", + account, +}); +``` + +```ts +function signMessage(options: { + account: Account; + message: Message; +}): Promise; +``` + +#### Parameters + + The options for signing. + +##### Type + +```ts +let options: { account: Account; message: Message }; +``` + +#### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The signature as a hex string +--- + +## signTypedData + + Signs a typed data object with a given private key according to EIP712. + +### Example + +```ts +import { signTypedData } from "thirdweb/utils"; +signTypedData({ + privateKey: "0x...", + ...typedData, +}); +``` + +```ts +function signTypedData( + options: SignTypedDataOptions, +): Hex; +``` + +### Parameters + + The typed data is passed within options alongside the private key + +#### Type + +```ts +let options: SignTypedDataOptions; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` + + The signature as a hex string +--- + +## stringify + + Stringify a JSON object and convert all bigint values to string + + If you are getting this error: "Exception: Do not know how to serialize a BigInt", you probably can use this function to parse the data. Because bigint is not an accepted value of the JSON format. + +### Example + +```ts +import { stringify } from "thirdweb/utils"; +const obj = { tokenId: 0n }; +const str = stringify(obj); // "{"tokenId":"0"}" +``` + +```ts +function stringify( + value: any, + replacer?: null | ((this: any, key: string, value: any) => any), + space?: string | number, +): string; +``` + +### Parameters + +#### Type + +```ts +let value: any; +``` + +#### Type + +```ts +let replacer: null | ((this: any, key: string, value: any) => any); +``` + +#### Type + +```ts +let space: string | number; +``` + +### Returns + +```ts +let returnType: string; +``` + + An object with all bigint values converted to string +--- +# Miscellaneous +--- + +## WalletName + + This component fetches then shows the name of a wallet. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` + +### Example + +#### Basic usage + +```tsx +import { WalletProvider, WalletName } from "thirdweb/react"; + + + +; +``` + + Result: + +```html +MetaMask +``` + +#### Show a loading sign when the name is being fetched + +```tsx +import { WalletProvider, WalletName } from "thirdweb/react"; + + + } /> +; +``` + +#### Fallback to something when the name fails to resolve + +```tsx + + Failed to load} /> +; +``` + +#### Custom query options for useQuery + + This component uses `@tanstack-query` 's useQuery internally. You can use the `queryOptions` prop for more fine-grained control + +```tsx + +@component +@beta +@wallet +``` + +```ts +function WalletName( + __namedParameters: WalletNameProps, +): null | Element; +``` + +### Parameters + +#### Type + +```ts +let __namedParameters: {about : string,accessKey : string,aria-activedescendant : string,aria-atomic : Booleanish,aria-autocomplete : "inline" | "none" | "list" | "both",aria-braillelabel : string,aria-brailleroledescription : string,aria-busy : Booleanish,aria-checked : boolean | "false" | "true" | "mixed",aria-colcount : number,aria-colindex : number,aria-colindextext : string,aria-colspan : number,aria-controls : string,aria-current : boolean | "false" | "true" | "time" | "step" | "page" | "location" | "date",aria-describedby : string,aria-description : string,aria-details : string,aria-disabled : Booleanish,aria-dropeffect : "link" | "popup" | "execute" | "none" | "copy" | "move",aria-errormessage : string,aria-expanded : Booleanish,aria-flowto : string,aria-grabbed : Booleanish,aria-haspopup : boolean | "false" | "true" | "dialog" | "menu" | "grid" | "tree" | "listbox",aria-hidden : Booleanish,aria-invalid : boolean | "false" | "true" | "grammar" | "spelling",aria-keyshortcuts : string,aria-label : string,aria-labelledby : string,aria-level : number,aria-live : "off" | "polite" | "assertive",aria-modal : Booleanish,aria-multiline : Booleanish,aria-multiselectable : Booleanish,aria-orientation : "horizontal" | "vertical",aria-owns : string,aria-placeholder : string,aria-posinset : number,aria-pressed : boolean | "false" | "true" | "mixed",aria-readonly : Booleanish,aria-relevant : "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals",aria-required : Booleanish,aria-roledescription : string,aria-rowcount : number,aria-rowindex : number,aria-rowindextext : string,aria-rowspan : number,aria-selected : Booleanish,aria-setsize : number,aria-sort : "none" | "ascending" | "descending" | "other",aria-valuemax : number,aria-valuemin : number,aria-valuenow : number,aria-valuetext : string,autoCapitalize : (string & ({ })) | "on" | "off" | "none" | "sentences" | "words" | "characters",autoCorrect : string,autoFocus : boolean,autoSave : string,className : string,color : string,content : string,contentEditable : "inherit" | (Booleanish) | "plaintext-only",contextMenu : string,dangerouslySetInnerHTML : { __html: string | (TrustedHTML) },datatype : string,defaultChecked : boolean,defaultValue : string | number | (readonly Array),dir : string,draggable : Booleanish,enterKeyHint : "search" | "done" | "next" | "send" | "enter" | "go" | "previous",fallbackComponent : Element,formatFn : (str: string) => string,hidden : boolean,id : string,inert : boolean,inlist : any,inputMode : "search" | "email" | "url" | "text" | "none" | "tel" | "numeric" | "decimal",is : string,itemID : string,itemProp : string,itemRef : string,itemScope : boolean,itemType : string,lang : string,loadingComponent : Element,nonce : string,onAbort : ReactEventHandler,onAbortCapture : ReactEventHandler,onAnimationEnd : AnimationEventHandler,onAnimationEndCapture : AnimationEventHandler,onAnimationIteration : AnimationEventHandler,onAnimationIterationCapture : AnimationEventHandler,onAnimationStart : AnimationEventHandler,onAnimationStartCapture : AnimationEventHandler,onAuxClick : MouseEventHandler,onAuxClickCapture : MouseEventHandler,onBeforeInput : FormEventHandler,onBeforeInputCapture : FormEventHandler,onBeforeToggle : ToggleEventHandler,onBlur : FocusEventHandler,onBlurCapture : FocusEventHandler,onCanPlay : ReactEventHandler,onCanPlayCapture : ReactEventHandler,onCanPlayThrough : ReactEventHandler,onCanPlayThroughCapture : ReactEventHandler,onChange : FormEventHandler,onChangeCapture : FormEventHandler,onClick : MouseEventHandler,onClickCapture : MouseEventHandler,onCompositionEnd : CompositionEventHandler,onCompositionEndCapture : CompositionEventHandler,onCompositionStart : CompositionEventHandler,onCompositionStartCapture : CompositionEventHandler,onCompositionUpdate : CompositionEventHandler,onCompositionUpdateCapture : CompositionEventHandler,onContextMenu : MouseEventHandler,onContextMenuCapture : MouseEventHandler,onCopy : ClipboardEventHandler,onCopyCapture : ClipboardEventHandler,onCut : ClipboardEventHandler,onCutCapture : ClipboardEventHandler,onDoubleClick : MouseEventHandler,onDoubleClickCapture : MouseEventHandler,onDrag : DragEventHandler,onDragCapture : DragEventHandler,onDragEnd : DragEventHandler,onDragEndCapture : DragEventHandler,onDragEnter : DragEventHandler,onDragEnterCapture : DragEventHandler,onDragExit : DragEventHandler,onDragExitCapture : DragEventHandler,onDragLeave : DragEventHandler,onDragLeaveCapture : DragEventHandler,onDragOver : DragEventHandler,onDragOverCapture : DragEventHandler,onDragStart : DragEventHandler,onDragStartCapture : DragEventHandler,onDrop : DragEventHandler,onDropCapture : DragEventHandler,onDurationChange : ReactEventHandler,onDurationChangeCapture : ReactEventHandler,onEmptied : ReactEventHandler,onEmptiedCapture : ReactEventHandler,onEncrypted : ReactEventHandler,onEncryptedCapture : ReactEventHandler,onEnded : ReactEventHandler,onEndedCapture : ReactEventHandler,onError : ReactEventHandler,onErrorCapture : ReactEventHandler,onFocus : FocusEventHandler,onFocusCapture : FocusEventHandler,onGotPointerCapture : PointerEventHandler,onGotPointerCaptureCapture : PointerEventHandler,onInput : FormEventHandler,onInputCapture : FormEventHandler,onInvalid : FormEventHandler,onInvalidCapture : FormEventHandler,onKeyDown : KeyboardEventHandler,onKeyDownCapture : KeyboardEventHandler,onKeyPress : KeyboardEventHandler,onKeyPressCapture : KeyboardEventHandler,onKeyUp : KeyboardEventHandler,onKeyUpCapture : KeyboardEventHandler,onLoad : ReactEventHandler,onLoadCapture : ReactEventHandler,onLoadedData : ReactEventHandler,onLoadedDataCapture : ReactEventHandler,onLoadedMetadata : ReactEventHandler,onLoadedMetadataCapture : ReactEventHandler,onLoadStart : ReactEventHandler,onLoadStartCapture : ReactEventHandler,onLostPointerCapture : PointerEventHandler,onLostPointerCaptureCapture : PointerEventHandler,onMouseDown : MouseEventHandler,onMouseDownCapture : MouseEventHandler,onMouseEnter : MouseEventHandler,onMouseLeave : MouseEventHandler,onMouseMove : MouseEventHandler,onMouseMoveCapture : MouseEventHandler,onMouseOut : MouseEventHandler,onMouseOutCapture : MouseEventHandler,onMouseOver : MouseEventHandler,onMouseOverCapture : MouseEventHandler,onMouseUp : MouseEventHandler,onMouseUpCapture : MouseEventHandler,onPaste : ClipboardEventHandler,onPasteCapture : ClipboardEventHandler,onPause : ReactEventHandler,onPauseCapture : ReactEventHandler,onPlay : ReactEventHandler,onPlayCapture : ReactEventHandler,onPlaying : ReactEventHandler,onPlayingCapture : ReactEventHandler,onPointerCancel : PointerEventHandler,onPointerCancelCapture : PointerEventHandler,onPointerDown : PointerEventHandler,onPointerDownCapture : PointerEventHandler,onPointerEnter : PointerEventHandler,onPointerLeave : PointerEventHandler,onPointerMove : PointerEventHandler,onPointerMoveCapture : PointerEventHandler,onPointerOut : PointerEventHandler,onPointerOutCapture : PointerEventHandler,onPointerOver : PointerEventHandler,onPointerOverCapture : PointerEventHandler,onPointerUp : PointerEventHandler,onPointerUpCapture : PointerEventHandler,onProgress : ReactEventHandler,onProgressCapture : ReactEventHandler,onRateChange : ReactEventHandler,onRateChangeCapture : ReactEventHandler,onReset : FormEventHandler,onResetCapture : FormEventHandler,onResize : ReactEventHandler,onResizeCapture : ReactEventHandler,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onSeeked : ReactEventHandler,onSeekedCapture : ReactEventHandler,onSeeking : ReactEventHandler,onSeekingCapture : ReactEventHandler,onSelect : ReactEventHandler,onSelectCapture : ReactEventHandler,onStalled : ReactEventHandler,onStalledCapture : ReactEventHandler,onSubmit : FormEventHandler,onSubmitCapture : FormEventHandler,onSuspend : ReactEventHandler,onSuspendCapture : ReactEventHandler,onTimeUpdate : ReactEventHandler,onTimeUpdateCapture : ReactEventHandler,onToggle : ToggleEventHandler,onTouchCancel : TouchEventHandler,onTouchCancelCapture : TouchEventHandler,onTouchEnd : TouchEventHandler,onTouchEndCapture : TouchEventHandler,onTouchMove : TouchEventHandler,onTouchMoveCapture : TouchEventHandler,onTouchStart : TouchEventHandler,onTouchStartCapture : TouchEventHandler,onTransitionCancel : TransitionEventHandler,onTransitionCancelCapture : TransitionEventHandler,onTransitionEnd : TransitionEventHandler,onTransitionEndCapture : TransitionEventHandler,onTransitionRun : TransitionEventHandler,onTransitionRunCapture : TransitionEventHandler,onTransitionStart : TransitionEventHandler,onTransitionStartCapture : TransitionEventHandler,onVolumeChange : ReactEventHandler,onVolumeChangeCapture : ReactEventHandler,onWaiting : ReactEventHandler,onWaitingCapture : ReactEventHandler,onWheel : WheelEventHandler,onWheelCapture : WheelEventHandler,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,queryOptions : Omit, "queryKey" | "queryFn">,radioGroup : string,rel : string,resource : string,results : number,rev : string,role : AriaRole,security : string,slot : string,spellCheck : Booleanish,style : CSSProperties,suppressContentEditableWarning : boolean,suppressHydrationWarning : boolean,tabIndex : number,title : string,translate : "yes" | "no",typeof : string,unselectable : "on" | "off",vocab : string} +``` + +### Returns + +```ts +let returnType: null | Element; +``` +--- + +## decodeAbiParameters + +```ts +function decodeAbiParameters( + params: params, + data: `0x${string}` | ByteArray, +): DecodeAbiParametersReturnType; +``` + +### Parameters + +#### Type + +```ts +let params: params; +``` + +#### Type + +```ts +let data: `0x${string}` | ByteArray; +``` + +### Returns + +```ts +let returnType: DecodeAbiParametersReturnType; +``` +--- + +## encodePacked + +```ts +function encodePacked( + types: packedAbiTypes, + values: EncodePackedValues, +): Hex; +``` + +### Parameters + +#### Type + +```ts +let types: packedAbiTypes; +``` + +#### Type + +```ts +let values: EncodePackedValues; +``` + +### Returns + +```ts +let returnType: ox__Hex.Hex; +``` +--- + +## isBytes + +```ts +function isBytes(value: unknown): value is ByteArray; +``` + +### Parameters + +#### Type + +```ts +let value: unknown; +``` + +### Returns + +```ts +let returnType: value is (ByteArray) +``` +--- + +## isValidENSName + + Checks if a string is a valid ENS name. It does not check if the ENS name is currently registered or resolves to an address - it only validates the string format. + +### Example + +```ts +isValidENSName("thirdweb.eth"); // true +isValidENSName("foo.bar.com"); // true +isValidENSName("xyz"); // false +``` + +```ts +function isValidENSName(name: string): boolean; +``` + +### Parameters + + The ENS name to check. + +#### Type + +```ts +let name: string; +``` + +### Returns + +```ts +let returnType: boolean; +``` +--- + +## toEventSelector + + Returns the hash (of the function/event signature) for a given event or function definition. + +```ts +function toEventSelector( + fn: string | AbiEvent | AbiFunction, +): `0x${string}`; +``` + +### Parameters + +#### Type + +```ts +let fn: string | AbiEvent | AbiFunction; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` +--- + +## toFunctionSelector + +```ts +function toFunctionSelector(fn: string | AbiFunction): `0x${string}`; +``` + +### Parameters + +#### Type + +```ts +let fn: string | AbiFunction; +``` + +### Returns + +```ts +let returnType: `0x${string}`; +``` +--- + +## AutoConnect + + AutoConnect last connected wallet on page reload or revisit. Note: If you are using `ConnectButton` or `ConnectEmbed` components, You don't need to use this component as it is already included. + + This is useful if you are manually connecting the wallets using the [useConnect](https://portal.thirdweb.com/references/typescript/v5/useConnect) hook and want to auto connect the last connected wallets on page reload or revisit. + + You can also use the [useAutoConnect](https://portal.thirdweb.com/references/typescript/v5/useAutoConnect) hook to achieve the same result. + + To check if the wallet in in the process of auto connecting, you can use the [useIsAutoConnecting](https://portal.thirdweb.com/references/typescript/v5/useIsAutoConnecting) hook. + +### Example + +```tsx +import { AutoConnect } from "thirdweb/react"; +import { createWallet, inAppWallet } from "thirdweb/wallets"; + +// list of wallets that your app uses +const wallets = [ + inAppWallet(), + createWallet("io.metamask"), + createWallet("me.rainbow"), +]; + +function Example() { + return ( + + ); +} +``` + +```ts +function AutoConnect(props: AutoConnectProps): Element; +``` + +### Parameters + + Object of type `AutoConnectProps` . Refer to [AutoConnectProps](https://portal.thirdweb.com/references/typescript/v5/AutoConnectProps) + +#### Type + +```ts +let props: { + accountAbstraction?: SmartWalletOptions; + appMetadata?: AppMetadata; + chain?: Chain; + client: ThirdwebClient; + onConnect?: (wallet: Wallet) => void; + onTimeout?: () => void; + timeout?: number; + wallets?: Array; +}; +``` + +### Returns + +```ts +let returnType: Element; +``` diff --git a/apps/portal/public/llms.txt b/apps/portal/public/llms.txt new file mode 100644 index 00000000000..b3a26d149d4 --- /dev/null +++ b/apps/portal/public/llms.txt @@ -0,0 +1,1225 @@ +# __thirdweb TypeScript SDK Documentation__ + +> Frontend, Backend, and Onchain tools to build complete web3 apps — on every EVM chain. + +--- +**UI Components** +--- +# Wallets +* [AccountAddress](https://portal.thirdweb.com/references/typescript/v5/AccountAddress): Result: +* [AccountBlobbie](https://portal.thirdweb.com/references/typescript/v5/AccountBlobbie): A wrapper for the Blobbie component +* [AccountProvider](https://portal.thirdweb.com/references/typescript/v5/AccountProvider): A React context provider component that supplies Account-related data to its child components. +* [Blobbie](https://portal.thirdweb.com/references/typescript/v5/Blobbie): A unique gradient avatar based on the provided address. +* [WalletProvider](https://portal.thirdweb.com/references/typescript/v5/WalletProvider): /\*\* +--- +# Wallet Connection +* [AutoConnectProps](https://portal.thirdweb.com/references/typescript/v5/AutoConnect): Enable Account abstraction for all wallets. This will connect to the users's smart account based on the connected personal wallet and the given options. +* [ConnectButton](https://portal.thirdweb.com/references/typescript/v5/ConnectButton): A fully featured wallet connection component that allows to: +* [ConnectEmbed](https://portal.thirdweb.com/references/typescript/v5/ConnectEmbed): An inline wallet connection component that allows to: +* [SiteEmbed](https://portal.thirdweb.com/references/typescript/v5/SiteEmbed): Embeds another thirdweb-supported site for seamless in-app and ecosystem wallet connection. +* [SiteLink](https://portal.thirdweb.com/references/typescript/v5/SiteLink): Creates a link to another thirdweb-supported site with wallet connection parameters. +* [ThirdwebProvider](https://portal.thirdweb.com/references/typescript/v5/ThirdwebProvider): The ThirdwebProvider is component is a provider component that sets up the React Query client. +--- +# Chain +* [ChainProvider](https://portal.thirdweb.com/references/typescript/v5/ChainProvider): A React context provider component that supplies Chain-related data to its child components. +--- +# Transactions +* [BuyDirectListingButton](https://portal.thirdweb.com/references/typescript/v5/BuyDirectListingButton): This button is used with thirdweb Marketplace v3 contract, for buying NFT(s) from a listing. +* [ClaimButton](https://portal.thirdweb.com/references/typescript/v5/ClaimButton): This button is used to claim tokens (NFT or ERC20) from a given thirdweb Drop contract. +* [CreateDirectListingButton](https://portal.thirdweb.com/references/typescript/v5/CreateDirectListingButton): This button is used to create Direct listings for the thirdweb Marketplace v3 contract +* [TransactionButton](https://portal.thirdweb.com/references/typescript/v5/TransactionButton): TransactionButton component is used to render a button that triggers a transaction. It shows a "Switch Network" button if the connected wallet is on a different chain than the transaction. +--- +# NFT +* [NFTProvider](https://portal.thirdweb.com/references/typescript/v5/NFTProvider): A React context provider component that supplies NFT-related data to its child components. +--- +# Tokens +* [TokenProvider](https://portal.thirdweb.com/references/typescript/v5/TokenProvider): A React context provider component that supplies Token-related data to its child components. +--- +# Miscellaneous +* [MediaRenderer](https://portal.thirdweb.com/references/typescript/v5/MediaRenderer): Refer to [MediaRendererProps](https://portal.thirdweb.com/references/typescript/v5/MediaRendererProps) to see the available props. +* [PayEmbed](https://portal.thirdweb.com/references/typescript/v5/PayEmbed): Embed a prebuilt UI for funding wallets, purchases or transactions with crypto or fiat. +--- +**React Hooks** +--- +# Extensions +--- +## EIP5792 +* [useCallsStatus](https://portal.thirdweb.com/references/typescript/v5/eip5792/useCallsStatus): A hook to get a call bundle's current status according to [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) . +* [useCapabilities](https://portal.thirdweb.com/references/typescript/v5/eip5792/useCapabilities): A hook to get the current wallet's capabilities according to [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) . +* [useSendCalls](https://portal.thirdweb.com/references/typescript/v5/eip5792/useSendCalls): A hook to send [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) calls to a wallet. This hook works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792\. Transactions will be bundled and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions. +--- +## ENS +* [useEnsAvatar](https://portal.thirdweb.com/references/typescript/v5/ens/useEnsAvatar): Get the ENS avatar for an ENS name +* [useEnsName](https://portal.thirdweb.com/references/typescript/v5/ens/useEnsName): Get the ENS name and avatar for an address +--- +# Wallets +* [useLinkProfile](https://portal.thirdweb.com/references/typescript/v5/useLinkProfile): Links a web2 or web3 profile to the connected in-app or ecosystem account. _When a profile is linked to the account, that profile can then be used to sign into the same account._ +* [useNetworkSwitcherModal](https://portal.thirdweb.com/references/typescript/v5/useNetworkSwitcherModal): Hook to open the Wallet Network Switcher Modal that shows allows users to switch to different network. +* [useProfiles](https://portal.thirdweb.com/references/typescript/v5/useProfiles): Retrieves all linked profiles of the connected in-app or ecosystem account. +* [useUnlinkProfile](https://portal.thirdweb.com/references/typescript/v5/useUnlinkProfile): Unlinks a web2 or web3 profile currently connected in-app or ecosystem account. _When a profile is unlinked from the account, it will no longer be able to be used to sign into the account._ +* [useWalletBalance](https://portal.thirdweb.com/references/typescript/v5/useWalletBalance): Fetch the balance of a wallet in native currency or for a specific token. Leave `tokenAddress` undefined to fetch the native token balance. +* [useWalletDetailsModal](https://portal.thirdweb.com/references/typescript/v5/useWalletDetailsModal): Hook to open the Wallet Details Modal that shows various information about the connected wallet and allows users to perform various actions like sending funds, receiving funds, switching networks, Buying tokens, etc. +* [useWalletImage](https://portal.thirdweb.com/references/typescript/v5/useWalletImage): Returns the wallet icon for the provided wallet id. +* [useWalletInfo](https://portal.thirdweb.com/references/typescript/v5/useWalletInfo): Returns the wallet info for the provided wallet id. +--- +# Wallet Connection +* [useActiveAccount](https://portal.thirdweb.com/references/typescript/v5/useActiveAccount): A hook that returns the active account +* [useActiveWallet](https://portal.thirdweb.com/references/typescript/v5/useActiveWallet): A hook that returns the active wallet +* [useActiveWalletChain](https://portal.thirdweb.com/references/typescript/v5/useActiveWalletChain): A hook that returns the chain the active wallet is connected to +* [useActiveWalletConnectionStatus](https://portal.thirdweb.com/references/typescript/v5/useActiveWalletConnectionStatus): A hook that returns the active account's connection status. +* [useAdminWallet](https://portal.thirdweb.com/references/typescript/v5/useAdminWallet): Get the admin wallet for the active wallet Useful for smart wallets to get the underlying personal account +* [useAutoConnect](https://portal.thirdweb.com/references/typescript/v5/useAutoConnect): Autoconnect the last previously connected wallet. +* [useConnect](https://portal.thirdweb.com/references/typescript/v5/useConnect): A hook to set a wallet as active wallet +* [useConnectedWallets](https://portal.thirdweb.com/references/typescript/v5/useConnectedWallets): A hook that returns all connected wallets +* [useConnectModal](https://portal.thirdweb.com/references/typescript/v5/useConnectModal): hook that allows you to open the Connect UI in a Modal to prompt the user to connect wallet. +* [useDisconnect](https://portal.thirdweb.com/references/typescript/v5/useDisconnect): Disconnect from given account +* [useIsAutoConnecting](https://portal.thirdweb.com/references/typescript/v5/useIsAutoConnecting): A hook to check if the auto connect is in progress. +* [useSetActiveWallet](https://portal.thirdweb.com/references/typescript/v5/useSetActiveWallet): A hook that lets you set the active wallet. +* [useSwitchActiveWalletChain](https://portal.thirdweb.com/references/typescript/v5/useSwitchActiveWalletChain): Switch to blockchain with given chain id in the active wallet. +--- +# Chain +* [useChainMetadata](https://portal.thirdweb.com/references/typescript/v5/useChainMetadata): Retrieves metadata for a chain such as name, icon, available faucets, block explorers, etc. +--- +# Contract +* [useContractEvents](https://portal.thirdweb.com/references/typescript/v5/useContractEvents): Watches contract events and returns the parsed logs. +* [useReadContract](https://portal.thirdweb.com/references/typescript/v5/useReadContract): A hook to read state from a contract that automatically updates when the contract changes. +--- +# Transactions +* [useEstimateGas](https://portal.thirdweb.com/references/typescript/v5/useEstimateGas): A hook to estimate the gas for a given transaction. +* [useEstimateGasCost](https://portal.thirdweb.com/references/typescript/v5/useEstimateGasCost): A hook to estimate the gas cost in ether and wei for a given transaction. +* [useSendAndConfirmTransaction](https://portal.thirdweb.com/references/typescript/v5/useSendAndConfirmTransaction): A hook to send a transaction. +* [useSendBatchTransaction](https://portal.thirdweb.com/references/typescript/v5/useSendBatchTransaction): A hook to send a transaction. +* [useSendTransaction](https://portal.thirdweb.com/references/typescript/v5/useSendTransaction): A hook to send a transaction with from the user's connected wallet. +* [useSimulateTransaction](https://portal.thirdweb.com/references/typescript/v5/useSimulateTransaction): A hook to simulate a transaction. +* [useWaitForReceipt](https://portal.thirdweb.com/references/typescript/v5/useWaitForReceipt): A hook to wait for a transaction receipt. +--- +# Social API +* [useSocialProfiles](https://portal.thirdweb.com/references/typescript/v5/useSocialProfiles): Fetches the wallet's available social profiles. +--- +# Buy Crypto +* [useBuyHistory](https://portal.thirdweb.com/references/typescript/v5/useBuyHistory): Hook to get the history of Buy transactions for a given wallet - This includes both "buy with crypto" and "buy with fiat" transactions. +* [useBuyWithCryptoHistory](https://portal.thirdweb.com/references/typescript/v5/useBuyWithCryptoHistory): Hook to get the "Buy with crypto" transaction history for a given wallet address. +* [useBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/useBuyWithCryptoQuote): Hook to get a price quote for performing a "Buy with crypto" transaction that allows users to buy a token with another token - aka a swap. +* [useBuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/useBuyWithCryptoStatus): A hook to get a status of a "Buy with crypto" transaction to determine if the transaction is completed, failed or pending. +* [useBuyWithFiatHistory](https://portal.thirdweb.com/references/typescript/v5/useBuyWithFiatHistory): Hook to get the "Buy with Fiat" transaction history for a given wallet address. +* [useBuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/useBuyWithFiatQuote): Hook to get a price quote for performing a "Buy with Fiat" transaction that allows users to buy a token with fiat currency. +* [useBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/useBuyWithFiatStatus): A hook to get a status of a "Buy with Fiat" transaction to determine if the transaction is completed, failed or pending. +* [usePostOnRampQuote](https://portal.thirdweb.com/references/typescript/v5/usePostOnRampQuote): When buying a token with fiat currency - It only involes doing on-ramp if the on-ramp provider supports buying the given destination token directly. +--- +# Utils +* [useBlockNumber](https://portal.thirdweb.com/references/typescript/v5/useBlockNumber): Hook that watches for changes in the block number on a given chain. +--- +**Core Functions** +--- +# Extensions +--- +## EIP1193 +* [fromProvider](https://portal.thirdweb.com/references/typescript/v5/eip1193/fromProvider): Creates a Thirdweb wallet from an EIP-1193 compatible provider. +* [toProvider](https://portal.thirdweb.com/references/typescript/v5/eip1193/toProvider): Converts a Thirdweb wallet into an EIP-1193 compatible provider. +--- +## DEPLOY +* [prepareDirectDeployTransaction](https://portal.thirdweb.com/references/typescript/v5/deploy/prepareDirectDeployTransaction): Prepares a direct deploy transaction with ABI. +* [computePublishedContractAddress](https://portal.thirdweb.com/references/typescript/v5/deploy/computePublishedContractAddress): Predicts the implementation address of any published contract +* [deployContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployContract): Deploy a contract on a given chain +* [deployERC1155Contract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployERC1155Contract): Deploys an thirdweb ERC1155 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. +* [deployERC20Contract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployERC20Contract): Deploys an thirdweb ERC20 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. +* [deployERC721Contract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployERC721Contract): Deploys an thirdweb ERC721 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. +* [deployPackContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployPackContract): Deploy a thirdweb Pack contract +* [deployPublishedContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployPublishedContract): Deploy an instance of a published contract on a given chain +* [deploySplitContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deploySplitContract): Deploys a thirdweb [Split contract](https://thirdweb.com/thirdweb.eth/Split)On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. +* [prepareDeterministicDeployTransaction](https://portal.thirdweb.com/references/typescript/v5/deploy/prepareDeterministicDeployTransaction): Deploy a contract deterministically - will maintain the same address across chains. This is meant to be used with published contracts configured with the 'direct deploy' method. Under the hood, this uses a keyless transaction with a common create2 factory. +--- +## AIRDROP +* [airdropERC1155](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC1155): Prepares a transaction to call the "airdropERC1155" function on the contract. +* [airdropERC1155WithSignature](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC1155WithSignature): Prepares a transaction to call the "airdropERC1155WithSignature" function on the contract. +* [airdropERC20](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC20): Prepares a transaction to call the "airdropERC20" function on the contract. +* [airdropERC20WithSignature](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC20WithSignature): Prepares a transaction to call the "airdropERC20WithSignature" function on the contract. +* [airdropERC721](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC721): Prepares a transaction to call the "airdropERC721" function on the contract. +* [airdropERC721WithSignature](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC721WithSignature): Prepares a transaction to call the "airdropERC721WithSignature" function on the contract. +* [airdropNativeToken](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropNativeToken): Prepares a transaction to call the "airdropNativeToken" function on the contract. +* [claimERC1155](https://portal.thirdweb.com/references/typescript/v5/airdrop/claimERC1155): Claim airdrop of ERC1155 tokens for allowlisted addresses. (Pull based airdrop) +* [claimERC20](https://portal.thirdweb.com/references/typescript/v5/airdrop/claimERC20): Claim airdrop of ERC20 tokens for allowlisted addresses. (Pull based airdrop) +* [claimERC721](https://portal.thirdweb.com/references/typescript/v5/airdrop/claimERC721): Claim airdrop of ERC721 tokens for allowlisted addresses. (Pull based airdrop) +* [fetchProofsERC1155](https://portal.thirdweb.com/references/typescript/v5/airdrop/fetchProofsERC1155): Retrieves the claim merkle proof for the provided address. +* [fetchProofsERC20](https://portal.thirdweb.com/references/typescript/v5/airdrop/fetchProofsERC20): Retrieves the claim merkle proof for the provided address. +* [fetchProofsERC721](https://portal.thirdweb.com/references/typescript/v5/airdrop/fetchProofsERC721): Retrieves the claim merkle proof for the provided address. +* [generateAirdropSignatureERC1155](https://portal.thirdweb.com/references/typescript/v5/airdrop/generateAirdropSignatureERC1155): Generates the req and signature for sending ERC1155 airdrop. +* [generateAirdropSignatureERC20](https://portal.thirdweb.com/references/typescript/v5/airdrop/generateAirdropSignatureERC20): Generates the req and signature for sending ERC20 airdrop. +* [generateAirdropSignatureERC721](https://portal.thirdweb.com/references/typescript/v5/airdrop/generateAirdropSignatureERC721): Generates the req and signature for sending ERC721 airdrop. +* [generateMerkleTreeInfoERC1155](https://portal.thirdweb.com/references/typescript/v5/airdrop/generateMerkleTreeInfoERC1155): Generate merkle tree for a given snapshot. +* [generateMerkleTreeInfoERC20](https://portal.thirdweb.com/references/typescript/v5/airdrop/generateMerkleTreeInfoERC20): Generate merkle tree for a given snapshot. +* [generateMerkleTreeInfoERC721](https://portal.thirdweb.com/references/typescript/v5/airdrop/generateMerkleTreeInfoERC721): Generate merkle tree for a given snapshot. +* [isClaimed](https://portal.thirdweb.com/references/typescript/v5/airdrop/isClaimed): Calls the "isClaimed" function on the contract. +* [saveSnapshot](https://portal.thirdweb.com/references/typescript/v5/airdrop/saveSnapshot): Generate merkle tree for a given snapshot and save the info on-chain. +* [setMerkleRoot](https://portal.thirdweb.com/references/typescript/v5/airdrop/setMerkleRoot): Prepares a transaction to call the "setMerkleRoot" function on the contract. +* [tokenConditionId](https://portal.thirdweb.com/references/typescript/v5/airdrop/tokenConditionId): Calls the "tokenConditionId" function on the contract. +* [tokenMerkleRoot](https://portal.thirdweb.com/references/typescript/v5/airdrop/tokenMerkleRoot): Calls the "tokenMerkleRoot" function on the contract. +--- +## COMMON +* [contractURI](https://portal.thirdweb.com/references/typescript/v5/common/contractURI): Calls the "contractURI" function on the contract. +* [getContractMetadata](https://portal.thirdweb.com/references/typescript/v5/common/getContractMetadata): Retrieves the contract metadata including name and symbol. +* [getDefaultRoyaltyInfo](https://portal.thirdweb.com/references/typescript/v5/common/getDefaultRoyaltyInfo): Calls the "getDefaultRoyaltyInfo" function on the contract. +* [getPlatformFeeInfo](https://portal.thirdweb.com/references/typescript/v5/common/getPlatformFeeInfo): Calls the "getPlatformFeeInfo" function on the contract. +* [getRoyaltyInfoForToken](https://portal.thirdweb.com/references/typescript/v5/common/getRoyaltyInfoForToken): Calls the "getRoyaltyInfoForToken" function on the contract. +* [isGetContractMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/common/isGetContractMetadataSupported): Checks if the `contractURI` method is supported by the given contract. +* [isGetDefaultRoyaltyInfoSupported](https://portal.thirdweb.com/references/typescript/v5/common/isGetDefaultRoyaltyInfoSupported): Checks if the `getDefaultRoyaltyInfo` method is supported by the given contract. +* [isGetPlatformFeeInfoSupported](https://portal.thirdweb.com/references/typescript/v5/common/isGetPlatformFeeInfoSupported): Checks if the `getPlatformFeeInfo` method is supported by the given contract. +* [isGetRoyaltyInfoForTokenSupported](https://portal.thirdweb.com/references/typescript/v5/common/isGetRoyaltyInfoForTokenSupported): Checks if the `getRoyaltyInfoForToken` method is supported by the given contract. +* [isMulticallSupported](https://portal.thirdweb.com/references/typescript/v5/common/isMulticallSupported): Checks if the `multicall` method is supported by the given contract. +* [isNameSupported](https://portal.thirdweb.com/references/typescript/v5/common/isNameSupported): Checks if the `name` method is supported by the given contract. +* [isOwnerSupported](https://portal.thirdweb.com/references/typescript/v5/common/isOwnerSupported): Checks if the `owner` method is supported by the given contract. +* [isPrimarySaleRecipientSupported](https://portal.thirdweb.com/references/typescript/v5/common/isPrimarySaleRecipientSupported): Checks if the `primarySaleRecipient` method is supported by the given contract. +* [isSetContractURISupported](https://portal.thirdweb.com/references/typescript/v5/common/isSetContractURISupported): Checks if the `setContractURI` method is supported by the given contract. +* [isSetDefaultRoyaltyInfoSupported](https://portal.thirdweb.com/references/typescript/v5/common/isSetDefaultRoyaltyInfoSupported): Checks if the `setDefaultRoyaltyInfo` method is supported by the given contract. +* [isSetPlatformFeeInfoSupported](https://portal.thirdweb.com/references/typescript/v5/common/isSetPlatformFeeInfoSupported): Checks if the `setPlatformFeeInfo` method is supported by the given contract. +* [isSetPrimarySaleRecipientSupported](https://portal.thirdweb.com/references/typescript/v5/common/isSetPrimarySaleRecipientSupported): Checks if the `setPrimarySaleRecipient` method is supported by the given contract. +* [isSetRoyaltyInfoForTokenSupported](https://portal.thirdweb.com/references/typescript/v5/common/isSetRoyaltyInfoForTokenSupported): Checks if the `setRoyaltyInfoForToken` method is supported by the given contract. +* [isSymbolSupported](https://portal.thirdweb.com/references/typescript/v5/common/isSymbolSupported): Checks if the `symbol` method is supported by the given contract. +* [multicall](https://portal.thirdweb.com/references/typescript/v5/common/multicall): Prepares a transaction to call the "multicall" function on the contract. +* [name](https://portal.thirdweb.com/references/typescript/v5/common/name): Retrieves the name associated with the given contract. +* [owner](https://portal.thirdweb.com/references/typescript/v5/common/owner): Calls the "owner" function on the contract. +* [ownerUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/common/ownerUpdatedEvent): Creates an event object for the OwnerUpdated event. +* [primarySaleRecipient](https://portal.thirdweb.com/references/typescript/v5/common/primarySaleRecipient): Calls the "primarySaleRecipient" function on the contract. +* [setContractMetadata](https://portal.thirdweb.com/references/typescript/v5/common/setContractMetadata): Sets the metadata for a contract. +* [setContractURI](https://portal.thirdweb.com/references/typescript/v5/common/setContractURI): Prepares a transaction to call the "setContractURI" function on the contract. +* [setDefaultRoyaltyInfo](https://portal.thirdweb.com/references/typescript/v5/common/setDefaultRoyaltyInfo): Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. +* [setOwner](https://portal.thirdweb.com/references/typescript/v5/common/setOwner): Prepares a transaction to call the "setOwner" function on the contract. +* [setPlatformFeeInfo](https://portal.thirdweb.com/references/typescript/v5/common/setPlatformFeeInfo): Prepares a transaction to call the "setPlatformFeeInfo" function on the contract. +* [setPrimarySaleRecipient](https://portal.thirdweb.com/references/typescript/v5/common/setPrimarySaleRecipient): Prepares a transaction to call the "setPrimarySaleRecipient" function on the contract. +* [setRoyaltyInfoForToken](https://portal.thirdweb.com/references/typescript/v5/common/setRoyaltyInfoForToken): Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. +* [symbol](https://portal.thirdweb.com/references/typescript/v5/common/symbol): Retrieves the name associated with the given contract. +--- +## ENS +* [parseNftUri](https://portal.thirdweb.com/references/typescript/v5/ens/parseNftUri): Parses an NFT URI. +* [parseAvatarRecord](https://portal.thirdweb.com/references/typescript/v5/ens/parseAvatarRecord): Parses an ENS or similar avatar record. Supports NFT URIs, IPFS scheme, and HTTPS URIs. +* [resolveAddress](https://portal.thirdweb.com/references/typescript/v5/ens/resolveAddress): Resolves an ENS name to an Ethereum address. +* [resolveAvatar](https://portal.thirdweb.com/references/typescript/v5/ens/resolveAvatar): Resolves an ENS name to the avatar URL. +* [resolveL2Name](https://portal.thirdweb.com/references/typescript/v5/ens/resolveL2Name): Resolves the L2 name for a specified address. +* [resolveName](https://portal.thirdweb.com/references/typescript/v5/ens/resolveName): Resolves the primary name for a specified address. +* [resolveText](https://portal.thirdweb.com/references/typescript/v5/ens/resolveText): Resolves an ENS name and key to the specified record. +--- +## ERC1155 +* [approvalForAllEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/approvalForAllEvent): Creates an event object for the ApprovalForAll event. +* [balanceOf](https://portal.thirdweb.com/references/typescript/v5/erc1155/balanceOf): Calls the "balanceOf" function on the contract. +* [balanceOfBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/balanceOfBatch): Calls the "balanceOfBatch" function on the contract. +* [batchMetadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/batchMetadataUpdateEvent): Creates an event object for the BatchMetadataUpdate event. +* [burn](https://portal.thirdweb.com/references/typescript/v5/erc1155/burn): Prepares a transaction to call the "burn" function on the contract. +* [burnBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/burnBatch): Prepares a transaction to call the "burnBatch" function on the contract. +* [claimTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/claimTo): Claim ERC1155 NFTs to a specified address +* [createPack](https://portal.thirdweb.com/references/typescript/v5/erc1155/createPack): Prepares a transaction to call the "createPack" function on the contract. +* [encodeSafeTransferFrom](https://portal.thirdweb.com/references/typescript/v5/erc1155/encodeSafeTransferFrom): Encodes the "safeTransferFrom" function into a Hex string with its parameters. +* [freezeMetadata](https://portal.thirdweb.com/references/typescript/v5/erc1155/freezeMetadata): Prepares a transaction to call the "freezeMetadata" function on the contract. +* [generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/erc1155/generateMintSignature): Generates the payload and signature for minting an ERC1155 token. +* [getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc1155/getActiveClaimCondition): Retrieves the active claim condition. +* [getClaimConditionById](https://portal.thirdweb.com/references/typescript/v5/erc1155/getClaimConditionById): Calls the "getClaimConditionById" function on the contract. +* [getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc1155/getClaimConditions): Retrieves all claim conditions. +* [getNFT](https://portal.thirdweb.com/references/typescript/v5/erc1155/getNFT): Retrieves information about a specific ERC1155 non-fungible token (NFT). +* [getNFTs](https://portal.thirdweb.com/references/typescript/v5/erc1155/getNFTs): Retrieves an array of NFTs ("ERC1155") based on the provided options. +* [getOwnedNFTs](https://portal.thirdweb.com/references/typescript/v5/erc1155/getOwnedNFTs): Retrieves the owned ERC1155 NFTs for a given wallet address. +* [getOwnedTokenIds](https://portal.thirdweb.com/references/typescript/v5/erc1155/getOwnedTokenIds): Retrieves the owned ERC1155 tokenIds & the owned balance of each tokenId for a given wallet address. +* [isApprovedForAll](https://portal.thirdweb.com/references/typescript/v5/erc1155/isApprovedForAll): Calls the "isApprovedForAll" function on the contract. +* [isBurnSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isBurnSupported): Checks if the `burn` method is supported by the given contract. +* [isClaimToSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isClaimToSupported): Checks if the `claimTo` method is supported by the given contract. +* [isERC1155](https://portal.thirdweb.com/references/typescript/v5/erc1155/isERC1155): Check if a contract supports the ERC1155 interface. +* [isGetActiveClaimConditionSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isGetActiveClaimConditionSupported): Checks if the `getActiveClaimCondition` method is supported by the given contract. +* [isGetClaimConditionByIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isGetClaimConditionByIdSupported): Checks if the `getClaimConditionById` method is supported by the given contract. +* [isGetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isGetClaimConditionsSupported): Checks if the `getClaimConditions` method is supported by the given contract. +* [isGetNFTsSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isGetNFTsSupported): Checks if the `getNFTs` method is supported by the given contract. +* [isGetNFTSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isGetNFTSupported): Checks if the `uri` method is supported by the given contract. +* [isLazyMintSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isLazyMintSupported): Checks if the `lazyMint` method is supported by the given contract. +* [isMintAdditionalSupplyToSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isMintAdditionalSupplyToSupported): Checks if the `mintAdditionalSupplyTo` method is supported by the given contract. +* [isMintToSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isMintToSupported): Checks if the `mintTo` method is supported by the given contract. +* [isNextTokenIdToMintSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isNextTokenIdToMintSupported): Checks if the `nextTokenIdToMint` method is supported by the given contract. +* [isResetClaimEligibilitySupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isResetClaimEligibilitySupported): Checks if the `resetClaimEligibility` method is supported by the given contract. +* [isSetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isSetClaimConditionsSupported): Checks if the `setClaimConditions` method is supported by the given contract. +* [isTotalSupplySupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isTotalSupplySupported): Checks if the `totalSupply` method is supported by the given contract. +* [isUpdateTokenURISupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isUpdateTokenURISupported): Checks if the `setTokenURI` method is supported by the given contract. +* [lazyMint](https://portal.thirdweb.com/references/typescript/v5/erc1155/lazyMint): Lazily mints ERC1155 tokens. +* [metadataFrozenEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/metadataFrozenEvent): Creates an event object for the MetadataFrozen event. +* [metadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/metadataUpdateEvent): Creates an event object for the MetadataUpdate event. +* [mintAdditionalSupplyTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintAdditionalSupplyTo): Mints a "supply" number of additional ERC1155 tokens to the specified "to" address. +* [mintAdditionalSupplyToBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintAdditionalSupplyToBatch): This extension batches multiple `mintAdditionalSupplyToBatch` extensions into one single multicall. Keep in mind that there is a limit of how many NFTs you can mint per transaction. This limit varies depends on the network that you are transacting on. +* [mintTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintTo): Mints a "supply" number of new ERC1155 tokens to the specified "to" address. If the `nft` parameter is a string, it will be used as the token URI. If the `nft` parameter is a file, it will be uploaded to the storage server and the resulting URI will be used as the token URI. +* [mintToBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintToBatch): This extension batches multiple `mintTo` extensions into one single multicall. Keep in mind that there is a limit of how many NFTs you can mint per transaction. This limit varies depends on the network that you are transacting on. +* [mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintWithSignature): Mints a new ERC1155 token with the given minter signature +* [nextTokenId](https://portal.thirdweb.com/references/typescript/v5/erc1155/nextTokenId): Calls the "nextTokenId" function on the contract. +* [nextTokenIdToMint](https://portal.thirdweb.com/references/typescript/v5/erc1155/nextTokenIdToMint): Calls the "nextTokenIdToMint" function on the contract. +* [openPack](https://portal.thirdweb.com/references/typescript/v5/erc1155/openPack): Prepares a transaction to call the "openPack" function on the contract. +* [packCreatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/packCreatedEvent): Creates an event object for the PackCreated event. +* [packOpenedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/packOpenedEvent): Creates an event object for the PackOpened event. +* [packUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/packUpdatedEvent): Creates an event object for the PackUpdated event. +* [resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc1155/resetClaimEligibility): Reset the claim eligibility for all users. +* [safeBatchTransferFrom](https://portal.thirdweb.com/references/typescript/v5/erc1155/safeBatchTransferFrom): Prepares a transaction to call the "safeBatchTransferFrom" function on the contract. +* [safeTransferFrom](https://portal.thirdweb.com/references/typescript/v5/erc1155/safeTransferFrom): Prepares a transaction to call the "safeTransferFrom" function on the contract. +* [setApprovalForAll](https://portal.thirdweb.com/references/typescript/v5/erc1155/setApprovalForAll): Prepares a transaction to call the "setApprovalForAll" function on the contract. +* [setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc1155/setClaimConditions): Set the claim conditions for a ERC1155 drop +* [setTokenURI](https://portal.thirdweb.com/references/typescript/v5/erc1155/setTokenURI): Prepares a transaction to call the "setTokenURI" function on the contract. +* [tokensClaimedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/tokensClaimedEvent): Creates an event object for the TokensClaimed event. +* [tokensLazyMintedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/tokensLazyMintedEvent): Creates an event object for the TokensLazyMinted event. +* [tokensMintedWithSignatureEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/tokensMintedWithSignatureEvent): Creates an event object for the TokensMintedWithSignature event. +* [totalSupply](https://portal.thirdweb.com/references/typescript/v5/erc1155/totalSupply): Calls the "totalSupply" function on the contract. +* [transferBatchEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/transferBatchEvent): Creates an event object for the TransferBatch event. +* [transferSingleEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/transferSingleEvent): Creates an event object for the TransferSingle event. +* [updateMetadata](https://portal.thirdweb.com/references/typescript/v5/erc1155/updateMetadata): Update the metadata of the single token in an Edition Drop (DropERC1155) collection For Edition contracts, use `setTokenURI` +* [updateTokenURI](https://portal.thirdweb.com/references/typescript/v5/erc1155/updateTokenURI): This function is an abstracted layer of the [setTokenURI extension](https://portal.thirdweb.com/references/typescript/v5/erc1155/setTokenURI) , which means it uses `setTokenURI` under the hood. While the `setTokenURI` method only takes in a uri string, this extension takes in a user-friendly [NFTInput](https://portal.thirdweb.com/references/typescript/v5/NFTInput) , upload that content to IPFS and pass the IPFS URI (of said `NFTInput` ) to the underlying `setTokenURI` method. +* [uri](https://portal.thirdweb.com/references/typescript/v5/erc1155/uri): Calls the "uri" function on the contract. +--- +## ERC721 +* [isUpdateMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isUpdateMetadataSupported): Checks if the `updateMetadata` method is supported by the given contract. +* [isGetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetClaimConditionsSupported): Checks if the `getClaimConditions` method is supported by the given contract. +* [approvalEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/approvalEvent): Creates an event object for the Approval event. +* [approvalForAllEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/approvalForAllEvent): Creates an event object for the ApprovalForAll event. +* [approve](https://portal.thirdweb.com/references/typescript/v5/erc721/approve): Prepares a transaction to call the "approve" function on the contract. +* [balanceOf](https://portal.thirdweb.com/references/typescript/v5/erc721/balanceOf): Calls the "balanceOf" function on the contract. +* [burn](https://portal.thirdweb.com/references/typescript/v5/erc721/burn): Prepares a transaction to call the "burn" function on the contract. +* [claimConditionsUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/claimConditionsUpdatedEvent): Creates an event object for the ClaimConditionsUpdated event. +* [claimTo](https://portal.thirdweb.com/references/typescript/v5/erc721/claimTo): Claim ERC721 NFTs to a specified address +* [claimToBatch](https://portal.thirdweb.com/references/typescript/v5/erc721/claimToBatch): This extension batches multiple `claimTo` extensions into one single multicall. Keep in mind that there is a limit of how many NFTs you can claim per transaction. This limit varies depends on the network that you are transacting on. +* [createDelayedRevealBatch](https://portal.thirdweb.com/references/typescript/v5/erc721/createDelayedRevealBatch): Creates a batch of encrypted NFTs that can be revealed at a later time. +* [generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/erc721/generateMintSignature): Generates the payload and signature for minting an ERC721 token. +* [getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc721/getActiveClaimCondition): Retrieves the active claim condition. +* [getActiveClaimConditionId](https://portal.thirdweb.com/references/typescript/v5/erc721/getActiveClaimConditionId): Calls the "getActiveClaimConditionId" function on the contract. +* [getAllOwners](https://portal.thirdweb.com/references/typescript/v5/erc721/getAllOwners): Retrieves the owners of all ERC721 tokens within a specified range. +* [getBatchesToReveal](https://portal.thirdweb.com/references/typescript/v5/erc721/getBatchesToReveal): Retrieves the batches available to reveal in an NFT contract. +* [getClaimConditionById](https://portal.thirdweb.com/references/typescript/v5/erc721/getClaimConditionById): Calls the "getClaimConditionById" function on the contract. +* [getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc721/getClaimConditions): Retrieves all claim conditions. +* [getNFT](https://portal.thirdweb.com/references/typescript/v5/erc721/getNFT): Retrieves information about a specific ERC721 non-fungible token (NFT). +* [getNFTs](https://portal.thirdweb.com/references/typescript/v5/erc721/getNFTs): Retrieves an array of NFTs ("ERC721") based on the provided options. +* [getOwnedNFTs](https://portal.thirdweb.com/references/typescript/v5/erc721/getOwnedNFTs): Retrieves the owned NFTs for a given owner. This extension only works with ERC721 contracts that support the [tokenOfOwnerByIndex](https://portal.thirdweb.com/references/typescript/v5/erc721/tokenOfOwnerByIndex) method +* [getOwnedTokenIds](https://portal.thirdweb.com/references/typescript/v5/erc721/getOwnedTokenIds): Retrieves the token IDs owned by a specific address. +* [getTotalClaimedSupply](https://portal.thirdweb.com/references/typescript/v5/erc721/getTotalClaimedSupply): Retrieves the total claimed supply of ERC721 tokens. +* [getTotalUnclaimedSupply](https://portal.thirdweb.com/references/typescript/v5/erc721/getTotalUnclaimedSupply): Retrieves the total unclaimed supply of ERC721 tokens. +* [isApprovedForAll](https://portal.thirdweb.com/references/typescript/v5/erc721/isApprovedForAll): Calls the "isApprovedForAll" function on the contract. +* [isBurnSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isBurnSupported): Checks if the `burn` method is supported by the given contract. +* [isClaimToSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isClaimToSupported): Checks if the `claimTo` method is supported by the given contract. +* [isCreateDelayedRevealBatchSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isCreateDelayedRevealBatchSupported): Checks if the `createDelayedRevealBatch` method is supported by the given contract. +* [isERC721](https://portal.thirdweb.com/references/typescript/v5/erc721/isERC721): Check if a contract supports the ERC721 interface. +* [isGetActiveClaimConditionIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetActiveClaimConditionIdSupported): Checks if the `getActiveClaimConditionId` method is supported by the given contract. +* [isGetActiveClaimConditionSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetActiveClaimConditionSupported): Checks if the `getActiveClaimCondition` method is supported by the given contract. +* [isGetBatchesToRevealSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetBatchesToRevealSupported): Checks if the `getBatchesToReveal` method is supported by the given contract. +* [isGetClaimConditionByIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetClaimConditionByIdSupported): Checks if the `getClaimConditionById` method is supported by the given contract. +* [isGetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetClaimConditionsSupported-2): Checks if the `getClaimConditions` method is supported by the given contract. +* [isGetNFTsSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetNFTsSupported): Checks if the `getNFTs` method is supported by the given contract. +* [isGetNFTSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetNFTSupported): Checks if the `tokenURI` method is supported by the given contract. +* [isLazyMintSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isLazyMintSupported): Checks if the `lazyMint` method is supported by the given contract. +* [isMintToSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isMintToSupported): Checks if the `mintTo` method is supported by the given contract. +* [isNextTokenIdToMintSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isNextTokenIdToMintSupported): Checks if the `nextTokenIdToMint` method is supported by the given contract. +* [isResetClaimEligibilitySupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isResetClaimEligibilitySupported): Checks if the `resetClaimEligibility` method is supported by the given contract. +* [isRevealSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isRevealSupported): Checks if the `reveal` method is supported by the given contract. +* [isSetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isSetClaimConditionsSupported): Checks if the `setClaimConditions` method is supported by the given contract. +* [isSetSharedMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isSetSharedMetadataSupported): Checks if the `setSharedMetadata` method is supported by the given contract. +* [isSharedMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isSharedMetadataSupported): Checks if the `sharedMetadata` method is supported by the given contract. +* [isTotalSupplySupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isTotalSupplySupported): Checks if the `totalSupply` method is supported by the given contract. +* [isUpdateMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isUpdateMetadataSupported-2): Checks if the `updateMetadata` method is supported by the given contract. +* [isUpdateTokenURISupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isUpdateTokenURISupported): Checks if the `setTokenURI` method is supported by the given contract. +* [lazyMint](https://portal.thirdweb.com/references/typescript/v5/erc721/lazyMint): Lazily mints ERC721 tokens. +* [mintTo](https://portal.thirdweb.com/references/typescript/v5/erc721/mintTo): Mints a new ERC721 token and assigns it to the specified address. If the `nft` parameter is a string, it will be used as the token URI. If the `nft` parameter is a file, it will be uploaded to the storage server and the resulting URI will be used as the token URI. +* [mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc721/mintWithSignature): Mints a new ERC721 token with the given minter signature +* [nextTokenIdToMint](https://portal.thirdweb.com/references/typescript/v5/erc721/nextTokenIdToMint): Calls the "nextTokenIdToMint" function on the contract. +* [ownerOf](https://portal.thirdweb.com/references/typescript/v5/erc721/ownerOf): Calls the "ownerOf" function on the contract. +* [resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc721/resetClaimEligibility): Reset the claim eligibility for all users. +* [reveal](https://portal.thirdweb.com/references/typescript/v5/erc721/reveal): Reveals a previously lazy minted batch of NFTs. +* [setApprovalForAll](https://portal.thirdweb.com/references/typescript/v5/erc721/setApprovalForAll): Prepares a transaction to call the "setApprovalForAll" function on the contract. +* [setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc721/setClaimConditions): Set the claim conditions for a ERC721 drop +* [setSharedMetadata](https://portal.thirdweb.com/references/typescript/v5/erc721/setSharedMetadata): Sets the shared metadata for a OpenEdition contract. +* [setTokenURI](https://portal.thirdweb.com/references/typescript/v5/erc721/setTokenURI): Prepares a transaction to call the "setTokenURI" function on the contract. +* [sharedMetadata](https://portal.thirdweb.com/references/typescript/v5/erc721/sharedMetadata): Calls the "sharedMetadata" function on the contract. +* [sharedMetadataUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/sharedMetadataUpdatedEvent): Creates an event object for the SharedMetadataUpdated event. +* [startTokenId](https://portal.thirdweb.com/references/typescript/v5/erc721/startTokenId): Calls the "startTokenId" function on the contract. +* [tokenOfOwnerByIndex](https://portal.thirdweb.com/references/typescript/v5/erc721/tokenOfOwnerByIndex): Calls the "tokenOfOwnerByIndex" function on the contract. +* [tokensClaimedEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/tokensClaimedEvent): Creates an event object for the TokensClaimed event. +* [tokensLazyMintedEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/tokensLazyMintedEvent): Creates an event object for the TokensLazyMinted event. +* [tokensMintedWithSignatureEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/tokensMintedWithSignatureEvent): Creates an event object for the TokensMintedWithSignature event. +* [tokensOfOwner](https://portal.thirdweb.com/references/typescript/v5/erc721/tokensOfOwner): Calls the "tokensOfOwner" function on the contract. +* [tokenURI](https://portal.thirdweb.com/references/typescript/v5/erc721/tokenURI): Calls the "tokenURI" function on the contract. +* [tokenURIRevealedEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/tokenURIRevealedEvent): Creates an event object for the TokenURIRevealed event. +* [totalSupply](https://portal.thirdweb.com/references/typescript/v5/erc721/totalSupply): Calls the "totalSupply" function on the contract. +* [transferEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/transferEvent): Creates an event object for the Transfer event. +* [transferFrom](https://portal.thirdweb.com/references/typescript/v5/erc721/transferFrom): Prepares a transaction to call the "transferFrom" function on the contract. +* [updateMetadata](https://portal.thirdweb.com/references/typescript/v5/erc721/updateMetadata): Update the metadata of the single token in an NFT Drop (DropERC721) collection For NFT Collection, please use `setTokenURI` +* [updateTokenURI](https://portal.thirdweb.com/references/typescript/v5/erc721/updateTokenURI): This function is an abstracted layer of the [setTokenURI extension](https://portal.thirdweb.com/references/typescript/v5/erc721/setTokenURI) , which means it uses `setTokenURI` under the hood. While the `setTokenURI` method only takes in a uri string, this extension takes in a user-friendly [NFTInput](https://portal.thirdweb.com/references/typescript/v5/NFTInput) , upload that content to IPFS and pass the IPFS URI (of said `NFTInput` ) to the underlying `setTokenURI` method. +--- +## ERC1271 +* [checkContractWalletSignature](https://portal.thirdweb.com/references/typescript/v5/erc1271/checkContractWalletSignature): Use `verifySignature` instead +* [checkContractWalletSignedTypedData](https://portal.thirdweb.com/references/typescript/v5/erc1271/checkContractWalletSignedTypedData): Use `verifyTypedData` instead +--- +## ERC20 +* [allowance](https://portal.thirdweb.com/references/typescript/v5/erc20/allowance): Calls the "allowance" function on the contract. +* [approvalEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/approvalEvent): Creates an event object for the Approval event. +* [approve](https://portal.thirdweb.com/references/typescript/v5/erc20/approve): Approves the spending of tokens by a specific address. +* [balanceOf](https://portal.thirdweb.com/references/typescript/v5/erc20/balanceOf): Calls the "balanceOf" function on the contract. +* [burn](https://portal.thirdweb.com/references/typescript/v5/erc20/burn): Prepares a transaction to call the "burn" function on the contract. +* [burnFrom](https://portal.thirdweb.com/references/typescript/v5/erc20/burnFrom): Prepares a transaction to call the "burnFrom" function on the contract. +* [claimConditionsUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/claimConditionsUpdatedEvent): Creates an event object for the ClaimConditionsUpdated event. +* [claimTo](https://portal.thirdweb.com/references/typescript/v5/erc20/claimTo): Claim ERC20 NFTs to a specified address +* [decimals](https://portal.thirdweb.com/references/typescript/v5/erc20/decimals): Retrieves the number of decimal places for a given ERC20 contract. +* [delegate](https://portal.thirdweb.com/references/typescript/v5/erc20/delegate): Prepares a transaction to call the "delegate" function on the contract. +* [delegates](https://portal.thirdweb.com/references/typescript/v5/erc20/delegates): Calls the "delegates" function on the contract. +* [deposit](https://portal.thirdweb.com/references/typescript/v5/erc20/deposit): Calls the "deposit" function on the contract (useful to wrap ETH). +* [generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/erc20/generateMintSignature): Generates the payload and signature for minting an ERC20 token. +* [getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc20/getActiveClaimCondition): Retrieves the active claim condition. +* [getActiveClaimConditionId](https://portal.thirdweb.com/references/typescript/v5/erc20/getActiveClaimConditionId): Calls the "getActiveClaimConditionId" function on the contract. +* [getBalance](https://portal.thirdweb.com/references/typescript/v5/erc20/getBalance): Retrieves the balance of an ERC20 token for a specific address. +* [getClaimConditionById](https://portal.thirdweb.com/references/typescript/v5/erc20/getClaimConditionById): Calls the "getClaimConditionById" function on the contract. +* [getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc20/getClaimConditions): Retrieves all claim conditions. +* [getCurrencyMetadata](https://portal.thirdweb.com/references/typescript/v5/erc20/getCurrencyMetadata): Retrieves the metadata of a currency. +* [isClaimToSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isClaimToSupported): Checks if the `claimTo` method is supported by the given contract. +* [isERC20](https://portal.thirdweb.com/references/typescript/v5/erc20/isERC20): Check if a contract is an ERC20 token. +* [isGetActiveClaimConditionIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isGetActiveClaimConditionIdSupported): Checks if the `getActiveClaimConditionId` method is supported by the given contract. +* [isGetActiveClaimConditionSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isGetActiveClaimConditionSupported): Checks if the `getActiveClaimCondition` method is supported by the given contract. +* [isGetClaimConditionByIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isGetClaimConditionByIdSupported): Checks if the `getClaimConditionById` method is supported by the given contract. +* [isMintToSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isMintToSupported): Checks if the `mintTo` method is supported by the given contract. +* [isResetClaimEligibilitySupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isResetClaimEligibilitySupported): Checks if the `resetClaimEligibility` method is supported by the given contract. +* [isSetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isSetClaimConditionsSupported): Checks if the `setClaimConditions` method is supported by the given contract. +* [mintTo](https://portal.thirdweb.com/references/typescript/v5/erc20/mintTo): Mints a specified amount of tokens to a given address. +* [mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc20/mintWithSignature): Mints a new ERC20 token with the given minter signature +* [resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc20/resetClaimEligibility): Reset the claim eligibility for all users. +* [setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc20/setClaimConditions): Set the claim conditions for a ERC20 drop +* [tokensClaimedEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/tokensClaimedEvent): Creates an event object for the TokensClaimed event. +* [tokensMintedEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/tokensMintedEvent): Creates an event object for the TokensMinted event. +* [tokensMintedWithSignatureEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/tokensMintedWithSignatureEvent): Creates an event object for the TokensMintedWithSignature event. +* [totalSupply](https://portal.thirdweb.com/references/typescript/v5/erc20/totalSupply): Calls the "totalSupply" function on the contract. +* [transfer](https://portal.thirdweb.com/references/typescript/v5/erc20/transfer): Transfers ERC20 tokens from the sender's address to the specified recipient address. +* [transferBatch](https://portal.thirdweb.com/references/typescript/v5/erc20/transferBatch): Transfers a batch of ERC20 tokens from the sender's address to the specified recipient address. +* [transferEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/transferEvent): Creates an event object for the Transfer event. +* [transferFrom](https://portal.thirdweb.com/references/typescript/v5/erc20/transferFrom): Transfers a specified amount of tokens from one address to another address on the ERC20 contract. +* [withdraw](https://portal.thirdweb.com/references/typescript/v5/erc20/withdraw): Prepares a transaction to call the "withdraw" function on the contract. +--- +## ERC4337 +* [accountDeployedEvent](https://portal.thirdweb.com/references/typescript/v5/erc4337/accountDeployedEvent): Creates an event object for the AccountDeployed event. +* [addAdmin](https://portal.thirdweb.com/references/typescript/v5/erc4337/addAdmin): Adds admin permissions for a specified address. +* [addSessionKey](https://portal.thirdweb.com/references/typescript/v5/erc4337/addSessionKey): Adds session key permissions for a specified address. +* [adminUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc4337/adminUpdatedEvent): Creates an event object for the AdminUpdated event. +* [createAccount](https://portal.thirdweb.com/references/typescript/v5/erc4337/createAccount): Prepares a transaction to call the "createAccount" function on the contract. +* [getAccounts](https://portal.thirdweb.com/references/typescript/v5/erc4337/getAccounts): Calls the "getAccounts" function on the contract. +* [getAccountsOfSigner](https://portal.thirdweb.com/references/typescript/v5/erc4337/getAccountsOfSigner): Calls the "getAccountsOfSigner" function on the contract. +* [getAllAccounts](https://portal.thirdweb.com/references/typescript/v5/erc4337/getAllAccounts): Calls the "getAllAccounts" function on the contract. +* [getAllActiveSigners](https://portal.thirdweb.com/references/typescript/v5/erc4337/getAllActiveSigners): Calls the "getAllActiveSigners" function on the contract. +* [getAllAdmins](https://portal.thirdweb.com/references/typescript/v5/erc4337/getAllAdmins): Calls the "getAllAdmins" function on the contract. +* [getAllSigners](https://portal.thirdweb.com/references/typescript/v5/erc4337/getAllSigners): Calls the "getAllSigners" function on the contract. +* [getPermissionsForSigner](https://portal.thirdweb.com/references/typescript/v5/erc4337/getPermissionsForSigner): Calls the "getPermissionsForSigner" function on the contract. +* [getUserOpHash](https://portal.thirdweb.com/references/typescript/v5/erc4337/getUserOpHash): Calls the "getUserOpHash" function on the contract. +* [isAccountDeployed](https://portal.thirdweb.com/references/typescript/v5/erc4337/isAccountDeployed): Adds admin permissions for a specified address. +* [isActiveSigner](https://portal.thirdweb.com/references/typescript/v5/erc4337/isActiveSigner): Calls the "isActiveSigner" function on the contract. +* [isAddAdminSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isAddAdminSupported): Checks if the `isAddAdminSupported` method is supported by the given contract. +* [isAddSessionKeySupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isAddSessionKeySupported): Checks if the `isAddSessionKeySupported` method is supported by the given contract. +* [isAdmin](https://portal.thirdweb.com/references/typescript/v5/erc4337/isAdmin): Calls the "isAdmin" function on the contract. +* [isCreateAccountSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isCreateAccountSupported): Checks if the `createAccount` method is supported by the given contract. +* [isGetAccountsOfSignerSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isGetAccountsOfSignerSupported): Checks if the `getAccountsOfSigner` method is supported by the given contract. +* [isGetAccountsSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isGetAccountsSupported): Checks if the `getAccounts` method is supported by the given contract. +* [isGetAllAccountsSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isGetAllAccountsSupported): Checks if the `getAllAccounts` method is supported by the given contract. +* [isGetAllActiveSignersSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isGetAllActiveSignersSupported): Checks if the `getAllActiveSigners` method is supported by the given contract. +* [isGetAllAdminsSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isGetAllAdminsSupported): Checks if the `getAllAdmins` method is supported by the given contract. +* [isGetAllSignersSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isGetAllSignersSupported): Checks if the `getAllSigners` method is supported by the given contract. +* [isIsAccountDeployedSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isIsAccountDeployedSupported): Checks if the `getAddress` method is supported by the given contract. +* [isIsActiveSignerSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isIsActiveSignerSupported): Checks if the `isActiveSigner` method is supported by the given contract. +* [isIsAdminSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isIsAdminSupported): Checks if the `isAdmin` method is supported by the given contract. +* [isRegistered](https://portal.thirdweb.com/references/typescript/v5/erc4337/isRegistered): Calls the "isRegistered" function on the contract. +* [isRemoveAdminSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isRemoveAdminSupported): Checks if the `isRemoveAdminSupported` method is supported by the given contract. +* [isRemoveSessionKeySupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isRemoveSessionKeySupported): Checks if the `isRemoveSessionKeySupported` method is supported by the given contract. +* [isTotalAccountsSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isTotalAccountsSupported): Checks if the `totalAccounts` method is supported by the given contract. +* [isValidateUserOpSupported](https://portal.thirdweb.com/references/typescript/v5/erc4337/isValidateUserOpSupported): Checks if the `validateUserOp` method is supported by the given contract. +* [predictAccountAddress](https://portal.thirdweb.com/references/typescript/v5/erc4337/predictAccountAddress): Calls the "getAddress" function on the contract. +* [removeAdmin](https://portal.thirdweb.com/references/typescript/v5/erc4337/removeAdmin): Removes admin permissions for a specified address. +* [removeSessionKey](https://portal.thirdweb.com/references/typescript/v5/erc4337/removeSessionKey): Removes session key permissions for a specified address. +* [signerPermissionsUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc4337/signerPermissionsUpdatedEvent): Creates an event object for the SignerPermissionsUpdated event. +* [simulateHandleOp](https://portal.thirdweb.com/references/typescript/v5/erc4337/simulateHandleOp): Prepares a transaction to call the "simulateHandleOp" function on the contract. +* [totalAccounts](https://portal.thirdweb.com/references/typescript/v5/erc4337/totalAccounts): Calls the "totalAccounts" function on the contract. +* [userOperationEventEvent](https://portal.thirdweb.com/references/typescript/v5/erc4337/userOperationEventEvent): Creates an event object for the UserOperationEvent event. +* [userOperationRevertReasonEvent](https://portal.thirdweb.com/references/typescript/v5/erc4337/userOperationRevertReasonEvent): Creates an event object for the UserOperationRevertReason event. +--- +## ERC4626 +* [asset](https://portal.thirdweb.com/references/typescript/v5/erc4626/asset): Calls the "asset" function on the contract. +* [convertToAssets](https://portal.thirdweb.com/references/typescript/v5/erc4626/convertToAssets): Calls the "convertToAssets" function on the contract. +* [convertToShares](https://portal.thirdweb.com/references/typescript/v5/erc4626/convertToShares): Calls the "convertToShares" function on the contract. +* [deposit](https://portal.thirdweb.com/references/typescript/v5/erc4626/deposit): Prepares a transaction to call the "deposit" function on the contract. +* [depositEvent](https://portal.thirdweb.com/references/typescript/v5/erc4626/depositEvent): Creates an event object for the Deposit event. +* [maxDeposit](https://portal.thirdweb.com/references/typescript/v5/erc4626/maxDeposit): Calls the "maxDeposit" function on the contract. +* [maxMint](https://portal.thirdweb.com/references/typescript/v5/erc4626/maxMint): Calls the "maxMint" function on the contract. +* [maxRedeem](https://portal.thirdweb.com/references/typescript/v5/erc4626/maxRedeem): Calls the "maxRedeem" function on the contract. +* [maxWithdraw](https://portal.thirdweb.com/references/typescript/v5/erc4626/maxWithdraw): Calls the "maxWithdraw" function on the contract. +* [mint](https://portal.thirdweb.com/references/typescript/v5/erc4626/mint): Prepares a transaction to call the "mint" function on the contract. +* [previewDeposit](https://portal.thirdweb.com/references/typescript/v5/erc4626/previewDeposit): Calls the "previewDeposit" function on the contract. +* [previewMint](https://portal.thirdweb.com/references/typescript/v5/erc4626/previewMint): Calls the "previewMint" function on the contract. +* [previewRedeem](https://portal.thirdweb.com/references/typescript/v5/erc4626/previewRedeem): Calls the "previewRedeem" function on the contract. +* [previewWithdraw](https://portal.thirdweb.com/references/typescript/v5/erc4626/previewWithdraw): Calls the "previewWithdraw" function on the contract. +* [redeem](https://portal.thirdweb.com/references/typescript/v5/erc4626/redeem): Prepares a transaction to call the "redeem" function on the contract. +* [totalAssets](https://portal.thirdweb.com/references/typescript/v5/erc4626/totalAssets): Calls the "totalAssets" function on the contract. +* [withdraw](https://portal.thirdweb.com/references/typescript/v5/erc4626/withdraw): Prepares a transaction to call the "withdraw" function on the contract. +* [withdrawEvent](https://portal.thirdweb.com/references/typescript/v5/erc4626/withdrawEvent): Creates an event object for the Withdraw event. +--- +## FARCASTER +* [addSigner](https://portal.thirdweb.com/references/typescript/v5/farcaster/addSigner): Adds farcaster signer for the given account. +* [addSignerFor](https://portal.thirdweb.com/references/typescript/v5/farcaster/addSignerFor): Adds farcaster signer for a given user. Helpful if you want to cover the gas fee for a user. +* [createEd25519Keypair](https://portal.thirdweb.com/references/typescript/v5/farcaster/createEd25519Keypair): Generates an Ed25519 keypair to be used as an account signer. +* [encodeSignedKeyRequestMetadata](https://portal.thirdweb.com/references/typescript/v5/farcaster/encodeSignedKeyRequestMetadata): Encodes the signed key request metadata into a hexadecimal string. This function takes in the request signer's address, the key request signature, the request Fid, and the deadline, and returns the encoded ABI parameters as a hexadecimal string. It's used to prepare the metadata for transactions involving signed key requests. +* [getAddData](https://portal.thirdweb.com/references/typescript/v5/farcaster/getAddData): Prepares the data required for signing an Add message according to EIP-712. +* [getBundler](https://portal.thirdweb.com/references/typescript/v5/farcaster/getBundler): Retrieves the Bundler contract. +* [getFid](https://portal.thirdweb.com/references/typescript/v5/farcaster/getFid): Retrieves the current fid for an account. +* [getIdGateway](https://portal.thirdweb.com/references/typescript/v5/farcaster/getIdGateway): Retrieves the IdGateway contract. +* [getIdRegistry](https://portal.thirdweb.com/references/typescript/v5/farcaster/getIdRegistry): Retrieves the IdRegistry contract. +* [getKeyGateway](https://portal.thirdweb.com/references/typescript/v5/farcaster/getKeyGateway): Retrieves the KeyGateway contract. +* [getKeyRequestData](https://portal.thirdweb.com/references/typescript/v5/farcaster/getKeyRequestData): Prepares the data required for signing a key request using EIP-712 typed data signing. This includes the domain, types, primary type, and the message to be signed. +* [getNonce](https://portal.thirdweb.com/references/typescript/v5/farcaster/getNonce): Retrieves the current key gateway nonce for an account. +* [getRegisterData](https://portal.thirdweb.com/references/typescript/v5/farcaster/getRegisterData): Constructs the data required for signing a register message in the Farcaster ID Gateway. This includes the EIP-712 domain, types, and the message to be signed. +* [getRegistrationPrice](https://portal.thirdweb.com/references/typescript/v5/farcaster/getRegistrationPrice): Retrieves the current cost to register a Farcaster fid in wei. +* [getSignedKeyRequestMetadata](https://portal.thirdweb.com/references/typescript/v5/farcaster/getSignedKeyRequestMetadata): Generates the signed key request metadata to add a signer to an account. This function can either sign a new key request using an account object or use an existing key request signature. It prepares the metadata necessary for transactions involving signed key requests. +* [getStoragePrice](https://portal.thirdweb.com/references/typescript/v5/farcaster/getStoragePrice): Retrieves the current cost to register a Farcaster fid in wei. +* [getStorageRegistry](https://portal.thirdweb.com/references/typescript/v5/farcaster/getStorageRegistry): Retrieves the StorageRegistry contract. +* [getUsdRegistrationPrice](https://portal.thirdweb.com/references/typescript/v5/farcaster/getUsdRegistrationPrice): Retrieves the current cost to register a Farcaster fid in USD. +* [getUsdStoragePrice](https://portal.thirdweb.com/references/typescript/v5/farcaster/getUsdStoragePrice): Retrieves the current cost to register a Farcaster fid in USD. +* [registerFid](https://portal.thirdweb.com/references/typescript/v5/farcaster/registerFid): Registers a Farcaster fid for the given wallet. +* [registerFidAndSigner](https://portal.thirdweb.com/references/typescript/v5/farcaster/registerFidAndSigner): Registers a Farcaster fid and signer for the given wallet using the provided app account. +* [rentStorage](https://portal.thirdweb.com/references/typescript/v5/farcaster/rentStorage): Rent storage for the provided farcaster fid. +* [signAdd](https://portal.thirdweb.com/references/typescript/v5/farcaster/signAdd): Signs an Add message using the account's signTypedData method. +* [signKeyRequest](https://portal.thirdweb.com/references/typescript/v5/farcaster/signKeyRequest): Signs a key request message using EIP-712 typed data signing. This function prepares the data for signing, signs it with the provided account, and returns the signature. +* [signRegister](https://portal.thirdweb.com/references/typescript/v5/farcaster/signRegister): Signs the register message for Farcaster ID Gateway. +* [idGateway](https://portal.thirdweb.com/references/typescript/v5/farcaster/idGateway): Calls the "idGateway" function on the contract. +* [keyGateway](https://portal.thirdweb.com/references/typescript/v5/farcaster/keyGateway): Calls the "keyGateway" function on the contract. +* [price](https://portal.thirdweb.com/references/typescript/v5/farcaster/price): Calls the "price" function on the contract. +* [register](https://portal.thirdweb.com/references/typescript/v5/farcaster/register): Prepares a transaction to call the "register" function on the contract. +* [idRegistry](https://portal.thirdweb.com/references/typescript/v5/farcaster/idRegistry): Calls the "idRegistry" function on the contract. +* [price](https://portal.thirdweb.com/references/typescript/v5/farcaster/price-2): Calls the "price" function on the contract. +* [register](https://portal.thirdweb.com/references/typescript/v5/farcaster/register-2): Prepares a transaction to call the "register" function on the contract. +* [REGISTER_TYPEHASH](https://portal.thirdweb.com/references/typescript/v5/farcaster/REGISTER_TYPEHASH): Calls the "REGISTER\_TYPEHASH" function on the contract. +* [registerFor](https://portal.thirdweb.com/references/typescript/v5/farcaster/registerFor): Prepares a transaction to call the "registerFor" function on the contract. +* [setStorageRegistryEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setStorageRegistryEvent): Creates an event object for the SetStorageRegistry event. +* [storageRegistry](https://portal.thirdweb.com/references/typescript/v5/farcaster/storageRegistry): Calls the "storageRegistry" function on the contract. +* [adminResetEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/adminResetEvent): Creates an event object for the AdminReset event. +* [CHANGE_RECOVERY_ADDRESS_TYPEHASH](https://portal.thirdweb.com/references/typescript/v5/farcaster/CHANGE_RECOVERY_ADDRESS_TYPEHASH): Calls the "CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH" function on the contract. +* [changeRecoveryAddress](https://portal.thirdweb.com/references/typescript/v5/farcaster/changeRecoveryAddress): Prepares a transaction to call the "changeRecoveryAddress" function on the contract. +* [changeRecoveryAddressEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/changeRecoveryAddressEvent): Creates an event object for the ChangeRecoveryAddress event. +* [custodyOf](https://portal.thirdweb.com/references/typescript/v5/farcaster/custodyOf): Calls the "custodyOf" function on the contract. +* [freezeIdGatewayEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/freezeIdGatewayEvent): Creates an event object for the FreezeIdGateway event. +* [gatewayFrozen](https://portal.thirdweb.com/references/typescript/v5/farcaster/gatewayFrozen): Calls the "gatewayFrozen" function on the contract. +* [idCounter](https://portal.thirdweb.com/references/typescript/v5/farcaster/idCounter): Calls the "idCounter" function on the contract. +* [idGateway](https://portal.thirdweb.com/references/typescript/v5/farcaster/idGateway-2): Calls the "idGateway" function on the contract. +* [idOf](https://portal.thirdweb.com/references/typescript/v5/farcaster/idOf): Calls the "idOf" function on the contract. +* [recover](https://portal.thirdweb.com/references/typescript/v5/farcaster/recover): Prepares a transaction to call the "recover" function on the contract. +* [recoverEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/recoverEvent): Creates an event object for the Recover event. +* [recoverFor](https://portal.thirdweb.com/references/typescript/v5/farcaster/recoverFor): Prepares a transaction to call the "recoverFor" function on the contract. +* [recoveryOf](https://portal.thirdweb.com/references/typescript/v5/farcaster/recoveryOf): Calls the "recoveryOf" function on the contract. +* [registerEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/registerEvent): Creates an event object for the Register event. +* [setIdCounterEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setIdCounterEvent): Creates an event object for the SetIdCounter event. +* [setIdGatewayEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setIdGatewayEvent): Creates an event object for the SetIdGateway event. +* [transfer](https://portal.thirdweb.com/references/typescript/v5/farcaster/transfer): Prepares a transaction to call the "transfer" function on the contract. +* [TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH](https://portal.thirdweb.com/references/typescript/v5/farcaster/TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH): Calls the "TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH" function on the contract. +* [TRANSFER_TYPEHASH](https://portal.thirdweb.com/references/typescript/v5/farcaster/TRANSFER_TYPEHASH): Calls the "TRANSFER\_TYPEHASH" function on the contract. +* [transferAndChangeRecovery](https://portal.thirdweb.com/references/typescript/v5/farcaster/transferAndChangeRecovery): Prepares a transaction to call the "transferAndChangeRecovery" function on the contract. +* [transferEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/transferEvent): Creates an event object for the Transfer event. +* [transferFor](https://portal.thirdweb.com/references/typescript/v5/farcaster/transferFor): Prepares a transaction to call the "transferFor" function on the contract. +* [verifyFidSignature](https://portal.thirdweb.com/references/typescript/v5/farcaster/verifyFidSignature): Calls the "verifyFidSignature" function on the contract. +* [add](https://portal.thirdweb.com/references/typescript/v5/farcaster/add): Prepares a transaction to call the "add" function on the contract. +* [ADD_TYPEHASH](https://portal.thirdweb.com/references/typescript/v5/farcaster/ADD_TYPEHASH): Calls the "ADD\_TYPEHASH" function on the contract. +* [addFor](https://portal.thirdweb.com/references/typescript/v5/farcaster/addFor): Prepares a transaction to call the "addFor" function on the contract. +* [keyRegistry](https://portal.thirdweb.com/references/typescript/v5/farcaster/keyRegistry): Calls the "keyRegistry" function on the contract. +* [nonces](https://portal.thirdweb.com/references/typescript/v5/farcaster/nonces): Calls the "nonces" function on the contract. +* [addEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/addEvent): Creates an event object for the Add event. +* [adminResetEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/adminResetEvent-2): Creates an event object for the AdminReset event. +* [freezeKeyGatewayEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/freezeKeyGatewayEvent): Creates an event object for the FreezeKeyGateway event. +* [gatewayFrozen](https://portal.thirdweb.com/references/typescript/v5/farcaster/gatewayFrozen-2): Calls the "gatewayFrozen" function on the contract. +* [idRegistry](https://portal.thirdweb.com/references/typescript/v5/farcaster/idRegistry-2): Calls the "idRegistry" function on the contract. +* [keyAt](https://portal.thirdweb.com/references/typescript/v5/farcaster/keyAt): Calls the "keyAt" function on the contract. +* [keyDataOf](https://portal.thirdweb.com/references/typescript/v5/farcaster/keyDataOf): Calls the "keyDataOf" function on the contract. +* [keyGateway](https://portal.thirdweb.com/references/typescript/v5/farcaster/keyGateway-2): Calls the "keyGateway" function on the contract. +* [keysOf](https://portal.thirdweb.com/references/typescript/v5/farcaster/keysOf): Calls the "keysOf" function on the contract. +* [maxKeysPerFid](https://portal.thirdweb.com/references/typescript/v5/farcaster/maxKeysPerFid): Calls the "maxKeysPerFid" function on the contract. +* [remove](https://portal.thirdweb.com/references/typescript/v5/farcaster/remove): Prepares a transaction to call the "remove" function on the contract. +* [REMOVE_TYPEHASH](https://portal.thirdweb.com/references/typescript/v5/farcaster/REMOVE_TYPEHASH): Calls the "REMOVE\_TYPEHASH" function on the contract. +* [removeEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/removeEvent): Creates an event object for the Remove event. +* [removeFor](https://portal.thirdweb.com/references/typescript/v5/farcaster/removeFor): Prepares a transaction to call the "removeFor" function on the contract. +* [setIdRegistryEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setIdRegistryEvent): Creates an event object for the SetIdRegistry event. +* [setKeyGatewayEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setKeyGatewayEvent): Creates an event object for the SetKeyGateway event. +* [setMaxKeysPerFidEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setMaxKeysPerFidEvent): Creates an event object for the SetMaxKeysPerFid event. +* [setValidatorEvent](https://portal.thirdweb.com/references/typescript/v5/farcaster/setValidatorEvent): Creates an event object for the SetValidator event. +* [totalKeys](https://portal.thirdweb.com/references/typescript/v5/farcaster/totalKeys): Calls the "totalKeys" function on the contract. +* [batchRent](https://portal.thirdweb.com/references/typescript/v5/farcaster/batchRent): Prepares a transaction to call the "batchRent" function on the contract. +* [deprecationTimestamp](https://portal.thirdweb.com/references/typescript/v5/farcaster/deprecationTimestamp): Calls the "deprecationTimestamp" function on the contract. +* [maxUnits](https://portal.thirdweb.com/references/typescript/v5/farcaster/maxUnits): Calls the "maxUnits" function on the contract. +* [price](https://portal.thirdweb.com/references/typescript/v5/farcaster/price-3): Calls the "price" function on the contract. +* [rent](https://portal.thirdweb.com/references/typescript/v5/farcaster/rent): Prepares a transaction to call the "rent" function on the contract. +* [rentedUnits](https://portal.thirdweb.com/references/typescript/v5/farcaster/rentedUnits): Calls the "rentedUnits" function on the contract. +* [unitPrice](https://portal.thirdweb.com/references/typescript/v5/farcaster/unitPrice): Calls the "unitPrice" function on the contract. +* [usdUnitPrice](https://portal.thirdweb.com/references/typescript/v5/farcaster/usdUnitPrice): Calls the "usdUnitPrice" function on the contract. +--- +## LENS +* [exists](https://portal.thirdweb.com/references/typescript/v5/lens/exists): Calls the "exists" function on the contract. +* [getContentURI](https://portal.thirdweb.com/references/typescript/v5/lens/getContentURI): Calls the "getContentURI" function on the contract. +* [getDefaultHandle](https://portal.thirdweb.com/references/typescript/v5/lens/getDefaultHandle): Calls the "getDefaultHandle" function on the contract. +* [getFollowData](https://portal.thirdweb.com/references/typescript/v5/lens/getFollowData): Calls the "getFollowData" function on the contract. +* [getFollowerCount](https://portal.thirdweb.com/references/typescript/v5/lens/getFollowerCount): Calls the "getFollowerCount" function on the contract. +* [getFollowerProfileId](https://portal.thirdweb.com/references/typescript/v5/lens/getFollowerProfileId): Calls the "getFollowerProfileId" function on the contract. +* [getFollowTokenId](https://portal.thirdweb.com/references/typescript/v5/lens/getFollowTokenId): Calls the "getFollowTokenId" function on the contract. +* [getFullProfile](https://portal.thirdweb.com/references/typescript/v5/lens/getFullProfile): Return the profile data _with Lens handle_ and optional join date +* [getHandle](https://portal.thirdweb.com/references/typescript/v5/lens/getHandle): Calls the "getHandle" function on the contract. +* [getHandleFromProfileId](https://portal.thirdweb.com/references/typescript/v5/lens/getHandleFromProfileId): Return the Lens handle of a profile in the format: lens/@`` +* [getHandleTokenURIContract](https://portal.thirdweb.com/references/typescript/v5/lens/getHandleTokenURIContract): Calls the "getHandleTokenURIContract" function on the contract. +* [getLocalName](https://portal.thirdweb.com/references/typescript/v5/lens/getLocalName): Calls the "getLocalName" function on the contract. +* [getModuleTypes](https://portal.thirdweb.com/references/typescript/v5/lens/getModuleTypes): Calls the "getModuleTypes" function on the contract. +* [getOriginalFollowTimestamp](https://portal.thirdweb.com/references/typescript/v5/lens/getOriginalFollowTimestamp): Calls the "getOriginalFollowTimestamp" function on the contract. +* [getProfile](https://portal.thirdweb.com/references/typescript/v5/lens/getProfile): Calls the "getProfile" function on the contract. +* [getProfileIdAllowedToRecover](https://portal.thirdweb.com/references/typescript/v5/lens/getProfileIdAllowedToRecover): Calls the "getProfileIdAllowedToRecover" function on the contract. +* [getProfileIdByHandleHash](https://portal.thirdweb.com/references/typescript/v5/lens/getProfileIdByHandleHash): Calls the "getProfileIdByHandleHash" function on the contract. +* [getProfileMetadata](https://portal.thirdweb.com/references/typescript/v5/lens/getProfileMetadata): Download user lens profile from Arweave This method does NOT give you the user handle & join-time - consider using `getFullProfileData` instead It is useful & cost efficient if you only want to get user's name, bio, picture, coverPicture etc. +* [getPublication](https://portal.thirdweb.com/references/typescript/v5/lens/getPublication): Calls the "getPublication" function on the contract. +* [getTokenId](https://portal.thirdweb.com/references/typescript/v5/lens/getTokenId): Calls the "getTokenId" function on the contract. +* [isErc20CurrencyRegistered](https://portal.thirdweb.com/references/typescript/v5/lens/isErc20CurrencyRegistered): Calls the "isErc20CurrencyRegistered" function on the contract. +* [isFollowing](https://portal.thirdweb.com/references/typescript/v5/lens/isFollowing): Calls the "isFollowing" function on the contract. +* [isModuleRegistered](https://portal.thirdweb.com/references/typescript/v5/lens/isModuleRegistered): Calls the "isModuleRegistered" function on the contract. +* [isModuleRegisteredAs](https://portal.thirdweb.com/references/typescript/v5/lens/isModuleRegisteredAs): Calls the "isModuleRegisteredAs" function on the contract. +* [mintTimestampOf](https://portal.thirdweb.com/references/typescript/v5/lens/mintTimestampOf): Calls the "mintTimestampOf" function on the contract. +* [mintTimestampOfFollowNFT](https://portal.thirdweb.com/references/typescript/v5/lens/mintTimestampOfFollowNFT): Calls the "mintTimestampOf" function on the contract. +* [nonces](https://portal.thirdweb.com/references/typescript/v5/lens/nonces): Calls the "nonces" function on the contract. +* [resolve](https://portal.thirdweb.com/references/typescript/v5/lens/resolve): Calls the "resolve" function on the contract. +* [resolveAddress](https://portal.thirdweb.com/references/typescript/v5/lens/resolveAddress): Take in a Lens handle or local-name and return the wallet address behind that handle/local-name. For example, "lens/vitalik" is a handle, with "lens" being the namespace and "vitalik" being the local name +* [tokenDataOf](https://portal.thirdweb.com/references/typescript/v5/lens/tokenDataOf): Calls the "tokenDataOf" function on the contract. +--- +## MARKETPLACE +* [acceptedOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/acceptedOfferEvent): Creates an event object for the AcceptedOffer event. +* [acceptOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/acceptOffer): Accepts an offer after performing necessary checks and validations. Throws an error if the offer is not active, the offeror's balance is insufficient, or the offeror's allowance is insufficient. +* [approveBuyerForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/approveBuyerForListing): Prepares a transaction to call the "approveBuyerForListing" function on the contract. +* [approveCurrencyForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/approveCurrencyForListing): Prepares a transaction to call the "approveCurrencyForListing" function on the contract. +* [auctionClosedEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/auctionClosedEvent): Creates an event object for the AuctionClosed event. +* [bidInAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/bidInAuction): Places a bid in an English auction. +* [buyerApprovedForListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyerApprovedForListingEvent): Creates an event object for the BuyerApprovedForListing event. +* [buyFromListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyFromListing): Buys a listing from the marketplace. +* [buyoutAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyoutAuction): Buys out an English auction. +* [cancelAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelAuction): Cancels an auction by providing the necessary options. +* [cancelledAuctionEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledAuctionEvent): Creates an event object for the CancelledAuction event. +* [cancelledListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledListingEvent): Creates an event object for the CancelledListing event. +* [cancelledOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledOfferEvent): Creates an event object for the CancelledOffer event. +* [cancelListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelListing): Prepares a transaction to call the "cancelListing" function on the contract. +* [cancelOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelOffer): Prepares a transaction to call the "cancelOffer" function on the contract. +* [collectAuctionPayout](https://portal.thirdweb.com/references/typescript/v5/marketplace/collectAuctionPayout): Prepares a transaction to call the "collectAuctionPayout" function on the contract. +* [collectAuctionTokens](https://portal.thirdweb.com/references/typescript/v5/marketplace/collectAuctionTokens): Prepares a transaction to call the "collectAuctionTokens" function on the contract. +* [createAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/createAuction): Creates an auction. +* [createListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/createListing): Creates a direct listing. +* [currencyApprovedForListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/currencyApprovedForListingEvent): Creates an event object for the CurrencyApprovedForListing event. +* [currencyPriceForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/currencyPriceForListing): Retrieves the currency price for a listing. +* [executeSale](https://portal.thirdweb.com/references/typescript/v5/marketplace/executeSale): Executes a sale for an English auction. +* [getAllAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllAuctions): Retrieves all auctions based on the provided options. +* [getAllListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllListings): Retrieves all direct listings based on the provided options. +* [getAllOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllOffers): Retrieves all offers based on the provided options. +* [getAllValidAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidAuctions): Retrieves all valid auctions based on the provided options. +* [getAllValidListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidListings): Retrieves all valid direct listings based on the provided options. +* [getAllValidOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidOffers): Retrieves all valid offers based on the provided options. +* [getAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAuction): Retrieves an auction listing based on the provided options. +* [getListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/getListing): Retrieves a direct listing based on the provided options. +* [getOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/getOffer): Retrieves an offer based on the provided options. +* [getWinningBid](https://portal.thirdweb.com/references/typescript/v5/marketplace/getWinningBid): Retrieves the winning bid information for a given auction. +* [isBidInAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBidInAuctionSupported): Checks if the `bidInAuction` method is supported by the given contract. +* [isBuyerApprovedForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBuyerApprovedForListing): Checks if the buyer is approved for a listing. +* [isBuyFromListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBuyFromListingSupported): Checks if the `buyFromListing` method is supported by the given contract. +* [isCancelAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCancelAuctionSupported): Checks if the `cancelAuction` method is supported by the given contract. +* [isCancelListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCancelListingSupported): Checks if the `cancelListing` method is supported by the given contract. +* [isCreateAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCreateAuctionSupported): Checks if the `createAuction` method is supported by the given contract. +* [isCreateListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCreateListingSupported): Checks if the `createListing` method is supported by the given contract. +* [isCurrencyApprovedForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCurrencyApprovedForListing): Calls the "isCurrencyApprovedForListing" function on the contract. +* [isGetAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetAuctionSupported): Checks if the `getAuction` method is supported by the given contract. +* [isGetListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetListingSupported): Checks if the `isGetListingSupported` method is supported by the given contract. +* [isGetWinningBidSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetWinningBidSupported): Checks if the `getWinningBid` method is supported by the given contract. +* [isNewWinningBid](https://portal.thirdweb.com/references/typescript/v5/marketplace/isNewWinningBid): Calls the "isNewWinningBid" function on the contract. +* [makeOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/makeOffer): Makes an offer for any asset (ERC721 or ERC1155). +* [newAuctionEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newAuctionEvent): Creates an event object for the NewAuction event. +* [newBidEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newBidEvent): Creates an event object for the NewBid event. +* [newListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newListingEvent): Creates an event object for the NewListing event. +* [newOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newOfferEvent): Creates an event object for the NewOffer event. +* [newSaleEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newSaleEvent): Creates an event object for the NewSale event. +* [totalAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalAuctions): Calls the "totalAuctions" function on the contract. +* [totalListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalListings): Calls the "totalListings" function on the contract. +* [totalOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalOffers): Calls the "totalOffers" function on the contract. +* [updatedListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/updatedListingEvent): Creates an event object for the UpdatedListing event. +* [updateListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/updateListing): Updates an existing direct listing. +--- +## MULTICALL3 +* [aggregate](https://portal.thirdweb.com/references/typescript/v5/multicall3/aggregate): Prepares a transaction to call the "aggregate" function on the contract. +* [aggregate3](https://portal.thirdweb.com/references/typescript/v5/multicall3/aggregate3): Prepares a transaction to call the "aggregate3" function on the contract. +* [aggregate3Value](https://portal.thirdweb.com/references/typescript/v5/multicall3/aggregate3Value): Prepares a transaction to call the "aggregate3Value" function on the contract. +* [blockAndAggregate](https://portal.thirdweb.com/references/typescript/v5/multicall3/blockAndAggregate): Prepares a transaction to call the "blockAndAggregate" function on the contract. +* [getBasefee](https://portal.thirdweb.com/references/typescript/v5/multicall3/getBasefee): Calls the "getBasefee" function on the contract. +* [getBlockHash](https://portal.thirdweb.com/references/typescript/v5/multicall3/getBlockHash): Calls the "getBlockHash" function on the contract. +* [getBlockNumber](https://portal.thirdweb.com/references/typescript/v5/multicall3/getBlockNumber): Calls the "getBlockNumber" function on the contract. +* [getChainId](https://portal.thirdweb.com/references/typescript/v5/multicall3/getChainId): Calls the "getChainId" function on the contract. +* [getCurrentBlockCoinbase](https://portal.thirdweb.com/references/typescript/v5/multicall3/getCurrentBlockCoinbase): Calls the "getCurrentBlockCoinbase" function on the contract. +* [getCurrentBlockDifficulty](https://portal.thirdweb.com/references/typescript/v5/multicall3/getCurrentBlockDifficulty): Calls the "getCurrentBlockDifficulty" function on the contract. +* [getCurrentBlockGasLimit](https://portal.thirdweb.com/references/typescript/v5/multicall3/getCurrentBlockGasLimit): Calls the "getCurrentBlockGasLimit" function on the contract. +* [getCurrentBlockTimestamp](https://portal.thirdweb.com/references/typescript/v5/multicall3/getCurrentBlockTimestamp): Calls the "getCurrentBlockTimestamp" function on the contract. +* [getEthBalance](https://portal.thirdweb.com/references/typescript/v5/multicall3/getEthBalance): Calls the "getEthBalance" function on the contract. +* [getLastBlockHash](https://portal.thirdweb.com/references/typescript/v5/multicall3/getLastBlockHash): Calls the "getLastBlockHash" function on the contract. +* [tryAggregate](https://portal.thirdweb.com/references/typescript/v5/multicall3/tryAggregate): Prepares a transaction to call the "tryAggregate" function on the contract. +* [tryBlockAndAggregate](https://portal.thirdweb.com/references/typescript/v5/multicall3/tryBlockAndAggregate): Prepares a transaction to call the "tryBlockAndAggregate" function on the contract. +--- +## PACK +* [createNewPack](https://portal.thirdweb.com/references/typescript/v5/pack/createNewPack): Reference for createNewPack +* [createPack](https://portal.thirdweb.com/references/typescript/v5/pack/createPack): Prepares a transaction to call the "createPack" function on the contract. +* [getPackContents](https://portal.thirdweb.com/references/typescript/v5/pack/getPackContents): Calls the "getPackContents" function on the contract. +* [getTokenCountOfBundle](https://portal.thirdweb.com/references/typescript/v5/pack/getTokenCountOfBundle): Calls the "getTokenCountOfBundle" function on the contract. +* [openPack](https://portal.thirdweb.com/references/typescript/v5/pack/openPack): Prepares a transaction to call the "openPack" function on the contract. +* [packCreatedEvent](https://portal.thirdweb.com/references/typescript/v5/pack/packCreatedEvent): Creates an event object for the PackCreated event. +* [packOpenedEvent](https://portal.thirdweb.com/references/typescript/v5/pack/packOpenedEvent): Creates an event object for the PackOpened event. +* [packUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/pack/packUpdatedEvent): Creates an event object for the PackUpdated event. +--- +## PERMISSIONS +* [getAllRoleMembers](https://portal.thirdweb.com/references/typescript/v5/permissions/getAllRoleMembers): Retrieves all members of a specific role. +* [getRoleAdmin](https://portal.thirdweb.com/references/typescript/v5/permissions/getRoleAdmin): Gets the admin of a role. +* [getRoleHash](https://portal.thirdweb.com/references/typescript/v5/permissions/getRoleHash): Get a hex value of a smart contract role You need the hex value to interact with the smart contracts. +* [getRoleMember](https://portal.thirdweb.com/references/typescript/v5/permissions/getRoleMember): Retrieves a specific member of a specific role. +* [getRoleMemberCount](https://portal.thirdweb.com/references/typescript/v5/permissions/getRoleMemberCount): Retrieves the number of members of a specific role. +* [grantRole](https://portal.thirdweb.com/references/typescript/v5/permissions/grantRole): Grants a role to a target account. +* [hasRole](https://portal.thirdweb.com/references/typescript/v5/permissions/hasRole): Checks if the target account has the role. +* [isGetAllRoleMembersSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isGetAllRoleMembersSupported): Checks if the `getAllRoleMembers` method is supported by the given contract. +* [isGetRoleAdminSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isGetRoleAdminSupported): Checks if the `getRoleAdmin` method is supported by the given contract. +* [isGetRoleMemberCountSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isGetRoleMemberCountSupported): Checks if the `getRoleMemberCount` method is supported by the given contract. +* [isGetRoleMemberSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isGetRoleMemberSupported): Checks if the `getRoleMember` method is supported by the given contract. +* [isGrantRoleSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isGrantRoleSupported): Checks if the `grantRole` method is supported by the given contract. +* [isHasRoleSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isHasRoleSupported): Checks if the `hasRole` method is supported by the given contract. +* [isRenounceRoleSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isRenounceRoleSupported): Checks if the `renounceRole` method is supported by the given contract. +* [isRevokeRoleSupported](https://portal.thirdweb.com/references/typescript/v5/permissions/isRevokeRoleSupported): Checks if the `revokeRole` method is supported by the given contract. +* [renounceRole](https://portal.thirdweb.com/references/typescript/v5/permissions/renounceRole): Lets the target account renounce the role. (The target account must be the sender of the transaction.) +* [revokeRole](https://portal.thirdweb.com/references/typescript/v5/permissions/revokeRole): Revokes a role from a target account. +* [roleAdminChangedEvent](https://portal.thirdweb.com/references/typescript/v5/permissions/roleAdminChangedEvent): Creates an event object for the RoleAdminChanged event. +* [roleGrantedEvent](https://portal.thirdweb.com/references/typescript/v5/permissions/roleGrantedEvent): Creates an event object for the RoleGranted event. +* [roleRevokedEvent](https://portal.thirdweb.com/references/typescript/v5/permissions/roleRevokedEvent): Creates an event object for the RoleRevoked event. +--- +## SPLIT +* [distribute](https://portal.thirdweb.com/references/typescript/v5/split/distribute): Prepares a transaction to call the "distribute" function on the contract. +* [distributeByToken](https://portal.thirdweb.com/references/typescript/v5/split/distributeByToken): This extension is similar to the `distribute` extension, however it require you to specify the token (address) that you want to distribute +* [getAllRecipientsAddresses](https://portal.thirdweb.com/references/typescript/v5/split/getAllRecipientsAddresses): Get the addresses of all recipients of a [thirdweb Split contract](https://thirdweb.com/thirdweb.eth/Split) +* [getAllRecipientsPercentages](https://portal.thirdweb.com/references/typescript/v5/split/getAllRecipientsPercentages): Get all the recipients of a Split contracts +* [getRecipientSplitPercentage](https://portal.thirdweb.com/references/typescript/v5/split/getRecipientSplitPercentage): Get the split percentage of a recipient +* [payee](https://portal.thirdweb.com/references/typescript/v5/split/payee): Calls the "payee" function on the contract. +* [payeeCount](https://portal.thirdweb.com/references/typescript/v5/split/payeeCount): Calls the "payeeCount" function on the contract. +* [releasable](https://portal.thirdweb.com/references/typescript/v5/split/releasable): Calls the "releasable" function on the contract. +* [releasableByToken](https://portal.thirdweb.com/references/typescript/v5/split/releasableByToken): Calls the "releasable" function on the contract. +* [release](https://portal.thirdweb.com/references/typescript/v5/split/release): Prepares a transaction to call the "release" function on the contract. +* [releaseByToken](https://portal.thirdweb.com/references/typescript/v5/split/releaseByToken): Similar to the `release` extension, however this one requires you to specify a tokenAddress to release +* [released](https://portal.thirdweb.com/references/typescript/v5/split/released): Calls the "released" function on the contract. +* [releasedByToken](https://portal.thirdweb.com/references/typescript/v5/split/releasedByToken): Calls the "released" function on the contract. Similar to the `released` extension, however this one requires you to specify a tokenAddress +* [shares](https://portal.thirdweb.com/references/typescript/v5/split/shares): Calls the "shares" function on the contract. +* [totalReleased](https://portal.thirdweb.com/references/typescript/v5/split/totalReleased): Calls the "totalReleased" function on the contract. +* [totalReleasedByToken](https://portal.thirdweb.com/references/typescript/v5/split/totalReleasedByToken): Calls the "totalReleased" function on the contract. Similar to the `release` extension, however this one requires you to specify a tokenAddress +--- +## THIRDWEB +* [add](https://portal.thirdweb.com/references/typescript/v5/thirdweb/add): Prepares a transaction to call the "add" function on the contract. +* [contractType](https://portal.thirdweb.com/references/typescript/v5/thirdweb/contractType): Calls the "contractType" function on the contract. +* [count](https://portal.thirdweb.com/references/typescript/v5/thirdweb/count): Calls the "count" function on the contract. +* [deployProxyByImplementation](https://portal.thirdweb.com/references/typescript/v5/thirdweb/deployProxyByImplementation): Prepares a transaction to call the "deployProxyByImplementation" function on the contract. +* [getAll](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getAll): Calls the "getAll" function on the contract. +* [getAllPublishedContracts](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getAllPublishedContracts): Calls the "getAllPublishedContracts" function on the contract. +* [getMetadataUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getMetadataUri): Calls the "getMetadataUri" function on the contract. +* [getPublishedContract](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getPublishedContract): Calls the "getPublishedContract" function on the contract. +* [getPublishedContractVersions](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getPublishedContractVersions): Calls the "getPublishedContractVersions" function on the contract. +* [getPublishedUriFromCompilerUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getPublishedUriFromCompilerUri): Calls the "getPublishedUriFromCompilerUri" function on the contract. +* [getPublisherProfileUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getPublisherProfileUri): Calls the "getPublisherProfileUri" function on the contract. +* [isContractTypeSupported](https://portal.thirdweb.com/references/typescript/v5/thirdweb/isContractTypeSupported): Checks if the `contractType` method is supported by the given contract. +* [remove](https://portal.thirdweb.com/references/typescript/v5/thirdweb/remove): Prepares a transaction to call the "remove" function on the contract. +* [setPublisherProfileUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/setPublisherProfileUri): Prepares a transaction to call the "setPublisherProfileUri" function on the contract. +* [unpublishContract](https://portal.thirdweb.com/references/typescript/v5/thirdweb/unpublishContract): Prepares a transaction to call the "unpublishContract" function on the contract. +--- +## thirdweb +* [publishContract](https://portal.thirdweb.com/references/typescript/v5/thirdweb/publishContract): Publish a contract to the contract publisher. +--- +## UNISWAP +* [createPool](https://portal.thirdweb.com/references/typescript/v5/uniswap/createPool): Prepares a transaction to call the "createPool" function on the contract. +* [enableFeeAmount](https://portal.thirdweb.com/references/typescript/v5/uniswap/enableFeeAmount): Prepares a transaction to call the "enableFeeAmount" function on the contract. +* [exactInput](https://portal.thirdweb.com/references/typescript/v5/uniswap/exactInput): Prepares a transaction to call the "exactInput" function on the contract. +* [exactInputSingle](https://portal.thirdweb.com/references/typescript/v5/uniswap/exactInputSingle): Prepares a transaction to call the "exactInputSingle" function on the contract. +* [exactOutput](https://portal.thirdweb.com/references/typescript/v5/uniswap/exactOutput): Prepares a transaction to call the "exactOutput" function on the contract. +* [exactOutputSingle](https://portal.thirdweb.com/references/typescript/v5/uniswap/exactOutputSingle): Prepares a transaction to call the "exactOutputSingle" function on the contract. +* [feeAmountEnabledEvent](https://portal.thirdweb.com/references/typescript/v5/uniswap/feeAmountEnabledEvent): Creates an event object for the FeeAmountEnabled event. +* [feeAmountTickSpacing](https://portal.thirdweb.com/references/typescript/v5/uniswap/feeAmountTickSpacing): Calls the "feeAmountTickSpacing" function on the contract. +* [getPool](https://portal.thirdweb.com/references/typescript/v5/uniswap/getPool): Calls the "getPool" function on the contract. +* [getUniswapV3Pool](https://portal.thirdweb.com/references/typescript/v5/uniswap/getUniswapV3Pool): Finds the Uniswap V3 pools for the two tokens. +* [owner](https://portal.thirdweb.com/references/typescript/v5/uniswap/owner): Calls the "owner" function on the contract. +* [ownerChangedEvent](https://portal.thirdweb.com/references/typescript/v5/uniswap/ownerChangedEvent): Creates an event object for the OwnerChanged event. +* [poolCreatedEvent](https://portal.thirdweb.com/references/typescript/v5/uniswap/poolCreatedEvent): Creates an event object for the PoolCreated event. +* [quoteExactInput](https://portal.thirdweb.com/references/typescript/v5/uniswap/quoteExactInput): Prepares a transaction to call the "quoteExactInput" function on the contract. +* [quoteExactInputSingle](https://portal.thirdweb.com/references/typescript/v5/uniswap/quoteExactInputSingle): Prepares a transaction to call the "quoteExactInputSingle" function on the contract. +* [quoteExactOutput](https://portal.thirdweb.com/references/typescript/v5/uniswap/quoteExactOutput): Prepares a transaction to call the "quoteExactOutput" function on the contract. +* [quoteExactOutputSingle](https://portal.thirdweb.com/references/typescript/v5/uniswap/quoteExactOutputSingle): Prepares a transaction to call the "quoteExactOutputSingle" function on the contract. +* [setOwner](https://portal.thirdweb.com/references/typescript/v5/uniswap/setOwner): Prepares a transaction to call the "setOwner" function on the contract. +--- +## UNSTOPPABLE-DOMAINS +* [namehash](https://portal.thirdweb.com/references/typescript/v5/unstoppable-domains/namehash): Calls the "namehash" function on the contract. +* [resolveAddress](https://portal.thirdweb.com/references/typescript/v5/unstoppable-domains/resolveAddress): Resolve an Unstoppable-Domain domain to an Ethereum address +* [resolveName](https://portal.thirdweb.com/references/typescript/v5/unstoppable-domains/resolveName): Resolves the primary Untoppable-Domains name for a specified address. +* [reverseNameOf](https://portal.thirdweb.com/references/typescript/v5/unstoppable-domains/reverseNameOf): Calls the "reverseNameOf" function on the contract. +--- +## VOTE +* [canExecute](https://portal.thirdweb.com/references/typescript/v5/vote/canExecute): Simulate the `execute` method of the Vote contract, to check if you can execute a proposal +* [castVote](https://portal.thirdweb.com/references/typescript/v5/vote/castVote): Prepares a transaction to call the "castVote" function on the contract. +* [castVoteBySig](https://portal.thirdweb.com/references/typescript/v5/vote/castVoteBySig): Prepares a transaction to call the "castVoteBySig" function on the contract. +* [castVoteWithReason](https://portal.thirdweb.com/references/typescript/v5/vote/castVoteWithReason): Prepares a transaction to call the "castVoteWithReason" function on the contract. +* [castVoteWithReasonAndParams](https://portal.thirdweb.com/references/typescript/v5/vote/castVoteWithReasonAndParams): Prepares a transaction to call the "castVoteWithReasonAndParams" function on the contract. +* [castVoteWithReasonAndParamsBySig](https://portal.thirdweb.com/references/typescript/v5/vote/castVoteWithReasonAndParamsBySig): Prepares a transaction to call the "castVoteWithReasonAndParamsBySig" function on the contract. +* [execute](https://portal.thirdweb.com/references/typescript/v5/vote/execute): Prepares a transaction to call the "execute" function on the contract. +* [executeProposal](https://portal.thirdweb.com/references/typescript/v5/vote/executeProposal): Execute a Proposal +* [getAll](https://portal.thirdweb.com/references/typescript/v5/vote/getAll): Get all proposals from a Vote contract with some extra info attached for each proposal (current state and votes) +* [getAllProposals](https://portal.thirdweb.com/references/typescript/v5/vote/getAllProposals): Calls the "getAllProposals" function on the contract. +* [getProposalVoteCounts](https://portal.thirdweb.com/references/typescript/v5/vote/getProposalVoteCounts): Get the info about Against, For and Abstain votes of a proposal +* [getVotes](https://portal.thirdweb.com/references/typescript/v5/vote/getVotes): Calls the "getVotes" function on the contract. +* [getVotesWithParams](https://portal.thirdweb.com/references/typescript/v5/vote/getVotesWithParams): Calls the "getVotesWithParams" function on the contract. +* [hashProposal](https://portal.thirdweb.com/references/typescript/v5/vote/hashProposal): Calls the "hashProposal" function on the contract. +* [hasVoted](https://portal.thirdweb.com/references/typescript/v5/vote/hasVoted): Calls the "hasVoted" function on the contract. +* [proposalDeadline](https://portal.thirdweb.com/references/typescript/v5/vote/proposalDeadline): Calls the "proposalDeadline" function on the contract. +* [proposalExists](https://portal.thirdweb.com/references/typescript/v5/vote/proposalExists): Check if a proposal exists based on a given proposalId +* [proposalIndex](https://portal.thirdweb.com/references/typescript/v5/vote/proposalIndex): Calls the "proposalIndex" function on the contract. +* [proposals](https://portal.thirdweb.com/references/typescript/v5/vote/proposals): Calls the "proposals" function on the contract. +* [proposalSnapshot](https://portal.thirdweb.com/references/typescript/v5/vote/proposalSnapshot): Calls the "proposalSnapshot" function on the contract. +* [proposalThreshold](https://portal.thirdweb.com/references/typescript/v5/vote/proposalThreshold): Calls the "proposalThreshold" function on the contract. +* [proposalVotes](https://portal.thirdweb.com/references/typescript/v5/vote/proposalVotes): Calls the "proposalVotes" function on the contract. +* [propose](https://portal.thirdweb.com/references/typescript/v5/vote/propose): Prepares a transaction to call the "propose" function on the contract. +* [quorum](https://portal.thirdweb.com/references/typescript/v5/vote/quorum): Calls the "quorum" function on the contract. +* [quorumDenominator](https://portal.thirdweb.com/references/typescript/v5/vote/quorumDenominator): Calls the "quorumDenominator" function on the contract. +* [quorumNumeratorByBlockNumber](https://portal.thirdweb.com/references/typescript/v5/vote/quorumNumeratorByBlockNumber): Calls the "quorumDenominator" function on the contract with an extra param called `blockNumber` . This extension is similar to the `quorumDenominator` extension, except that it takes in a bigint (blockNumber) +* [relay](https://portal.thirdweb.com/references/typescript/v5/vote/relay): Prepares a transaction to call the "relay" function on the contract. +* [setProposalThreshold](https://portal.thirdweb.com/references/typescript/v5/vote/setProposalThreshold): Prepares a transaction to call the "setProposalThreshold" function on the contract. +* [setVotingDelay](https://portal.thirdweb.com/references/typescript/v5/vote/setVotingDelay): Prepares a transaction to call the "setVotingDelay" function on the contract. +* [setVotingPeriod](https://portal.thirdweb.com/references/typescript/v5/vote/setVotingPeriod): Prepares a transaction to call the "setVotingPeriod" function on the contract. +* [state](https://portal.thirdweb.com/references/typescript/v5/vote/state): Calls the "state" function on the contract. +* [token](https://portal.thirdweb.com/references/typescript/v5/vote/token): Calls the "token" function on the contract. +* [updateQuorumNumerator](https://portal.thirdweb.com/references/typescript/v5/vote/updateQuorumNumerator): Prepares a transaction to call the "updateQuorumNumerator" function on the contract. +* [votingDelay](https://portal.thirdweb.com/references/typescript/v5/vote/votingDelay): Calls the "votingDelay" function on the contract. +* [votingPeriod](https://portal.thirdweb.com/references/typescript/v5/vote/votingPeriod): Calls the "votingPeriod" function on the contract. +--- +## MODULES +* [cancelOwnershipHandover](https://portal.thirdweb.com/references/typescript/v5/modules/cancelOwnershipHandover): Prepares a transaction to call the "cancelOwnershipHandover" function on the contract. +* [completeOwnershipHandover](https://portal.thirdweb.com/references/typescript/v5/modules/completeOwnershipHandover): Prepares a transaction to call the "completeOwnershipHandover" function on the contract. +* [getInstalledModules](https://portal.thirdweb.com/references/typescript/v5/modules/getInstalledModules): Calls the "getInstalledModules" function on the contract. +* [getModuleConfig](https://portal.thirdweb.com/references/typescript/v5/modules/getModuleConfig): Calls the "getModuleConfig" function on the contract. +* [getSupportedCallbackFunctions](https://portal.thirdweb.com/references/typescript/v5/modules/getSupportedCallbackFunctions): Calls the "getSupportedCallbackFunctions" function on the contract. +* [grantRoles](https://portal.thirdweb.com/references/typescript/v5/modules/grantRoles): Prepares a transaction to call the "grantRoles" function on the contract. +* [hasAllRoles](https://portal.thirdweb.com/references/typescript/v5/modules/hasAllRoles): Calls the "hasAllRoles" function on the contract. +* [hasAnyRole](https://portal.thirdweb.com/references/typescript/v5/modules/hasAnyRole): Calls the "hasAnyRole" function on the contract. +* [installModule](https://portal.thirdweb.com/references/typescript/v5/modules/installModule): Prepares a transaction to call the "installModule" function on the contract. +* [isGetInstalledModulesSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isGetInstalledModulesSupported): Checks if the `getInstalledModules` method is supported by the given contract. +* [isGetModuleConfigSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isGetModuleConfigSupported): Checks if the `getModuleConfig` method is supported by the given contract. +* [isGetSupportedCallbackFunctionsSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isGetSupportedCallbackFunctionsSupported): Checks if the `getSupportedCallbackFunctions` method is supported by the given contract. +* [isInstallModuleSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isInstallModuleSupported): Checks if the `installModule` method is supported by the given contract. +* [isUninstallModuleSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isUninstallModuleSupported): Checks if the `uninstallModule` method is supported by the given contract. +* [owner](https://portal.thirdweb.com/references/typescript/v5/modules/owner): Calls the "owner" function on the contract. +* [ownershipHandoverExpiresAt](https://portal.thirdweb.com/references/typescript/v5/modules/ownershipHandoverExpiresAt): Calls the "ownershipHandoverExpiresAt" function on the contract. +* [renounceOwnership](https://portal.thirdweb.com/references/typescript/v5/modules/renounceOwnership): Prepares a transaction to call the "renounceOwnership" function on the contract. +* [renounceRoles](https://portal.thirdweb.com/references/typescript/v5/modules/renounceRoles): Prepares a transaction to call the "renounceRoles" function on the contract. +* [requestOwnershipHandover](https://portal.thirdweb.com/references/typescript/v5/modules/requestOwnershipHandover): Prepares a transaction to call the "requestOwnershipHandover" function on the contract. +* [revokeRoles](https://portal.thirdweb.com/references/typescript/v5/modules/revokeRoles): Prepares a transaction to call the "revokeRoles" function on the contract. +* [rolesOf](https://portal.thirdweb.com/references/typescript/v5/modules/rolesOf): Calls the "rolesOf" function on the contract. +* [transferOwnership](https://portal.thirdweb.com/references/typescript/v5/modules/transferOwnership): Prepares a transaction to call the "transferOwnership" function on the contract. +* [uninstallModule](https://portal.thirdweb.com/references/typescript/v5/modules/uninstallModule): Prepares a transaction to call the "uninstallModule" function on the contract. +* [encodeMintParams](https://portal.thirdweb.com/references/typescript/v5/modules/encodeMintParams): Encodes the parameters for the "encodeBytesBeforeMintERC20" function. +* [encodeMintParams](https://portal.thirdweb.com/references/typescript/v5/modules/encodeMintParams-2): Encodes the parameters for the "encodeBytesBeforeMintERC20" function. +* [encodeMintParams](https://portal.thirdweb.com/references/typescript/v5/modules/encodeMintParams-3): Encodes the parameters for the "encodeBytesBeforeMintERC721" function. +--- +## EIP5792 +* [getCallsStatus](https://portal.thirdweb.com/references/typescript/v5/eip5792/getCallsStatus): Get the status of an [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle. +* [getCapabilities](https://portal.thirdweb.com/references/typescript/v5/eip5792/getCapabilities): Get the capabilities of a wallet based on the [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) specification. +* [sendCalls](https://portal.thirdweb.com/references/typescript/v5/eip5792/sendCalls): Send [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) calls to a wallet. This function works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792\. Transactions will be bundled and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions. +* [waitForBundle](https://portal.thirdweb.com/references/typescript/v5/eip5792/waitForBundle): Waits for the [ EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle to be confirmed. +--- +# Modules +--- +## Common +* [checkModulesCompatibility](https://portal.thirdweb.com/references/typescript/v5/common/checkModulesCompatibility): Check if the given modules are compatible with the given core contract +* [deployModularContract](https://portal.thirdweb.com/references/typescript/v5/common/deployModularContract): Deploys an thirdweb ERC20 contract of the given type. On chains where the thirdweb infrastructure contracts are not deployed, this function will deploy them as well. +* [getDeployedModule](https://portal.thirdweb.com/references/typescript/v5/common/getDeployedModule): Gets a deployed module implementation contract. +* [getOrDeployModule](https://portal.thirdweb.com/references/typescript/v5/common/getOrDeployModule): Gets or deploys a module implementation contract. +* [grantMinterRole](https://portal.thirdweb.com/references/typescript/v5/common/grantMinterRole): Grants the minter role to a user. +* [installPublishedModule](https://portal.thirdweb.com/references/typescript/v5/common/installPublishedModule): Install a published module on a modular contract +* [uninstallModuleByProxy](https://portal.thirdweb.com/references/typescript/v5/common/uninstallModuleByProxy): Uninstall an module by proxy +* [uninstallPublishedModule](https://portal.thirdweb.com/references/typescript/v5/common/uninstallPublishedModule): Uninstall a published module +--- +## BatchMetadataERC1155 +* [batchMetadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc1155/batchMetadataUpdateEvent): Creates an event object for the BatchMetadataUpdate event. +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc1155/encodeInstall): Encodes the install data for the BatchMetadataERC1155 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc1155/install): Installs the BatchMetadataERC1155 module on a core contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc1155/module): Convenience function to add the BatchMetadataERC1155 module as a default module on a core contract. +* [uploadMetadata](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc1155/uploadMetadata): Uploads metadata for a batch of NFTs. +--- +## BatchMetadataERC721 +* [batchMetadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc721/batchMetadataUpdateEvent): Creates an event object for the BatchMetadataUpdate event. +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc721/encodeInstall): Encodes the install data for the BatchMetadataERC721 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc721/install): Installs the BatchMetadataERC721 module on a core contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc721/module): Convenience function to add the BatchMetadataERC721 module as a default module on a core contract. +* [uploadMetadata](https://portal.thirdweb.com/references/typescript/v5/batchmetadataerc721/uploadMetadata): Uploads metadata for a batch of NFTs. +--- +## ClaimableERC1155 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/encodeInstall): Encodes the install data for the ClaimableERC1155 module. +* [getClaimCondition](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/getClaimCondition): Calls the "getClaimConditionByTokenId" function on the contract. +* [getSaleConfig](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/getSaleConfig): Calls the "getSaleConfig" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/install): Installs the ClaimableERC1155 module on a core contract. +* [mint](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/mint): Mints ERC1155 tokens to a specified address via a ClaimableERC1155 module. +* [module](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/module): Convenience function to add the ClaimableERC1155 module as a default module on a core contract. +* [setClaimCondition](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/setClaimCondition): Sets the claim conditions for a given token ID. +* [setSaleConfig](https://portal.thirdweb.com/references/typescript/v5/claimableerc1155/setSaleConfig): Prepares a transaction to call the "setSaleConfig" function on the contract. +--- +## ClaimableERC20 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/encodeInstall): Encodes the install data for the ClaimableERC20 module. +* [getClaimCondition](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/getClaimCondition): Calls the "getClaimCondition" function on the contract. +* [getSaleConfig](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/getSaleConfig): Calls the "getSaleConfig" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/install): Installs the ClaimableERC20 module on a core contract. +* [mint](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/mint): Mints tokens to a specified address via a ClaimableERC20 module. +* [module](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/module): Convenience function to add the ClaimableERC20 module as a default module on a core contract. +* [setClaimCondition](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/setClaimCondition): Sets the claim conditions for a given token ID. +* [setSaleConfig](https://portal.thirdweb.com/references/typescript/v5/claimableerc20/setSaleConfig): Prepares a transaction to call the "setSaleConfig" function on the contract. +--- +## ClaimableERC721 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/encodeInstall): Encodes the install data for the ClaimableERC721 module. +* [getClaimCondition](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/getClaimCondition): Calls the "getClaimCondition" function on the contract. +* [getSaleConfig](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/getSaleConfig): Calls the "getSaleConfig" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/install): Installs the ClaimableERC721 module on a core contract. +* [mint](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/mint): Mints ERC721 tokens to a specified address via a ClaimableERC721 module. +* [module](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/module): Convenience function to add the ClaimableERC721 module as a default module on a core contract. +* [setClaimCondition](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/setClaimCondition): Sets the claim conditions for a given token ID. +* [setSaleConfig](https://portal.thirdweb.com/references/typescript/v5/claimableerc721/setSaleConfig): Prepares a transaction to call the "setSaleConfig" function on the contract. +--- +## MintableERC1155 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/encodeInstall): Encodes the install data for the MintableERC1155 module. +* [generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/generateMintSignature): Generates a payload and signature for minting ERC1155 tokens with a signature. +* [getSaleConfig](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/getSaleConfig): Calls the "getSaleConfig" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/install): Installs the MintableERC1155 module on a core contract. +* [mintWithRole](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/mintWithRole): Mints ERC1155 tokens to a specified address via a MintableERC1155 module. +* [mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/mintWithSignature): Mints ERC1155 tokens to a specified address with a signature via a MintableERC1155 module. +* [module](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/module): Convenience function to add the MintableERC1155 module as a default module on a core contract. +* [setSaleConfig](https://portal.thirdweb.com/references/typescript/v5/mintableerc1155/setSaleConfig): Prepares a transaction to call the "setSaleConfig" function on the contract. +--- +## MintableERC20 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/encodeInstall): Encodes the install data for the MintableERC20 module. +* [generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/generateMintSignature): Generates a mint signature for a given mint request to be used with a MintableERC20 module. +* [getSaleConfig](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/getSaleConfig): Calls the "getSaleConfig" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/install): Installs the MintableERC20 module on a core contract. +* [mintWithRole](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/mintWithRole): Mints ERC20 tokens to a specified address via a MintableERC20 module. +* [mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/mintWithSignature): Mints ERC20 tokens to a specified address with a signature via a MintableERC20 module. +* [module](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/module): Convenience function to add the MintableERC20 module as a default module on a core contract. +* [setSaleConfig](https://portal.thirdweb.com/references/typescript/v5/mintableerc20/setSaleConfig): Prepares a transaction to call the "setSaleConfig" function on the contract. +--- +## MintableERC721 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/encodeInstall): Encodes the install data for the MintableERC721 module. +* [generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/generateMintSignature): Generates a payload and signature for minting ERC721 tokens via a MintableERC721 module. +* [getSaleConfig](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/getSaleConfig): Calls the "getSaleConfig" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/install): Installs the MintableERC721 module on a core contract. +* [mintWithRole](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/mintWithRole): Mints ERC721 tokens to a specified address via a MintableERC721 module. +* [mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/mintWithSignature): Mints ERC721 tokens to a specified address with a signature via a MintableERC721 module. +* [module](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/module): Convenience function to add the MintableERC721 module as a default module on a core contract. +* [setSaleConfig](https://portal.thirdweb.com/references/typescript/v5/mintableerc721/setSaleConfig): Prepares a transaction to call the "setSaleConfig" function on the contract. +--- +## OpenEditionMetadataERC721 +* [batchMetadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/openeditionmetadataerc721/batchMetadataUpdateEvent): Creates an event object for the BatchMetadataUpdate event. +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/openeditionmetadataerc721/encodeInstall): Encodes the install data for the OpenEditionMetadataERC721 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/openeditionmetadataerc721/install): Installs the OpenEditionMetadataERC721 module on a core contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/openeditionmetadataerc721/module): Convenience function to add the OpenEditionMetadataERC721 module as a default module on a core contract. +* [setSharedMetadata](https://portal.thirdweb.com/references/typescript/v5/openeditionmetadataerc721/setSharedMetadata): Prepares a transaction to call the "setSharedMetadata" function on the contract. +* [sharedMetadataUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/openeditionmetadataerc721/sharedMetadataUpdatedEvent): Creates an event object for the SharedMetadataUpdated event. +--- +## RoyaltyERC1155 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/encodeInstall): Encodes the install data for the RoyaltyERC1155 module. +* [getDefaultRoyaltyInfo](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/getDefaultRoyaltyInfo): Calls the "getDefaultRoyaltyInfo" function on the contract. +* [getRoyaltyInfoForToken](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/getRoyaltyInfoForToken): Calls the "getRoyaltyInfoForToken" function on the contract. +* [getTransferValidationFunction](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/getTransferValidationFunction): Calls the "getTransferValidationFunction" function on the contract. +* [getTransferValidator](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/getTransferValidator): Calls the "getTransferValidator" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/install): Installs the RoyaltyERC1155 module on a core contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/module): Convenience function to add the RoyaltyERC1155 module as a default module on a core contract. +* [royaltyInfo](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/royaltyInfo): Calls the "royaltyInfo" function on the contract. +* [setDefaultRoyaltyInfo](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/setDefaultRoyaltyInfo): Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. +* [setRoyaltyInfoForToken](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/setRoyaltyInfoForToken): Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. +* [setTransferValidator](https://portal.thirdweb.com/references/typescript/v5/royaltyerc1155/setTransferValidator): Prepares a transaction to call the "setTransferValidator" function on the contract. +--- +## RoyaltyERC721 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/encodeInstall): Encodes the install data for the RoyaltyERC721 module. +* [getDefaultRoyaltyInfo](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/getDefaultRoyaltyInfo): Calls the "getDefaultRoyaltyInfo" function on the contract. +* [getRoyaltyInfoForToken](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/getRoyaltyInfoForToken): Calls the "getRoyaltyInfoForToken" function on the contract. +* [getTransferValidationFunction](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/getTransferValidationFunction): Calls the "getTransferValidationFunction" function on the contract. +* [getTransferValidator](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/getTransferValidator): Calls the "getTransferValidator" function on the contract. +* [install](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/install): Installs the RoyaltyERC721 module on a core contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/module): Convenience function to add the RoyaltyERC721 module as a default module on a core contract. +* [royaltyInfo](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/royaltyInfo): Calls the "royaltyInfo" function on the contract. +* [setDefaultRoyaltyInfo](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/setDefaultRoyaltyInfo): Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. +* [setRoyaltyInfoForToken](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/setRoyaltyInfoForToken): Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. +* [setTransferValidator](https://portal.thirdweb.com/references/typescript/v5/royaltyerc721/setTransferValidator): Prepares a transaction to call the "setTransferValidator" function on the contract. +--- +## SequentialTokenIdERC1155 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/sequentialtokeniderc1155/encodeInstall): Encodes the install data for the SequentialTokenIdERC1155 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/sequentialtokeniderc1155/install): Installs the SequentialTokenIdERC1155 module on a core contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/sequentialtokeniderc1155/module): Convenience function to add the SequentialTokenIdERC1155 module as a default module on a core contract. +--- +## TransferableERC1155 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/encodeInstall): Encodes the install data for the TransferableERC1155 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/install): Installs the TransferableERC1155 module on a core contract. +* [isTransferEnabled](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/isTransferEnabled): Calls the "isTransferEnabled" function on the contract. +* [isTransferEnabledFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/isTransferEnabledFor): Calls the "isTransferEnabledFor" function on the contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/module): Convenience function to add the TransferableERC1155 module as a default module on a core contract. +* [setTransferable](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/setTransferable): Prepares a transaction to call the "setTransferable" function on the contract. +* [setTransferableFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc1155/setTransferableFor): Prepares a transaction to call the "setTransferableFor" function on the contract. +--- +## TransferableERC20 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/encodeInstall): Encodes the install data for the TransferableERC20 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/install): Installs the TransferableERC20 module on a core contract. +* [isTransferEnabled](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/isTransferEnabled): Calls the "isTransferEnabled" function on the contract. +* [isTransferEnabledFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/isTransferEnabledFor): Calls the "isTransferEnabledFor" function on the contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/module): Convenience function to add the TransferableERC20 module as a default module on a core contract. +* [setTransferable](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/setTransferable): Prepares a transaction to call the "setTransferable" function on the contract. +* [setTransferableFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc20/setTransferableFor): Prepares a transaction to call the "setTransferableFor" function on the contract. +--- +## TransferableERC721 +* [encodeInstall](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/encodeInstall): Encodes the install data for the TransferableERC721 module. +* [install](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/install): Installs the TransferableERC721 module on a core contract. +* [isTransferEnabled](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/isTransferEnabled): Calls the "isTransferEnabled" function on the contract. +* [isTransferEnabledFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/isTransferEnabledFor): Calls the "isTransferEnabledFor" function on the contract. +* [module](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/module): Convenience function to add the TransferableERC721 module as a default module on a core contract. +* [setTransferable](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/setTransferable): Prepares a transaction to call the "setTransferable" function on the contract. +* [setTransferableFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/setTransferableFor): Prepares a transaction to call the "setTransferableFor" function on the contract. +--- +# Client +* [createThirdwebClient](https://portal.thirdweb.com/references/typescript/v5/createThirdwebClient): Creates a Thirdweb client using the provided client ID (client-side) or secret key (server-side). +--- +# Wallets +* [AccountAvatar](https://portal.thirdweb.com/references/typescript/v5/AccountAvatar): The component for showing the avatar of the account. If fetches all the social profiles linked to your wallet, including: Farcaster, ENS, Lens (more to be added) You can choose which social profile you want to display. Defaults to the first item in the list. +* [AccountBalance](https://portal.thirdweb.com/references/typescript/v5/AccountBalance): This component fetches and shows the balance of the wallet address on a given chain. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` +* [AccountName](https://portal.thirdweb.com/references/typescript/v5/AccountName): This component is used to display the name of the account. A "name" in this context is the username, or account of the social profiles that the wallet may have. In case a name is not found or failed to resolve, you can always fallback to displaying the wallet address instead by using the `fallbackComponent` prop. +* [WalletIcon](https://portal.thirdweb.com/references/typescript/v5/WalletIcon): This component tries to resolve the icon of a given wallet, then return an image. +* [deploySmartAccount](https://portal.thirdweb.com/references/typescript/v5/deploySmartAccount): Deployes a smart account via a dummy transaction. +* [getUser](https://portal.thirdweb.com/references/typescript/v5/getUser): Gets user based on the provided query parameters. This function is only available on the server (a secret key is required in the client). +* [authenticate](https://portal.thirdweb.com/references/typescript/v5/authenticate): Authenticates the user based on the provided authentication arguments. +* [authenticateWithRedirect](https://portal.thirdweb.com/references/typescript/v5/authenticateWithRedirect): Authenticates the user based on the provided authentication arguments using a redirect. +* [createWallet](https://portal.thirdweb.com/references/typescript/v5/createWallet): Creates a wallet based on the provided ID and arguments. +* [createWalletAdapter](https://portal.thirdweb.com/references/typescript/v5/createWalletAdapter): Creates a wallet from the given account. +* [createWalletConnectClient](https://portal.thirdweb.com/references/typescript/v5/createWalletConnectClient): Creates a new WalletConnect client for interacting with another application. +* [createWalletConnectSession](https://portal.thirdweb.com/references/typescript/v5/createWalletConnectSession): Initiates a new WalletConnect session for interacting with another application. +* [disconnectWalletConnectSession](https://portal.thirdweb.com/references/typescript/v5/disconnectWalletConnectSession): Disconnects a WalletConnect session. +* [ecosystemWallet](https://portal.thirdweb.com/references/typescript/v5/ecosystemWallet): Creates an [ Ecosystem Wallet](https://portal.thirdweb.com/connect/wallet/overview) based on various authentication methods. Full list of available authentication methods [ here](/connect/wallet/sign-in-methods/configure) . +* [getActiveWalletConnectSessions](https://portal.thirdweb.com/references/typescript/v5/getActiveWalletConnectSessions): Retrieves all active WalletConnect sessions. +* [getProfiles](https://portal.thirdweb.com/references/typescript/v5/getProfiles): Gets the linked profiles for the connected in-app or ecosystem wallet. +* [getUserEmail](https://portal.thirdweb.com/references/typescript/v5/getUserEmail): Retrieves the authenticated user email for the active in-app wallet. +* [getUserPhoneNumber](https://portal.thirdweb.com/references/typescript/v5/getUserPhoneNumber): Retrieves the authenticated user phone number for the active embedded wallet. +* [inAppWallet](https://portal.thirdweb.com/references/typescript/v5/inAppWallet): Creates an app scoped wallet for users based on various authentication methods. Full list of available authentication methods [ here](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure) . +* [linkProfile](https://portal.thirdweb.com/references/typescript/v5/linkProfile): Connects a new profile (and new authentication method) to the current user. +* [preAuthenticate](https://portal.thirdweb.com/references/typescript/v5/preAuthenticate): Pre-authenticates the user based on the provided authentication strategy. Use this function to send a verification code to the user's email or phone number. +* [privateKeyToAccount](https://portal.thirdweb.com/references/typescript/v5/privateKeyToAccount): Get an `Account` object from a private key. +* [smartWallet](https://portal.thirdweb.com/references/typescript/v5/smartWallet): Creates a ERC4337 smart wallet based on a admin account. +* [unlinkProfile](https://portal.thirdweb.com/references/typescript/v5/unlinkProfile): Disconnects an existing profile (authentication method) from the current user. Once disconnected, that profile can no longer be used to sign into the account. +* [walletConnect](https://portal.thirdweb.com/references/typescript/v5/walletConnect): Creates a wallet that allows connecting to any wallet that supports the WalletConnect protocol. +* [engineAccount](https://portal.thirdweb.com/references/typescript/v5/engineAccount): Creates an account that uses your engine backend wallet for sending transactions and signing messages. +* [erc7579](https://portal.thirdweb.com/references/typescript/v5/erc7579): Config for a ERC7579 modular smart wallet. +--- +# Wallet Utilities +* [generateAccount](https://portal.thirdweb.com/references/typescript/v5/generateAccount): Generates a new account with a random private key. +* [getWalletBalance](https://portal.thirdweb.com/references/typescript/v5/getWalletBalance): Retrieves the balance of a token or native currency for a given wallet. +* [injectedProvider](https://portal.thirdweb.com/references/typescript/v5/injectedProvider): Get Injected Provider for given wallet by passing a wallet ID (rdns) using [ EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) Provider Discovery. +* [getSocialIcon](https://portal.thirdweb.com/references/typescript/v5/getSocialIcon): Gets the icon URI for a given social authentication provider +* [hasStoredPasskey](https://portal.thirdweb.com/references/typescript/v5/hasStoredPasskey): Returns whether this device has a stored passkey ready to be used for sign-in +* [bundleUserOp](https://portal.thirdweb.com/references/typescript/v5/bundleUserOp): Bundle a user operation. +* [createAndSignUserOp](https://portal.thirdweb.com/references/typescript/v5/createAndSignUserOp): Create and sign a user operation. +* [createUnsignedUserOp](https://portal.thirdweb.com/references/typescript/v5/createUnsignedUserOp): Creates an unsigned user operation from a prepared transaction. +* [estimateUserOpGas](https://portal.thirdweb.com/references/typescript/v5/estimateUserOpGas): Estimate the gas cost of a user operation. +* [getPaymasterAndData](https://portal.thirdweb.com/references/typescript/v5/getPaymasterAndData): Get paymaster and data details for a user operation. +* [getUserOpGasFees](https://portal.thirdweb.com/references/typescript/v5/getUserOpGasFees): Get the gas fees of a user operation. +* [getUserOpReceipt](https://portal.thirdweb.com/references/typescript/v5/getUserOpReceipt): Get the receipt of a user operation. +* [getUserOpReceiptRaw](https://portal.thirdweb.com/references/typescript/v5/getUserOpReceiptRaw): Get the receipt of a user operation. +* [predictAddress](https://portal.thirdweb.com/references/typescript/v5/predictAddress): Use `predictSmartAccountAddress` instead. +* [predictSmartAccountAddress](https://portal.thirdweb.com/references/typescript/v5/predictSmartAccountAddress): Predict the address of a smart account. +* [signUserOp](https://portal.thirdweb.com/references/typescript/v5/signUserOp): Sign a user operation. +* [waitForUserOpReceipt](https://portal.thirdweb.com/references/typescript/v5/waitForUserOpReceipt): Wait for the user operation to be mined. +--- +# Chain +* [defineChain](https://portal.thirdweb.com/references/typescript/v5/defineChain): Defines a chain with the given options. +* [getChainMetadata](https://portal.thirdweb.com/references/typescript/v5/getChainMetadata): Retrieves chain data for a given chain. +* [getRpcUrlForChain](https://portal.thirdweb.com/references/typescript/v5/getRpcUrlForChain): Retrieves the RPC URL for the specified chain. If a custom RPC URL is defined in the options, it will be used. Otherwise, a thirdweb RPC URL will be constructed using the chain ID and client ID. +* [ChainIcon](https://portal.thirdweb.com/references/typescript/v5/ChainIcon): This component tries to resolve the icon of a given chain, then return an image. +* [ChainName](https://portal.thirdweb.com/references/typescript/v5/ChainName): This component fetches then shows the name of a chain. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` +* [isZkSyncChain](https://portal.thirdweb.com/references/typescript/v5/isZkSyncChain): Checks whether the given chain is part of the zksync stack +--- +# Contract +* [checkVerificationStatus](https://portal.thirdweb.com/references/typescript/v5/checkVerificationStatus): Checks the verification status of a contract. +* [fetchPublishedContract](https://portal.thirdweb.com/references/typescript/v5/fetchPublishedContract): Fetches the published contract based on the provided options. +* [getBytecode](https://portal.thirdweb.com/references/typescript/v5/getBytecode): Retrieves the bytecode of a contract. +* [getCompilerMetadata](https://portal.thirdweb.com/references/typescript/v5/getCompilerMetadata): Down the compiled metadata from thirdweb contract api and format it +* [getContract](https://portal.thirdweb.com/references/typescript/v5/getContract): Creates a Thirdweb contract by combining the Thirdweb client and contract options. +* [prepareMethod](https://portal.thirdweb.com/references/typescript/v5/prepareMethod): Prepares a method for usage by converting it into a prepared method object. +* [resolveAbiFromBytecode](https://portal.thirdweb.com/references/typescript/v5/resolveAbiFromBytecode): Resolves the ABI (Application Binary Interface) from the bytecode of a contract. +* [resolveAbiFromContractApi](https://portal.thirdweb.com/references/typescript/v5/resolveAbiFromContractApi): Resolves the ABI (Application Binary Interface) for a contract from the contract API. +* [resolveCompositeAbi](https://portal.thirdweb.com/references/typescript/v5/resolveCompositeAbi): Resolves the ABI for a contract based on its bytecode. If the contract follows the plugin-pattern or dynamic pattern, it resolves the ABIs for the plugins and merges them with the root ABI. If the contract follows the base router pattern, it resolves the ABIs for the plugins and merges them with the root ABI. If the contract follows the diamond pattern, it resolves the ABIs for the facets and merges them with the root ABI. +* [resolveContractAbi](https://portal.thirdweb.com/references/typescript/v5/resolveContractAbi): Resolves the ABI (Application Binary Interface) for a given contract. If the ABI is already cached, it returns the cached value. Otherwise, it tries to resolve the ABI from the contract's API. If that fails, it resolves the ABI from the contract's bytecode. +* [verifyContract](https://portal.thirdweb.com/references/typescript/v5/verifyContract): Verifies a contract by performing the following steps: +* [getInitializeTransaction](https://portal.thirdweb.com/references/typescript/v5/getInitializeTransaction): Prepares the initialization transaction for a contract deployment +* [getOrDeployInfraForPublishedContract](https://portal.thirdweb.com/references/typescript/v5/getOrDeployInfraForPublishedContract): Gets or deploys the infrastructure contracts needed for a published contract deployment +* [getContractEvents](https://portal.thirdweb.com/references/typescript/v5/getContractEvents): Retrieves events from a contract based on the provided options. +* [parseEventLogs](https://portal.thirdweb.com/references/typescript/v5/parseEventLogs): Parses logs and returns the corresponding events. +* [prepareEvent](https://portal.thirdweb.com/references/typescript/v5/prepareEvent): Prepares an event by parsing the signature, generating the event hash, and encoding the event topics. +* [watchContractEvents](https://portal.thirdweb.com/references/typescript/v5/watchContractEvents): Listens for contract events from the blockchain. +* [resolveMethod](https://portal.thirdweb.com/references/typescript/v5/resolveMethod): Resolves and returns the ABI function with the specified method name. Throws an error if the function is not found in the ABI. +* [detectMethod](https://portal.thirdweb.com/references/typescript/v5/detectMethod): Detects if the specified method is present in the contract bytecode. +* [isContractDeployed](https://portal.thirdweb.com/references/typescript/v5/isContractDeployed): Checks if a contract is deployed by verifying its bytecode. +* [resolveImplementation](https://portal.thirdweb.com/references/typescript/v5/resolveImplementation): Resolves the implementation address and bytecode for a given proxy contract. +--- +# Transactions +* [getApprovalForTransaction](https://portal.thirdweb.com/references/typescript/v5/getApprovalForTransaction): When dealing with transactions that involve ERC20 tokens (Airdropping ERC20, buy NFTs with ERC20, etc.) you often have to do a pre-check to see if the targeted contract has the sufficient allowance to "take" the ERC20 tokens from the caller's wallet. +* [createContractQuery](https://portal.thirdweb.com/references/typescript/v5/createContractQuery): Creates a `useQuery` hook for a contract call. +* [encode](https://portal.thirdweb.com/references/typescript/v5/encode): Encodes a transaction object into a hexadecimal string representation of the encoded data. +* [estimateGas](https://portal.thirdweb.com/references/typescript/v5/estimateGas): Estimates the gas required to execute a transaction. The gas is returned as a `bigint` and in gwei units. +* [estimateGasCost](https://portal.thirdweb.com/references/typescript/v5/estimateGasCost): Estimate the gas cost of a transaction in ether and wei. +* [prepareContractCall](https://portal.thirdweb.com/references/typescript/v5/prepareContractCall): Prepares a contract call by resolving the ABI function, parameters and encoded data. Optionally specify other properties such as value or gas price. +* [prepareTransaction](https://portal.thirdweb.com/references/typescript/v5/prepareTransaction): Prepares a transaction with the given options. +* [readContract](https://portal.thirdweb.com/references/typescript/v5/readContract): Use this for raw read calls from a contract, but you can also use read [ extensions](https://portal.thirdweb.com/typescript/v5/extensions/use) for predefined methods for common standards. +* [sendAndConfirmTransaction](https://portal.thirdweb.com/references/typescript/v5/sendAndConfirmTransaction): Sends a transaction using the provided wallet. +* [sendBatchTransaction](https://portal.thirdweb.com/references/typescript/v5/sendBatchTransaction): Sends a batch transaction using the provided options. +* [sendTransaction](https://portal.thirdweb.com/references/typescript/v5/sendTransaction): Sends a transaction using the provided account. +* [serializeTransaction](https://portal.thirdweb.com/references/typescript/v5/serializeTransaction): Serializes a legacy, EIP-1559, EIP-2930, EIP-4844, or EIP-7702 transaction object. +* [signAuthorization](https://portal.thirdweb.com/references/typescript/v5/signAuthorization): Sign the given EIP-7702 authorization object. +* [signTransaction](https://portal.thirdweb.com/references/typescript/v5/signTransaction): Signs a transaction to be sent to a node. +* [simulateTransaction](https://portal.thirdweb.com/references/typescript/v5/simulateTransaction): Simulates the execution of a transaction. +* [toSerializableTransaction](https://portal.thirdweb.com/references/typescript/v5/toSerializableTransaction): Converts a prepared transaction to a transaction with populated options. +* [waitForReceipt](https://portal.thirdweb.com/references/typescript/v5/waitForReceipt): Waits for the transaction receipt of a given transaction hash on a specific contract. +* [getTransactionStore](https://portal.thirdweb.com/references/typescript/v5/getTransactionStore): Retrieve the transaction store for a given address. +--- +# Nebula +* [chat](https://portal.thirdweb.com/references/typescript/v5/chat): Chat with Nebula. +* [execute](https://portal.thirdweb.com/references/typescript/v5/execute): Execute a transaction based on a prompt. +--- +# Social API +* [getSocialProfiles](https://portal.thirdweb.com/references/typescript/v5/getSocialProfiles): Fetches the wallet's available social profiles. +--- +# Auth +* [createAuth](https://portal.thirdweb.com/references/typescript/v5/createAuth): Creates an authentication object with the given options. +* [isErc6492Signature](https://portal.thirdweb.com/references/typescript/v5/isErc6492Signature): The signature to check for ERC6492 compatibility +* [parseErc6492Signature](https://portal.thirdweb.com/references/typescript/v5/parseErc6492Signature): The signature to parse +* [serializeErc6492Signature](https://portal.thirdweb.com/references/typescript/v5/serializeErc6492Signature): The serialized signature +* [signLoginPayload](https://portal.thirdweb.com/references/typescript/v5/signLoginPayload): Signs the login payload using the provided account. +* [verifyContractWalletSignature](https://portal.thirdweb.com/references/typescript/v5/verifyContractWalletSignature): A boolean indicating whether the signature is valid. +* [verifyEOASignature](https://portal.thirdweb.com/references/typescript/v5/verifyEOASignature): Verifies the signature of a message using an Ethereum account's EOA (Externally Owned Account). +* [verifySignature](https://portal.thirdweb.com/references/typescript/v5/verifySignature): Verifies the signature based on the provided options. Handles smart contract wallet signatures and EOA signatures. _IMPORTANT: in order to check smart contract signatures, a chain and client must be provided. Or, you can use the `verifyContractWalletSignature` function directly if all signatures will be from smart accounts._ +* [verifyTypedData](https://portal.thirdweb.com/references/typescript/v5/verifyTypedData): A promise that resolves to `true` if the signature is valid, or `false` otherwise. +* [decodeJWT](https://portal.thirdweb.com/references/typescript/v5/decodeJWT): Decodes a JSON Web Token (JWT) and returns the decoded payload and signature. +* [encodeJWT](https://portal.thirdweb.com/references/typescript/v5/encodeJWT): Builds a JSON Web Token (JWT) using the provided options. +* [refreshJWT](https://portal.thirdweb.com/references/typescript/v5/refreshJWT): Refreshes a JSON Web Token (JWT) by encoding a new payload with updated expiration time. +--- +# NFT +* [NFTDescription](https://portal.thirdweb.com/references/typescript/v5/NFTDescription): This component fetches and displays an NFT's description. It inherits all the attributes of a ``so you can style it just like how you would style a `` element. +* [NFTMedia](https://portal.thirdweb.com/references/typescript/v5/NFTMedia): This component fetches and displays an NFT's media. It uses thirdweb [MediaRenderer](https://portal.thirdweb.com/refernces/typescript/v5/MediaRenderer) under the hood so you can style it just like how you would style a MediaRenderer. +* [NFTName](https://portal.thirdweb.com/references/typescript/v5/NFTName): This component fetches and displays an NFT's name. It takes in a `className` and `style` props so you can style it just like how you would style a `` element. +--- +# Buy Crypto +* [convertCryptoToFiat](https://portal.thirdweb.com/references/typescript/v5/convertCryptoToFiat): Get a price of a token (using tokenAddress + chainId) in fiat. Only USD is supported at the moment. +* [convertFiatToCrypto](https://portal.thirdweb.com/references/typescript/v5/convertFiatToCrypto): Convert a fiat value to a token. Currently only USD is supported. +* [getBuyHistory](https://portal.thirdweb.com/references/typescript/v5/getBuyHistory): Get Buy transaction history for a given wallet address. +* [getBuyWithCryptoHistory](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoHistory): Gets the History of purchases for a given wallet address +* [getBuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoQuote): Get a quote of type [BuyWithCryptoQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoQuote) to buy any given token with crypto. This quote contains the information about the swap such as token amounts, processing fees, estimated time etc. +* [getBuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoStatus): Gets the status of a buy with crypto transaction +* [getBuyWithCryptoTransfer](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoTransfer): Get a quote of type [BuyWithCryptoTransfer](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) to facilitate a token transfer transaction. Using this instead of a native transfer allows you to receive status and webhooks about successful or failed payments. +* [getBuyWithFiatHistory](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatHistory): Get the "Buy with fiat" transaction history for a given wallet address +* [getBuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatQuote): Get a quote of type [BuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatQuote) to buy given token with fiat currency. This quote contains the information about the swap such as token amounts, processing fees, estimated time etc. +* [getBuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatStatus): Once you get a `quote` from [getBuyWithFiatQuote](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatQuote)and open the `quote.onRampLink` in a new tab, you can start polling for the transaction status using `getBuyWithFiatStatus` +* [getPostOnRampQuote](https://portal.thirdweb.com/references/typescript/v5/getPostOnRampQuote): When buying a token with fiat currency - It only involes doing on-ramp if the on-ramp provider supports buying the given destination token directly. +* [isSwapRequiredPostOnramp](https://portal.thirdweb.com/references/typescript/v5/isSwapRequiredPostOnramp): Check if a Swap is required after on-ramp when buying a token with fiat currency. +--- +# Tokens +* [TokenIcon](https://portal.thirdweb.com/references/typescript/v5/TokenIcon): This component tries to resolve the icon of a given token, then return an image. +* [TokenName](https://portal.thirdweb.com/references/typescript/v5/TokenName): This component fetches then shows the name of a token. For ERC20 tokens, it calls the `name` function in the ERC20 contract. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` +* [TokenSymbol](https://portal.thirdweb.com/references/typescript/v5/TokenSymbol): This component fetches then shows the symbol of a token. For ERC20 tokens, it calls the `symbol` function in the ERC20 contract. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` +--- +# Storage +* [download](https://portal.thirdweb.com/references/typescript/v5/download): Download a file from IPFS: +* [resolveArweaveScheme](https://portal.thirdweb.com/references/typescript/v5/resolveArweaveScheme): Resolves the scheme of a given Arweave URI and returns the corresponding URL. +* [resolveScheme](https://portal.thirdweb.com/references/typescript/v5/resolveScheme): Resolves the scheme of a given URI and returns the corresponding URL. If the URI starts with "ipfs://", it constructs a URL using the IPFS client ID and the IPFS gateway. If the URI starts with "http", it returns the URI as is. Otherwise, it throws an error indicating an invalid URI scheme. +* [unpin](https://portal.thirdweb.com/references/typescript/v5/unpin): Unpins a file from IPFS. For security purposes, this method requires a secret key to be set in the ThirdwebClient instance. +* [upload](https://portal.thirdweb.com/references/typescript/v5/upload): Uploads files based on the provided options. +* [uploadMobile](https://portal.thirdweb.com/references/typescript/v5/uploadMobile): Batch upload arbitrary file or JSON data using the configured decentralized storage system. Automatically uploads any file data within JSON objects and replaces them with hashes. +--- +# RPC +* [eth_blockNumber](https://portal.thirdweb.com/references/typescript/v5/eth_blockNumber): Retrieves the current block number from the Ethereum blockchain. +* [eth_call](https://portal.thirdweb.com/references/typescript/v5/eth_call): Executes a call or a transaction on the Ethereum network. +* [eth_estimateGas](https://portal.thirdweb.com/references/typescript/v5/eth_estimateGas): Estimates the gas required to execute a transaction on the Ethereum network. +* [eth_gasPrice](https://portal.thirdweb.com/references/typescript/v5/eth_gasPrice): Retrieves the current gas price from the Ethereum network. +* [eth_getBalance](https://portal.thirdweb.com/references/typescript/v5/eth_getBalance): Retrieves the balance of the specified Ethereum address. +* [eth_getBlockByHash](https://portal.thirdweb.com/references/typescript/v5/eth_getBlockByHash): Retrieves a block by its hash. +* [eth_getBlockByNumber](https://portal.thirdweb.com/references/typescript/v5/eth_getBlockByNumber): Retrieves a block by its number or tag from the Ethereum blockchain. +* [eth_getCode](https://portal.thirdweb.com/references/typescript/v5/eth_getCode): Retrieves the bytecode of a smart contract at the specified address. +* [eth_getLogs](https://portal.thirdweb.com/references/typescript/v5/eth_getLogs): Retrieves logs from the Ethereum blockchain based on the specified parameters. +* [eth_getStorageAt](https://portal.thirdweb.com/references/typescript/v5/eth_getStorageAt): Retrieves the value stored at a specific position in the storage of a contract. +* [eth_getTransactionByHash](https://portal.thirdweb.com/references/typescript/v5/eth_getTransactionByHash): Retrieves a transaction by its hash. +* [eth_getTransactionCount](https://portal.thirdweb.com/references/typescript/v5/eth_getTransactionCount): Retrieves the transaction count (nonce) for a given Ethereum address. +* [eth_getTransactionReceipt](https://portal.thirdweb.com/references/typescript/v5/eth_getTransactionReceipt): Retrieves the transaction receipt for a given transaction hash. Throws an error if the receipt is not found. +* [eth_maxPriorityFeePerGas](https://portal.thirdweb.com/references/typescript/v5/eth_maxPriorityFeePerGas): Retrieves the maximum priority fee per gas from the Ethereum network. +* [eth_sendRawTransaction](https://portal.thirdweb.com/references/typescript/v5/eth_sendRawTransaction): Sends a raw transaction to the Ethereum network. +* [getRpcClient](https://portal.thirdweb.com/references/typescript/v5/getRpcClient): Returns an RPC request that can be used to make JSON-RPC requests. +* [watchBlockNumber](https://portal.thirdweb.com/references/typescript/v5/watchBlockNumber): Watches the block number for a specific chain. +--- +# Theme +* [darkTheme](https://portal.thirdweb.com/references/typescript/v5/darkTheme): Create a custom dark theme object by using the default dark theme as a base and applying overrides. +* [lightTheme](https://portal.thirdweb.com/references/typescript/v5/lightTheme): Create a custom light theme object by using the default dark theme as a base and applying overrides. +--- +# Utils +* [getContractPublisher](https://portal.thirdweb.com/references/typescript/v5/getContractPublisher): Returns the default publisher contract on polygon +* [getDefaultToken](https://portal.thirdweb.com/references/typescript/v5/getDefaultToken): Get the default token for a given chain and symbol +* [getLastAuthProvider](https://portal.thirdweb.com/references/typescript/v5/getLastAuthProvider): Retrieves the last authentication provider used from local storage. +* [boolToBytes](https://portal.thirdweb.com/references/typescript/v5/boolToBytes): Converts a boolean value to a Uint8Array of bytes. +* [boolToHex](https://portal.thirdweb.com/references/typescript/v5/boolToHex): Converts a boolean value to a hexadecimal string representation. +* [bytesToBigInt](https://portal.thirdweb.com/references/typescript/v5/bytesToBigInt): Converts a Uint8Array of bytes to a bigint. +* [bytesToBool](https://portal.thirdweb.com/references/typescript/v5/bytesToBool): Converts a byte array to a boolean value. +* [bytesToNumber](https://portal.thirdweb.com/references/typescript/v5/bytesToNumber): Converts a Uint8Array of bytes to a number. +* [bytesToString](https://portal.thirdweb.com/references/typescript/v5/bytesToString): Converts an array of bytes to a string using UTF-8 encoding. +* [concatHex](https://portal.thirdweb.com/references/typescript/v5/concatHex): Concatenates an array of hexadecimal values into a single hexadecimal value. +* [fromBytes](https://portal.thirdweb.com/references/typescript/v5/fromBytes): Converts a Uint8Array to the specified type. +* [fromGwei](https://portal.thirdweb.com/references/typescript/v5/fromGwei): Converts the specified number from gwei to wei. +* [fromHex](https://portal.thirdweb.com/references/typescript/v5/fromHex): Converts a hexadecimal string to the specified type. +* [getAddress](https://portal.thirdweb.com/references/typescript/v5/getAddress): Retrieves the address after performing validation and checksumming. +* [getGasPrice](https://portal.thirdweb.com/references/typescript/v5/getGasPrice): Retrieves the gas price for a transaction on a specific chain. +* [hexToBigInt](https://portal.thirdweb.com/references/typescript/v5/hexToBigInt): Converts a hexadecimal string to a BigInt. +* [hexToBool](https://portal.thirdweb.com/references/typescript/v5/hexToBool): Converts a hexadecimal string to a boolean value. +* [hexToBytes](https://portal.thirdweb.com/references/typescript/v5/hexToBytes): Converts a hexadecimal string to a Uint8Array of bytes. +* [hexToNumber](https://portal.thirdweb.com/references/typescript/v5/hexToNumber): Converts a hexadecimal string to a number. +* [hexToString](https://portal.thirdweb.com/references/typescript/v5/hexToString): Converts a hexadecimal string to a UTF-8 string. +* [hexToUint8Array](https://portal.thirdweb.com/references/typescript/v5/hexToUint8Array): Converts a hexadecimal string to a Uint8Array. +* [isAddress](https://portal.thirdweb.com/references/typescript/v5/isAddress): Checks if a given string is a valid address. +* [isHex](https://portal.thirdweb.com/references/typescript/v5/isHex): Checks if a value is a valid hexadecimal string. +* [keccak256](https://portal.thirdweb.com/references/typescript/v5/keccak256): Calculates the Keccak-256 hash of the given value. +* [numberToBytes](https://portal.thirdweb.com/references/typescript/v5/numberToBytes): Converts a number to bytes. +* [numberToHex](https://portal.thirdweb.com/references/typescript/v5/numberToHex): Converts a number or bigint to a hexadecimal string. +* [padHex](https://portal.thirdweb.com/references/typescript/v5/padHex): Pads a hexadecimal string with zeros to a specified size. +* [sha256](https://portal.thirdweb.com/references/typescript/v5/sha256): Calculates the SHA256 hash of the given value. +* [stringToBytes](https://portal.thirdweb.com/references/typescript/v5/stringToBytes): Converts a string to an array of bytes. +* [stringToHex](https://portal.thirdweb.com/references/typescript/v5/stringToHex): Converts a string to its hexadecimal representation. +* [toBytes](https://portal.thirdweb.com/references/typescript/v5/toBytes): Converts a value to an array of bytes. +* [toEther](https://portal.thirdweb.com/references/typescript/v5/toEther): Converts a value from wei to ether. +* [toHex](https://portal.thirdweb.com/references/typescript/v5/toHex): Converts a value to its hexadecimal representation. +* [toTokens](https://portal.thirdweb.com/references/typescript/v5/toTokens): Converts a given number of units to a string representation with a specified number of decimal places. +* [toUnits](https://portal.thirdweb.com/references/typescript/v5/toUnits): Converts a string representation of a number with decimal places to a BigInt representation. +* [toWei](https://portal.thirdweb.com/references/typescript/v5/toWei): Converts the specified number of tokens to Wei. +* [uint8ArrayToHex](https://portal.thirdweb.com/references/typescript/v5/uint8ArrayToHex): Converts an array of bytes to a hexadecimal string. +* [checksumAddress](https://portal.thirdweb.com/references/typescript/v5/checksumAddress): Calculates the checksum address for the given address. +* [computeDeploymentAddress](https://portal.thirdweb.com/references/typescript/v5/computeDeploymentAddress): Computes the deployment address for a contract based on the given options. +* [decodeError](https://portal.thirdweb.com/references/typescript/v5/decodeError): Decodes an error. +* [decodeFunctionData](https://portal.thirdweb.com/references/typescript/v5/decodeFunctionData): Decodes the data of a function call. +* [decodeFunctionResult](https://portal.thirdweb.com/references/typescript/v5/decodeFunctionResult): Decodes the result of a function call. +* [encodeAbiParameters](https://portal.thirdweb.com/references/typescript/v5/encodeAbiParameters): Encodes the given ABI parameters and values into a hexadecimal string. +* [ensureBytecodePrefix](https://portal.thirdweb.com/references/typescript/v5/ensureBytecodePrefix): Ensures that the given bytecode has the correct prefix. If the bytecode already starts with "0x", it is returned as is. Otherwise, the prefix "0x" is added to the bytecode. +* [extractIPFSUri](https://portal.thirdweb.com/references/typescript/v5/extractIPFSUri): Extracts the IPFS URI from the given bytecode. +* [extractMinimalProxyImplementationAddress](https://portal.thirdweb.com/references/typescript/v5/extractMinimalProxyImplementationAddress): Extracts the implementation address from a given bytecode string if it matches any of the known minimal proxy patterns. +* [formatNumber](https://portal.thirdweb.com/references/typescript/v5/formatNumber): Round up a number to a certain decimal place +* [getClaimParams](https://portal.thirdweb.com/references/typescript/v5/getClaimParams): Get the claim parameters for a given drop +* [getInitBytecodeWithSalt](https://portal.thirdweb.com/references/typescript/v5/getInitBytecodeWithSalt): Generates the initialization bytecode with salt for a contract deployment. +* [getSaltHash](https://portal.thirdweb.com/references/typescript/v5/getSaltHash): Calculates the salt hash for a given bytecode. +* [hashMessage](https://portal.thirdweb.com/references/typescript/v5/hashMessage): Ethereum Signed Message hashing +* [isEIP155Enforced](https://portal.thirdweb.com/references/typescript/v5/isEIP155Enforced): Checks whether EIP-155 is enforced by sending a random transaction of legacy type (pre-EIP-155) and parsing the error message. +* [keccakId](https://portal.thirdweb.com/references/typescript/v5/keccakId): Calculates the keccak ID of the given input. +* [max](https://portal.thirdweb.com/references/typescript/v5/max): Returns the maximum of two BigInt values. +* [min](https://portal.thirdweb.com/references/typescript/v5/min): Returns the minimum of two BigInt values. +* [parseAbiParams](https://portal.thirdweb.com/references/typescript/v5/parseAbiParams): Converts an array of parameter values to their respective types based on the provided type array. +* [resolveSignature](https://portal.thirdweb.com/references/typescript/v5/resolveSignature): Resolves a signature by converting a hexadecimal string into a function or event signature. +* [resolveSignatures](https://portal.thirdweb.com/references/typescript/v5/resolveSignatures): Resolves the signatures of the given hexadecimal signatures. +* [shortenAddress](https://portal.thirdweb.com/references/typescript/v5/shortenAddress): Checksums and formats an address if valid. Note this function does not check if the provided address is an ENS. +* [shortenHex](https://portal.thirdweb.com/references/typescript/v5/shortenHex): Shortens a hexadecimal string without performing any validation or checksumming. +* [shortenLargeNumber](https://portal.thirdweb.com/references/typescript/v5/shortenLargeNumber): Shorten the string for large value Mainly used for Examples: 10\_000 -> 10k 1\_000\_000 -> 1M 1\_000\_000\_000 -> 1B +* [sign](https://portal.thirdweb.com/references/typescript/v5/sign): Generates the signature for the provided transaction hash. +* [signatureToHex](https://portal.thirdweb.com/references/typescript/v5/signatureToHex): Converts a signature to a hex string. +* [signMessage](https://portal.thirdweb.com/references/typescript/v5/signMessage): Signs a string message with a given private key. +* [signTypedData](https://portal.thirdweb.com/references/typescript/v5/signTypedData): Signs a typed data object with a given private key according to EIP712. +* [stringify](https://portal.thirdweb.com/references/typescript/v5/stringify): Stringify a JSON object and convert all bigint values to string +--- +# Miscellaneous +* [WalletName](https://portal.thirdweb.com/references/typescript/v5/WalletName): This component fetches then shows the name of a wallet. It inherits all the attributes of a HTML `` component, hence you can style it just like how you would style a normal `` +* [decodeAbiParameters](https://portal.thirdweb.com/references/typescript/v5/decodeAbiParameters): Reference for decodeAbiParameters +* [encodePacked](https://portal.thirdweb.com/references/typescript/v5/encodePacked): Reference for encodePacked +* [isBytes](https://portal.thirdweb.com/references/typescript/v5/isBytes): Reference for isBytes +* [isValidENSName](https://portal.thirdweb.com/references/typescript/v5/isValidENSName): Checks if a string is a valid ENS name. It does not check if the ENS name is currently registered or resolves to an address - it only validates the string format. +* [toEventSelector](https://portal.thirdweb.com/references/typescript/v5/toEventSelector): Returns the hash (of the function/event signature) for a given event or function definition. +* [toFunctionSelector](https://portal.thirdweb.com/references/typescript/v5/toFunctionSelector): Reference for toFunctionSelector +* [AutoConnect](https://portal.thirdweb.com/references/typescript/v5/autoConnect): AutoConnect last connected wallet on page reload or revisit. Note: If you are using `ConnectButton` or `ConnectEmbed` components, You don't need to use this component as it is already included. diff --git a/apps/portal/scripts/extractLLMData.ts b/apps/portal/scripts/extractLLMData.ts index 4cc2a77ca0f..0e4eb08bfdb 100644 --- a/apps/portal/scripts/extractLLMData.ts +++ b/apps/portal/scripts/extractLLMData.ts @@ -2,10 +2,17 @@ import { writeFileSync } from "node:fs"; import { extractContentForLLM } from "../src/app/api/search/extraction/llm-extract"; async function main() { + console.log(">> Extracting LLM data"); const rootDir = process.cwd(); - const { llmContent, llmFullContent } = await extractContentForLLM(rootDir); - writeFileSync("./public/llms.txt", llmContent); - writeFileSync("./public/llms-full.txt", llmFullContent); + try { + const { llmContent, llmFullContent } = await extractContentForLLM(rootDir); + writeFileSync("./public/llms.txt", llmContent); + writeFileSync("./public/llms-full.txt", llmFullContent); + console.log(">> LLM files saved successfully"); + } catch (e) { + console.error("Failed to extract LLM data"); + console.error(e); + } } main(); diff --git a/apps/portal/scripts/extractSearchData.ts b/apps/portal/scripts/extractSearchData.ts index 6d8c5fd820e..27d9eb171ba 100644 --- a/apps/portal/scripts/extractSearchData.ts +++ b/apps/portal/scripts/extractSearchData.ts @@ -2,9 +2,16 @@ import { writeFileSync } from "node:fs"; import { extractContent } from "../src/app/api/search/extraction"; async function main() { + console.log(">> Extracting search data"); const rootDir = process.cwd(); - const { searchData } = await extractContent(rootDir); - writeFileSync("./searchIndex.json", JSON.stringify(searchData, null, 2)); + try { + const { searchData } = await extractContent(rootDir); + writeFileSync("./searchIndex.json", JSON.stringify(searchData, null, 2)); + console.log(">> Search data saved successfully"); + } catch (e) { + console.error("Failed to extract search data"); + console.error(e); + } } main();