diff --git a/apps/portal/public/llms-full.txt b/apps/portal/public/llms-full.txt index 0b2c8a3df62..704581e5920 100644 --- a/apps/portal/public/llms-full.txt +++ b/apps/portal/public/llms-full.txt @@ -62,7 +62,7 @@ function AccountAddress( #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -117,7 +117,7 @@ import { AccountAddress, } from "thirdweb/react"; - + @@ -178,66 +178,25 @@ let returnType: Element; ``` --- -## SocialIcon - -Social auth provider icon - -### Example - -```tsx -import { SocialIcon } from "thirdweb/react"; - -; -``` - -Result: An `` component with the src of the icon - -```html - -``` - -```ts -function SocialIcon(__namedParameters: SocialIconProps): 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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 : "lazy" | "eager",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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,popover : "" | "auto" | "manual",popoverTarget : string,popoverTargetAction : "toggle" | "hide" | "show",prefix : string,property : string,provider : string,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: Element; -``` - -an `` component with the src set to the svg ---- - ## 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. +* 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"; - - - - -; +* #### Basic usage +* ```tsx +``` +* import { WalletProvider, WalletIcon, WalletName } from "thirdweb/react"; +* `` +* `` +* `` +* `` +* ```javascript ``` ```ts @@ -273,12 +232,6 @@ type AutoConnectProps = { client: ThirdwebClient; onConnect?: (wallet: Wallet) => void; onTimeout?: () => void; - siweAuth?: { - doLogin: () => Promise; - isLoggedIn: boolean | undefined; - isLoggingIn: boolean | undefined; - requiresAuth: boolean; - }; timeout?: number; wallets?: Array; }; @@ -354,7 +307,6 @@ function onConnect(wallet: Wallet): void; ```ts let wallet: { getAdminAccount?: () => Account | undefined; - getAuthToken?: () => string | null; getConfig: () => CreateWalletArgs[1]; id: TWalletId; onConnectRequested?: () => Promise; @@ -370,7 +322,9 @@ let wallet: { getChain: () => | undefined | Readonly; - switchChain: (chain: Readonly) => Promise; + switchChain: ( + chain: Readonly, + ) => Promise; }; ``` @@ -390,15 +344,6 @@ function onTimeout(): void; let returnType: void; ``` -```ts -type siweAuth = { - doLogin: () => Promise; - isLoggedIn: boolean | undefined; - isLoggingIn: boolean | undefined; - requiresAuth: boolean; -}; -``` - 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). @@ -1051,7 +996,9 @@ function ThirdwebProvider( isAutoConnecting: Store; removeConnectedWallet: (wallet: Wallet) => void; setActiveWallet: (activeWallet: Wallet) => Promise; - switchActiveWalletChain: (chain: Readonly) => Promise; + switchActiveWalletChain: ( + chain: Readonly, + ) => Promise; }; }>, ): Element; @@ -1089,7 +1036,9 @@ let props: PropsWithChildren<{ isAutoConnecting: Store; removeConnectedWallet: (wallet: Wallet) => void; setActiveWallet: (activeWallet: Wallet) => Promise; - switchActiveWalletChain: (chain: Readonly) => Promise; + switchActiveWalletChain: ( + chain: Readonly, + ) => Promise; }; }>; ``` @@ -1193,8 +1142,6 @@ function BuyDirectListingButton( ### Parameters -props of type [BuyDirectListingButtonProps](https://portal.thirdweb.com/references/typescript/v5/BuyDirectListingButtonProps) - #### Type ```ts @@ -1212,6 +1159,8 @@ let props: Omit & { ```ts let returnType: Element; ``` + +`` --- ## ClaimButton @@ -1596,322 +1545,6 @@ let props: PropsWithChildren; ### Returns -```ts -let returnType: Element; -``` ---- -# Buy Crypto ---- - -## BuyWidget - -Widget is a prebuilt UI for purchasing a specific token. - -### Example - -#### Basic usage - -The `BuyWidget` component requires `client`, `chain`, and `amount` props to function. - -```tsx -import { ethereum } from "thirdweb/chains"; - - -``` - -#### Buy a specific token - -You can specify a token to purchase by passing the `tokenAddress` prop. - -```tsx - -``` - -#### Customize the UI - -You can customize the UI of the `BuyWidget` 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. - -#### Update the Title - -You can update the title of the widget by passing a `title` prop to the `BuyWidget` component. - -```tsx - -``` - -#### Configure the wallet connection - -You can customize the wallet connection flow by passing a `connectOptions` object to the `BuyWidget` component. - -```tsx - -``` - -Refer to the [BuyWidgetConnectOptions](https://portal.thirdweb.com/references/typescript/v5/BuyWidgetConnectOptions) type for more details. - -```ts -function BuyWidget(props: BuyWidgetProps): Element; -``` - -### Parameters - -Props of type [BuyWidgetProps](https://portal.thirdweb.com/references/typescript/v5/BuyWidgetProps) to configure the BuyWidget component. - -#### Type - -```ts -let props: { - activeWallet?: Wallet; - amount: string; - chain: Chain; - className?: string; - client: ThirdwebClient; - connectOptions?: BuyWidgetConnectOptions; - description?: string; - hiddenWallets?: Array; - image?: string; - locale?: LocaleId; - onCancel?: () => void; - onError?: (error: Error) => void; - onSuccess?: () => void; - paymentLinkId?: string; - presetOptions?: [number, number, number]; - purchaseData?: Record; - style?: React.CSSProperties; - supportedTokens?: SupportedTokens; - theme?: "light" | "dark" | Theme; - title?: string; - tokenAddress?: Address; -}; -``` - -### Returns - -```ts -let returnType: Element; -``` - -## CheckoutWidget - -Widget is a prebuilt UI for making direct payments to a wallet address. - -### Example - -#### Basic usage - -The `CheckoutWidget` component requires `client`, `chain`, `amount`, `tokenAddress`, and `sellerAddress` props to function. - -```tsx -import { base } from "thirdweb/chains"; -import { getDefaultToken } from "thirdweb/utils"; - - -``` - -#### With metadata - -You can add metadata to display product information. - -```tsx - -``` - -```ts -function CheckoutWidget(props: CheckoutWidgetProps): Element; -``` - -### Parameters - -Props of type [CheckoutWidgetProps](https://portal.thirdweb.com/references/typescript/v5/CheckoutWidgetProps) to configure the CheckoutWidget component. - -#### Type - -```ts -let props: { - activeWallet?: Wallet; - amount: string; - chain: Chain; - className?: string; - client: ThirdwebClient; - connectOptions?: CheckoutWidgetConnectOptions; - description?: string; - hiddenWallets?: Array; - image?: string; - locale?: LocaleId; - onCancel?: () => void; - onError?: (error: Error) => void; - onSuccess?: () => void; - paymentLinkId?: string; - purchaseData?: Record; - sellerAddress: Address; - style?: React.CSSProperties; - supportedTokens?: SupportedTokens; - theme?: "light" | "dark" | Theme; - title?: string; - tokenAddress: Address; -}; -``` - -### Returns - -```ts -let returnType: Element; -``` - -## TransactionWidget - -Widget is a prebuilt UI for executing a transaction with a different wallet, chain or token. - -### Example - -#### Basic usage - -The `TransactionWidget` component requires `client` and `transaction` props to function. - -```tsx -import { claimTo } from "thirdweb/extensions/erc1155"; - - -``` - -#### With metadata - -You can add metadata to display transaction information. - -```tsx - -``` - -#### ERC20 payments - -You can handle ERC20 payments by passing `erc20value` to your transaction: - -```tsx -import { prepareContractCall } from "thirdweb"; -import { toUnits } from "thirdweb/utils"; - - -``` - -```ts -function TransactionWidget(props: TransactionWidgetProps): Element; -``` - -### Parameters - -Props of type [TransactionWidgetProps](https://portal.thirdweb.com/references/typescript/v5/TransactionWidgetProps) to configure the TransactionWidget component. - -#### Type - -```ts -let props: { - activeWallet?: Wallet; - className?: string; - client: ThirdwebClient; - connectOptions?: TransactionWidgetConnectOptions; - description?: string; - hiddenWallets?: Array; - image?: string; - locale?: LocaleId; - onCancel?: () => void; - onError?: (error: Error) => void; - onSuccess?: () => void; - paymentLinkId?: string; - purchaseData?: Record; - style?: React.CSSProperties; - supportedTokens?: SupportedTokens; - theme?: "light" | "dark" | Theme; - title?: string; - transaction: PreparedTransaction; -}; -``` - -### Returns - ```ts let returnType: Element; ``` @@ -2001,6 +1634,189 @@ let props: MediaRendererProps & RefAttributes; 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 @@ -2008,24 +1824,28 @@ let returnType: ReactNode; ## EIP5792 --- -## EIP5792.useCapabilities +## EIP5792.useCallsStatus -A hook to get the current wallet's capabilities according to [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792). +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, but will not throw._The returned object contains a `message` field detailing any issues with the wallet's support for 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 { useCapabilities } from "thirdweb/react"; -const { data: capabilities, isLoading } = useCapabilities(); +import { useCallsStatus } from "thirdweb/react"; +const { data: status, isLoading } = useCallsStatus({ + bundleId, + client, +}); ``` ```ts -function useCapabilities(options?: { - chainId?: number; +function useCallsStatus(options: { + bundleId: string; + client: ThirdwebClient; queryOptions?: { enabled?: boolean; retry?: number }; -}): UseQueryResult<{ message?: string }>; +}): UseQueryResult; ``` ### Parameters @@ -2034,7 +1854,8 @@ function useCapabilities(options?: { ```ts let options: { - chainId?: number; + bundleId: string; + client: ThirdwebClient; queryOptions?: { enabled?: boolean; retry?: number }; }; ``` @@ -2042,97 +1863,29 @@ let options: { ### Returns ```ts -let returnType: UseQueryResult<{ message?: string }>; +let returnType: UseQueryResult; ``` a React Query object. --- -## EIP5792.useSendAndConfirmCalls - -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 batched and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions. +## EIP5792.useCapabilities -When calls are sent, all contracts that are interacted with will have their corresponding reads revalidated via React Query. +A hook to get the current wallet's capabilities according to [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792). -This hook is dependent on the wallet's support for EIP-5792 and could fail. The mutation function will use your currently connected wallet by default, but you can pass it a specific wallet to use if you'd like. +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 { 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: result } = useSendAndConfirmCalls(); -await sendCalls({ - client, - calls: [sendTx1, sendTx2], -}); - -console.log( - "Transaction hash:", - result.receipts?.[0]?.transactionHash, -); -``` - -Sponsor transactions with a paymaster: - -```ts -const { mutate: sendAndConfirmCalls, data: id } = - useSendAndConfirmCalls(); -const result = await sendAndConfirmCalls({ - client, - calls: [sendTx1, sendTx2], - capabilities: { - paymasterService: { - url: `https://${CHAIN.id}.bundler.thirdweb.com/${client.clientId}`, - }, - }, -}); -console.log( - "Transaction hash:", - result.receipts?.[0]?.transactionHash, -); +import { useCapabilities } from "thirdweb/react"; +const { data: capabilities, isLoading } = useCapabilities(); ``` -We recommend proxying any paymaster calls via an API route you setup and control. - ```ts -function useSendAndConfirmCalls(args?: { - maxBlocksWaitTime?: number; -}): UseMutationResult< - { - atomic: boolean; - chainId: number; - id: string; - receipts?: Array< - WalletCallReceipt - >; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; - }, - Error, - Omit< - { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; - }, - "chain" | "wallet" - > & { wallet?: Wallet } ->; +function useCapabilities(options?: { + queryOptions?: { enabled?: boolean; retry?: number }; +}): UseQueryResult; ``` ### Parameters @@ -2140,40 +1893,16 @@ function useSendAndConfirmCalls(args?: { #### Type ```ts -let args: { maxBlocksWaitTime?: number }; +let options: { queryOptions?: { enabled?: boolean; retry?: number } }; ``` ### Returns ```ts -let returnType: UseMutationResult< - { - atomic: boolean; - chainId: number; - id: string; - receipts?: Array< - WalletCallReceipt - >; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; - }, - Error, - Omit< - { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; - }, - "chain" | "wallet" - > & { wallet?: Wallet } ->; +let returnType: UseQueryResult; ``` -A React Query mutation object to interact with sendAndConfirmCalls +a React Query object. --- ## EIP5792.useSendCalls @@ -2199,7 +1928,9 @@ const sendTx2 = approve({ amount: 100, spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709", }); -const { mutate: sendCalls, data: id } = useSendCalls(); +const { mutate: sendCalls, data: bundleId } = useSendCalls({ + client, +}); await sendCalls({ wallet, client, @@ -2210,21 +1941,21 @@ await sendCalls({ Await the bundle's full confirmation: ```tsx -const { mutate: sendCalls, data } = useSendCalls(); -const { data: result, isLoading } = useWaitForCallsReceipt(data); +const { mutate: sendCalls, data: bundleId } = useSendCalls({ + client, + waitForResult: true, +}); await sendCalls({ wallet, client, calls: [sendTx1, sendTx2], }); - -console.log("Receipts:", result.receipts); ``` Sponsor transactions with a paymaster: ```ts -const { mutate: sendCalls, data: id } = useSendCalls(); +const { mutate: sendCalls, data: bundleId } = useSendCalls(); await sendCalls({ client, calls: [sendTx1, sendTx2], @@ -2239,104 +1970,13 @@ await sendCalls({ We recommend proxying any paymaster calls via an API route you setup and control. ```ts -function useSendCalls(): UseMutationResult< - { - chain: Readonly; - client: ThirdwebClient; - id: string; - wallet: Wallet; - }, - Error, - Omit< - { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; - }, - "chain" | "wallet" - > & { wallet?: Wallet } ->; -``` - -### Returns - -```ts -let returnType: UseMutationResult< - { - chain: Readonly; - client: ThirdwebClient; - id: string; - wallet: Wallet; - }, +function useSendCalls(__namedParameters: { + client: ThirdwebClient; + waitForResult?: boolean; +}): UseMutationResult< + GetCallsStatusResponse | WalletSendCallsId, Error, - Omit< - { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; - }, - "chain" | "wallet" - > & { wallet?: Wallet } ->; -``` - -A React Query mutatuon object to interact with sendCalls ---- - -## EIP5792.useWaitForCallsReceipt - -A hook to wait for the receipt of eip5792 calls. - -### Example - -```tsx -const { data: receipt, isLoading } = useWaitForCallsReceipt({ - id, - client, - chain, - wallet, -}); -``` - -Example with useSendCalls: - -```tsx -const { mutate: sendCalls, data } = useSendCalls(); -const { data: receipt, isLoading } = useWaitForCallsReceipt(data); -``` - -```ts -function useWaitForCallsReceipt( - args: - | undefined - | ({ - chain: Readonly; - client: ThirdwebClient; - id: string; - wallet: Wallet; - } & { - maxBlocksWaitTime?: number; - queryOptions?: { enabled?: boolean }; - }), -): UseQueryResult< - { - atomic: boolean; - chainId: number; - id: string; - receipts?: Array< - WalletCallReceipt - >; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; - }, - Error + Omit & { wallet?: Wallet } >; ``` @@ -2345,39 +1985,23 @@ function useWaitForCallsReceipt( #### Type ```ts -let args: - | undefined - | ({ - chain: Readonly; - client: ThirdwebClient; - id: string; - wallet: Wallet; - } & { - maxBlocksWaitTime?: number; - queryOptions?: { enabled?: boolean }; - }); +let __namedParameters: { + client: ThirdwebClient; + waitForResult?: boolean; +}; ``` ### Returns ```ts -let returnType: UseQueryResult< - { - atomic: boolean; - chainId: number; - id: string; - receipts?: Array< - WalletCallReceipt - >; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; - }, - Error +let returnType: UseMutationResult< + GetCallsStatusResponse | WalletSendCallsId, + Error, + Omit & { wallet?: Wallet } >; ``` -A useQuery object. +A React Query mutatuon object to interact with sendCalls --- ## ENS --- @@ -2469,40 +2093,6 @@ let returnType: UseQueryResult; # Wallets --- -## useAuthToken - -A hook that returns the authentication token (JWT) for the currently active wallet. This token can be used to authorize API calls to your backend server. - -### Example - -```tsx -function MyComponent() { - const authToken = useAuthToken(); - - const fetchData = async () => { - const response = await fetch("https://api.example.com/data", { - headers: { - Authorization: `Bearer ${authToken}`, - }, - }); - // ... handle response - }; -} -``` - -```ts -function useAuthToken(): null | string; -``` - -### Returns - -```ts -let returnType: null | string; -``` - -The JWT string if the active wallet is an in-app wallet and matches the active account, null otherwise ---- - ## 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._ @@ -2772,7 +2362,7 @@ function useWalletBalance( tokenAddress?: string; }, queryOptions?: UseWalletBalanceQueryOptions, -): UseQueryResult; +): UseQueryResult; ``` ### Parameters @@ -2799,7 +2389,7 @@ let queryOptions: UseWalletBalanceQueryOptions; ### Returns ```ts -let returnType: UseQueryResult; +let returnType: UseQueryResult; ``` GetWalletBalanceResult The result of the query. @@ -2901,7 +2491,7 @@ Returns the wallet info for the provided wallet id. import { useWalletInfo } from "thirdweb/react"; const { data: walletInfo } = useWalletInfo("io.metamask"); -console.log("wallet name", walletInfo?.name); +console.log("Walelt name", walletInfo?.name); ``` ```ts @@ -3060,11 +2650,7 @@ function useActiveWalletConnectionStatus(): ConnectionStatus; ### Returns ```ts -let returnType: - | "connected" - | "disconnected" - | "connecting" - | "unknown"; +let returnType: "connected" | "disconnected" | "connecting"; ``` The active wallet's connection status. @@ -3125,12 +2711,6 @@ let props: { client: ThirdwebClient; onConnect?: (wallet: Wallet) => void; onTimeout?: () => void; - siweAuth?: { - doLogin: () => Promise; - isLoggedIn: boolean | undefined; - isLoggingIn: boolean | undefined; - requiresAuth: boolean; - }; timeout?: number; wallets?: Array; }; @@ -3202,7 +2782,6 @@ let options: { accountAbstraction?: SmartWalletOptions; client: ThirdwebClient; onConnect?: (wallet: Wallet) => void; - setWalletAsActive?: boolean; }; ``` @@ -3398,14 +2977,16 @@ const switchChain = useSwitchActiveWalletChain(); ```ts function useSwitchActiveWalletChain(): ( - chain: Readonly, + chain: Readonly, ) => Promise; ``` ### Returns ```ts -let returnType: (chain: Readonly) => Promise; +let returnType: ( + chain: Readonly, +) => Promise; ``` A function to switch to blockchain with given chain id in the active wallet. @@ -3559,9 +3140,7 @@ function useReadContract( ReadContractOptions >, ): UseQueryResult< - ReadContractResult< - ParseMethod>["outputs"] - > + ReadContractResult>[2]> >; ``` @@ -3581,9 +3160,7 @@ let options: WithPickedOnceQueryOptions< ```ts let returnType: UseQueryResult< - ReadContractResult< - ParseMethod>["outputs"] - > + ReadContractResult>[2]> >; ``` @@ -3660,7 +3237,7 @@ const estimatedGas = await estimateGas(tx); ```ts function useEstimateGas(): UseMutationResult< - bigint, + EstimateGasResult, Error, PreparedTransaction >; @@ -3669,7 +3246,11 @@ function useEstimateGas(): UseMutationResult< ### Returns ```ts -let returnType: UseMutationResult; +let returnType: UseMutationResult< + EstimateGasResult, + Error, + PreparedTransaction +>; ``` A mutation object to estimate gas. @@ -3798,12 +3379,7 @@ sendBatch([tx1, tx2]); ```ts function useSendBatchTransaction(): UseMutationResult< - { - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; - }, + WaitForReceiptOptions, Error, Array >; @@ -3813,12 +3389,7 @@ function useSendBatchTransaction(): UseMutationResult< ```ts let returnType: UseMutationResult< - { - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; - }, + WaitForReceiptOptions, Error, Array >; @@ -3911,7 +3482,7 @@ function useSendTransaction( config: SendTransactionConfig, ): UseMutationResult< { - chain: Readonly; + chain: Readonly; client: ThirdwebClient; maxBlocksWaitTime?: number; readonly transactionHash: `0x${string}`; @@ -3939,7 +3510,7 @@ let config: { ```ts let returnType: UseMutationResult< { - chain: Readonly; + chain: Readonly; client: ThirdwebClient; maxBlocksWaitTime?: number; readonly transactionHash: `0x${string}`; @@ -3968,7 +3539,7 @@ const result = await simulateTx(tx); ```ts function useSimulateTransaction(): UseMutationResult< - any, + Awaited>, Error, SimulateOptions >; @@ -3978,7 +3549,7 @@ function useSimulateTransaction(): UseMutationResult< ```ts let returnType: UseMutationResult< - any, + Awaited>, Error, SimulateOptions >; @@ -4006,12 +3577,12 @@ const { data: receipt, isLoading } = useWaitForReceipt({ function useWaitForReceipt( options: | undefined - | ({ - chain: Readonly; + | { + chain: Readonly; client: ThirdwebClient; maxBlocksWaitTime?: number; readonly transactionHash: `0x${string}`; - } & { queryOptions?: { enabled?: boolean } }), + }, ): UseQueryResult; ``` @@ -4024,12 +3595,12 @@ The options for waiting for a transaction receipt. ```ts let options: | undefined - | ({ - chain: Readonly; + | { + chain: Readonly; client: ThirdwebClient; maxBlocksWaitTime?: number; readonly transactionHash: `0x${string}`; - } & { queryOptions?: { enabled?: boolean } }); + }; ``` ### Returns @@ -4082,7 +3653,50 @@ let returnType: UseQueryResult, Error>; A React Query result containing the social profiles. --- -# Buy Crypto +# 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. +--- +# Miscellaneous --- ## useBuyHistory @@ -4143,8 +3757,6 @@ A React Query object which contains the data of type [BuyHistoryData](https://po ## useBuyWithCryptoHistory -Deprecated - 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 @@ -4201,8 +3813,6 @@ A React Query object which contains the data of type [BuyWithCryptoHistoryData]( ## useBuyWithCryptoQuote -Deprecated - 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. @@ -4285,7 +3895,6 @@ let params: { fromTokenAddress: string; intentId?: string; maxSlippageBPS?: number; - paymentLinkId?: string; purchaseData?: object; toAddress: string; toChainId: number; @@ -4315,8 +3924,6 @@ A React Query object which contains the data of type [BuyWithCryptoQuote](https: ## useBuyWithCryptoStatus -Deprecated - 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. @@ -4387,11 +3994,7 @@ object of type [BuyWithCryptoTransaction](https://portal.thirdweb.com/references #### Type ```ts -let params: { - chainId: number; - client: ThirdwebClient; - transactionHash: string; -}; +let params: { client: ThirdwebClient; transactionHash: string }; ``` ### Returns @@ -4405,8 +4008,6 @@ A react query object which contains the data of type [BuyWithCryptoStatus](https ## useBuyWithFiatHistory -Deprecated - 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 @@ -4463,8 +4064,6 @@ A React Query object which contains the data of type [BuyWithFiatHistoryData](ht ## useBuyWithFiatQuote -Deprecated - 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. @@ -4521,10 +4120,9 @@ let params: { client: ThirdwebClient; fromAddress: string; fromAmount?: string; - fromCurrencySymbol: CurrencyMeta["shorthand"]; + fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR" | "JPY"; isTestMode?: boolean; maxSlippageBPS?: number; - paymentLinkId?: string; preferredProvider?: FiatProvider; purchaseData?: object; toAddress: string; @@ -4552,8 +4150,6 @@ A React Query object which contains the data of type [BuyWithFiatQuote](https:// ## useBuyWithFiatStatus -Deprecated - 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. @@ -4580,7 +4176,7 @@ function Example() { ```ts function useBuyWithFiatStatus( - params?: WithPickedOnceQueryOptions, + params?: GetBuyWithFiatStatusParams, ): UseQueryResult; ``` @@ -4591,7 +4187,7 @@ object of type [GetBuyWithFiatStatusParams](https://portal.thirdweb.com/referenc #### Type ```ts -let params: WithPickedOnceQueryOptions; +let params: { client: ThirdwebClient; intentId: string }; ``` ### Returns @@ -4632,7 +4228,6 @@ object of type [GetPostOnRampQuoteParams](https://portal.thirdweb.com/references let params: { buyWithFiatStatus: BuyWithFiatStatus; client: ThirdwebClient; - paymentLinkId?: string; }; ``` @@ -4650,49 +4245,6 @@ 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 @@ -4744,9 +4296,7 @@ Configuration options for creating the wallet adapter ```ts let options: { - provider: - | EIP1193Provider - | ((params?: { chainId?: number }) => Promise); + provider: EIP1193Provider | (() => Promise); walletId?: WalletId; }; ``` @@ -4756,7 +4306,6 @@ let options: { ```ts let returnType: { getAdminAccount?: () => Account | undefined; - getAuthToken?: () => string | null; getConfig: () => CreateWalletArgs[1]; id: TWalletId; onConnectRequested?: () => Promise; @@ -4772,7 +4321,9 @@ let returnType: { getChain: () => | undefined | Readonly; - switchChain: (chain: Readonly) => Promise; + switchChain: ( + chain: Readonly, + ) => Promise; }; ``` @@ -4872,10 +4423,9 @@ const tx = prepareDirectDeployTransaction({ function prepareDirectDeployTransaction(options: { abi: Abi; bytecode: `0x${string}`; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; - extraDataWithUri?: string; }): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; ``` @@ -4889,10 +4439,9 @@ The options for preparing the transaction. let options: { abi: Abi; bytecode: `0x${string}`; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; - extraDataWithUri?: string; }; ``` @@ -4928,7 +4477,7 @@ const address = await computePublishedContractAddress({ ```ts function computePublishedContractAddress(args: { - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; contractId: string; @@ -4946,7 +4495,7 @@ The arguments for predicting the address of a published contract. ```ts let args: { - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; contractId: string; @@ -4974,7 +4523,7 @@ Deploy a contract on a given chain ### Deploying a regular contract from ABI and bytecode ```ts -import { deployContract } from "thirdweb/deploys"; +import { deployContract } from "thirdweb/deployContract"; const address = await deployContract({ client, @@ -4992,7 +4541,7 @@ const address = await deployContract({ ### Deploying a contract deterministically ```ts -import { deployContract } from "thirdweb/deploys"; +import { deployContract } from "thirdweb/deployContract"; const address = await deployContract({ client, @@ -5012,16 +4561,10 @@ function deployContract( options: { abi: Abi; bytecode: `0x${string}`; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; - extraDataWithUri?: string; - } & { - account: Account; - extraDataWithUri?: `0x${string}`; - isStylus?: boolean; - salt?: string; - }, + } & { account: Account; salt?: string }, ): Promise; ``` @@ -5035,16 +4578,10 @@ the deploy options let options: { abi: Abi; bytecode: `0x${string}`; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; - extraDataWithUri?: string; -} & { - account: Account; - extraDataWithUri?: `0x${string}`; - isStylus?: boolean; - salt?: string; -}; +} & { account: Account; salt?: string }; ``` ### Returns @@ -5079,7 +4616,7 @@ const contractAddress = await deployERC1155Contract({ ```ts function deployERC1155Contract(options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: ERC1155ContractParams; type: ERC1155ContractType; @@ -5095,7 +4632,7 @@ The deployment options. ```ts let options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: ERC1155ContractParams; type: ERC1155ContractType; @@ -5134,7 +4671,7 @@ const contractAddress = await deployERC20Contract({ ```ts function deployERC20Contract(options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: ERC20ContractParams; publisher?: string; @@ -5151,7 +4688,7 @@ The deployment options. ```ts let options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: ERC20ContractParams; publisher?: string; @@ -5191,7 +4728,7 @@ const contractAddress = await deployERC721Contract({ ```ts function deployERC721Contract(options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: ERC721ContractParams; type: ERC721ContractType; @@ -5207,7 +4744,7 @@ The deployment options. ```ts let options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: ERC721ContractParams; type: ERC721ContractType; @@ -5225,10 +4762,6 @@ The deployed contract address. ## DEPLOY.deployPackContract -Deprecated - -\[Pack contract is incompatible with Pectra update. Support for this contract is being removed in next release.\] - Deploy a thirdweb Pack contract ### Example @@ -5250,7 +4783,7 @@ const packAddress = await deployPackContract({ ```ts function deployPackContract(options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: PackContractParams; }): Promise; @@ -5265,7 +4798,7 @@ params for deploying [Pack contract](https://thirdweb.com/thirdweb.eth/Pack) ```ts let options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: PackContractParams; }; @@ -5379,7 +4912,7 @@ const contractAddress = await deploySplitContract({ ```ts function deploySplitContract(options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: SplitContractParams; }): Promise; @@ -5394,7 +4927,7 @@ The deployment options. ```ts let options: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; params: SplitContractParams; }; @@ -5429,7 +4962,7 @@ const tx = prepareDeterministicDeployTransaction({ ```ts function prepareDeterministicDeployTransaction(options: { - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; contractId: string; @@ -5447,7 +4980,7 @@ the options to deploy the contract ```ts let options: { - chain: Readonly; + chain: Readonly; client: ThirdwebClient; constructorParams?: Record; contractId: string; @@ -5469,192 +5002,170 @@ let returnType: PreparedTransaction< * the transaction to deploy the contract --- -## MARKETPLACE +## AIRDROP --- -## MARKETPLACE.deployMarketplaceContract +## AIRDROP.airdropERC1155 -Deploys a marketplace contract. +Prepares a transaction to call the "airdropERC1155" function on the contract. ### Example ```ts -import { deployMarketplaceContract } from "thirdweb/deploys"; +import { sendTransaction } from "thirdweb"; +import { airdropERC1155 } from "thirdweb/extensions/airdrop"; -const address = await deployMarketplaceContract({ - client, - chain, - account, - params: { - name: "MarketplaceV3", - description: "MarketplaceV3 deployed using thirdweb SDK", - platformFeeRecipient: - "0x21d514c90ee4E4e4Cd16Ce9185BF01F0F1eE4A04", - platformFeeBps: 1000, - }, +const transaction = airdropERC1155({ + contract, + tokenAddress: ..., + contents: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function deployMarketplaceContract(options: { - account: Account; - chain: Readonly; - client: ThirdwebClient; - params: MarketplaceContractParams; - version?: string; -}): Promise; +function airdropERC1155( + options: BaseTransactionOptions< + | AirdropERC1155Params + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for deploying the marketplace contract. +The options for the "airdropERC1155" function. #### Type ```ts -let options: { - account: Account; - chain: Readonly; - client: ThirdwebClient; - params: MarketplaceContractParams; - version?: string; -}; +let options: BaseTransactionOptions< + | AirdropERC1155Params + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` + +A prepared transaction object. --- -## MARKETPLACE.acceptedOfferEvent +## AIRDROP.airdropERC1155WithSignature -Creates an event object for the AcceptedOffer event. +Prepares a transaction to call the "airdropERC1155WithSignature" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { acceptedOfferEvent } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; +import { airdropERC1155WithSignature } from "thirdweb/extensions/airdrop"; -const events = await getContractEvents({ -contract, -events: [ - acceptedOfferEvent({ - offeror: ..., - offerId: ..., - assetContract: ..., -}) -], +const transaction = airdropERC1155WithSignature({ + contract, + req: ..., + signature: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function acceptedOfferEvent( - filters: Partial, -): 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"; -}>; +function airdropERC1155WithSignature( + options: BaseTransactionOptions< + | AirdropERC1155WithSignatureParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The options for the "airdropERC1155WithSignature" function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions< + | AirdropERC1155WithSignatureParams + | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## MARKETPLACE.acceptOffer +## AIRDROP.airdropERC20 -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. +Prepares a transaction to call the "airdropERC20" function on the contract. ### Example ```ts -import { acceptOffer } from "thirdweb/extensions/marketplace"; import { sendTransaction } from "thirdweb"; +import { airdropERC20 } from "thirdweb/extensions/airdrop"; -const acceptOfferTx = acceptOffer({ - contract, - offerId: 1n, +const transaction = airdropERC20({ + contract, + tokenAddress: ..., + contents: ..., + overrides: { + ... + } }); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function acceptOffer( - options: BaseTransactionOptions, +function airdropERC20( + options: BaseTransactionOptions< + | AirdropERC20Params + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for accepting the offer. +The options for the "airdropERC20" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | AirdropERC20Params + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -5667,24 +5178,23 @@ let returnType: PreparedTransaction< >; ``` -A transaction object that can be sent to accept the offer. +A prepared transaction object. --- -## MARKETPLACE.approveBuyerForListing +## AIRDROP.airdropERC20WithSignature -Prepares a transaction to call the "approveBuyerForListing" function on the contract. +Prepares a transaction to call the "airdropERC20WithSignature" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { approveBuyerForListing } from "thirdweb/extensions/marketplace"; +import { airdropERC20WithSignature } from "thirdweb/extensions/airdrop"; -const transaction = approveBuyerForListing({ +const transaction = airdropERC20WithSignature({ contract, - listingId: ..., - buyer: ..., - toApprove: ..., + req: ..., + signature: ..., overrides: { ... } @@ -5695,24 +5205,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function approveBuyerForListing( +function airdropERC20WithSignature( options: BaseTransactionOptions< - | ApproveBuyerForListingParams - | { asyncParams: () => Promise } + | AirdropERC20WithSignatureParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "approveBuyerForListing" function. +The options for the "airdropERC20WithSignature" function. #### Type ```ts let options: BaseTransactionOptions< - | ApproveBuyerForListingParams - | { asyncParams: () => Promise } + | AirdropERC20WithSignatureParams + | { asyncParams: () => Promise } >; ``` @@ -5729,21 +5239,20 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MARKETPLACE.approveCurrencyForListing +## AIRDROP.airdropERC721 -Prepares a transaction to call the "approveCurrencyForListing" function on the contract. +Prepares a transaction to call the "airdropERC721" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { approveCurrencyForListing } from "thirdweb/extensions/marketplace"; +import { airdropERC721 } from "thirdweb/extensions/airdrop"; -const transaction = approveCurrencyForListing({ +const transaction = airdropERC721({ contract, - listingId: ..., - currency: ..., - pricePerTokenInCurrency: ..., + tokenAddress: ..., + contents: ..., overrides: { ... } @@ -5754,24 +5263,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function approveCurrencyForListing( +function airdropERC721( options: BaseTransactionOptions< - | ApproveCurrencyForListingParams - | { asyncParams: () => Promise } + | AirdropERC721Params + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "approveCurrencyForListing" function. +The options for the "airdropERC721" function. #### Type ```ts let options: BaseTransactionOptions< - | ApproveCurrencyForListingParams - | { asyncParams: () => Promise } + | AirdropERC721Params + | { asyncParams: () => Promise } >; ``` @@ -5788,132 +5297,106 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MARKETPLACE.auctionClosedEvent +## AIRDROP.airdropERC721WithSignature -Creates an event object for the AuctionClosed event. +Prepares a transaction to call the "airdropERC721WithSignature" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { auctionClosedEvent } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; +import { airdropERC721WithSignature } from "thirdweb/extensions/airdrop"; -const events = await getContractEvents({ -contract, -events: [ - auctionClosedEvent({ - auctionId: ..., - assetContract: ..., - closer: ..., -}) -], +const transaction = airdropERC721WithSignature({ + contract, + req: ..., + signature: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function auctionClosedEvent( - filters: Partial, -): 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"; -}>; +function airdropERC721WithSignature( + options: BaseTransactionOptions< + | AirdropERC721WithSignatureParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The options for the "airdropERC721WithSignature" function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions< + | AirdropERC721WithSignatureParams + | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## MARKETPLACE.bidInAuction +## AIRDROP.airdropNativeToken -Places a bid in an English auction. +Prepares a transaction to call the "airdropNativeToken" function on the contract. ### Example ```ts -import { bidInAuction } from "thirdweb/extensions/marketplace"; import { sendTransaction } from "thirdweb"; +import { airdropNativeToken } from "thirdweb/extensions/airdrop"; -const transaction = bidInAuction({ - contract, - auctionId: 0n, - bidAmount: "100", +const transaction = airdropNativeToken({ + contract, + contents: ..., + overrides: { + ... + } }); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function bidInAuction( - options: BaseTransactionOptions, +function airdropNativeToken( + options: BaseTransactionOptions< + | AirdropNativeTokenParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for placing the bid. +The options for the "airdropNativeToken" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | AirdropNativeTokenParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -5926,123 +5409,96 @@ let returnType: PreparedTransaction< >; ``` -A transaction that can be sent to place the bid. +A prepared transaction object. --- -## MARKETPLACE.buyerApprovedForListingEvent +## AIRDROP.claimERC1155 -Creates an event object for the BuyerApprovedForListing event. +Claim airdrop of ERC1155 tokens for allowlisted addresses. (Pull based airdrop) ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { buyerApprovedForListingEvent } from "thirdweb/extensions/marketplace"; +import { claimERC1155 } from "thirdweb/extensions/airdrop"; +import { sendTransaction } from "thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - buyerApprovedForListingEvent({ - listingId: ..., - buyer: ..., -}) -], +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 buyerApprovedForListingEvent( - filters: Partial, -): 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"; -}>; +function claimERC1155( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The transaction options. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A promise that resolves to the transaction result. --- -## MARKETPLACE.buyFromListing +## AIRDROP.claimERC20 -Buys a listing from the marketplace. +Claim airdrop of ERC20 tokens for allowlisted addresses. (Pull based airdrop) ### Example ```ts -import { buyFromListing } from "thirdweb/extensions/marketplace"; +import { claimERC20 } from "thirdweb/extensions/airdrop"; import { sendTransaction } from "thirdweb"; -const transaction = buyFromListing({ +const tokenAddress = "0x..."; // Address of airdropped tokens to claim +const recipient = "0x..."; // Address of the allowlisted recipient + +const claimTransaction = claimERC20({ contract, - listingId: 1n, - quantity: 1n, - recipient: "0x...", + tokenAddress, + recipient, }); -await sendTransaction({ transaction, account }); +await sendTransaction({ claimTransaction, account }); ``` -When using `buyFromListing` with Pay, the `erc20Value` will be automatically set to the listing currency. - ```ts -function buyFromListing( - options: BaseTransactionOptions, +function claimERC20( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for buying from a listing. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -6058,38 +5514,42 @@ let returnType: PreparedTransaction< A promise that resolves to the transaction result. --- -## MARKETPLACE.buyoutAuction +## AIRDROP.claimERC721 -Buys out an English auction. +Claim airdrop of ERC721 tokens for allowlisted addresses. (Pull based airdrop) ### Example ```ts -import { buyoutAuction } from "thirdweb/extensions/marketplace"; +import { claimERC721 } from "thirdweb/extensions/airdrop"; import { sendTransaction } from "thirdweb"; -const transaction = buyoutAuction({ +const tokenAddress = "0x..."; // Address of airdropped tokens to claim +const recipient = "0x..."; // Address of the allowlisted recipient + +const claimTransaction = claimERC721({ contract, - auctionId: 0n, + tokenAddress, + recipient, }); -await sendTransaction({ transaction, account }); +await sendTransaction({ claimTransaction, account }); ``` ```ts -function buyoutAuction( - options: BaseTransactionOptions, +function claimERC721( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for buying out the auction. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -6102,1332 +5562,1143 @@ let returnType: PreparedTransaction< >; ``` -A transaction that can be sent to buy out the auction. +A promise that resolves to the transaction result. --- -## MARKETPLACE.cancelAuction +## AIRDROP.fetchProofsERC1155 -Cancels an auction by providing the necessary options. +Retrieves the claim merkle proof for the provided address. ### Example ```ts -import { cancelAuction } from "thirdweb/extensions/marketplace"; -import { sendTransaction } from "thirdweb"; +import { fetchProofsERCC1155 } from "thirdweb/extensions/airdrop"; +import { getContract, defineChain } from "thirdweb"; -const transaction = cancelAuction({ - contract, - auctionId: 0n, +const TOKEN = getContracct({ + client, + chain: defineChain(1), + address: "0x...", }); -await sendTransaction({ transaction, account }); +const merkleRoot = await tokenMerkleRoot({ + contract: TOKEN, + tokenAddress: TOKEN.address, +}); + +const proof = await fetchProofsERC1155({ + contract: TOKEN, + recipient: "0x...", + merkleRoot, +}); ``` ```ts -function cancelAuction( - options: BaseTransactionOptions, -): PreparedTransaction; +function fetchProofsERC1155(options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}): Promise; ``` ### Parameters -The options for canceling the auction. - #### Type ```ts -let options: BaseTransactionOptions; +let options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A transaction that can be sent to cancel the auction. +A promise that resolves to the proof or null if the recipient is not in the allowlist --- -## MARKETPLACE.cancelledAuctionEvent +## AIRDROP.fetchProofsERC20 -Creates an event object for the CancelledAuction event. +Retrieves the claim merkle proof for the provided address. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { cancelledAuctionEvent } from "thirdweb/extensions/marketplace"; +import { fetchProofsERCC20 } from "thirdweb/extensions/airdrop"; +import { getContract, defineChain } from "thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - cancelledAuctionEvent({ - auctionCreator: ..., - auctionId: ..., -}) -], +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 cancelledAuctionEvent( - filters: Partial, -): 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"; -}>; +function fetchProofsERC20(options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; + tokenDecimals: number; +}): Promise; ``` ### Parameters -Optional filters to apply to the event. - #### Type ```ts -let filters: Partial; +let options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; + tokenDecimals: number; +}; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +A promise that resolves to the proof or null if the recipient is not in the allowlist --- -## MARKETPLACE.cancelledListingEvent +## AIRDROP.fetchProofsERC721 -Creates an event object for the CancelledListing event. +Retrieves the claim merkle proof for the provided address. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { cancelledListingEvent } from "thirdweb/extensions/marketplace"; +import { fetchProofsERC721 } from "thirdweb/extensions/airdrop"; +import { getContract, defineChain } from "thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - cancelledListingEvent({ - listingCreator: ..., - listingId: ..., -}) -], +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 cancelledListingEvent( - filters: Partial, -): 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"; -}>; +function fetchProofsERC721(options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}): Promise; ``` ### Parameters -Optional filters to apply to the event. - #### Type ```ts -let filters: Partial; +let options: { + contract: Readonly>; + merkleRoot: string; + recipient: string; +}; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +A promise that resolves to the proof or null if the recipient is not in the allowlist --- -## MARKETPLACE.cancelledOfferEvent +## AIRDROP.generateAirdropSignatureERC1155 -Creates an event object for the CancelledOffer event. +Generates the req and signature for sending ERC1155 airdrop. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { cancelledOfferEvent } from "thirdweb/extensions/marketplace"; +import { + airdropERC1155WithSignature, + generateAirdropSignatureERC1155, +} from "thirdweb/extensions/airdrop"; -const events = await getContractEvents({ -contract, -events: [ - cancelledOfferEvent({ - offeror: ..., - offerId: ..., -}) -], +// 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 cancelledOfferEvent( - filters: Partial, -): 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"; -}>; +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 -Optional filters to apply to the event. +The options for the airdrop. #### Type ```ts -let filters: Partial; +let options: { + account: Account; + airdropRequest: GenerateReqInput; + contract: ThirdwebContract; +}; ``` ### 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"; -}>; +let returnType: Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> ``` -The prepared event object. +A promise that resolves to the req and signature. --- -## MARKETPLACE.cancelListing +## AIRDROP.generateAirdropSignatureERC20 -Prepares a transaction to call the "cancelListing" function on the contract. +Generates the req and signature for sending ERC20 airdrop. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { cancelListing } from "thirdweb/extensions/marketplace"; +import { + airdropERC20WithSignature, + generateAirdropSignatureERC20, +} from "thirdweb/extensions/airdrop"; -const transaction = cancelListing({ - contract, - listingId: ..., - overrides: { - ... - } +// 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, + }, }); -// Send the transaction +const transaction = airdropERC20WithSignature({ + contract, + req, + signature, +}); await sendTransaction({ transaction, account }); ``` ```ts -function cancelListing( - options: BaseTransactionOptions< - | CancelListingParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 "cancelListing" function. +The options for the airdrop. #### Type ```ts -let options: BaseTransactionOptions< - | CancelListingParams - | { asyncParams: () => Promise } ->; +let options: { + account: Account; + airdropRequest: GenerateReqInput; + contract: ThirdwebContract; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> ``` -A prepared transaction object. +A promise that resolves to the req and signature. --- -## MARKETPLACE.cancelOffer +## AIRDROP.generateAirdropSignatureERC721 -Prepares a transaction to call the "cancelOffer" function on the contract. +Generates the req and signature for sending ERC721 airdrop. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { cancelOffer } from "thirdweb/extensions/marketplace"; +import { + airdropERC721WithSignature, + generateAirdropSignatureERC721, +} from "thirdweb/extensions/airdrop"; -const transaction = cancelOffer({ - contract, - offerId: ..., - overrides: { - ... - } +// 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, + }, }); -// Send the transaction +const transaction = airdropERC721WithSignature({ + contract, + req, + signature, +}); await sendTransaction({ transaction, account }); ``` ```ts -function cancelOffer( - options: BaseTransactionOptions< - | CancelOfferParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 "cancelOffer" function. +The options for the airdrop. #### Type ```ts -let options: BaseTransactionOptions< - | CancelOfferParams - | { asyncParams: () => Promise } ->; -``` - -### Returns +let options: { + account: Account; + airdropRequest: GenerateReqInput; + contract: ThirdwebContract; +}; +``` + +### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise<{ req: { contents: readonly Array<{ recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> ``` -A prepared transaction object. +A promise that resolves to the req and signature. --- -## MARKETPLACE.collectAuctionPayout +## AIRDROP.generateMerkleTreeInfoERC1155 -Prepares a transaction to call the "collectAuctionPayout" function on the contract. +Generate merkle tree for a given snapshot. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { collectAuctionPayout } from "thirdweb/extensions/marketplace"; +import { generateMerkleTreeInfoERC1155 } from "thirdweb/extensions/airdrop"; -const transaction = collectAuctionPayout({ - contract, - auctionId: ..., - overrides: { - ... - } -}); +// 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 }, +]; -// Send the transaction -await sendTransaction({ transaction, account }); +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 collectAuctionPayout( - options: BaseTransactionOptions< - | CollectAuctionPayoutParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function generateMerkleTreeInfoERC1155( + options: BaseTransactionOptions, +): Promise<{ merkleRoot: string; snapshotUri: string }>; ``` ### Parameters -The options for the "collectAuctionPayout" function. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions< - | CollectAuctionPayoutParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; ``` -A prepared transaction object. +A promise that resolves to the merkle-root and snapshot-uri. --- -## MARKETPLACE.collectAuctionTokens +## AIRDROP.generateMerkleTreeInfoERC20 -Prepares a transaction to call the "collectAuctionTokens" function on the contract. +Generate merkle tree for a given snapshot. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { collectAuctionTokens } from "thirdweb/extensions/marketplace"; +import { generateMerkleTreeInfoERC20 } from "thirdweb/extensions/airdrop"; -const transaction = collectAuctionTokens({ - contract, - auctionId: ..., - overrides: { - ... - } -}); +// snapshot / allowlist of airdrop recipients and amounts +const snapshot = [ + { recipient: "0x...", amount: 10 }, + { recipient: "0x...", amount: 15 }, + { recipient: "0x...", amount: 20 }, +]; -// Send the transaction -await sendTransaction({ transaction, account }); +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 collectAuctionTokens( - options: BaseTransactionOptions< - | CollectAuctionTokensParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function generateMerkleTreeInfoERC20( + options: BaseTransactionOptions, +): Promise<{ merkleRoot: string; snapshotUri: string }>; ``` ### Parameters -The options for the "collectAuctionTokens" function. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions< - | CollectAuctionTokensParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; ``` -A prepared transaction object. +A promise that resolves to the merkle-root and snapshot-uri. --- -## MARKETPLACE.createAuction +## AIRDROP.generateMerkleTreeInfoERC721 -Creates an auction. +Generate merkle tree for a given snapshot. ### Example -```typescript -import { createAuction } from "thirdweb/extensions/marketplace"; -import { sendTransaction } from "thirdweb"; +```ts +import { generateMerkleTreeInfoERC721 } from "thirdweb/extensions/airdrop"; -const transaction = createAuction({...}); +// snapshot / allowlist of airdrop recipients and amounts +const snapshot = [ + { recipient: "0x...", tokenId: 0 }, + { recipient: "0x...", tokenId: 1 }, + { recipient: "0x...", tokenId: 2 }, +]; -await sendTransaction({ transaction, account }); +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 createAuction( - options: BaseTransactionOptions, -): PreparedTransaction; +function generateMerkleTreeInfoERC721( + options: BaseTransactionOptions, +): Promise<{ merkleRoot: string; snapshotUri: string }>; ``` ### Parameters -The options for creating the auction. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; ``` -The result of creating the auction. +A promise that resolves to the merkle-root and snapshot-uri. --- -## MARKETPLACE.createListing +## AIRDROP.isClaimed -Creates a direct listing. +Calls the "isClaimed" function on the contract. ### Example -```typescript -import { createListing } from "thirdweb/extensions/marketplace"; -import { sendTransaction } from "thirdweb"; +```ts +import { isClaimed } from "thirdweb/extensions/airdrop"; -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 +const result = await isClaimed({ + contract, + receiver: ..., + token: ..., + tokenId: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function createListing( - options: BaseTransactionOptions, -): PreparedTransaction; +function isClaimed( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for creating the direct listing. +The options for the isClaimed function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -The result of creating the direct listing. +The parsed result of the function call. --- -## MARKETPLACE.currencyApprovedForListingEvent +## AIRDROP.saveSnapshot -Creates an event object for the CurrencyApprovedForListing event. +Generate merkle tree for a given snapshot and save the info on-chain. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { currencyApprovedForListingEvent } from "thirdweb/extensions/marketplace"; +// This is ERC20 example. Should import and use other ERC variants as needed -const events = await getContractEvents({ -contract, -events: [ - currencyApprovedForListingEvent({ - listingId: ..., - currency: ..., -}) -], +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 currencyApprovedForListingEvent( - filters: Partial, -): 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"; -}>; +function saveSnapshot( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The transaction options. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A promise that resolves to the transaction result. --- -## MARKETPLACE.currencyPriceForListing +## AIRDROP.setMerkleRoot -Retrieves the currency price for a listing. +Prepares a transaction to call the "setMerkleRoot" function on the contract. ### Example ```ts -import { currencyPriceForListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; +import { setMerkleRoot } from "thirdweb/extensions/airdrop"; -const price = await currencyPriceForListing({ - contract, - listingId: 1n, - currency: "0x...", +const transaction = setMerkleRoot({ + contract, + token: ..., + tokenMerkleRoot: ..., + resetClaimStatus: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function currencyPriceForListing( - options: BaseTransactionOptions, -): Promise; +function setMerkleRoot( + options: BaseTransactionOptions< + | SetMerkleRootParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for retrieving the currency price. +The options for the "setMerkleRoot" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SetMerkleRootParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the currency price as a bigint. +A prepared transaction object. --- -## MARKETPLACE.executeSale +## AIRDROP.tokenConditionId -Executes a sale for an English auction. +Calls the "tokenConditionId" function on the contract. ### Example ```ts -import { executeSale } from "thirdweb/extensions/marketplace"; -import { sendTransaction } from "thirdweb"; +import { tokenConditionId } from "thirdweb/extensions/airdrop"; -const transaction = executeSale({ - contract, - auctionId: 0n, +const result = await tokenConditionId({ + contract, + tokenAddress: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function executeSale( - options: BaseTransactionOptions, -): PreparedTransaction; +function tokenConditionId( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for executing the sale. +The options for the tokenConditionId function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A transaction that can be sent to execute the sale. +The parsed result of the function call. --- -## MARKETPLACE.getAllAuctions +## AIRDROP.tokenMerkleRoot -Retrieves all auctions based on the provided options. +Calls the "tokenMerkleRoot" function on the contract. ### Example ```ts -import { getAllAuctions } from "thirdweb/extensions/marketplace"; +import { tokenMerkleRoot } from "thirdweb/extensions/airdrop"; -const listings = await getAllAuctions({ - contract, - start: 0, - count: 10, +const result = await tokenMerkleRoot({ + contract, + tokenAddress: ..., }); ``` ```ts -function getAllAuctions( - options: BaseTransactionOptions, -): Promise>; +function tokenMerkleRoot( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for retrieving the auctions. +The options for the tokenMerkleRoot function. #### Type ```ts -let options: BaseTransactionOptions; +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"; -}; +let returnType: Promise<`0x${string}`>; ``` -A promise that resolves to the auctions array. +The parsed result of the function call. +--- +## COMMON --- -## MARKETPLACE.getAllListings +## COMMON.contractURI -Retrieves all direct listings based on the provided options. +Calls the "contractURI" function on the contract. ### Example ```ts -import { getAllListings } from "thirdweb/extensions/marketplace"; +import { contractURI } from "thirdweb/extensions/common"; -const listings = await getAllListings({ +const result = await contractURI({ contract, - start: 0, - count: 10, }); ``` ```ts -function getAllListings( - options: BaseTransactionOptions, -): Promise>; +function contractURI( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving the listing. +The options for the contractURI function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}; +let returnType: Promise; ``` -A promise that resolves to the direct listings array. +The parsed result of the function call. --- -## MARKETPLACE.getAllOffers +## COMMON.getContractMetadata -Retrieves all offers based on the provided options. +Retrieves the contract metadata including name and symbol. ### Example ```ts -import { getAllOffers } from "thirdweb/extensions/marketplace"; - -const listings = await getAllOffers({ - contract, - start: 0, - count: 10, -}); +import { getContractMetadata } from "thirdweb/extensions/common"; +const metadata = await getContractMetadata({ contract }); ``` ```ts -function getAllOffers( - options: BaseTransactionOptions, -): Promise>; +function getContractMetadata( + options: BaseTransactionOptions, +): Promise<{ name: string; symbol: string }>; ``` ### Parameters -The options for retrieving the offers. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### 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; -}; +let returnType: Promise<{ name: string; symbol: string }>; ``` -A promise that resolves to the offers array. +A promise that resolves to an object containing the resolved metadata, name, and symbol. --- -## MARKETPLACE.getAllValidAuctions +## COMMON.getDefaultRoyaltyInfo -Retrieves all valid auctions based on the provided options. +Calls the "getDefaultRoyaltyInfo" function on the contract. ### Example ```ts -import { getAllValidAuctions } from "thirdweb/extensions/marketplace"; +import { getDefaultRoyaltyInfo } from "thirdweb/extensions/common"; -const validAuctions = await getAllValidAuctions({ +const result = await getDefaultRoyaltyInfo({ contract, - start: 0, - count: 10, }); ``` ```ts -function getAllValidAuctions( - options: BaseTransactionOptions, -): Promise>; +function getDefaultRoyaltyInfo( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving the listing. +The options for the getDefaultRoyaltyInfo function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}; +let returnType: Promise; ``` -A promise that resolves to the valid auctions array. +The parsed result of the function call. --- -## MARKETPLACE.getAllValidListings +## COMMON.getPlatformFeeInfo -Retrieves all valid direct listings based on the provided options. +Calls the "getPlatformFeeInfo" function on the contract. ### Example ```ts -import { getAllValidListings } from "thirdweb/extensions/marketplace"; +import { getPlatformFeeInfo } from "thirdweb/extensions/common"; -const validListings = await getAllValidListings({ +const result = await getPlatformFeeInfo({ contract, - start: 0, - count: 10, }); ``` ```ts -function getAllValidListings( - options: BaseTransactionOptions, -): Promise>; +function getPlatformFeeInfo( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving the valid listing. +The options for the getPlatformFeeInfo function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}; +let returnType: Promise; ``` -A promise that resolves to the direct listings array. +The parsed result of the function call. --- -## MARKETPLACE.getAllValidOffers +## COMMON.getRoyaltyInfoForToken -Retrieves all valid offers based on the provided options. +Calls the "getRoyaltyInfoForToken" function on the contract. ### Example ```ts -import { getAllValidOffers } from "thirdweb/extensions/marketplace"; +import { getRoyaltyInfoForToken } from "thirdweb/extensions/common"; -const validOffers = await getAllValidOffers({ - contract, - start: 0, - count: 10, +const result = await getRoyaltyInfoForToken({ + contract, + tokenId: ..., }); ``` ```ts -function getAllValidOffers( - options: BaseTransactionOptions, -): Promise>; +function getRoyaltyInfoForToken( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving the valid offers. +The options for the getRoyaltyInfoForToken function. #### Type ```ts -let options: BaseTransactionOptions; +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; -}; +let returnType: Promise; ``` -A promise that resolves to the offers array. +The parsed result of the function call. --- -## MARKETPLACE.getAuction +## COMMON.isGetContractMetadataSupported -Retrieves an auction listing based on the provided options. +Checks if the `contractURI` method is supported by the given contract. ### Example ```ts -import { getListing } from "thirdweb/extensions/marketplace"; - -const listing = await getListing({ contract, listingId: 1n }); +import { isContractURISupported } from "thirdweb/extensions/common"; +const supported = isContractURISupported(["0x..."]); ``` ```ts -function getAuction( - options: BaseTransactionOptions, -): Promise; +function isGetContractMetadataSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for retrieving the listing. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### 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"; -}; +let returnType: boolean; ``` -A promise that resolves to the direct listing. +A boolean indicating if the `contractURI` method is supported. --- -## MARKETPLACE.getListing +## COMMON.isGetDefaultRoyaltyInfoSupported -Retrieves a direct listing based on the provided options. +Checks if the `getDefaultRoyaltyInfo` method is supported by the given contract. ### Example ```ts -import { getListing } from "thirdweb/extensions/marketplace"; - -const listing = await getListing({ contract, listingId: 1n }); +import { isGetDefaultRoyaltyInfoSupported } from "thirdweb/extensions/common"; +const supported = isGetDefaultRoyaltyInfoSupported(["0x..."]); ``` ```ts -function getListing( - options: BaseTransactionOptions, -): Promise; +function isGetDefaultRoyaltyInfoSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for retrieving the listing. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### 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"; -}; +let returnType: boolean; ``` -A promise that resolves to the direct listing. +A boolean indicating if the `getDefaultRoyaltyInfo` method is supported. --- -## MARKETPLACE.getOffer +## COMMON.isGetPlatformFeeInfoSupported -Retrieves an offer based on the provided options. +Checks if the `getPlatformFeeInfo` method is supported by the given contract. ### Example ```ts -import { getOffer } from "thirdweb/extensions/marketplace"; - -const listing = await getOffer({ contract, listingId: 1n }); +import { isGetPlatformFeeInfoSupported } from "thirdweb/extensions/common"; +const supported = isGetPlatformFeeInfoSupported(["0x..."]); ``` ```ts -function getOffer( - options: BaseTransactionOptions, -): Promise; +function isGetPlatformFeeInfoSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for retrieving the offer. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### 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; -}; +let returnType: boolean; ``` -A promise that resolves to the offer. +A boolean indicating if the `getPlatformFeeInfo` method is supported. --- -## MARKETPLACE.getWinningBid +## COMMON.isGetRoyaltyInfoForTokenSupported -Retrieves the winning bid information for a given auction. +Checks if the `getRoyaltyInfoForToken` method is supported by the given contract. ### Example ```ts -import { getWinningBid } from "thirdweb/extensions/marketplace"; - -const winningBid = await getWinningBid({ - contract, - auctionId: 0n, -}); +import { isGetRoyaltyInfoForTokenSupported } from "thirdweb/extensions/common"; +const supported = isGetRoyaltyInfoForTokenSupported(["0x..."]); ``` ```ts -function getWinningBid( - options: BaseTransactionOptions, -): Promise< - | undefined - | { - bidAmountWei: bigint; - bidderAddress: string; - currencyAddress: string; - currencyValue: CurrencyValue; - } ->; +function isGetRoyaltyInfoForTokenSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for retrieving the winning bid. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise< - | undefined - | { - bidAmountWei: bigint; - bidderAddress: string; - currencyAddress: string; - currencyValue: CurrencyValue; - } ->; +let returnType: boolean; ``` -The winning bid information, or undefined if there is no winning bid. +A boolean indicating if the `getRoyaltyInfoForToken` method is supported. --- -## MARKETPLACE.isBidInAuctionSupported +## COMMON.isMulticallSupported -Checks if the `bidInAuction` method is supported by the given contract. +Checks if the `multicall` method is supported by the given contract. ### Example ```ts -import { isBidInAuctionSupported } from "thirdweb/extensions/marketplace"; +import { isMulticallSupported } from "thirdweb/extensions/common"; -const supported = isBidInAuctionSupported(["0x..."]); +const supported = isMulticallSupported(["0x..."]); ``` ```ts -function isBidInAuctionSupported( +function isMulticallSupported( availableSelectors: Array, ): boolean; ``` @@ -7448,66 +6719,56 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `bidInAuction` method is supported. +A boolean indicating if the `multicall` method is supported. --- -## MARKETPLACE.isBuyerApprovedForListing +## COMMON.isNameSupported -Checks if the buyer is approved for a listing. +Checks if the `name` method is supported by the given contract. ### Example ```ts -import { isBuyerApprovedForListing } from "thirdweb/extensions/marketplace"; - -const isApproved = await isBuyerApprovedForListing({ - contract, - listingId: 1n, - buyer: "0x...", -}); +import { isNameSupported } from "thirdweb/extensions/common"; +const supported = isNameSupported(["0x..."]); ``` ```ts -function isBuyerApprovedForListing( - options: BaseTransactionOptions, -): Promise; +function isNameSupported(availableSelectors: Array): boolean; ``` ### Parameters -The options for checking buyer approval. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -A promise that resolves to a boolean indicating whether the buyer is approved for the listing. +A boolean indicating if the `name` method is supported. --- -## MARKETPLACE.isBuyFromListingSupported +## COMMON.isOwnerSupported -Checks if the `buyFromListing` method is supported by the given contract. +Checks if the `owner` method is supported by the given contract. ### Example ```ts -import { isBuyFromListingSupported } from "thirdweb/extensions/marketplace"; - -const supported = isBuyFromListingSupported(["0x..."]); +import { isOwnerSupported } from "thirdweb/extensions/common"; +const supported = isOwnerSupported(["0x..."]); ``` ```ts -function isBuyFromListingSupported( - availableSelectors: Array, -): boolean; +function isOwnerSupported(availableSelectors: Array): boolean; ``` ### Parameters @@ -7526,23 +6787,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `buyFromListing` method is supported. +A boolean indicating if the `owner` method is supported. --- -## MARKETPLACE.isCancelAuctionSupported +## COMMON.isPrimarySaleRecipientSupported -Checks if the `cancelAuction` method is supported by the given contract. +Checks if the `primarySaleRecipient` method is supported by the given contract. ### Example ```ts -import { isCancelAuctionSupported } from "thirdweb/extensions/marketplace"; - -const supported = isCancelAuctionSupported(["0x..."]); +import { isPrimarySaleRecipientSupported } from "thirdweb/extensions/common"; +const supported = isPrimarySaleRecipientSupported(["0x..."]); ``` ```ts -function isCancelAuctionSupported( +function isPrimarySaleRecipientSupported( availableSelectors: Array, ): boolean; ``` @@ -7563,23 +6823,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `cancelAuction` method is supported. +A boolean indicating if the `primarySaleRecipient` method is supported. --- -## MARKETPLACE.isCancelListingSupported +## COMMON.isSetContractURISupported -Checks if the `cancelListing` method is supported by the given contract. +Checks if the `setContractURI` method is supported by the given contract. ### Example ```ts -import { isCancelListingSupported } from "thirdweb/extensions/marketplace"; +import { isSetContractURISupported } from "thirdweb/extensions/common"; -const supported = isCancelListingSupported(["0x..."]); +const supported = isSetContractURISupported(["0x..."]); ``` ```ts -function isCancelListingSupported( +function isSetContractURISupported( availableSelectors: Array, ): boolean; ``` @@ -7600,23 +6860,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `cancelListing` method is supported. +A boolean indicating if the `setContractURI` method is supported. --- -## MARKETPLACE.isCreateAuctionSupported +## COMMON.isSetDefaultRoyaltyInfoSupported -Checks if the `createAuction` method is supported by the given contract. +Checks if the `setDefaultRoyaltyInfo` method is supported by the given contract. ### Example ```ts -import { isCreateAuctionSupported } from "thirdweb/extensions/marketplace"; +import { isSetDefaultRoyaltyInfoSupported } from "thirdweb/extensions/common"; -const supported = isCreateAuctionSupported(["0x..."]); +const supported = isSetDefaultRoyaltyInfoSupported(["0x..."]); ``` ```ts -function isCreateAuctionSupported( +function isSetDefaultRoyaltyInfoSupported( availableSelectors: Array, ): boolean; ``` @@ -7637,23 +6897,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `createAuction` method is supported. +A boolean indicating if the `setDefaultRoyaltyInfo` method is supported. --- -## MARKETPLACE.isCreateListingSupported +## COMMON.isSetPlatformFeeInfoSupported -Checks if the `createListing` method is supported by the given contract. +Checks if the `setPlatformFeeInfo` method is supported by the given contract. ### Example ```ts -import { isCreateAuctionSupported } from "thirdweb/extensions/marketplace"; +import { isSetPlatformFeeInfoSupported } from "thirdweb/extensions/common"; -const supported = isCreateAuctionSupported(["0x..."]); +const supported = isSetPlatformFeeInfoSupported(["0x..."]); ``` ```ts -function isCreateListingSupported( +function isSetPlatformFeeInfoSupported( availableSelectors: Array, ): boolean; ``` @@ -7674,64 +6934,60 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `createListing` method is supported. +A boolean indicating if the `setPlatformFeeInfo` method is supported. --- -## MARKETPLACE.isCurrencyApprovedForListing +## COMMON.isSetPrimarySaleRecipientSupported -Calls the "isCurrencyApprovedForListing" function on the contract. +Checks if the `setPrimarySaleRecipient` method is supported by the given contract. ### Example ```ts -import { isCurrencyApprovedForListing } from "thirdweb/extensions/marketplace"; +import { isSetPrimarySaleRecipientSupported } from "thirdweb/extensions/common"; -const result = await isCurrencyApprovedForListing({ - contract, - listingId: ..., - currency: ..., -}); +const supported = isSetPrimarySaleRecipientSupported(["0x..."]); ``` ```ts -function isCurrencyApprovedForListing( - options: BaseTransactionOptions, -): Promise; +function isSetPrimarySaleRecipientSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the isCurrencyApprovedForListing function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `setPrimarySaleRecipient` method is supported. --- -## MARKETPLACE.isGetAuctionSupported +## COMMON.isSetRoyaltyInfoForTokenSupported -Checks if the `getAuction` method is supported by the given contract. +Checks if the `setRoyaltyInfoForToken` method is supported by the given contract. ### Example ```ts -import { isGetAuctionSupported } from "thirdweb/extensions/marketplace"; +import { isSetRoyaltyInfoForTokenSupported } from "thirdweb/extensions/common"; -const supported = isGetAuctionSupported(["0x..."]); +const supported = isSetRoyaltyInfoForTokenSupported(["0x..."]); ``` ```ts -function isGetAuctionSupported( +function isSetRoyaltyInfoForTokenSupported( availableSelectors: Array, ): boolean; ``` @@ -7752,23 +7008,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `getAuction` method is supported. +A boolean indicating if the `setRoyaltyInfoForToken` method is supported. --- -## MARKETPLACE.isGetListingSupported +## COMMON.isSymbolSupported -Checks if the `isGetListingSupported` method is supported by the given contract. +Checks if the `symbol` method is supported by the given contract. ### Example ```ts -import { isGetListingSupported } from "thirdweb/extensions/marketplace"; - -const supported = isGetListingSupported(["0x..."]); +import { isSymbolSupported } from "thirdweb/extensions/common"; +const supported = isSymbolSupported(["0x..."]); ``` ```ts -function isGetListingSupported( +function isSymbolSupported( availableSelectors: Array, ): boolean; ``` @@ -7789,212 +7044,174 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `isGetListingSupported` method is supported. +A boolean indicating if the `symbol` method is supported. --- -## MARKETPLACE.isGetWinningBidSupported +## COMMON.multicall -Checks if the `getWinningBid` method is supported by the given contract. +Prepares a transaction to call the "multicall" function on the contract. ### Example ```ts -import { isGetWinningBidSupported } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; +import { multicall } from "thirdweb/extensions/common"; -const supported = isGetWinningBidSupported(["0x..."]); +const transaction = multicall({ + contract, + data: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function isGetWinningBidSupported( - availableSelectors: Array, -): boolean; +function multicall( + options: BaseTransactionOptions< + MulticallParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "multicall" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + MulticallParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getWinningBid` method is supported. +A prepared transaction object. --- -## MARKETPLACE.isNewWinningBid +## COMMON.name -Calls the "isNewWinningBid" function on the contract. +Retrieves the name associated with the given contract. ### Example ```ts -import { isNewWinningBid } from "thirdweb/extensions/marketplace"; +import { name } from "thirdweb/extensions/common"; -const result = await isNewWinningBid({ - contract, - auctionId: ..., - bidAmount: ..., -}); +const contractName = await name({ contract }); ``` ```ts -function isNewWinningBid( - options: BaseTransactionOptions, -): Promise; +function name(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the isNewWinningBid function. +The options for the transaction. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +A promise that resolves to the name associated with the contract. --- -## MARKETPLACE.makeOffer +## COMMON.owner -Makes an offer for any asset (ERC721 or ERC1155). +Calls the "owner" function on the contract. ### Example ```ts -import { makeOffer } from "thirdweb/extensions/marketplace"; -import { sendTransaction } from "thirdweb"; +import { owner } from "thirdweb/extensions/common"; -const offerTx = makeOffer({ +const result = await owner({ 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; +function owner(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for making the offer. +The options for the owner function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A transaction object that can be sent to make the offer. +The parsed result of the function call. --- -## MARKETPLACE.newAuctionEvent +## COMMON.ownerUpdatedEvent -Creates an event object for the NewAuction event. +Creates an event object for the OwnerUpdated event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { newAuctionEvent } from "thirdweb/extensions/marketplace"; +import { ownerUpdatedEvent } from "thirdweb/extensions/common"; const events = await getContractEvents({ contract, events: [ - newAuctionEvent({ - auctionCreator: ..., - auctionId: ..., - assetContract: ..., + ownerUpdatedEvent({ + prevOwner: ..., + newOwner: ..., }) ], }); ``` ```ts -function newAuctionEvent( - filters: Partial, +function ownerUpdatedEvent( + filters: Partial<{ newOwner: string; prevOwner: string }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "auctionCreator"; + readonly name: "prevOwner"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "auctionId"; - readonly type: "uint256"; - }, - { - readonly indexed: true; - readonly name: "assetContract"; + readonly name: "newOwner"; 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 name: "OwnerUpdated"; readonly type: "event"; }>; ``` @@ -8006,7 +7223,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ newOwner: string; prevOwner: string }>; ``` ### Returns @@ -8016,50 +7233,16 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "auctionCreator"; + readonly name: "prevOwner"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "auctionId"; - readonly type: "uint256"; - }, - { - readonly indexed: true; - readonly name: "assetContract"; + readonly name: "newOwner"; 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 name: "OwnerUpdated"; readonly type: "event"; }>; ``` @@ -8067,765 +7250,197 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## MARKETPLACE.newBidEvent +## COMMON.primarySaleRecipient -Creates an event object for the NewBid event. +Calls the "primarySaleRecipient" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { newBidEvent } from "thirdweb/extensions/marketplace"; +import { primarySaleRecipient } from "thirdweb/extensions/common"; -const events = await getContractEvents({ -contract, -events: [ - newBidEvent({ - auctionId: ..., - bidder: ..., - assetContract: ..., -}) -], +const result = await primarySaleRecipient({ + contract, }); ``` ```ts -function newBidEvent( - filters: Partial, -): 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"; -}>; +function primarySaleRecipient( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the primarySaleRecipient function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## MARKETPLACE.newListingEvent +## COMMON.setContractMetadata -Creates an event object for the NewListing event. +Sets the metadata for a contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { newListingEvent } from "thirdweb/extensions/marketplace"; +import { setContractMetadata } from "@thirdweb/extensions/common"; +import { sendTransaction } from "thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - newListingEvent({ - listingCreator: ..., - listingId: ..., - assetContract: ..., -}) -], +const transaction = setContractMetadata({ + contract, + name: "My NFT", + symbol: "NFT", +}); + +// Send the transaction +await sendTransaction({ + transaction, + account, }); ``` ```ts -function newListingEvent( - filters: Partial, -): 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"; -}>; +function setContractMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The options for setting the contract metadata. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +* The prepared transaction to set the contract metadata. --- -## MARKETPLACE.newOfferEvent +## COMMON.setContractURI -Creates an event object for the NewOffer event. +Prepares a transaction to call the "setContractURI" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { newOfferEvent } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; +import { setContractURI } from "thirdweb/extensions/common"; -const events = await getContractEvents({ -contract, -events: [ - newOfferEvent({ - offeror: ..., - offerId: ..., - assetContract: ..., -}) -], +const transaction = setContractURI({ + contract, + uri: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function newOfferEvent( - filters: Partial, -): 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"; -}>; +function setContractURI( + options: BaseTransactionOptions< + | SetContractURIParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The options for the "setContractURI" function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions< + | SetContractURIParams + | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## MARKETPLACE.newSaleEvent +## COMMON.setDefaultRoyaltyInfo -Creates an event object for the NewSale event. +Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { newSaleEvent } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; +import { setDefaultRoyaltyInfo } from "thirdweb/extensions/common"; -const events = await getContractEvents({ -contract, -events: [ - newSaleEvent({ - listingCreator: ..., - listingId: ..., - assetContract: ..., -}) -], +const transaction = setDefaultRoyaltyInfo({ + contract, + royaltyRecipient: ..., + royaltyBps: ..., + overrides: { + ... + } }); -``` - -```ts -function newSaleEvent( - filters: Partial, -): 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; -``` - -### 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. ---- - -## MARKETPLACE.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. ---- - -## MARKETPLACE.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. ---- - -## MARKETPLACE.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. ---- - -## MARKETPLACE.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, -): 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; -``` - -### 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. ---- - -## MARKETPLACE.updateListing - -Updates an existing direct listing. - -### Example - -```typescript -import { updateListing } from "thirdweb/extensions/marketplace"; -import { sendTransaction } from "thirdweb"; - -const transaction = updateListing({...}); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function updateListing( - options: BaseTransactionOptions, +function setDefaultRoyaltyInfo( + options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for updating the direct listing. +The options for the "setDefaultRoyaltyInfo" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SetDefaultRoyaltyInfoParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -8838,25 +7453,22 @@ let returnType: PreparedTransaction< >; ``` -The result of updating the direct listing. ---- -## AIRDROP +A prepared transaction object. --- -## AIRDROP.airdropERC1155 +## COMMON.setOwner -Prepares a transaction to call the "airdropERC1155" function on the contract. +Prepares a transaction to call the "setOwner" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { airdropERC1155 } from "thirdweb/extensions/airdrop"; +import { setOwner } from "thirdweb/extensions/common"; -const transaction = airdropERC1155({ +const transaction = setOwner({ contract, - tokenAddress: ..., - contents: ..., + newOwner: ..., overrides: { ... } @@ -8867,24 +7479,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function airdropERC1155( +function setOwner( options: BaseTransactionOptions< - | AirdropERC1155Params - | { asyncParams: () => Promise } + SetOwnerParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "airdropERC1155" function. +The options for the "setOwner" function. #### Type ```ts let options: BaseTransactionOptions< - | AirdropERC1155Params - | { asyncParams: () => Promise } + SetOwnerParams | { asyncParams: () => Promise } >; ``` @@ -8901,20 +7511,20 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## AIRDROP.airdropERC1155WithSignature +## COMMON.setPlatformFeeInfo -Prepares a transaction to call the "airdropERC1155WithSignature" function on the contract. +Prepares a transaction to call the "setPlatformFeeInfo" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { airdropERC1155WithSignature } from "thirdweb/extensions/airdrop"; +import { setPlatformFeeInfo } from "thirdweb/extensions/common"; -const transaction = airdropERC1155WithSignature({ +const transaction = setPlatformFeeInfo({ contract, - req: ..., - signature: ..., + platformFeeRecipient: ..., + platformFeeBps: ..., overrides: { ... } @@ -8925,26 +7535,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function airdropERC1155WithSignature( +function setPlatformFeeInfo( options: BaseTransactionOptions< - | AirdropERC1155WithSignatureParams - | { - asyncParams: () => Promise; - } + | SetPlatformFeeInfoParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "airdropERC1155WithSignature" function. +The options for the "setPlatformFeeInfo" function. #### Type ```ts let options: BaseTransactionOptions< - | AirdropERC1155WithSignatureParams - | { asyncParams: () => Promise } + | SetPlatformFeeInfoParams + | { asyncParams: () => Promise } >; ``` @@ -8961,20 +7569,19 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## AIRDROP.airdropERC20 +## COMMON.setPrimarySaleRecipient -Prepares a transaction to call the "airdropERC20" function on the contract. +Prepares a transaction to call the "setPrimarySaleRecipient" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { airdropERC20 } from "thirdweb/extensions/airdrop"; +import { setPrimarySaleRecipient } from "thirdweb/extensions/common"; -const transaction = airdropERC20({ +const transaction = setPrimarySaleRecipient({ contract, - tokenAddress: ..., - contents: ..., + saleRecipient: ..., overrides: { ... } @@ -8985,24 +7592,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function airdropERC20( +function setPrimarySaleRecipient( options: BaseTransactionOptions< - | AirdropERC20Params - | { asyncParams: () => Promise } + | SetPrimarySaleRecipientParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "airdropERC20" function. +The options for the "setPrimarySaleRecipient" function. #### Type ```ts let options: BaseTransactionOptions< - | AirdropERC20Params - | { asyncParams: () => Promise } + | SetPrimarySaleRecipientParams + | { asyncParams: () => Promise } >; ``` @@ -9019,20 +7626,21 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## AIRDROP.airdropERC20WithSignature +## COMMON.setRoyaltyInfoForToken -Prepares a transaction to call the "airdropERC20WithSignature" function on the contract. +Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { airdropERC20WithSignature } from "thirdweb/extensions/airdrop"; +import { setRoyaltyInfoForToken } from "thirdweb/extensions/common"; -const transaction = airdropERC20WithSignature({ +const transaction = setRoyaltyInfoForToken({ contract, - req: ..., - signature: ..., + tokenId: ..., + recipient: ..., + bps: ..., overrides: { ... } @@ -9043,24 +7651,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function airdropERC20WithSignature( +function setRoyaltyInfoForToken( options: BaseTransactionOptions< - | AirdropERC20WithSignatureParams - | { asyncParams: () => Promise } + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "airdropERC20WithSignature" function. +The options for the "setRoyaltyInfoForToken" function. #### Type ```ts let options: BaseTransactionOptions< - | AirdropERC20WithSignatureParams - | { asyncParams: () => Promise } + | SetRoyaltyInfoForTokenParams + | { asyncParams: () => Promise } >; ``` @@ -9077,959 +7685,756 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## AIRDROP.airdropERC721 +## COMMON.symbol -Prepares a transaction to call the "airdropERC721" function on the contract. +Retrieves the name associated with the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { airdropERC721 } from "thirdweb/extensions/airdrop"; - -const transaction = airdropERC721({ - contract, - tokenAddress: ..., - contents: ..., - overrides: { - ... - } -}); +import { symbol } from "thirdweb/extensions/common"; -// Send the transaction -await sendTransaction({ transaction, account }); +const contractSymbol = await symbol({ contract }); ``` ```ts -function airdropERC721( - options: BaseTransactionOptions< - | AirdropERC721Params - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function symbol(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the "airdropERC721" function. +The options for the transaction. #### Type ```ts -let options: BaseTransactionOptions< - | AirdropERC721Params - | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +A promise that resolves to the name associated with the contract. +--- +## ENS --- -## AIRDROP.airdropERC721WithSignature +## ENS.parseNftUri -Prepares a transaction to call the "airdropERC721WithSignature" function on the contract. +Parses an NFT URI. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { airdropERC721WithSignature } from "thirdweb/extensions/airdrop"; - -const transaction = airdropERC721WithSignature({ - contract, - req: ..., - signature: ..., - overrides: { - ... - } +import { parseNftUri } from "thirdweb/utils/ens"; +const nftUri = await parseNftUri({ + client, + uri: "eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063", }); -// Send the transaction -await sendTransaction({ transaction, account }); +console.log(nftUri); // ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/ ``` ```ts -function airdropERC721WithSignature( - options: BaseTransactionOptions< - | AirdropERC721WithSignatureParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function parseNftUri(options: { + client: ThirdwebClient; + uri: string; +}): Promise; ``` ### Parameters -The options for the "airdropERC721WithSignature" function. +The options for parsing an NFT URI. #### Type ```ts -let options: BaseTransactionOptions< - | AirdropERC721WithSignatureParams - | { asyncParams: () => Promise } ->; +let options: { client: ThirdwebClient; uri: string }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +A promise that resolves to the NFT URI, or null if the URI could not be parsed. --- -## AIRDROP.airdropNativeToken +## ENS.parseAvatarRecord -Prepares a transaction to call the "airdropNativeToken" function on the contract. +Parses an ENS or similar avatar record. Supports NFT URIs, IPFS scheme, and HTTPS URIs. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { airdropNativeToken } from "thirdweb/extensions/airdrop"; +import { parseAvatarRecord } from "thirdweb/utils/ens"; +const avatarUrl = await parseAvatarRecord({ + client, + uri: "ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/", +}); -const transaction = airdropNativeToken({ - contract, - contents: ..., - overrides: { - ... - } +console.log(avatarUrl); // "https://ipfs.io/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/" + +const avatarUrl2 = await parseAvatarRecord({ + client, + uri: "eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063", }); -// Send the transaction -await sendTransaction({ transaction, account }); +console.log(avatarUrl2); // "https://opensea.io/assets/0xb32979486938aa9694bfc898f35dbed459f44424/10063" ``` ```ts -function airdropNativeToken( - options: BaseTransactionOptions< - | AirdropNativeTokenParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function parseAvatarRecord( + options: ParseAvatarOptions, +): Promise; ``` ### Parameters -The options for the "airdropNativeToken" function. +The options for parsing an ENS avatar record. #### Type ```ts -let options: BaseTransactionOptions< - | AirdropNativeTokenParams - | { asyncParams: () => Promise } ->; +let options: { client: ThirdwebClient; uri: string }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +A promise that resolves to the avatar URL, or null if the URI could not be parsed. --- -## AIRDROP.claimERC1155 +## ENS.resolveAddress -Claim airdrop of ERC1155 tokens for allowlisted addresses. (Pull based airdrop) +Resolves an ENS name to an Ethereum address. ### 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, +import { resolveAddress } from "thirdweb/extensions/ens"; +const address = await resolveAddress({ + client, + name: "vitalik.eth", }); - -await sendTransaction({ claimTransaction, account }); ``` +Resolve an address to a Basename. + ```ts -function claimERC1155( - options: BaseTransactionOptions, -): PreparedTransaction; +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 transaction options. +The options for resolving an ENS address. #### Type ```ts -let options: BaseTransactionOptions; +let options: { + client: ThirdwebClient; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise<`0x${string}`>; ``` -A promise that resolves to the transaction result. +A promise that resolves to the Ethereum address. --- -## AIRDROP.claimERC20 +## ENS.resolveAvatar -Claim airdrop of ERC20 tokens for allowlisted addresses. (Pull based airdrop) +Resolves an ENS name to the avatar URL. ### 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, +import { resolveAvatar } from "thirdweb/extensions/ens"; +const address = await resolveAvatar({ + client, + name: "vitalik.eth", }); - -await sendTransaction({ claimTransaction, account }); ``` ```ts -function claimERC20( - options: BaseTransactionOptions, -): PreparedTransaction; +function resolveAvatar( + options: ResolveAvatarOptions, +): Promise; ``` ### Parameters -The transaction options. +The options for resolving an ENS address. #### Type ```ts -let options: BaseTransactionOptions; +let options: { + client: ThirdwebClient; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +A promise that resolves to the avatar url, or null if not set. --- -## AIRDROP.claimERC721 +## ENS.resolveL2Name -Claim airdrop of ERC721 tokens for allowlisted addresses. (Pull based airdrop) +Resolves the L2 name for a specified address. ### 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, +import { resolveL2Name } from "thirdweb/extensions/ens"; +const name = await resolveL2Name({ + client, + address: "0x1234...", + resolverAddress: "0x...", + resolverChain: base, }); - -await sendTransaction({ claimTransaction, account }); ``` +Resolve a Basename. + ```ts -function claimERC721( - options: BaseTransactionOptions, -): PreparedTransaction; +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 transaction options. +The options for resolving an L2 ENS address. #### Type ```ts -let options: BaseTransactionOptions; +let options: { + address: Address; + client: ThirdwebClient; + resolverAddress: string; + resolverChain: Chain; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +A promise that resolves to the Ethereum address. --- -## AIRDROP.fetchProofsERC1155 +## ENS.resolveName -Retrieves the claim merkle proof for the provided address. +Resolves the primary name for a specified address. ### Example ```ts -import { fetchProofsERCC1155 } from "thirdweb/extensions/airdrop"; -import { getContract, defineChain } from "thirdweb"; - -const TOKEN = getContracct({ +import { resolveName } from "thirdweb/extensions/ens"; +const name = await resolveName({ client, - chain: defineChain(1), - address: "0x...", -}); - -const merkleRoot = await tokenMerkleRoot({ - contract: TOKEN, - tokenAddress: TOKEN.address, -}); - -const proof = await fetchProofsERC1155({ - contract: TOKEN, - recipient: "0x...", - merkleRoot, + address: "0x1234...", }); ``` ```ts -function fetchProofsERC1155(options: { - contract: Readonly; - merkleRoot: string; - recipient: string; -}): Promise; +function resolveName( + options: ResolveNameOptions, +): Promise; ``` ### Parameters +The options for resolving an ENS address. + #### Type ```ts let options: { - contract: Readonly; - merkleRoot: string; - recipient: string; + address: Address; + client: ThirdwebClient; + resolverAddress?: string; + resolverChain?: Chain; }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the proof or null if the recipient is not in the allowlist +A promise that resolves to the Ethereum address. --- -## AIRDROP.fetchProofsERC20 +## ENS.resolveText -Retrieves the claim merkle proof for the provided address. +Resolves an ENS name and key to the specified record. ### Example ```ts -import { fetchProofsERCC20 } from "thirdweb/extensions/airdrop"; -import { getContract, defineChain } from "thirdweb"; - -const TOKEN = getContracct({ +import { resolveText } from "thirdweb/extensions/ens"; +const twitterUsername = await resolveText({ client, - chain: defineChain(1), - address: "0x...", -}); - -const merkleRoot = await tokenMerkleRoot({ - contract: TOKEN, - tokenAddress: TOKEN.address, -}); - -const proof = await fetchProofsERC20({ - contract: TOKEN, - recipient: "0x...", - merkleRoot, + name: "vitalik.eth", + key: "com.twitter", }); ``` ```ts -function fetchProofsERC20(options: { - contract: Readonly; - merkleRoot: string; - recipient: string; - tokenDecimals: number; -}): Promise; +function resolveText( + options: ResolveTextOptions, +): Promise; ``` ### Parameters +The options for resolving an ENS address. + #### Type ```ts let options: { - contract: Readonly; - merkleRoot: string; - recipient: string; - tokenDecimals: number; + client: ThirdwebClient; + key: string; + name: string; + resolverAddress?: string; + resolverChain?: Chain; }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the proof or null if the recipient is not in the allowlist +A promise that resolves to the text record. +--- +## ERC1155 --- -## AIRDROP.fetchProofsERC721 +## ERC1155.approvalForAllEvent -Retrieves the claim merkle proof for the provided address. +Creates an event object for the ApprovalForAll event. ### 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, -}); +import { getContractEvents } from "thirdweb"; +import { approvalForAllEvent } from "thirdweb/extensions/erc1155"; -const proof = await fetchProofsERC721({ - contract: NFT, - recipient: "0x...", - merkleRoot, +const events = await getContractEvents({ +contract, +events: [ + approvalForAllEvent({ + _owner: ..., + _operator: ..., +}) +], }); ``` ```ts -function fetchProofsERC721(options: { - contract: Readonly; - merkleRoot: string; - recipient: string; -}): Promise; +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 options: { - contract: Readonly; - merkleRoot: string; - recipient: string; -}; +let filters: Partial<{ _operator: string; _owner: string }>; ``` ### Returns ```ts -let returnType: Promise; +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"; +}>; ``` -A promise that resolves to the proof or null if the recipient is not in the allowlist +The prepared event object. --- -## AIRDROP.generateAirdropSignatureERC1155 +## ERC1155.balanceOf -Generates the req and signature for sending ERC1155 airdrop. +Calls the "balanceOf" function on the contract. ### 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, - }, -}); +import { balanceOf } from "thirdweb/extensions/erc1155"; -const transaction = airdropERC1155WithSignature({ - contract, - req, - signature, +const result = await balanceOf({ + contract, + owner: ..., + tokenId: ..., }); -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}` }> +function balanceOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the airdrop. +The options for the balanceOf function. #### Type ```ts -let options: { - account: Account; - airdropRequest: GenerateReqInput; - contract: ThirdwebContract; -}; +let options: BaseTransactionOptions; ``` ### 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}` }> +let returnType: Promise; ``` -A promise that resolves to the req and signature. +The parsed result of the function call. --- -## AIRDROP.generateAirdropSignatureERC20 +## ERC1155.balanceOfBatch -Generates the req and signature for sending ERC20 airdrop. +Calls the "balanceOfBatch" function on the contract. ### 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, - }, -}); +import { balanceOfBatch } from "thirdweb/extensions/erc1155"; -const transaction = airdropERC20WithSignature({ - contract, - req, - signature, +const result = await balanceOfBatch({ + contract, + owners: ..., + tokenIds: ..., }); -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}` }> +function balanceOfBatch(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the airdrop. +The options for the balanceOfBatch function. #### Type ```ts -let options: { - account: Account; - airdropRequest: GenerateReqInput; - contract: ThirdwebContract; -}; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +let returnType: Promise> ``` -A promise that resolves to the req and signature. +The parsed result of the function call. --- -## AIRDROP.generateAirdropSignatureERC721 +## ERC1155.batchMetadataUpdateEvent -Generates the req and signature for sending ERC721 airdrop. +Creates an event object for the BatchMetadataUpdate event. ### 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 }, -]; +import { getContractEvents } from "thirdweb"; +import { batchMetadataUpdateEvent } from "thirdweb/extensions/erc1155"; -const { req, signature } = await generateAirdropSignatureERC721({ - account, +const events = await getContractEvents({ contract, - airdropRequest: { - tokenAddress: "0x...", // address of the ERC721 token to airdrop - contents, - }, + events: [batchMetadataUpdateEvent()], }); - -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; -}; +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: Promise<{ req: { contents: readonly Array<{ recipient: string; tokenId: bigint }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }> +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_fromTokenId"; readonly type: "uint256" }, + { readonly name: "_toTokenId"; readonly type: "uint256" }, + ]; + readonly name: "BatchMetadataUpdate"; + readonly type: "event"; +}>; ``` -A promise that resolves to the req and signature. +The prepared event object. --- -## AIRDROP.generateMerkleTreeInfoERC1155 +## ERC1155.burn -Generate merkle tree for a given snapshot. +Prepares a transaction to call the "burn" function on the contract. ### 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 +import { sendTransaction } from "thirdweb"; +import { burn } from "thirdweb/extensions/erc1155"; -const { merkleRoot, snapshotUri } = - await generateMerkleTreeInfoERC1155({ - contract, - tokenAddress, - snapshot, - }); +const transaction = burn({ + contract, + account: ..., + id: ..., + value: ..., + overrides: { + ... + } +}); -// 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 +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function generateMerkleTreeInfoERC1155( - options: BaseTransactionOptions, -): Promise<{ merkleRoot: string; snapshotUri: string }>; +function burn( + options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The transaction options. +The options for the "burn" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the merkle-root and snapshot-uri. +A prepared transaction object. --- -## AIRDROP.generateMerkleTreeInfoERC20 +## ERC1155.burnBatch -Generate merkle tree for a given snapshot. +Prepares a transaction to call the "burnBatch" function on the contract. ### 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 +import { sendTransaction } from "thirdweb"; +import { burnBatch } from "thirdweb/extensions/erc1155"; -const { merkleRoot, snapshotUri } = await generateMerkleTreeInfoERC20( - { - contract, - tokenAddress, - snapshot, - }, -); +const transaction = burnBatch({ + contract, + account: ..., + ids: ..., + values: ..., + overrides: { + ... + } +}); -// 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 +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function generateMerkleTreeInfoERC20( - options: BaseTransactionOptions, -): Promise<{ merkleRoot: string; snapshotUri: string }>; +function burnBatch( + options: BaseTransactionOptions< + BurnBatchParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The transaction options. +The options for the "burnBatch" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + BurnBatchParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise<{ merkleRoot: string; snapshotUri: string }>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the merkle-root and snapshot-uri. +A prepared transaction object. --- -## AIRDROP.generateMerkleTreeInfoERC721 +## ERC1155.claimTo -Generate merkle tree for a given snapshot. +Claim ERC1155 NFTs to a specified address ### 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. ---- - -## AIRDROP.isClaimed - -Calls the "isClaimed" function on the contract. - -### Example +#### Basic usage ```ts -import { isClaimed } from "thirdweb/extensions/airdrop"; +import { claimTo } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; -const result = await isClaimed({ - contract, - receiver: ..., - token: ..., - tokenId: ..., +const transaction = claimTo({ + contract, + to: "0x...", + tokenId: 0n, + quantity: 1n, }); + +await sendTransaction({ transaction, account }); ``` -```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. ---- - -## AIRDROP.saveSnapshot - -Generate merkle tree for a given snapshot and save the info on-chain. +#### For Drops with allowlists -### Example +You need to specify the claimer address as the `from` param to avoid any issue with the allowlist ```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({ +const transaction = claimTo({ contract, - token, - tokenMerkleRoot: merkleRoot as `0x${string}`, - resetClaimStatus: false // toggle as needed - signature, + to: "0x...", + tokenId: 0n, + quantity: 1n, + from: "0x...", // address of the one claiming }); -await sendTransaction({ setMerkleRootTransaction, account }); ``` ```ts -function saveSnapshot( - options: BaseTransactionOptions, +function claimTo( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The transaction options. +The options for the transaction #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -10042,24 +8447,27 @@ let returnType: PreparedTransaction< >; ``` -A promise that resolves to the transaction result. +The prepared transaction --- -## AIRDROP.setMerkleRoot +## ERC1155.createPack -Prepares a transaction to call the "setMerkleRoot" function on the contract. +Prepares a transaction to call the "createPack" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { setMerkleRoot } from "thirdweb/extensions/airdrop"; +import { createPack } from "thirdweb/extensions/erc1155"; -const transaction = setMerkleRoot({ +const transaction = createPack({ contract, - token: ..., - tokenMerkleRoot: ..., - resetClaimStatus: ..., + contents: ..., + numOfRewardUnits: ..., + packUri: ..., + openStartTimestamp: ..., + amountDistributedPerOpen: ..., + recipient: ..., overrides: { ... } @@ -10070,24 +8478,23 @@ await sendTransaction({ transaction, account }); ``` ```ts -function setMerkleRoot( +function createPack( options: BaseTransactionOptions< - | SetMerkleRootParams - | { asyncParams: () => Promise } + | CreatePackParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "setMerkleRoot" function. +The options for the "createPack" function. #### Type ```ts let options: BaseTransactionOptions< - | SetMerkleRootParams - | { asyncParams: () => Promise } + CreatePackParams | { asyncParams: () => Promise } >; ``` @@ -10104,142 +8511,222 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## AIRDROP.tokenConditionId +## ERC1155.encodeSafeTransferFrom -Calls the "tokenConditionId" function on the contract. +Encodes the "safeTransferFrom" function into a Hex string with its parameters. ### Example ```ts -import { tokenConditionId } from "thirdweb/extensions/airdrop"; - -const result = await tokenConditionId({ - contract, - tokenAddress: ..., +import { encodeSafeTransferFrom } from "thirdweb/extensions/erc1155"; +const result = encodeSafeTransferFrom({ + from: ..., + to: ..., + tokenId: ..., + value: ..., + data: ..., }); ``` ```ts -function tokenConditionId( - options: BaseTransactionOptions, -): Promise; +function encodeSafeTransferFrom( + options: SafeTransferFromParams, +): `0xf242432a${string}`; ``` ### Parameters -The options for the tokenConditionId function. +The options for the safeTransferFrom function. #### Type ```ts -let options: BaseTransactionOptions; +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: Promise; +let returnType: `0xf242432a${string}`; ``` -The parsed result of the function call. +The encoded hexadecimal string. --- -## AIRDROP.tokenMerkleRoot +## ERC1155.freezeMetadata -Calls the "tokenMerkleRoot" function on the contract. +Prepares a transaction to call the "freezeMetadata" function on the contract. ### Example ```ts -import { tokenMerkleRoot } from "thirdweb/extensions/airdrop"; +import { sendTransaction } from "thirdweb"; +import { freezeMetadata } from "thirdweb/extensions/erc1155"; -const result = await tokenMerkleRoot({ - contract, - tokenAddress: ..., -}); +const transaction = freezeMetadata(); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function tokenMerkleRoot( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function freezeMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the tokenMerkleRoot function. +The options for the "freezeMetadata" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. ---- -## COMMON +A prepared transaction object. --- -## COMMON.contractURI +## ERC1155.generateMintSignature -Calls the "contractURI" function on the contract. +Generates the payload and signature for minting an ERC1155 token. ### Example ```ts -import { contractURI } from "thirdweb/extensions/common"; +import { + mintWithSignature, + generateMintSignature, +} from "thirdweb/extensions/erc1155"; -const result = await contractURI({ +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 contractURI( - options: BaseTransactionOptions, -): Promise; +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 contractURI function. +The options for the minting process. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; ``` ### Returns ```ts -let returnType: Promise; +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}`; +}>; ``` -The parsed result of the function call. +A promise that resolves to the payload and signature. --- -## COMMON.getContractMetadata +## ERC1155.getActiveClaimCondition -Retrieves the contract metadata including name and symbol. +Retrieves the active claim condition. ### Example ```ts -import { getContractMetadata } from "thirdweb/extensions/common"; -const metadata = await getContractMetadata({ contract }); +import { getActiveClaimCondition } from "thirdweb/extensions/erc1155"; +const activeClaimCondition = await getActiveClaimCondition({ + contract, + tokenId, +}); ``` ```ts -function getContractMetadata( - options: BaseTransactionOptions, -): Promise<{ name: string; symbol: string }>; +function getActiveClaimCondition( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters @@ -10249,296 +8736,377 @@ The transaction options. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<{ name: string; symbol: string }>; +let returnType: Promise; ``` -A promise that resolves to an object containing the resolved metadata, name, and symbol. +A promise that resolves to the active claim condition. --- -## COMMON.getDefaultRoyaltyInfo +## ERC1155.getClaimConditionById -Calls the "getDefaultRoyaltyInfo" function on the contract. +Calls the "getClaimConditionById" function on the contract. ### Example ```ts -import { getDefaultRoyaltyInfo } from "thirdweb/extensions/common"; +import { getClaimConditionById } from "thirdweb/extensions/erc1155"; -const result = await getDefaultRoyaltyInfo({ - contract, +const result = await getClaimConditionById({ + contract, + tokenId: ..., + conditionId: ..., }); ``` ```ts -function getDefaultRoyaltyInfo( - options: BaseTransactionOptions, -): Promise; +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 getDefaultRoyaltyInfo function. +The options for the getClaimConditionById function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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. --- -## COMMON.getPlatformFeeInfo +## ERC1155.getClaimConditions -Calls the "getPlatformFeeInfo" function on the contract. +Retrieves all claim conditions. ### Example ```ts -import { getPlatformFeeInfo } from "thirdweb/extensions/common"; - -const result = await getPlatformFeeInfo({ +import { getClaimConditions } from "thirdweb/extensions/erc1155"; +const conditions = await getClaimConditions({ contract, + tokenId: 1n, }); ``` ```ts -function getPlatformFeeInfo( - options: BaseTransactionOptions, -): Promise; +function getClaimConditions( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the getPlatformFeeInfo function. +The transaction options. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise>; ``` -The parsed result of the function call. +A promise that resolves to all claim conditions. --- -## COMMON.getRoyaltyInfoForToken +## ERC1155.getNFT -Calls the "getRoyaltyInfoForToken" function on the contract. +Retrieves information about a specific ERC1155 non-fungible token (NFT). ### Example ```ts -import { getRoyaltyInfoForToken } from "thirdweb/extensions/common"; - -const result = await getRoyaltyInfoForToken({ - contract, - tokenId: ..., +import { getNFT } from "thirdweb/extensions/erc1155"; +const nft = await getNFT({ + contract, + tokenId: 1n, }); ``` ```ts -function getRoyaltyInfoForToken( - options: BaseTransactionOptions, -): Promise; +function getNFT( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getRoyaltyInfoForToken function. +The options for retrieving the NFT. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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"; + }; ``` -The parsed result of the function call. +A promise that resolves to the NFT object. --- -## COMMON.isGetContractMetadataSupported +## ERC1155.getNFTs -Checks if the `contractURI` method is supported by the given contract. +Retrieves an array of NFTs ("ERC1155") based on the provided options. ### Example ```ts -import { isContractURISupported } from "thirdweb/extensions/common"; -const supported = isContractURISupported(["0x..."]); +import { getNFTs } from "thirdweb/extensions/erc1155"; +const nfts = await getNFTs({ + contract, + start: 0, + count: 10, +}); ``` ```ts -function isGetContractMetadataSupported( - availableSelectors: Array, -): boolean; +function getNFTs( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +The options for retrieving the NFTs. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +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 boolean indicating if the `contractURI` method is supported. +A promise that resolves to an array of NFTs. --- -## COMMON.isGetDefaultRoyaltyInfoSupported +## ERC1155.getOwnedNFTs -Checks if the `getDefaultRoyaltyInfo` method is supported by the given contract. +Retrieves the owned ERC1155 NFTs for a given wallet address. ### Example ```ts -import { isGetDefaultRoyaltyInfoSupported } from "thirdweb/extensions/common"; -const supported = isGetDefaultRoyaltyInfoSupported(["0x..."]); +import { getOwnedNFTs } from "thirdweb/extensions/erc1155"; +const nfts = await getOwnedNFTs({ + contract, + start: 0, + count: 10, + address: "0x123...", +}); ``` ```ts -function isGetDefaultRoyaltyInfoSupported( - availableSelectors: Array, -): boolean; +function getOwnedNFTs( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +The transaction options and parameters. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +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 boolean indicating if the `getDefaultRoyaltyInfo` method is supported. +A promise that resolves to an array of ERC1155 NFTs owned by the wallet address, along with the quantity owned. --- -## COMMON.isGetPlatformFeeInfoSupported +## ERC1155.getOwnedTokenIds -Checks if the `getPlatformFeeInfo` method is supported by the given contract. +Retrieves the owned ERC1155 tokenIds & the owned balance of each tokenId for a given wallet address. ### Example ```ts -import { isGetPlatformFeeInfoSupported } from "thirdweb/extensions/common"; -const supported = isGetPlatformFeeInfoSupported(["0x..."]); +import { getOwnedNFTs } from "thirdweb/extensions/erc1155"; +const ownedTokenIds = await getOwnedTokenIds({ + contract, + start: 0, + count: 10, + address: "0x123...", +}); ``` ```ts -function isGetPlatformFeeInfoSupported( - availableSelectors: Array, -): boolean; +function getOwnedTokenIds( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +The transaction options and parameters. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise>; ``` -A boolean indicating if the `getPlatformFeeInfo` method is supported. +A promise that resolves to an array of ERC1155 NFTs owned by the wallet address, along with the quantity owned. --- -## COMMON.isGetRoyaltyInfoForTokenSupported +## ERC1155.isApprovedForAll -Checks if the `getRoyaltyInfoForToken` method is supported by the given contract. +Calls the "isApprovedForAll" function on the contract. ### Example ```ts -import { isGetRoyaltyInfoForTokenSupported } from "thirdweb/extensions/common"; -const supported = isGetRoyaltyInfoForTokenSupported(["0x..."]); +import { isApprovedForAll } from "thirdweb/extensions/erc1155"; + +const result = await isApprovedForAll({ + contract, + owner: ..., + operator: ..., +}); ``` ```ts -function isGetRoyaltyInfoForTokenSupported( - availableSelectors: Array, -): boolean; +function isApprovedForAll( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the isApprovedForAll function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getRoyaltyInfoForToken` method is supported. +The parsed result of the function call. --- -## COMMON.isMulticallSupported +## ERC1155.isBurnSupported -Checks if the `multicall` method is supported by the given contract. +Checks if the `burn` method is supported by the given contract. ### Example ```ts -import { isMulticallSupported } from "thirdweb/extensions/common"; +import { isBurnSupported } from "thirdweb/extensions/erc1155"; -const supported = isMulticallSupported(["0x..."]); +const supported = isBurnSupported(["0x..."]); ``` ```ts -function isMulticallSupported( - availableSelectors: Array, -): boolean; +function isBurnSupported(availableSelectors: Array): boolean; ``` ### Parameters @@ -10557,22 +9125,25 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `multicall` method is supported. +A boolean indicating if the `burn` method is supported. --- -## COMMON.isNameSupported +## ERC1155.isClaimToSupported -Checks if the `name` method is supported by the given contract. +Checks if the `claimTo` method is supported by the given contract. ### Example ```ts -import { isNameSupported } from "thirdweb/extensions/common"; -const supported = isNameSupported(["0x..."]); +import { isClaimToSupported } from "thirdweb/extensions/erc1155"; + +const supported = isClaimToSupported(["0x..."]); ``` ```ts -function isNameSupported(availableSelectors: Array): boolean; +function isClaimToSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters @@ -10591,56 +9162,57 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `name` method is supported. +A boolean indicating if the `claimTo` method is supported. --- -## COMMON.isOwnerSupported +## ERC1155.isERC1155 -Checks if the `owner` method is supported by the given contract. +Check if a contract supports the ERC1155 interface. ### Example ```ts -import { isOwnerSupported } from "thirdweb/extensions/common"; -const supported = isOwnerSupported(["0x..."]); +import { isERC1155 } from "thirdweb/extensions/erc1155"; +const result = await isERC1155({ contract }); ``` ```ts -function isOwnerSupported(availableSelectors: Array): boolean; +function isERC1155(options: BaseTransactionOptions): Promise; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `owner` method is supported. +A boolean indicating whether the contract supports the ERC1155 interface. --- -## COMMON.isPrimarySaleRecipientSupported +## ERC1155.isGetActiveClaimConditionSupported -Checks if the `primarySaleRecipient` method is supported by the given contract. +Checks if the `getActiveClaimCondition` method is supported by the given contract. ### Example ```ts -import { isPrimarySaleRecipientSupported } from "thirdweb/extensions/common"; -const supported = isPrimarySaleRecipientSupported(["0x..."]); +import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc1155"; + +const supported = isGetActiveClaimConditionSupported(["0x..."]); ``` ```ts -function isPrimarySaleRecipientSupported( +function isGetActiveClaimConditionSupported( availableSelectors: Array, ): boolean; ``` @@ -10661,23 +9233,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `primarySaleRecipient` method is supported. +A boolean indicating if the `getActiveClaimCondition` method is supported. --- -## COMMON.isSetContractURISupported +## ERC1155.isGetClaimConditionByIdSupported -Checks if the `setContractURI` method is supported by the given contract. +Checks if the `getClaimConditionById` method is supported by the given contract. ### Example ```ts -import { isSetContractURISupported } from "thirdweb/extensions/common"; - -const supported = isSetContractURISupported(["0x..."]); +import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc1155"; +const supported = isGetClaimConditionByIdSupported(["0x..."]); ``` ```ts -function isSetContractURISupported( +function isGetClaimConditionByIdSupported( availableSelectors: Array, ): boolean; ``` @@ -10698,23 +9269,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `setContractURI` method is supported. +A boolean indicating if the `getClaimConditionById` method is supported. --- -## COMMON.isSetDefaultRoyaltyInfoSupported +## ERC1155.isGetClaimConditionsSupported -Checks if the `setDefaultRoyaltyInfo` method is supported by the given contract. +Checks if the `getClaimConditions` method is supported by the given contract. ### Example ```ts -import { isSetDefaultRoyaltyInfoSupported } from "thirdweb/extensions/common"; +import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc1155"; -const supported = isSetDefaultRoyaltyInfoSupported(["0x..."]); +const supported = isGetClaimConditionsSupported(["0x..."]); ``` ```ts -function isSetDefaultRoyaltyInfoSupported( +function isGetClaimConditionsSupported( availableSelectors: Array, ): boolean; ``` @@ -10735,23 +9306,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `setDefaultRoyaltyInfo` method is supported. +A boolean indicating if the `getClaimConditions` method is supported. --- -## COMMON.isSetPlatformFeeInfoSupported +## ERC1155.isGetNFTsSupported -Checks if the `setPlatformFeeInfo` method is supported by the given contract. +Checks if the `getNFTs` method is supported by the given contract. ### Example ```ts -import { isSetPlatformFeeInfoSupported } from "thirdweb/extensions/common"; +import { isGetNFTsSupported } from "thirdweb/extensions/erc721"; -const supported = isSetPlatformFeeInfoSupported(["0x..."]); +const supported = isGetNFTsSupported(["0x..."]); ``` ```ts -function isSetPlatformFeeInfoSupported( +function isGetNFTsSupported( availableSelectors: Array, ): boolean; ``` @@ -10772,23 +9343,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `setPlatformFeeInfo` method is supported. +A boolean indicating if the `getNFTs` method is supported. --- -## COMMON.isSetPrimarySaleRecipientSupported +## ERC1155.isGetNFTSupported -Checks if the `setPrimarySaleRecipient` method is supported by the given contract. +Checks if the `uri` method is supported by the given contract. ### Example ```ts -import { isSetPrimarySaleRecipientSupported } from "thirdweb/extensions/common"; - -const supported = isSetPrimarySaleRecipientSupported(["0x..."]); +import { isUriSupported } from "thirdweb/extensions/erc1155"; +const supported = isUriSupported(["0x..."]); ``` ```ts -function isSetPrimarySaleRecipientSupported( +function isGetNFTSupported( availableSelectors: Array, ): boolean; ``` @@ -10809,23 +9379,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `setPrimarySaleRecipient` method is supported. +A boolean indicating if the `uri` method is supported. --- -## COMMON.isSetRoyaltyInfoForTokenSupported +## ERC1155.isLazyMintSupported -Checks if the `setRoyaltyInfoForToken` method is supported by the given contract. +Checks if the `lazyMint` method is supported by the given contract. ### Example ```ts -import { isSetRoyaltyInfoForTokenSupported } from "thirdweb/extensions/common"; +import { isLazyMintSupported } from "thirdweb/extensions/erc1155"; -const supported = isSetRoyaltyInfoForTokenSupported(["0x..."]); +const supported = isLazyMintSupported(["0x..."]); ``` ```ts -function isSetRoyaltyInfoForTokenSupported( +function isLazyMintSupported( availableSelectors: Array, ): boolean; ``` @@ -10846,22 +9416,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `setRoyaltyInfoForToken` method is supported. +A boolean indicating if the `lazyMint` method is supported. --- -## COMMON.isSymbolSupported +## ERC1155.isMintAdditionalSupplyToSupported -Checks if the `symbol` method is supported by the given contract. +Checks if the `mintAdditionalSupplyTo` method is supported by the given contract. ### Example ```ts -import { isSymbolSupported } from "thirdweb/extensions/common"; -const supported = isSymbolSupported(["0x..."]); +import { isMintAdditionalSupplyToSupported } from "thirdweb/extensions/erc1155"; + +const supported = isMintAdditionalSupplyToSupported(["0x..."]); ``` ```ts -function isSymbolSupported( +function isMintAdditionalSupplyToSupported( availableSelectors: Array, ): boolean; ``` @@ -10882,345 +9453,267 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `symbol` method is supported. +A boolean indicating if the `mintAdditionalSupplyTo` method is supported. --- -## COMMON.multicall +## ERC1155.isMintToSupported -Prepares a transaction to call the "multicall" function on the contract. +Checks if the `mintTo` method is supported by the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { multicall } from "thirdweb/extensions/common"; - -const transaction = multicall({ - contract, - data: ..., - overrides: { - ... - } -}); +import { isMintToSupported } from "thirdweb/extensions/erc1155"; -// Send the transaction -await sendTransaction({ transaction, account }); +const supported = isMintToSupported(["0x..."]); ``` ```ts -function multicall( - options: BaseTransactionOptions< - MulticallParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isMintToSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "multicall" function. +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 options: BaseTransactionOptions< - MulticallParams | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `mintTo` method is supported. --- -## COMMON.name +## ERC1155.isNextTokenIdToMintSupported -Retrieves the name associated with the given contract. +Checks if the `nextTokenIdToMint` method is supported by the given contract. ### Example ```ts -import { name } from "thirdweb/extensions/common"; - -const contractName = await name({ contract }); +import { isNextTokenIdToMintSupported } from "thirdweb/extensions/erc1155"; +const supported = isNextTokenIdToMintSupported(["0x..."]); ``` ```ts -function name(options: BaseTransactionOptions): Promise; +function isNextTokenIdToMintSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the transaction. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -A promise that resolves to the name associated with the contract. +A boolean indicating if the `nextTokenIdToMint` method is supported. --- -## COMMON.owner +## ERC1155.isResetClaimEligibilitySupported -Calls the "owner" function on the contract. +Checks if the `resetClaimEligibility` method is supported by the given contract. ### Example ```ts -import { owner } from "thirdweb/extensions/common"; +import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc1155"; -const result = await owner({ - contract, -}); +const supported = isResetClaimEligibilitySupported(["0x..."]); ``` ```ts -function owner(options: BaseTransactionOptions): Promise; +function isResetClaimEligibilitySupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the owner function. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `resetClaimEligibility` method is supported. --- -## COMMON.ownerUpdatedEvent +## ERC1155.isSetClaimConditionsSupported -Creates an event object for the OwnerUpdated event. +Checks if the `setClaimConditions` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { ownerUpdatedEvent } from "thirdweb/extensions/common"; +import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc1155"; -const events = await getContractEvents({ -contract, -events: [ - ownerUpdatedEvent({ - prevOwner: ..., - newOwner: ..., -}) -], -}); +const supported = isSetClaimConditionsSupported(["0x..."]); ``` ```ts -function ownerUpdatedEvent( - filters: Partial, -): 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"; -}>; +function isSetClaimConditionsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `setClaimConditions` method is supported. --- -## COMMON.primarySaleRecipient +## ERC1155.isTotalSupplySupported -Calls the "primarySaleRecipient" function on the contract. +Checks if the `totalSupply` method is supported by the given contract. ### Example ```ts -import { primarySaleRecipient } from "thirdweb/extensions/common"; - -const result = await primarySaleRecipient({ - contract, -}); +import { isTotalSupplySupported } from "thirdweb/extensions/erc1155"; +const supported = isTotalSupplySupported(["0x..."]); ``` ```ts -function primarySaleRecipient( - options: BaseTransactionOptions, -): Promise; +function isTotalSupplySupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the primarySaleRecipient function. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `totalSupply` method is supported. --- -## COMMON.setContractMetadata +## ERC1155.isUpdateTokenURISupported -Sets the metadata for a contract. +Checks if the `setTokenURI` method is supported by the given contract. ### Example ```ts -import { setContractMetadata } from "@thirdweb/extensions/common"; -import { sendTransaction } from "thirdweb"; - -const transaction = setContractMetadata({ - contract, - name: "My NFT", - symbol: "NFT", -}); +import { isSetTokenURISupported } from "thirdweb/extensions/erc1155"; -// Send the transaction -await sendTransaction({ - transaction, - account, -}); +const supported = isSetTokenURISupported(["0x..."]); ``` ```ts -function setContractMetadata( - options: BaseTransactionOptions, -): PreparedTransaction; +function isUpdateTokenURISupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for setting the contract metadata. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -* The prepared transaction to set the contract metadata. +A boolean indicating if the `setTokenURI` method is supported. --- -## COMMON.setContractURI +## ERC1155.lazyMint -Prepares a transaction to call the "setContractURI" function on the contract. +Lazily mints ERC1155 tokens. ### Example ```ts +import { lazyMint } from "thirdweb/extensions/erc1155"; import { sendTransaction } from "thirdweb"; -import { setContractURI } from "thirdweb/extensions/common"; -const transaction = setContractURI({ - contract, - uri: ..., - overrides: { - ... - } +const transaction = lazyMint({ + contract, + nfts: [ + { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, + ], }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function setContractURI( - options: BaseTransactionOptions< - | SetContractURIParams - | { asyncParams: () => Promise } - >, +function lazyMint( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "setContractURI" function. +The options for the lazy minting process. #### Type ```ts -let options: BaseTransactionOptions< - | SetContractURIParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -11233,107 +9726,121 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A promise that resolves to the prepared contract call. --- -## COMMON.setDefaultRoyaltyInfo +## ERC1155.metadataFrozenEvent -Prepares a transaction to call the "setDefaultRoyaltyInfo" function on the contract. +Creates an event object for the MetadataFrozen event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { setDefaultRoyaltyInfo } from "thirdweb/extensions/common"; +import { getContractEvents } from "thirdweb"; +import { metadataFrozenEvent } from "thirdweb/extensions/erc1155"; -const transaction = setDefaultRoyaltyInfo({ - contract, - royaltyRecipient: ..., - royaltyBps: ..., - overrides: { - ... - } +const events = await getContractEvents({ + contract, + events: [metadataFrozenEvent()], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function setDefaultRoyaltyInfo( - options: BaseTransactionOptions< - | SetDefaultRoyaltyInfoParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function metadataFrozenEvent(): PreparedEvent<{ + readonly inputs: readonly []; + readonly name: "MetadataFrozen"; + readonly type: "event"; +}>; ``` -### Parameters +### Returns -The options for the "setDefaultRoyaltyInfo" function. +```ts +let returnType: PreparedEvent<{ + readonly inputs: readonly []; + readonly name: "MetadataFrozen"; + readonly type: "event"; +}>; +``` -#### Type +The prepared event object. +--- + +## ERC1155.metadataUpdateEvent + +Creates an event object for the MetadataUpdate event. + +### Example ```ts -let options: BaseTransactionOptions< - | SetDefaultRoyaltyInfoParams - | { asyncParams: () => Promise } ->; +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: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "_tokenId"; readonly type: "uint256" }, + ]; + readonly name: "MetadataUpdate"; + readonly type: "event"; +}>; ``` -A prepared transaction object. +The prepared event object. --- -## COMMON.setOwner +## ERC1155.mintAdditionalSupplyTo -Prepares a transaction to call the "setOwner" function on the contract. +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"; -import { setOwner } from "thirdweb/extensions/common"; -const transaction = setOwner({ - contract, - newOwner: ..., - overrides: { - ... - } +const transaction = mintAdditionalSupplyTo({ + contract, + to: "0x...", + tokenId: 1n, + supply: 10n, }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function setOwner( - options: BaseTransactionOptions< - SetOwnerParams | { asyncParams: () => Promise } - >, +function mintAdditionalSupplyTo( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "setOwner" function. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions< - SetOwnerParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -11346,52 +9853,42 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A promise that resolves to the transaction result. --- -## COMMON.setPlatformFeeInfo +## ERC1155.mintAdditionalSupplyToBatch -Prepares a transaction to call the "setPlatformFeeInfo" function on the contract. +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 { sendTransaction } from "thirdweb"; -import { setPlatformFeeInfo } from "thirdweb/extensions/common"; +import { mintAdditionalSupplyToBatch } from "thirdweb/extensions/erc1155"; -const transaction = setPlatformFeeInfo({ - contract, - platformFeeRecipient: ..., - platformFeeBps: ..., - overrides: { - ... - } +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 }, + ], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function setPlatformFeeInfo( - options: BaseTransactionOptions< - | SetPlatformFeeInfoParams - | { asyncParams: () => Promise } - >, +function mintAdditionalSupplyToBatch( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "setPlatformFeeInfo" function. - #### Type ```ts -let options: BaseTransactionOptions< - | SetPlatformFeeInfoParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -11403,52 +9900,46 @@ let returnType: PreparedTransaction< PrepareTransactionOptions >; ``` - -A prepared transaction object. --- -## COMMON.setPrimarySaleRecipient +## ERC1155.mintTo -Prepares a transaction to call the "setPrimarySaleRecipient" function on the contract. +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"; -import { setPrimarySaleRecipient } from "thirdweb/extensions/common"; -const transaction = setPrimarySaleRecipient({ - contract, - saleRecipient: ..., - overrides: { - ... - } +const transaction = mintTo({ + contract, + to: "0x...", + supply: 10n, + nft: { + name: "My NFT", + description: "This is my NFT", + image: "https://example.com/image.png", + }, }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function setPrimarySaleRecipient( - options: BaseTransactionOptions< - | SetPrimarySaleRecipientParams - | { asyncParams: () => Promise } - >, +function mintTo( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "setPrimarySaleRecipient" function. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions< - | SetPrimarySaleRecipientParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -11461,53 +9952,60 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A promise that resolves to the transaction result. --- -## COMMON.setRoyaltyInfoForToken +## ERC1155.mintToBatch -Prepares a transaction to call the "setRoyaltyInfoForToken" function on the contract. +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 { sendTransaction } from "thirdweb"; -import { setRoyaltyInfoForToken } from "thirdweb/extensions/common"; +import { mintBatchTo } from "thirdweb/extension/erc1155"; -const transaction = setRoyaltyInfoForToken({ - contract, - tokenId: ..., - recipient: ..., - bps: ..., - overrides: { - ... - } +const transaction = mintToBatch({ + contract: editionContract, + to: "0x...", + nfts: [ + { + metadata: { + name: "Token #0", + image: "...", + attributes: [], + }, + supply: 100n, + }, + { + metadata: { + name: "Token #1", + image: "...", + attributes: [], + }, + supply: 111n, + }, + ], }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function setRoyaltyInfoForToken( - options: BaseTransactionOptions< - | SetRoyaltyInfoForTokenParams - | { asyncParams: () => Promise } - >, +function mintToBatch( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "setRoyaltyInfoForToken" function. +the transaction options #### Type ```ts -let options: BaseTransactionOptions< - | SetRoyaltyInfoForTokenParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -11520,433 +10018,393 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A promise that resolves to the transaction result. --- -## COMMON.symbol +## ERC1155.mintWithSignature -Retrieves the name associated with the given contract. +Mints a new ERC1155 token with the given minter signature ### Example ```ts -import { symbol } from "thirdweb/extensions/common"; +import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; -const contractSymbol = await symbol({ contract }); +const { payload, signature } = await generateMintSignature(...) + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); +await sendTransaction({ transaction, account }); ``` ```ts -function symbol(options: BaseTransactionOptions): Promise; +function mintWithSignature( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the transaction. +The transaction options. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the name associated with the contract. ---- -## ENS +A promise that resolves to the transaction result. --- -## ENS.parseNftUri +## ERC1155.nextTokenId -Parses an NFT URI. +Calls the "nextTokenId" function on the contract. ### Example ```ts -import { parseNftUri } from "thirdweb/utils/ens"; -const nftUri = await parseNftUri({ - client, - uri: "eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063", -}); +import { nextTokenId } from "thirdweb/extensions/erc1155"; -console.log(nftUri); // ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/ +const result = await nextTokenId({ + contract, +}); ``` ```ts -function parseNftUri(options: { - client: ThirdwebClient; - uri: string; -}): Promise; +function nextTokenId( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for parsing an NFT URI. +The options for the nextTokenId function. #### Type ```ts -let options: { client: ThirdwebClient; uri: string }; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the NFT URI, or null if the URI could not be parsed. +The parsed result of the function call. --- -## ENS.parseAvatarRecord +## ERC1155.nextTokenIdToMint -Parses an ENS or similar avatar record. Supports NFT URIs, IPFS scheme, and HTTPS URIs. +Calls the "nextTokenIdToMint" function on the contract. ### Example ```ts -import { parseAvatarRecord } from "thirdweb/utils/ens"; -const avatarUrl = await parseAvatarRecord({ - client, - uri: "ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/", -}); - -console.log(avatarUrl); // "https://ipfs.io/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/" +import { nextTokenIdToMint } from "thirdweb/extensions/erc1155"; -const avatarUrl2 = await parseAvatarRecord({ - client, - uri: "eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063", +const result = await nextTokenIdToMint({ + contract, }); - -console.log(avatarUrl2); // "https://opensea.io/assets/0xb32979486938aa9694bfc898f35dbed459f44424/10063" ``` ```ts -function parseAvatarRecord( - options: ParseAvatarOptions, -): Promise; +function nextTokenIdToMint( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for parsing an ENS avatar record. +The options for the nextTokenIdToMint function. #### Type ```ts -let options: { client: ThirdwebClient; uri: string }; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the avatar URL, or null if the URI could not be parsed. +The parsed result of the function call. --- -## ENS.resolveAddress +## ERC1155.openPack -Resolves an ENS name to an Ethereum address. +Prepares a transaction to call the "openPack" function on the contract. ### 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, +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 resolveAddress( - options: ResolveAddressOptions, -): Promise<`0x${string}`>; +function openPack( + options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for resolving an ENS address. +The options for the "openPack" function. #### Type ```ts -let options: { - client: ThirdwebClient; - name: string; - resolverAddress?: string; - resolverChain?: Chain; -}; +let options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; -``` - -A promise that resolves to the Ethereum address. ---- - -## ENS.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. ---- - -## ENS.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; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the Ethereum address. +A prepared transaction object. --- -## ENS.resolveName +## ERC1155.packCreatedEvent -Resolves the primary name for a specified address. +Creates an event object for the PackCreated event. ### Example ```ts -import { resolveName } from "thirdweb/extensions/ens"; -const name = await resolveName({ - client, - address: "0x1234...", +import { getContractEvents } from "thirdweb"; +import { packCreatedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + packCreatedEvent({ + packId: ..., +}) +], }); ``` ```ts -function resolveName( - options: ResolveNameOptions, -): Promise; +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 -The options for resolving an ENS address. +Optional filters to apply to the event. #### Type ```ts -let options: { - address: Address; - client: ThirdwebClient; - resolverAddress?: string; - resolverChain?: Chain; -}; +let filters: Partial<{ packId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +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"; +}>; ``` -A promise that resolves to the Ethereum address. +The prepared event object. --- -## ENS.resolveText +## ERC1155.packOpenedEvent -Resolves an ENS name and key to the specified record. +Creates an event object for the PackOpened event. ### Example ```ts -import { resolveText } from "thirdweb/extensions/ens"; -const twitterUsername = await resolveText({ - client, - name: "vitalik.eth", - key: "com.twitter", +import { getContractEvents } from "thirdweb"; +import { packOpenedEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + packOpenedEvent({ + packId: ..., + opener: ..., +}) +], }); ``` ```ts -function resolveText( - options: ResolveTextOptions, -): Promise; +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 -The options for resolving an ENS address. +Optional filters to apply to the event. #### Type ```ts -let options: { - client: ThirdwebClient; - key: string; - name: string; - resolverAddress?: string; - resolverChain?: Chain; -}; +let filters: Partial<{ opener: string; packId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +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"; +}>; ``` -A promise that resolves to the text record. ---- -## ERC1155 +The prepared event object. --- -## ERC1155.approvalForAllEvent +## ERC1155.packUpdatedEvent -Creates an event object for the ApprovalForAll event. +Creates an event object for the PackUpdated event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { approvalForAllEvent } from "thirdweb/extensions/erc1155"; +import { packUpdatedEvent } from "thirdweb/extensions/erc1155"; const events = await getContractEvents({ contract, events: [ - approvalForAllEvent({ - _owner: ..., - _operator: ..., + packUpdatedEvent({ + packId: ..., }) ], }); ``` ```ts -function approvalForAllEvent( - filters: Partial, +function packUpdatedEvent( + filters: Partial<{ packId: bigint }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "_owner"; - readonly type: "address"; - }, - { - readonly indexed: true; - readonly name: "_operator"; - readonly type: "address"; + readonly name: "packId"; + readonly type: "uint256"; }, - { readonly name: "_approved"; readonly type: "bool" }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, ]; - readonly name: "ApprovalForAll"; + readonly name: "PackUpdated"; readonly type: "event"; }>; ``` @@ -11958,7 +10416,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ packId: bigint }>; ``` ### Returns @@ -11968,17 +10426,13 @@ 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: "packId"; + readonly type: "uint256"; }, - { readonly name: "_approved"; readonly type: "bool" }, + { readonly name: "recipient"; readonly type: "address" }, + { readonly name: "totalPacksCreated"; readonly type: "uint256" }, ]; - readonly name: "ApprovalForAll"; + readonly name: "PackUpdated"; readonly type: "event"; }>; ``` @@ -11986,144 +10440,128 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC1155.balanceOf +## ERC1155.resetClaimEligibility -Calls the "balanceOf" function on the contract. +Reset the claim eligibility for all users. ### Example ```ts -import { balanceOf } from "thirdweb/extensions/erc1155"; +import { resetClaimEligibility } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; -const result = await balanceOf({ - contract, - owner: ..., - tokenId: ..., +const transaction = resetClaimEligibility({ + contract, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function balanceOf( - options: BaseTransactionOptions, -): Promise; +function resetClaimEligibility( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the balanceOf function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +the prepared transaction --- -## ERC1155.balanceOfBatch +## ERC1155.safeBatchTransferFrom -Calls the "balanceOfBatch" function on the contract. +Prepares a transaction to call the "safeBatchTransferFrom" function on the contract. ### Example ```ts -import { balanceOfBatch } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; +import { safeBatchTransferFrom } from "thirdweb/extensions/erc1155"; -const result = await balanceOfBatch({ +const transaction = safeBatchTransferFrom({ contract, - owners: ..., + from: ..., + to: ..., tokenIds: ..., + values: ..., + data: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function balanceOfBatch(options: BaseTransactionOptions) : Promise> +function safeBatchTransferFrom( + options: BaseTransactionOptions< + | SafeBatchTransferFromParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the balanceOfBatch function. +The options for the "safeBatchTransferFrom" function. #### Type ```ts -let options: BaseTransactionOptions; -``` - -### Returns - -```ts -let returnType: Promise> -``` - -The parsed result of the function call. ---- - -## ERC1155.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"; -}>; +let options: BaseTransactionOptions< + | SafeBatchTransferFromParams + | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## ERC1155.burn +## ERC1155.safeTransferFrom -Prepares a transaction to call the "burn" function on the contract. +Prepares a transaction to call the "safeTransferFrom" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { burn } from "thirdweb/extensions/erc1155"; +import { safeTransferFrom } from "thirdweb/extensions/erc1155"; -const transaction = burn({ +const transaction = safeTransferFrom({ contract, - account: ..., - id: ..., + from: ..., + to: ..., + tokenId: ..., value: ..., + data: ..., overrides: { ... } @@ -12134,22 +10572,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function burn( +function safeTransferFrom( options: BaseTransactionOptions< - BurnParams | { asyncParams: () => Promise } + | SafeTransferFromParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "burn" function. +The options for the "safeTransferFrom" function. #### Type ```ts let options: BaseTransactionOptions< - BurnParams | { asyncParams: () => Promise } + | SafeTransferFromParams + | { asyncParams: () => Promise } >; ``` @@ -12166,21 +10606,20 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ERC1155.burnBatch +## ERC1155.setApprovalForAll -Prepares a transaction to call the "burnBatch" function on the contract. +Prepares a transaction to call the "setApprovalForAll" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { burnBatch } from "thirdweb/extensions/erc1155"; +import { setApprovalForAll } from "thirdweb/extensions/erc1155"; -const transaction = burnBatch({ +const transaction = setApprovalForAll({ contract, - account: ..., - ids: ..., - values: ..., + operator: ..., + approved: ..., overrides: { ... } @@ -12191,22 +10630,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function burnBatch( +function setApprovalForAll( options: BaseTransactionOptions< - BurnBatchParams | { asyncParams: () => Promise } + | SetApprovalForAllParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "burnBatch" function. +The options for the "setApprovalForAll" function. #### Type ```ts let options: BaseTransactionOptions< - BurnBatchParams | { asyncParams: () => Promise } + | SetApprovalForAllParams + | { asyncParams: () => Promise } >; ``` @@ -12223,1871 +10664,2243 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ERC1155.canClaim +## ERC1155.setClaimConditions -Check if a user can claim a drop. This method is only available on the `DropERC1155` contract. +Set the claim conditions for a ERC1155 drop ### Example ```ts -const claimResult = await canClaim({ - contract: contract, - claimer: "0x1234567890123456789012345678901234567890", - quantity: "1", +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 canClaim( - options: BaseTransactionOptions, -): Promise; +function setClaimConditions( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the transaction. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: { reason?: string; result: boolean }; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -Whether the user can claim the drop. +the prepared transaction --- -## ERC1155.claimCondition +## ERC1155.setTokenURI -Calls the "claimCondition" function on the contract. +Prepares a transaction to call the "setTokenURI" function on the contract. ### Example ```ts -import { claimCondition } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; +import { setTokenURI } from "thirdweb/extensions/erc1155"; -const result = await claimCondition({ +const transaction = setTokenURI({ contract, tokenId: ..., + uri: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function claimCondition( - options: BaseTransactionOptions, -): Promise< - readonly [ - bigint, - bigint, - bigint, - bigint, - `0x${string}`, - bigint, - string, - string, - ] ->; -``` - -### Parameters +function setTokenURI( + options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters -The options for the claimCondition function. +The options for the "setTokenURI" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise< - readonly [ - bigint, - bigint, - bigint, - bigint, - `0x${string}`, - bigint, - string, - string, - ] +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions >; ``` -The parsed result of the function call. +A prepared transaction object. --- -## ERC1155.claimTo +## ERC1155.tokensClaimedEvent -Claim ERC1155 NFTs to a specified address This method is only available on the `DropERC1155` contract. +Creates an event object for the TokensClaimed event. ### Example -#### Basic usage - ```ts -import { claimTo } from "thirdweb/extensions/erc1155"; -import { sendTransaction } from "thirdweb"; - -const transaction = claimTo({ - contract, - to: "0x...", - tokenId: 0n, - quantity: 1n, -}); +import { getContractEvents } from "thirdweb"; +import { tokensClaimedEvent } from "thirdweb/extensions/erc1155"; -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 +const events = await getContractEvents({ +contract, +events: [ + tokensClaimedEvent({ + claimConditionIndex: ..., + claimer: ..., + receiver: ..., +}) +], }); ``` ```ts -function claimTo( - options: BaseTransactionOptions, -): PreparedTransaction; +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 -The options for the transaction +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; +}>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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 transaction +The prepared event object. --- -## ERC1155.createPack +## ERC1155.tokensLazyMintedEvent -Prepares a transaction to call the "createPack" function on the contract. +Creates an event object for the TokensLazyMinted event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { createPack } from "thirdweb/extensions/erc1155"; +import { getContractEvents } from "thirdweb"; +import { tokensLazyMintedEvent } from "thirdweb/extensions/erc1155"; -const transaction = createPack({ - contract, - contents: ..., - numOfRewardUnits: ..., - packUri: ..., - openStartTimestamp: ..., - amountDistributedPerOpen: ..., - recipient: ..., - overrides: { - ... - } +const events = await getContractEvents({ +contract, +events: [ + tokensLazyMintedEvent({ + startTokenId: ..., +}) +], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function createPack( - options: BaseTransactionOptions< - | CreatePackParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 -The options for the "createPack" function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions< - CreatePackParams | { asyncParams: () => Promise } ->; +let filters: Partial<{ startTokenId: bigint }>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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"; +}>; ``` -A prepared transaction object. +The prepared event object. --- -## ERC1155.encodeSafeTransferFrom +## ERC1155.tokensMintedWithSignatureEvent -Encodes the "safeTransferFrom" function into a Hex string with its parameters. +Creates an event object for the TokensMintedWithSignature event. ### Example ```ts -import { encodeSafeTransferFrom } from "thirdweb/extensions/erc1155"; -const result = encodeSafeTransferFrom({ - from: ..., - to: ..., - tokenId: ..., - value: ..., - data: ..., +import { getContractEvents } from "thirdweb"; +import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + tokensMintedWithSignatureEvent({ + signer: ..., + mintedTo: ..., + tokenIdMinted: ..., +}) +], }); ``` ```ts -function encodeSafeTransferFrom( - options: SafeTransferFromParams, -): `0xf242432a${string}`; +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 -The options for the safeTransferFrom function. +Optional filters to apply to the event. #### 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"; - }>; +let filters: Partial<{ + mintedTo: string; + signer: string; + tokenIdMinted: bigint; }>; ``` ### Returns ```ts -let returnType: `0xf242432a${string}`; +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 encoded hexadecimal string. +The prepared event object. --- -## ERC1155.freezeMetadata +## ERC1155.totalSupply -Prepares a transaction to call the "freezeMetadata" function on the contract. +Calls the "totalSupply" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { freezeMetadata } from "thirdweb/extensions/erc1155"; - -const transaction = freezeMetadata(); +import { totalSupply } from "thirdweb/extensions/erc1155"; -// Send the transaction -await sendTransaction({ transaction, account }); +const result = await totalSupply({ + contract, + id: ..., +}); ``` ```ts -function freezeMetadata( - options: BaseTransactionOptions, -): PreparedTransaction; +function totalSupply( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "freezeMetadata" function. +The options for the totalSupply function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## ERC1155.generateMintSignature +## ERC1155.transferBatchEvent -Generates the payload and signature for minting an ERC1155 token. +Creates an event object for the TransferBatch event. ### 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", - }, - }, -}); +import { getContractEvents } from "thirdweb"; +import { transferBatchEvent } from "thirdweb/extensions/erc1155"; -const transaction = mintWithSignature({ - contract, - payload, - signature, +const events = await getContractEvents({ +contract, +events: [ + transferBatchEvent({ + _operator: ..., + _from: ..., + _to: ..., +}) +], }); -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}`; +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 -The options for the minting process. +Optional filters to apply to the event. #### Type ```ts -let options: { - account: Account; - contract: ThirdwebContract; - contractType?: "TokenERC1155" | "SignatureMintERC1155"; - mintRequest: GeneratePayloadInput; -}; +let filters: Partial<{ + _from: string; + _operator: string; + _to: string; +}>; ``` ### 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}`; +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"; }>; ``` -A promise that resolves to the payload and signature. +The prepared event object. --- -## ERC1155.getActiveClaimCondition +## ERC1155.transferSingleEvent -Retrieves the active claim condition. This method is only available on the `DropERC1155` contract. +Creates an event object for the TransferSingle event. ### Example ```ts -import { getActiveClaimCondition } from "thirdweb/extensions/erc1155"; -const activeClaimCondition = await getActiveClaimCondition({ - contract, - tokenId, +import { getContractEvents } from "thirdweb"; +import { transferSingleEvent } from "thirdweb/extensions/erc1155"; + +const events = await getContractEvents({ +contract, +events: [ + transferSingleEvent({ + _operator: ..., + _from: ..., + _to: ..., +}) +], }); ``` ```ts -function getActiveClaimCondition( - options: BaseTransactionOptions, -): Promise; +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 -The transaction options. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + _from: string; + _operator: string; + _to: string; +}>; ``` ### Returns ```ts -let returnType: Promise; +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"; +}>; ``` -A promise that resolves to the active claim condition. +The prepared event object. --- -## ERC1155.getClaimConditionById +## ERC1155.updateMetadata -Calls the "getClaimConditionById" function on the contract. +Update the metadata of the single token in an Edition Drop (DropERC1155) collection For Edition contracts, use `setTokenURI` ### Example ```ts -import { getClaimConditionById } from "thirdweb/extensions/erc1155"; +import { updateMetadata } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; -const result = await getClaimConditionById({ - contract, - tokenId: ..., - conditionId: ..., +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 getClaimConditionById( - options: BaseTransactionOptions, -): Promise<{ - currency: string; - maxClaimableSupply: bigint; - merkleRoot: `0x${string}`; - metadata: string; - pricePerToken: bigint; - quantityLimitPerWallet: bigint; - startTimestamp: bigint; - supplyClaimed: bigint; -}>; +function updateMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the getClaimConditionById function. - #### Type ```ts -let options: BaseTransactionOptions; +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; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +the prepared transaction --- -## ERC1155.getClaimConditions +## ERC1155.updateTokenURI -Retrieves all claim conditions. This method is only available on the `DropERC1155` contract. +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 { getClaimConditions } from "thirdweb/extensions/erc1155"; -const conditions = await getClaimConditions({ - contract, - tokenId: 1n, +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 getClaimConditions( - options: { - contract: Readonly>; - } & GetClaimConditionsParams & { singlePhaseDrop?: boolean }, -): Promise>; +function updateTokenURI( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The transaction options. - #### Type ```ts -let options: { - contract: Readonly>; -} & GetClaimConditionsParams & { singlePhaseDrop?: boolean }; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to all claim conditions. +the prepared transaction from `setTokenURI` --- -## ERC1155.getNFT +## ERC1155.uri -Retrieves information about a specific ERC1155 non-fungible token (NFT). +Calls the "uri" function on the contract. ### Example ```ts -import { getNFT } from "thirdweb/extensions/erc1155"; -const nft = await getNFT({ - contract, - tokenId: 1n, +import { uri } from "thirdweb/extensions/erc1155"; + +const result = await uri({ + contract, + tokenId: ..., }); ``` ```ts -function getNFT( - options: BaseTransactionOptions, -): Promise; +function uri( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving the NFT. +The options for the uri function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: Promise; ``` -A promise that resolves to the NFT object. +The parsed result of the function call. +--- +## ERC721 --- -## ERC1155.getNFTs +## ERC721.isUpdateMetadataSupported -Retrieves an array of NFTs ("ERC1155") based on the provided options. +Checks if the `updateMetadata` method is supported by the given contract. ### Example ```ts -import { getNFTs } from "thirdweb/extensions/erc1155"; -const nfts = await getNFTs({ - contract, - start: 0, - count: 10, -}); +import { isUpdateMetadataSupported } from "thirdweb/extensions/erc721"; + +const supported = isUpdateMetadataSupported(["0x..."]); ``` ```ts -function getNFTs( - options: BaseTransactionOptions, -): Promise>; +function isUpdateMetadataSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for retrieving the NFTs. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: boolean; ``` -A promise that resolves to an array of NFTs. +A boolean indicating if the `updateMetadata` method is supported. --- -## ERC1155.getOwnedNFTs +## ERC721.isGetClaimConditionsSupported -Retrieves the owned ERC1155 NFTs for a given wallet address. +Checks if the `getClaimConditions` method is supported by the given contract. ### Example ```ts -import { getOwnedNFTs } from "thirdweb/extensions/erc1155"; -const nfts = await getOwnedNFTs({ - contract, - start: 0, - count: 10, - address: "0x123...", -}); +import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721"; + +const supported = isGetClaimConditionsSupported(["0x..."]); ``` ```ts -function getOwnedNFTs( - options: BaseTransactionOptions, -): Promise>; +function isGetClaimConditionsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The transaction options and 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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: boolean; ``` -A promise that resolves to an array of ERC1155 NFTs owned by the wallet address, along with the quantity owned. +A boolean indicating if the `getClaimConditions` method is supported. --- -## ERC1155.getOwnedTokenIds +## ERC721.approvalEvent -Retrieves the owned ERC1155 tokenIds & the owned balance of each tokenId for a given wallet address. +Creates an event object for the Approval event. ### Example ```ts -import { getOwnedNFTs } from "thirdweb/extensions/erc1155"; -const ownedTokenIds = await getOwnedTokenIds({ - contract, - start: 0, - count: 10, - address: "0x123...", +import { getContractEvents } from "thirdweb"; +import { approvalEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + approvalEvent({ + owner: ..., + approved: ..., + tokenId: ..., +}) +], }); ``` ```ts -function getOwnedTokenIds( - options: BaseTransactionOptions, -): Promise>; +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 -The transaction options and parameters. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + approved: string; + owner: string; + tokenId: bigint; +}>; ``` ### Returns ```ts -let returnType: Promise>; +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"; +}>; ``` -A promise that resolves to an array of ERC1155 NFTs owned by the wallet address, along with the quantity owned. +The prepared event object. --- -## ERC1155.isApprovedForAll +## ERC721.approvalForAllEvent -Calls the "isApprovedForAll" function on the contract. +Creates an event object for the ApprovalForAll event. ### Example ```ts -import { isApprovedForAll } from "thirdweb/extensions/erc1155"; +import { getContractEvents } from "thirdweb"; +import { approvalForAllEvent } from "thirdweb/extensions/erc721"; -const result = await isApprovedForAll({ - contract, +const events = await getContractEvents({ +contract, +events: [ + approvalForAllEvent({ owner: ..., operator: ..., +}) +], }); ``` ```ts -function isApprovedForAll( - options: BaseTransactionOptions, -): Promise; +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 -The options for the isApprovedForAll function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ operator: string; owner: string }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## ERC1155.isBurnSupported +## ERC721.approve -Checks if the `burn` method is supported by the given contract. +Prepares a transaction to call the "approve" function on the contract. ### Example ```ts -import { isBurnSupported } from "thirdweb/extensions/erc1155"; +import { sendTransaction } from "thirdweb"; +import { approve } from "thirdweb/extensions/erc721"; -const supported = isBurnSupported(["0x..."]); +const transaction = approve({ + contract, + to: ..., + tokenId: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function isBurnSupported(availableSelectors: Array): boolean; +function approve( + options: BaseTransactionOptions< + ApproveParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "approve" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + ApproveParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `burn` method is supported. +A prepared transaction object. --- -## ERC1155.isClaimToSupported +## ERC721.balanceOf -Checks if the `claimTo` method is supported by the given contract. +Calls the "balanceOf" function on the contract. ### Example ```ts -import { isClaimToSupported } from "thirdweb/extensions/erc1155"; +import { balanceOf } from "thirdweb/extensions/erc721"; -const supported = isClaimToSupported(["0x..."]); +const result = await balanceOf({ + contract, + owner: ..., +}); ``` ```ts -function isClaimToSupported( - availableSelectors: Array, -): boolean; +function balanceOf( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the balanceOf function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `claimTo` method is supported. +The parsed result of the function call. --- -## ERC1155.isERC1155 +## ERC721.burn -Check if a contract supports the ERC1155 interface. +Prepares a transaction to call the "burn" function on the contract. ### Example ```ts -import { isERC1155 } from "thirdweb/extensions/erc1155"; -const result = await isERC1155({ contract }); +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 isERC1155(options: BaseTransactionOptions): Promise; +function burn( + options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The transaction options. +The options for the "burn" function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating whether the contract supports the ERC1155 interface. +A prepared transaction object. --- -## ERC1155.isGetActiveClaimConditionSupported +## ERC721.claimConditionsUpdatedEvent -Checks if the `getActiveClaimCondition` method is supported by the given contract. +Creates an event object for the ClaimConditionsUpdated event. ### Example ```ts -import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc1155"; +import { getContractEvents } from "thirdweb"; +import { claimConditionsUpdatedEvent } from "thirdweb/extensions/erc721"; -const supported = isGetActiveClaimConditionSupported(["0x..."]); -``` - -```ts -function isGetActiveClaimConditionSupported( - availableSelectors: Array, -): boolean; +const events = await getContractEvents({ + contract, + events: [claimConditionsUpdatedEvent()], +}); ``` -### 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; +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: boolean; +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"; +}>; ``` -A boolean indicating if the `getActiveClaimCondition` method is supported. +The prepared event object. --- -## ERC1155.isGetClaimConditionByIdSupported +## ERC721.claimTo -Checks if the `getClaimConditionById` method is supported by the given contract. +Claim ERC721 NFTs to a specified address ### 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 +#### Basic usage ```ts -let returnType: boolean; +import { claimTo } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; + +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 1n, +}); + +await sendTransaction({ transaction, account }); ``` -A boolean indicating if the `getClaimConditionById` method is supported. ---- - -## ERC1155.isGetClaimConditionsSupported - -Checks if the `getClaimConditions` method is supported by the given contract. +#### For Drops with allowlists -### Example +You need to specify the claimer address as the `from` param to avoid any issue with the allowlist ```ts -import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc1155"; - -const supported = isGetClaimConditionsSupported(["0x..."]); +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 1n, + from: "0x...", // address of the one claiming +}); ``` ```ts -function isGetClaimConditionsSupported( - availableSelectors: Array, -): boolean; +function claimTo( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The options for the transaction #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getClaimConditions` method is supported. +A promise that resolves with the submitted transaction hash. --- -## ERC1155.isGetNFTsSupported +## ERC721.claimToBatch -Checks if the `getNFTs` method is supported by the given contract. +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 { isGetNFTsSupported } from "thirdweb/extensions/erc721"; +import { claimToBatch } from "thirdweb/extensions/erc721"; -const supported = isGetNFTsSupported(["0x..."]); +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 isGetNFTsSupported( - availableSelectors: Array, -): boolean; +function claimToBatch( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +the transaction options #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getNFTs` method is supported. +A promise that resolves to the transaction result. --- -## ERC1155.isGetNFTSupported +## ERC721.createDelayedRevealBatch -Checks if the `uri` method is supported by the given contract. +Creates a batch of encrypted NFTs that can be revealed at a later time. ### Example ```ts -import { isUriSupported } from "thirdweb/extensions/erc1155"; -const supported = isUriSupported(["0x..."]); +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 isGetNFTSupported( - availableSelectors: Array, -): boolean; +function createDelayedRevealBatch( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +{CreateDelayedRevealBatchParams} - The delayed reveal options. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `uri` method is supported. +The prepared transaction to send. --- -## ERC1155.isLazyMintSupported +## ERC721.generateMintSignature -Checks if the `lazyMint` method is supported by the given contract. +Generates the payload and signature for minting an ERC721 token. ### Example ```ts -import { isLazyMintSupported } from "thirdweb/extensions/erc1155"; +import { + mintWithSignature, + generateMintSignature, +} from "thirdweb/extensions/erc721"; -const supported = isLazyMintSupported(["0x..."]); +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 isLazyMintSupported( - availableSelectors: Array, -): boolean; +function generateMintSignature( + options: GenerateMintSignatureOptions, +): Promise>; ``` ### 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. +The options for the minting process. #### Type ```ts -let availableSelectors: Array; +let options: GenerateMintSignatureOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise>; ``` -A boolean indicating if the `lazyMint` method is supported. +A promise that resolves to the payload and signature. --- -## ERC1155.isMintAdditionalSupplyToSupported +## ERC721.getActiveClaimCondition -Checks if the `mintAdditionalSupplyTo` method is supported by the given contract. +Retrieves the active claim condition. ### Example ```ts -import { isMintAdditionalSupplyToSupported } from "thirdweb/extensions/erc1155"; - -const supported = isMintAdditionalSupplyToSupported(["0x..."]); +import { getActiveClaimCondition } from "thirdweb/extensions/erc721"; +const activeClaimCondition = await getActiveClaimCondition({ + contract, +}); ``` ```ts -function isMintAdditionalSupplyToSupported( - availableSelectors: Array, -): boolean; +function getActiveClaimCondition( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `mintAdditionalSupplyTo` method is supported. +A promise that resolves to the active claim condition. --- -## ERC1155.isMintToSupported +## ERC721.getActiveClaimConditionId -Checks if the `mintTo` method is supported by the given contract. +Calls the "getActiveClaimConditionId" function on the contract. ### Example ```ts -import { isMintToSupported } from "thirdweb/extensions/erc1155"; +import { getActiveClaimConditionId } from "thirdweb/extensions/erc721"; -const supported = isMintToSupported(["0x..."]); +const result = await getActiveClaimConditionId({ + contract, +}); ``` ```ts -function isMintToSupported( - availableSelectors: Array, -): boolean; +function getActiveClaimConditionId( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the getActiveClaimConditionId function. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `mintTo` method is supported. +The parsed result of the function call. --- -## ERC1155.isNextTokenIdToMintSupported +## ERC721.getAllOwners -Checks if the `nextTokenIdToMint` method is supported by the given contract. +Retrieves the owners of all ERC721 tokens within a specified range. ### Example ```ts -import { isNextTokenIdToMintSupported } from "thirdweb/extensions/erc1155"; -const supported = isNextTokenIdToMintSupported(["0x..."]); +import { getAllOwners } from "thirdweb/extensions/erc721"; +const owners = await getAllOwners({ + contract, + start: 0, + count: 10, +}); ``` ```ts -function isNextTokenIdToMintSupported( - availableSelectors: Array, -): boolean; +function getAllOwners( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +The options for retrieving the owners. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise>; ``` -A boolean indicating if the `nextTokenIdToMint` method is supported. +A promise that resolves to an array of objects containing the token ID and owner address. --- -## ERC1155.isResetClaimEligibilitySupported +## ERC721.getBatchesToReveal -Checks if the `resetClaimEligibility` method is supported by the given contract. +Retrieves the batches available to reveal in an NFT contract. ### Example ```ts -import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc1155"; +import { getBatchesToReveal } from "thirdweb/extensions/erc721"; -const supported = isResetClaimEligibilitySupported(["0x..."]); +const batches = await getBatchesToReveal({ contract: contract }); + +const { transactionHash } = await sendTransaction({ + transaction, + account, +}); ``` ```ts -function isResetClaimEligibilitySupported( - availableSelectors: Array, -): boolean; +function getBatchesToReveal( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +{BaseTransactionOptions} - The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: { + batchId: bigint; + batchUri: string; + placeholderMetadata: undefined | NFTMetadata; +}; ``` -A boolean indicating if the `resetClaimEligibility` method is supported. +A promise resolving to an array of unrevealed batches. + +Use the `batchId` and corresponding password for each batch to reveal it with `reveal`. reveal --- -## ERC1155.isSetClaimConditionsSupported +## ERC721.getClaimConditionById -Checks if the `setClaimConditions` method is supported by the given contract. +Calls the "getClaimConditionById" function on the contract. ### Example ```ts -import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc1155"; +import { getClaimConditionById } from "thirdweb/extensions/erc721"; -const supported = isSetClaimConditionsSupported(["0x..."]); +const result = await getClaimConditionById({ + contract, + conditionId: ..., +}); ``` ```ts -function isSetClaimConditionsSupported( - availableSelectors: Array, -): boolean; +function getClaimConditionById( + options: BaseTransactionOptions, +): Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; ``` ### 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. +The options for the getClaimConditionById function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; ``` -A boolean indicating if the `setClaimConditions` method is supported. +The parsed result of the function call. --- -## ERC1155.isTotalSupplySupported +## ERC721.getClaimConditions -Checks if the `totalSupply` method is supported by the given contract. +Retrieves all claim conditions. ### Example ```ts -import { isTotalSupplySupported } from "thirdweb/extensions/erc1155"; -const supported = isTotalSupplySupported(["0x..."]); +import { getClaimConditions } from "thirdweb/extensions/erc721"; +const conditions = await getClaimConditions({ contract }); ``` ```ts -function isTotalSupplySupported( - availableSelectors: Array, -): boolean; +function getClaimConditions( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise>; ``` -A boolean indicating if the `totalSupply` method is supported. +A promise that resolves to all claim conditions. --- -## ERC1155.isUpdateTokenURISupported +## ERC721.getNFT -Checks if the `setTokenURI` method is supported by the given contract. +Retrieves information about a specific ERC721 non-fungible token (NFT). ### Example ```ts -import { isSetTokenURISupported } from "thirdweb/extensions/erc1155"; - -const supported = isSetTokenURISupported(["0x..."]); +import { getNFT } from "thirdweb/extensions/erc721"; +const nft = await getNFT({ + contract, + tokenId: 1n, +}); ``` ```ts -function isUpdateTokenURISupported( - availableSelectors: Array, -): boolean; +function getNFT( + options: BaseTransactionOptions<{ + includeOwner?: boolean; + tokenId: bigint; + }>, +): Promise; ``` ### 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. +The options for retrieving the NFT. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions<{ + includeOwner?: boolean; + tokenId: bigint; +}>; ``` ### Returns ```ts -let returnType: boolean; +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 boolean indicating if the `setTokenURI` method is supported. +A promise that resolves to the NFT object. --- -## ERC1155.lazyMint +## ERC721.getNFTs -Lazily mints ERC1155 tokens. This method is only available on the `DropERC1155` contract. +Retrieves an array of NFTs ("ERC721") based on the provided options. ### Example ```ts -import { lazyMint } from "thirdweb/extensions/erc1155"; -import { sendTransaction } from "thirdweb"; - -const transaction = lazyMint({ +import { getNFTs } from "thirdweb/extensions/erc721"; +const nfts = await getNFTs({ contract, - nfts: [ - { - name: "My NFT", - description: "This is my NFT", - image: "https://example.com/image.png", - }, - ], + start: 0, + count: 10, }); - -await sendTransaction({ transaction, account }); ``` ```ts -function lazyMint( - options: BaseTransactionOptions, -): PreparedTransaction; +function getNFTs( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the lazy minting process. +The options for retrieving the NFTs. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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 prepared contract call. +A promise that resolves to an array of NFTs. --- -## ERC1155.metadataFrozenEvent +## ERC721.getOwnedNFTs -Creates an event object for the MetadataFrozen event. +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 { getContractEvents } from "thirdweb"; -import { metadataFrozenEvent } from "thirdweb/extensions/erc1155"; +import { getOwnedNFTs } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ +const ownedNFTs = await getOwnedNFTs({ contract, - events: [metadataFrozenEvent()], + owner: "0x1234...", }); ``` ```ts -function metadataFrozenEvent(): PreparedEvent<{ - readonly inputs: readonly []; - readonly name: "MetadataFrozen"; - readonly type: "event"; -}>; +function getOwnedNFTs( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + +The options for retrieving the owned NFTs. + +#### Type + +```ts +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedEvent<{ - readonly inputs: readonly []; - readonly name: "MetadataFrozen"; - readonly type: "event"; -}>; +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"; + }; ``` -The prepared event object. +A promise that resolves to an array of NFTs owned by the specified owner. --- -## ERC1155.metadataUpdateEvent +## ERC721.getOwnedTokenIds -Creates an event object for the MetadataUpdate event. +Retrieves the token IDs owned by a specific address. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { metadataUpdateEvent } from "thirdweb/extensions/erc1155"; +import { getOwnedTokenIds } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ +const ownedTokenIds = await getOwnedTokenIds({ contract, - events: [metadataUpdateEvent()], + owner: "0x1234...", }); ``` ```ts -function metadataUpdateEvent(): PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "_tokenId"; readonly type: "uint256" }, - ]; - readonly name: "MetadataUpdate"; - readonly type: "event"; -}>; +function getOwnedTokenIds( + options: BaseTransactionOptions, +): Promise>; +``` + +### Parameters + +The options for retrieving the owned token IDs. + +#### Type + +```ts +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "_tokenId"; readonly type: "uint256" }, - ]; - readonly name: "MetadataUpdate"; - readonly type: "event"; -}>; +let returnType: Promise>; ``` -The prepared event object. +A promise that resolves to an array of bigint representing the owned token IDs. --- -## ERC1155.mintAdditionalSupplyTo +## ERC721.getTotalClaimedSupply -Mints a "supply" number of additional ERC1155 tokens to the specified "to" address. This method is only available on the `TokenERC1155` contract. +Retrieves the total claimed supply of ERC721 tokens. ### Example ```ts -import { mintAdditionalSupplyTo } from "thirdweb/extensions/erc1155"; -import { sendTransaction } from "thirdweb"; +import { getTotalClaimedSupply } from "thirdweb/extensions/erc721"; -const transaction = mintAdditionalSupplyTo({ +const totalClaimedSupply = await getTotalClaimedSupply({ contract, - to: "0x...", - tokenId: 1n, - supply: 10n, }); - -await sendTransaction({ transaction, account }); ``` ```ts -function mintAdditionalSupplyTo( - options: BaseTransactionOptions, -): PreparedTransaction; +function getTotalClaimedSupply( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options. +The base transaction options. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +A promise that resolves to the total claimed supply as a bigint. --- -## ERC1155.mintAdditionalSupplyToBatch - -This extension batches multiple `mintAdditionalSupplyToBatch` extensions into one single multicall. This method is only available on the `TokenERC1155` contract. 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. +## ERC721.getTotalUnclaimedSupply -You are recommended to experiment with the number to figure out the best number for your chain of choice. +Retrieves the total unclaimed supply of ERC721 tokens. ### Example ```ts -import { mintAdditionalSupplyToBatch } from "thirdweb/extensions/erc1155"; +import { getTotalUnclaimedSupply } from "thirdweb/extensions/erc721"; -const transaction = mintAdditionalSupplyToBatch({ +const totalUnclaimedSupply = await getTotalUnclaimedSupply({ 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; +function getTotalUnclaimedSupply( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters +The base transaction options. + #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` + +A promise that resolves to the total unclaimed supply as a bigint. --- -## ERC1155.mintTo +## ERC721.isApprovedForAll -Mints a "supply" number of new ERC1155 tokens to the specified "to" address. This method is only available on the `TokenERC1155` contract. 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. +Calls the "isApprovedForAll" function on the contract. ### Example ```ts -import { mintTo } from "thirdweb/extensions/erc1155"; -import { sendTransaction } from "thirdweb"; +import { isApprovedForAll } from "thirdweb/extensions/erc721"; -const transaction = mintTo({ - contract, - to: "0x...", - supply: 10n, - nft: { - name: "My NFT", - description: "This is my NFT", - image: "https://example.com/image.png", - }, +const result = await isApprovedForAll({ + contract, + owner: ..., + operator: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function mintTo( - options: BaseTransactionOptions, -): PreparedTransaction; +function isApprovedForAll( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options. +The options for the isApprovedForAll function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +The parsed result of the function call. --- -## ERC1155.mintToBatch - -This extension batches multiple `mintTo` extensions into one single multicall. This method is only available on the `TokenERC1155` contract. 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. +## ERC721.isBurnSupported -You are recommended to experiment with the number to figure out the best number for your chain of choice. +Checks if the `burn` method is supported by the given contract. ### 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, - }, - ], -}); +import { isBurnSupported } from "thirdweb/extensions/erc721"; -await sendTransaction({ transaction, account }); +const supported = isBurnSupported(["0x..."]); ``` ```ts -function mintToBatch( - options: BaseTransactionOptions, -): PreparedTransaction; +function isBurnSupported(availableSelectors: Array): boolean; ``` ### Parameters -the transaction options +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A promise that resolves to the transaction result. +A boolean indicating if the `burn` method is supported. --- -## ERC1155.mintWithSignature +## ERC721.isClaimToSupported -Mints a new ERC1155 token with the given minter signature This method is only available on the `TokenERC1155` contract. +Checks if the `claimTo` method is supported by the given contract. ### Example ```ts -import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc1155"; -import { sendTransaction } from "thirdweb"; - -const { payload, signature } = await generateMintSignature(...) +import { isClaimToSupported } from "thirdweb/extensions/erc721"; -const transaction = mintWithSignature({ - contract, - payload, - signature, -}); -await sendTransaction({ transaction, account }); +const supported = isClaimToSupported(["0x..."]); ``` ```ts -function mintWithSignature( - options: BaseTransactionOptions, -): PreparedTransaction; +function isClaimToSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The transaction options. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A promise that resolves to the transaction result. +A boolean indicating if the `claimTo` method is supported. --- -## ERC1155.nextTokenId +## ERC721.isCreateDelayedRevealBatchSupported -Calls the "nextTokenId" function on the contract. +Checks if the `createDelayedRevealBatch` method is supported by the given contract. ### Example ```ts -import { nextTokenId } from "thirdweb/extensions/erc1155"; - -const result = await nextTokenId({ - contract, -}); +import { isCreateDelayedRevealBatchSupported } from "thirdweb/extensions/erc721"; +const supported = isCreateDelayedRevealBatchSupported(["0x..."]); ``` ```ts -function nextTokenId( - options: BaseTransactionOptions, -): Promise; +function isCreateDelayedRevealBatchSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the nextTokenId function. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `createDelayedRevealBatch` method is supported. --- -## ERC1155.nextTokenIdToMint +## ERC721.isERC721 -Calls the "nextTokenIdToMint" function on the contract. +Check if a contract supports the ERC721 interface. ### Example ```ts -import { nextTokenIdToMint } from "thirdweb/extensions/erc1155"; - -const result = await nextTokenIdToMint({ - contract, -}); +import { isERC721 } from "thirdweb/extensions/erc721"; +const result = await isERC721({ contract }); ``` ```ts -function nextTokenIdToMint( - options: BaseTransactionOptions, -): Promise; +function isERC721(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the nextTokenIdToMint function. +The transaction options. #### Type @@ -14098,1597 +12911,999 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +A boolean indicating whether the contract supports the ERC721 interface. --- -## ERC1155.openPack +## ERC721.isGetActiveClaimConditionIdSupported -Prepares a transaction to call the "openPack" function on the contract. +Checks if the `getActiveClaimConditionId` method is supported by the given 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 }); +import { isGetActiveClaimConditionIdSupported } from "thirdweb/extensions/erc721"; +const supported = isGetActiveClaimConditionIdSupported(["0x..."]); ``` ```ts -function openPack( - options: BaseTransactionOptions< - OpenPackParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isGetActiveClaimConditionIdSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "openPack" function. +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 options: BaseTransactionOptions< - OpenPackParams | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `getActiveClaimConditionId` method is supported. --- -## ERC1155.packCreatedEvent +## ERC721.isGetActiveClaimConditionSupported -Creates an event object for the PackCreated event. +Checks if the `getActiveClaimCondition` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { packCreatedEvent } from "thirdweb/extensions/erc1155"; +import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - packCreatedEvent({ - packId: ..., -}) -], -}); +const supported = isGetActiveClaimConditionSupported(["0x..."]); ``` ```ts -function packCreatedEvent( - filters: Partial, -): 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"; -}>; +function isGetActiveClaimConditionSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `getActiveClaimCondition` method is supported. --- -## ERC1155.packOpenedEvent +## ERC721.isGetBatchesToRevealSupported -Creates an event object for the PackOpened event. +Checks if the `getBatchesToReveal` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { packOpenedEvent } from "thirdweb/extensions/erc1155"; +import { isGetBatchesToRevealSupported } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - packOpenedEvent({ - packId: ..., - opener: ..., -}) -], -}); +const supported = isGetBatchesToRevealSupported(["0x..."]); ``` ```ts -function packOpenedEvent( - filters: Partial, -): 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"; -}>; +function isGetBatchesToRevealSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `getBatchesToReveal` method is supported. --- -## ERC1155.packUpdatedEvent +## ERC721.isGetClaimConditionByIdSupported -Creates an event object for the PackUpdated event. +Checks if the `getClaimConditionById` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { packUpdatedEvent } from "thirdweb/extensions/erc1155"; - -const events = await getContractEvents({ -contract, -events: [ - packUpdatedEvent({ - packId: ..., -}) -], -}); +import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc721"; +const supported = isGetClaimConditionByIdSupported(["0x..."]); ``` ```ts -function packUpdatedEvent( - filters: Partial, -): 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"; -}>; +function isGetClaimConditionByIdSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `getClaimConditionById` method is supported. --- -## ERC1155.resetClaimEligibility +## ERC721.isGetClaimConditionsSupported -Reset the claim eligibility for all users. This method is only available on the `DropERC1155` contract. +Checks if the `getClaimConditions` method is supported by the given contract. ### Example ```ts -import { resetClaimEligibility } from "thirdweb/extensions/erc1155"; -import { sendTransaction } from "thirdweb"; - -const transaction = resetClaimEligibility({ - contract, -}); +import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721"; -await sendTransaction({ transaction, account }); +const supported = isGetClaimConditionsSupported(["0x..."]); ``` ```ts -function resetClaimEligibility( - options: { - contract: Readonly>; - } & GetClaimConditionsParams & { singlePhaseDrop?: boolean }, -): PreparedTransaction; +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 options: { - contract: Readonly>; -} & GetClaimConditionsParams & { singlePhaseDrop?: boolean }; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -the prepared transaction +A boolean indicating if the `getClaimConditions` method is supported. --- -## ERC1155.safeBatchTransferFrom +## ERC721.isGetNFTsSupported -Prepares a transaction to call the "safeBatchTransferFrom" function on the contract. +Checks if the `getNFTs` method is supported by the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { safeBatchTransferFrom } from "thirdweb/extensions/erc1155"; - -const transaction = safeBatchTransferFrom({ - contract, - from: ..., - to: ..., - tokenIds: ..., - values: ..., - data: ..., - overrides: { - ... - } -}); +import { isGetNFTsSupported } from "thirdweb/extensions/erc721"; -// Send the transaction -await sendTransaction({ transaction, account }); +const supported = isGetNFTsSupported(["0x..."]); ``` ```ts -function safeBatchTransferFrom( - options: BaseTransactionOptions< - | SafeBatchTransferFromParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isGetNFTsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "safeBatchTransferFrom" function. +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 options: BaseTransactionOptions< - | SafeBatchTransferFromParams - | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `getNFTs` method is supported. --- -## ERC1155.safeTransferFrom +## ERC721.isGetNFTSupported -Prepares a transaction to call the "safeTransferFrom" function on the contract. +Checks if the `tokenURI` method is supported by the given 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 }); +import { isTokenURISupported } from "thirdweb/extensions/erc721"; +const supported = isTokenURISupported(["0x..."]); ``` ```ts -function safeTransferFrom( - options: BaseTransactionOptions< - | SafeTransferFromParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isGetNFTSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "safeTransferFrom" function. +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 options: BaseTransactionOptions< - | SafeTransferFromParams - | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `tokenURI` method is supported. --- -## ERC1155.setApprovalForAll +## ERC721.isLazyMintSupported -Prepares a transaction to call the "setApprovalForAll" function on the contract. +Checks if the `lazyMint` method is supported by the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { setApprovalForAll } from "thirdweb/extensions/erc1155"; - -const transaction = setApprovalForAll({ - contract, - operator: ..., - approved: ..., - overrides: { - ... - } -}); +import { isLazyMintSupported } from "thirdweb/extensions/erc721"; -// Send the transaction -await sendTransaction({ transaction, account }); +const supported = isLazyMintSupported(["0x..."]); ``` ```ts -function setApprovalForAll( - options: BaseTransactionOptions< - | SetApprovalForAllParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isLazyMintSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "setApprovalForAll" function. +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 options: BaseTransactionOptions< - | SetApprovalForAllParams - | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `lazyMint` method is supported. --- -## ERC1155.setClaimConditions +## ERC721.isMintToSupported -Set the claim conditions for a ERC1155 drop This method is only available on the `DropERC1155` contract. +Checks if the `mintTo` method is supported by the given contract. ### 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(), - }, - ], -}); +import { isMintToSupported } from "thirdweb/extensions/erc721"; -await sendTransaction({ transaction, account }); +const supported = isMintToSupported(["0x..."]); ``` ```ts -function setClaimConditions( - options: BaseTransactionOptions, -): PreparedTransaction; +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -the prepared transaction +A boolean indicating if the `mintTo` method is supported. --- -## ERC1155.setTokenURI +## ERC721.isNextTokenIdToMintSupported -Prepares a transaction to call the "setTokenURI" function on the contract. +Checks if the `nextTokenIdToMint` method is supported by the given 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 }); +import { isNextTokenIdToMintSupported } from "thirdweb/extensions/erc721"; +const supported = isNextTokenIdToMintSupported(["0x..."]); ``` ```ts -function setTokenURI( - options: BaseTransactionOptions< - | SetTokenURIParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isNextTokenIdToMintSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "setTokenURI" function. +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 options: BaseTransactionOptions< - | SetTokenURIParams - | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `nextTokenIdToMint` method is supported. --- -## ERC1155.tokensClaimedEvent +## ERC721.isResetClaimEligibilitySupported -Creates an event object for the TokensClaimed event. +Checks if the `resetClaimEligibility` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { tokensClaimedEvent } from "thirdweb/extensions/erc1155"; +import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - tokensClaimedEvent({ - claimConditionIndex: ..., - claimer: ..., - receiver: ..., -}) -], -}); +const supported = isResetClaimEligibilitySupported(["0x..."]); ``` ```ts -function tokensClaimedEvent( - filters: Partial, -): 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"; -}>; +function isResetClaimEligibilitySupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `resetClaimEligibility` method is supported. --- -## ERC1155.tokensLazyMintedEvent +## ERC721.isRevealSupported -Creates an event object for the TokensLazyMinted event. +Checks if the `reveal` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { tokensLazyMintedEvent } from "thirdweb/extensions/erc1155"; +import { isRevealSupported } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - tokensLazyMintedEvent({ - startTokenId: ..., -}) -], -}); +const supported = isRevealSupported(["0x..."]); ``` ```ts -function tokensLazyMintedEvent( - filters: Partial, -): 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"; -}>; +function isRevealSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `reveal` method is supported. --- -## ERC1155.tokensMintedWithSignatureEvent +## ERC721.isSetClaimConditionsSupported -Creates an event object for the TokensMintedWithSignature event. +Checks if the `setClaimConditions` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc1155"; +import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - tokensMintedWithSignatureEvent({ - signer: ..., - mintedTo: ..., - tokenIdMinted: ..., -}) -], -}); +const supported = isSetClaimConditionsSupported(["0x..."]); ``` ```ts -function tokensMintedWithSignatureEvent( - filters: Partial, -): 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"; -}>; +function isSetClaimConditionsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `setClaimConditions` method is supported. --- -## ERC1155.totalSupply +## ERC721.isSetSharedMetadataSupported -Calls the "totalSupply" function on the contract. +Checks if the `setSharedMetadata` method is supported by the given contract. ### Example ```ts -import { totalSupply } from "thirdweb/extensions/erc1155"; +import { isSetSharedMetadataSupported } from "thirdweb/extensions/erc721"; -const result = await totalSupply({ - contract, - id: ..., -}); +const supported = isSetSharedMetadataSupported(["0x..."]); ``` ```ts -function totalSupply( - options: BaseTransactionOptions, -): Promise; +function isSetSharedMetadataSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the totalSupply function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `setSharedMetadata` method is supported. --- -## ERC1155.transferBatchEvent +## ERC721.isSharedMetadataSupported -Creates an event object for the TransferBatch event. +Checks if the `sharedMetadata` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { transferBatchEvent } from "thirdweb/extensions/erc1155"; - -const events = await getContractEvents({ -contract, -events: [ - transferBatchEvent({ - _operator: ..., - _from: ..., - _to: ..., -}) -], -}); +import { isSharedMetadataSupported } from "thirdweb/extensions/erc721"; +const supported = isSharedMetadataSupported(["0x..."]); ``` ```ts -function transferBatchEvent( - filters: Partial, -): 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"; -}>; +function isSharedMetadataSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `sharedMetadata` method is supported. --- -## ERC1155.transferSingleEvent +## ERC721.isTotalSupplySupported -Creates an event object for the TransferSingle event. +Checks if the `totalSupply` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { transferSingleEvent } from "thirdweb/extensions/erc1155"; - -const events = await getContractEvents({ -contract, -events: [ - transferSingleEvent({ - _operator: ..., - _from: ..., - _to: ..., -}) -], -}); +import { isTotalSupplySupported } from "thirdweb/extensions/erc721"; +const supported = isTotalSupplySupported(["0x..."]); ``` ```ts -function transferSingleEvent( - filters: Partial, -): 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"; -}>; +function isTotalSupplySupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `totalSupply` method is supported. --- -## ERC1155.updateMetadata +## ERC721.isUpdateMetadataSupported -Update the metadata of the single token in an Edition Drop (DropERC1155) collection For Edition contracts, use `setTokenURI` +Checks if the `updateMetadata` method is supported by the given contract. ### 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", - // ... - }, -}); +import { isUpdateMetadataSupported } from "thirdweb/extensions/erc721"; -await sendTransaction({ transaction, account }); +const supported = isUpdateMetadataSupported(["0x..."]); ``` ```ts -function updateMetadata( - options: BaseTransactionOptions, -): PreparedTransaction; +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -the prepared transaction +A boolean indicating if the `updateMetadata` method is supported. --- -## 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. This method is only available on the `TokenERC1155` contract. +## ERC721.isUpdateTokenURISupported -This extension does not validate the NFTInput so make sure you are passing the proper content that you want to update. +Checks if the `setTokenURI` method is supported by the given contract. ### Example ```ts -import { updateTokenURI } from "thirdweb/extensions/erc1155"; +import { isSetTokenURISupported } from "thirdweb/extensions/erc721"; -const transaction = updateTokenURI({ - tokenId: 0n, - nft: { - name: "new name", - description: "new description", - image: "https://image-host.com/new-image.png", - }, -}); +const supported = isSetTokenURISupported(["0x..."]); ``` ```ts -function updateTokenURI( - options: BaseTransactionOptions, -): PreparedTransaction; +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -the prepared transaction from `setTokenURI` +A boolean indicating if the `setTokenURI` method is supported. --- -## ERC1155.uri +## ERC721.lazyMint -Calls the "uri" function on the contract. +Lazily mints ERC721 tokens. ### Example ```ts -import { uri } from "thirdweb/extensions/erc1155"; +import { lazyMint } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; -const result = await uri({ - contract, - tokenId: ..., +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 uri( - options: BaseTransactionOptions, -): Promise; +function lazyMint( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the uri function. +The options for the lazy minting process. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. ---- -## ERC721 +A promise that resolves to the prepared contract call. --- -## ERC721.isUpdateMetadataSupported +## ERC721.mintTo -Checks if the `updateMetadata` method is supported by the given contract. +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 { isUpdateMetadataSupported } from "thirdweb/extensions/erc721"; +import { mintTo } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; -const supported = isUpdateMetadataSupported(["0x..."]); +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 isUpdateMetadataSupported( - availableSelectors: Array, -): boolean; +function mintTo( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `updateMetadata` method is supported. +A promise that resolves to the transaction result. --- -## ERC721.isGetClaimConditionsSupported +## ERC721.mintWithSignature -Checks if the `getClaimConditions` method is supported by the given contract. +Mints a new ERC721 token with the given minter signature ### Example ```ts -import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721"; +import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; -const supported = isGetClaimConditionsSupported(["0x..."]); +const { payload, signature } = await generateMintSignature(...) + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); + +await sendTransaction({ transaction, account }); ``` ```ts -function isGetClaimConditionsSupported( - availableSelectors: Array, -): boolean; +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 -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. +The transaction options. #### Type ```ts -let availableSelectors: Array; -``` - -### Returns - -```ts -let returnType: boolean; -``` - -A boolean indicating if the `getClaimConditions` method is supported. ---- - -## ERC721.approvalEvent - -Creates an event object for the Approval event. - -### Example - -```ts -import { getContractEvents } from "thirdweb"; -import { approvalEvent } from "thirdweb/extensions/erc721"; +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. +--- + +## ERC721.nextTokenIdToMint + +Calls the "nextTokenIdToMint" function on the contract. + +### Example + +```ts +import { nextTokenIdToMint } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - approvalEvent({ - owner: ..., - approved: ..., - tokenId: ..., -}) -], +const result = await nextTokenIdToMint({ + contract, }); ``` ```ts -function approvalEvent( - filters: Partial, -): 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"; -}>; +function nextTokenIdToMint( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the nextTokenIdToMint function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC721.approvalForAllEvent +## ERC721.ownerOf -Creates an event object for the ApprovalForAll event. +Calls the "ownerOf" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { approvalForAllEvent } from "thirdweb/extensions/erc721"; +import { ownerOf } from "thirdweb/extensions/erc721"; -const events = await getContractEvents({ -contract, -events: [ - approvalForAllEvent({ - owner: ..., - operator: ..., -}) -], +const result = await ownerOf({ + contract, + tokenId: ..., }); ``` ```ts -function approvalForAllEvent( - filters: Partial, -): 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"; -}>; +function ownerOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the ownerOf function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC721.approve +## ERC721.resetClaimEligibility -Prepares a transaction to call the "approve" function on the contract. +Reset the claim eligibility for all users. ### Example ```ts +import { resetClaimEligibility } from "thirdweb/extensions/erc721"; import { sendTransaction } from "thirdweb"; -import { approve } from "thirdweb/extensions/erc721"; -const transaction = approve({ - contract, - to: ..., - tokenId: ..., - overrides: { - ... - } +const transaction = resetClaimEligibility({ + contract, }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function approve( - options: BaseTransactionOptions< - ApproveParams | { asyncParams: () => Promise } - >, +function resetClaimEligibility( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "approve" function. - #### Type ```ts -let options: BaseTransactionOptions< - ApproveParams | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns @@ -15701,62 +13916,73 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +the prepared transaction --- -## ERC721.balanceOf +## ERC721.reveal -Calls the "balanceOf" function on the contract. +Reveals a previously lazy minted batch of NFTs. ### Example ```ts -import { balanceOf } from "thirdweb/extensions/erc721"; +import { reveal } from "thirdweb/extensions/erc721"; -const result = await balanceOf({ - contract, - owner: ..., +const transaction = await reveal({ + contract: contract, + batchId: 0, + password: "password", +}); + +const { transactionHash } = await sendTransaction({ + transaction, + account, }); ``` ```ts -function balanceOf( - options: BaseTransactionOptions, -): Promise; +function reveal( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the balanceOf function. +{RevealParams} - The reveal parameters. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +The prepared transaction to send. --- -## ERC721.burn +## ERC721.setApprovalForAll -Prepares a transaction to call the "burn" function on the contract. +Prepares a transaction to call the "setApprovalForAll" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { burn } from "thirdweb/extensions/erc721"; +import { setApprovalForAll } from "thirdweb/extensions/erc721"; -const transaction = burn({ +const transaction = setApprovalForAll({ contract, - tokenId: ..., + operator: ..., + approved: ..., overrides: { ... } @@ -15767,22 +13993,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function burn( +function setApprovalForAll( options: BaseTransactionOptions< - BurnParams | { asyncParams: () => Promise } + | SetApprovalForAllParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "burn" function. +The options for the "setApprovalForAll" function. #### Type ```ts let options: BaseTransactionOptions< - BurnParams | { asyncParams: () => Promise } + | SetApprovalForAllParams + | { asyncParams: () => Promise } >; ``` @@ -15799,176 +14027,135 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ERC721.canClaim - -Check if a user can claim a drop. +## ERC721.setClaimConditions -This method is only available on the `DropERC721` contract. +Set the claim conditions for a ERC721 drop ### Example ```ts -const claimResult = await canClaim({ - contract: contract, - claimer: "0x1234567890123456789012345678901234567890", - quantity: "1", +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 canClaim( - options: BaseTransactionOptions, -): Promise; +function setClaimConditions( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the transaction. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: { reason?: string; result: boolean }; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -Whether the user can claim the drop. +the prepared transaction --- -## ERC721.claimConditionsUpdatedEvent - -Creates an event object for the ClaimConditionsUpdated event. +## ERC721.setSharedMetadata -### Example +Sets the shared metadata for a OpenEdition contract. ```ts -import { getContractEvents } from "thirdweb"; -import { claimConditionsUpdatedEvent } from "thirdweb/extensions/erc721"; - -const events = await getContractEvents({ - contract, - events: [claimConditionsUpdatedEvent()], -}); +function setSharedMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; ``` +### Parameters + +The options for the transaction. + +#### Type + ```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"; -}>; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +The prepared transaction. --- -## ERC721.claimTo +## ERC721.setTokenURI -Claim ERC721 NFTs to a specified address This method is only available on the `DropERC721` contract. +Prepares a transaction to call the "setTokenURI" function on the contract. ### Example -#### Basic usage - ```ts -import { claimTo } from "thirdweb/extensions/erc721"; import { sendTransaction } from "thirdweb"; +import { setTokenURI } from "thirdweb/extensions/erc721"; -const transaction = claimTo({ - contract, - to: "0x...", - quantity: 1n, +const transaction = setTokenURI({ + contract, + tokenId: ..., + uri: ..., + overrides: { + ... + } }); +// Send the transaction 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, +function setTokenURI( + options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for the transaction +The options for the "setTokenURI" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SetTokenURIParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -15981,816 +14168,1018 @@ let returnType: PreparedTransaction< >; ``` -A promise that resolves with the submitted transaction hash. +A prepared transaction object. --- -## 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. This method is only available on the `DropERC721` contract. +## ERC721.sharedMetadata -You are recommended to experiment with the number to figure out the best number for your chain of choice. +Calls the "sharedMetadata" function on the contract. ### Example ```ts -import { claimToBatch } from "thirdweb/extensions/erc721"; +import { sharedMetadata } 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 }, - ], +const result = await sharedMetadata({ + contract, }); ``` ```ts -function claimToBatch( - options: BaseTransactionOptions, -): PreparedTransaction; +function sharedMetadata( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -the transaction options +The options for the sharedMetadata function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +The parsed result of the function call. --- -## ERC721.createDelayedRevealBatch +## ERC721.sharedMetadataUpdatedEvent -Creates a batch of encrypted NFTs that can be revealed at a later time. This method is only available on the `DropERC721` contract. +Creates an event object for the SharedMetadataUpdated event. ### 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://..., -}]; +import { getContractEvents } from "thirdweb"; +import { sharedMetadataUpdatedEvent } from "thirdweb/extensions/erc721"; -const transaction = createDelayedRevealBatch({ - contract, - placeholderMetadata: placeholderNFT, - metadata: realNFTs, - password: "password123", +const events = await getContractEvents({ + contract, + events: [sharedMetadataUpdatedEvent()], }); - -const { transactionHash } = await sendTransaction({ transaction, account }); ``` ```ts -function createDelayedRevealBatch( - options: BaseTransactionOptions, -): PreparedTransaction; +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"; +}>; ``` -### Parameters - -{CreateDelayedRevealBatchParams} - The delayed reveal options. - -#### Type - -```ts -let options: BaseTransactionOptions; -``` - -### Returns +### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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 transaction to send. +The prepared event object. --- -## ERC721.generateMintSignature +## ERC721.startTokenId -Generates the payload and signature for minting an ERC721 token. +Calls the "startTokenId" function on the contract. ### 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", - }, - }, -}); +import { startTokenId } from "thirdweb/extensions/erc721"; -const transaction = mintWithSignature({ +const result = await startTokenId({ contract, - payload, - signature, }); -await sendTransaction({ transaction, account }); ``` ```ts -function generateMintSignature( - options: GenerateMintSignatureOptions, -): Promise>; +function startTokenId( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the minting process. +The options for the startTokenId function. #### Type ```ts -let options: GenerateMintSignatureOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise>; +let returnType: Promise; ``` -A promise that resolves to the payload and signature. +The parsed result of the function call. --- -## ERC721.getActiveClaimCondition +## ERC721.tokenOfOwnerByIndex -Retrieves the active claim condition. This method is only available on the `DropERC721` contract. +Calls the "tokenOfOwnerByIndex" function on the contract. ### Example ```ts -import { getActiveClaimCondition } from "thirdweb/extensions/erc721"; -const activeClaimCondition = await getActiveClaimCondition({ - contract, +import { tokenOfOwnerByIndex } from "thirdweb/extensions/erc721"; + +const result = await tokenOfOwnerByIndex({ + contract, + owner: ..., + index: ..., }); ``` ```ts -function getActiveClaimCondition( - options: BaseTransactionOptions, -): Promise; +function tokenOfOwnerByIndex( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options. +The options for the tokenOfOwnerByIndex function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the active claim condition. +The parsed result of the function call. --- -## ERC721.getActiveClaimConditionId +## ERC721.tokensClaimedEvent -Calls the "getActiveClaimConditionId" function on the contract. +Creates an event object for the TokensClaimed event. ### Example ```ts -import { getActiveClaimConditionId } from "thirdweb/extensions/erc721"; +import { getContractEvents } from "thirdweb"; +import { tokensClaimedEvent } from "thirdweb/extensions/erc721"; -const result = await getActiveClaimConditionId({ - contract, +const events = await getContractEvents({ +contract, +events: [ + tokensClaimedEvent({ + claimConditionIndex: ..., + claimer: ..., + receiver: ..., +}) +], }); ``` ```ts -function getActiveClaimConditionId( - options: BaseTransactionOptions, -): Promise; +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 -The options for the getActiveClaimConditionId function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## ERC721.getAllOwners +## ERC721.tokensLazyMintedEvent -Retrieves the owners of all ERC721 tokens within a specified range. +Creates an event object for the TokensLazyMinted event. ### Example ```ts -import { getAllOwners } from "thirdweb/extensions/erc721"; -const owners = await getAllOwners({ - contract, - start: 0, - count: 10, +import { getContractEvents } from "thirdweb"; +import { tokensLazyMintedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + tokensLazyMintedEvent({ + startTokenId: ..., +}) +], }); ``` ```ts -function getAllOwners( - options: BaseTransactionOptions, -): Promise>; +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 -The options for retrieving the owners. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ startTokenId: bigint }>; ``` ### Returns ```ts -let returnType: Promise>; +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"; +}>; ``` -A promise that resolves to an array of objects containing the token ID and owner address. +The prepared event object. --- -## ERC721.getApproved +## ERC721.tokensMintedWithSignatureEvent -Calls the "getApproved" function on the contract. +Creates an event object for the TokensMintedWithSignature event. ### Example ```ts -import { getApproved } from "thirdweb/extensions/erc721"; +import { getContractEvents } from "thirdweb"; +import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc721"; -const result = await getApproved({ - contract, - tokenId: ..., +const events = await getContractEvents({ +contract, +events: [ + tokensMintedWithSignatureEvent({ + signer: ..., + mintedTo: ..., + tokenIdMinted: ..., +}) +], }); ``` ```ts -function getApproved( - options: BaseTransactionOptions, -): Promise; +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 -The options for the getApproved function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + mintedTo: string; + signer: string; + tokenIdMinted: bigint; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## ERC721.getBatchesToReveal +## ERC721.tokensOfOwner -Retrieves the batches available to reveal in an NFT contract. +Calls the "tokensOfOwner" function on the contract. ### Example ```ts -import { getBatchesToReveal } from "thirdweb/extensions/erc721"; - -const batches = await getBatchesToReveal({ contract: contract }); +import { tokensOfOwner } from "thirdweb/extensions/erc721"; -const { transactionHash } = await sendTransaction({ - transaction, - account, +const result = await tokensOfOwner({ + contract, + owner: ..., }); ``` ```ts -function getBatchesToReveal( - options: BaseTransactionOptions, -): Promise>; +function tokensOfOwner(options: BaseTransactionOptions) : Promise> ``` ### Parameters -{BaseTransactionOptions} - The transaction options. +The options for the tokensOfOwner function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: { - batchId: bigint; - batchUri: string; - placeholderMetadata: undefined | NFTMetadata; -}; +let returnType: Promise> ``` -A promise resolving to an array of unrevealed batches. - -Use the `batchId` and corresponding password for each batch to reveal it with `reveal`. reveal +The parsed result of the function call. --- -## ERC721.getClaimConditionById +## ERC721.tokenURI -Calls the "getClaimConditionById" function on the contract. +Calls the "tokenURI" function on the contract. ### Example ```ts -import { getClaimConditionById } from "thirdweb/extensions/erc721"; +import { tokenURI } from "thirdweb/extensions/erc721"; -const result = await getClaimConditionById({ +const result = await tokenURI({ contract, - conditionId: ..., + tokenId: ..., }); ``` ```ts -function getClaimConditionById( - options: BaseTransactionOptions, -): Promise<{ - currency: string; - maxClaimableSupply: bigint; - merkleRoot: `0x${string}`; - metadata: string; - pricePerToken: bigint; - quantityLimitPerWallet: bigint; - startTimestamp: bigint; - supplyClaimed: bigint; -}>; +function tokenURI( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getClaimConditionById function. +The options for the tokenURI function. #### Type ```ts -let options: BaseTransactionOptions; +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; -}>; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC721.getClaimConditions - -Retrieves all claim conditions. +## ERC721.tokenURIRevealedEvent -This method is only available on the `DropERC721` contract. +Creates an event object for the TokenURIRevealed event. ### Example ```ts -import { getClaimConditions } from "thirdweb/extensions/erc721"; -const conditions = await getClaimConditions({ contract }); +import { getContractEvents } from "thirdweb"; +import { tokenURIRevealedEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + tokenURIRevealedEvent({ + index: ..., +}) +], +}); ``` ```ts -function getClaimConditions( - options: BaseTransactionOptions, -): Promise>; +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 -The transaction options. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ index: bigint }>; ``` ### Returns ```ts -let returnType: Promise>; +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"; +}>; ``` -A promise that resolves to all claim conditions. +The prepared event object. --- -## ERC721.getNFT +## ERC721.totalSupply -Retrieves information about a specific ERC721 non-fungible token (NFT). +Calls the "totalSupply" function on the contract. ### Example ```ts -import { getNFT } from "thirdweb/extensions/erc721"; -const nft = await getNFT({ +import { totalSupply } from "thirdweb/extensions/erc721"; + +const result = await totalSupply({ contract, - tokenId: 1n, }); ``` ```ts -function getNFT( - options: BaseTransactionOptions<{ - includeOwner?: boolean; - tokenByIndex?: boolean; - tokenId: bigint; - useIndexer?: boolean; - }>, -): Promise; +function totalSupply( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving the NFT. +The options for the totalSupply function. #### Type ```ts -let options: BaseTransactionOptions<{ - includeOwner?: boolean; - tokenByIndex?: boolean; - tokenId: bigint; - useIndexer?: boolean; -}>; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: Promise; ``` -A promise that resolves to the NFT object. +The parsed result of the function call. --- -## ERC721.getNFTs +## ERC721.transferEvent -Retrieves an array of NFTs ("ERC721") based on the provided options. +Creates an event object for the Transfer event. ### Example ```ts -import { getNFTs } from "thirdweb/extensions/erc721"; -const nfts = await getNFTs({ - contract, - start: 0, - count: 10, +import { getContractEvents } from "thirdweb"; +import { transferEvent } from "thirdweb/extensions/erc721"; + +const events = await getContractEvents({ +contract, +events: [ + transferEvent({ + from: ..., + to: ..., + tokenId: ..., +}) +], }); ``` ```ts -function getNFTs( - options: BaseTransactionOptions, -): Promise>; +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 -The options for retrieving the NFTs. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ from: string; to: string; tokenId: bigint }>; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +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"; +}>; ``` -A promise that resolves to an array of NFTs. +The prepared event object. --- -## ERC721.getOwnedNFTs +## ERC721.transferFrom -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 +Prepares a transaction to call the "transferFrom" function on the contract. ### Example ```ts -import { getOwnedNFTs } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; +import { transferFrom } from "thirdweb/extensions/erc721"; -const ownedNFTs = await getOwnedNFTs({ - contract, - owner: "0x1234...", +const transaction = transferFrom({ + contract, + from: ..., + to: ..., + tokenId: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getOwnedNFTs( - options: BaseTransactionOptions, -): Promise>; +function transferFrom( + options: BaseTransactionOptions< + | TransferFromParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for retrieving the owned NFTs. +The options for the "transferFrom" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | TransferFromParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to an array of NFTs owned by the specified owner. +A prepared transaction object. --- -## ERC721.getOwnedTokenIds +## ERC721.updateMetadata -Retrieves the token IDs owned by a specific address. +Update the metadata of the single token in an NFT Drop (DropERC721) collection For NFT Collection, please use `setTokenURI` ### Example ```ts -import { getOwnedTokenIds } from "thirdweb/extensions/erc721"; +import { updateMetadata } from "thirdweb/extensions/erc721"; -const ownedTokenIds = await getOwnedTokenIds({ +const transaction = updateMetadata({ contract, - owner: "0x1234...", + targetTokenId: 0n, + client: thirdwebClient, + newMetadata: { + name: "this is the new nft name", + description: "...", + image: "new image uri", + // ... + }, }); ``` ```ts -function getOwnedTokenIds( - options: BaseTransactionOptions, -): Promise>; +function updateMetadata( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for retrieving the owned token IDs. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to an array of bigint representing the owned token IDs. +the prepared transaction --- -## ERC721.getTotalClaimedSupply +## ERC721.updateTokenURI -Retrieves the total claimed supply of ERC721 tokens. +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 { getTotalClaimedSupply } from "thirdweb/extensions/erc721"; +import { updateTokenURI } from "thirdweb/extensions/erc721"; -const totalClaimedSupply = await getTotalClaimedSupply({ - contract, +const transaction = updateTokenURI({ + tokenId: 0n, + nft: { + name: "new name", + description: "new description", + image: "https://image-host.com/new-image.png", + }, }); ``` ```ts -function getTotalClaimedSupply( - options: BaseTransactionOptions, -): Promise; +function updateTokenURI( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The base transaction options. - #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the total claimed supply as a bigint. +the prepared transaction from `setTokenURI` +--- +## ERC1271 --- -## ERC721.getTotalUnclaimedSupply +## ERC1271.checkContractWalletSignature -Retrieves the total unclaimed supply of ERC721 tokens. +Deprecated + +Use `verifySignature` instead + +Checks if a contract wallet signature is valid. ### Example ```ts -import { getTotalUnclaimedSupply } from "thirdweb/extensions/erc721"; - -const totalUnclaimedSupply = await getTotalUnclaimedSupply({ - contract, +import { checkContractWalletSignature } from "thirdweb/extensions/erc1271"; +const isValid = await checkContractWalletSignature({ + contract: myContract, + message: "hello world", + signature: "0x...", }); ``` ```ts -function getTotalUnclaimedSupply( - options: BaseTransactionOptions, -): Promise; +function checkContractWalletSignature( + options: CheckContractWalletSignatureOptions, +): Promise; ``` ### Parameters -The base transaction options. +The options for the checkContractWalletSignature function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: { + contract: ThirdwebContract; + message: SignableMessage; + signature: string; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the total unclaimed supply as a bigint. +A promise that resolves with a boolean indicating if the signature is valid. --- -## ERC721.isApprovedForAll +## ERC1271.checkContractWalletSignedTypedData -Calls the "isApprovedForAll" function on the contract. +Deprecated + +Use `verifyTypedData` instead + +Checks if a contract wallet signature is valid. ### Example ```ts -import { isApprovedForAll } from "thirdweb/extensions/erc721"; - -const result = await isApprovedForAll({ - contract, - owner: ..., - operator: ..., +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 isApprovedForAll( - options: BaseTransactionOptions, +function checkContractWalletSignedTypedData( + options: CheckContractWalletSignTypedDataOptions< + typedData, + primaryType + >, ): Promise; ``` ### Parameters -The options for the isApprovedForAll function. +The options for the checkContractWalletSignature function. #### Type ```ts -let options: BaseTransactionOptions; +let options: CheckContractWalletSignTypedDataOptions< + typedData, + primaryType +>; ``` ### Returns @@ -16799,714 +15188,995 @@ let options: BaseTransactionOptions; let returnType: Promise; ``` -The parsed result of the function call. +A promise that resolves with a boolean indicating if the signature is valid. +--- +## ERC20 --- -## ERC721.isBurnSupported +## ERC20.allowance -Checks if the `burn` method is supported by the given contract. +Calls the "allowance" function on the contract. ### Example ```ts -import { isBurnSupported } from "thirdweb/extensions/erc721"; +import { allowance } from "thirdweb/extensions/erc20"; -const supported = isBurnSupported(["0x..."]); +const result = await allowance({ + contract, + owner: ..., + spender: ..., +}); ``` ```ts -function isBurnSupported(availableSelectors: Array): boolean; +function allowance( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the allowance function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `burn` method is supported. +The parsed result of the function call. --- -## ERC721.isClaimToSupported +## ERC20.approvalEvent -Checks if the `claimTo` method is supported by the given contract. +Creates an event object for the Approval event. ### Example ```ts -import { isClaimToSupported } from "thirdweb/extensions/erc721"; +import { getContractEvents } from "thirdweb"; +import { approvalEvent } from "thirdweb/extensions/erc20"; -const supported = isClaimToSupported(["0x..."]); +const events = await getContractEvents({ +contract, +events: [ + approvalEvent({ + owner: ..., + spender: ..., +}) +], +}); ``` ```ts -function isClaimToSupported( - availableSelectors: Array, -): boolean; +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 -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. +Optional filters to apply to the event. #### Type ```ts -let availableSelectors: Array; +let filters: Partial<{ owner: string; spender: string }>; ``` ### Returns ```ts -let returnType: boolean; +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"; +}>; ``` -A boolean indicating if the `claimTo` method is supported. +The prepared event object. --- -## ERC721.isCreateDelayedRevealBatchSupported +## ERC20.approve -Checks if the `createDelayedRevealBatch` method is supported by the given contract. +Approves the spending of tokens by a specific address. ### Example ```ts -import { isCreateDelayedRevealBatchSupported } from "thirdweb/extensions/erc721"; -const supported = isCreateDelayedRevealBatchSupported(["0x..."]); +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 isCreateDelayedRevealBatchSupported( - availableSelectors: Array, -): boolean; +function approve( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `createDelayedRevealBatch` method is supported. +A prepared transaction object. --- -## ERC721.isERC721 +## ERC20.balanceOf -Check if a contract supports the ERC721 interface. +Calls the "balanceOf" function on the contract. ### Example ```ts -import { isERC721 } from "thirdweb/extensions/erc721"; -const result = await isERC721({ contract }); +import { balanceOf } from "thirdweb/extensions/erc20"; + +const result = await balanceOf({ + contract, + address: ..., +}); ``` ```ts -function isERC721(options: BaseTransactionOptions): Promise; +function balanceOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options. +The options for the balanceOf function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A boolean indicating whether the contract supports the ERC721 interface. +The parsed result of the function call. --- -## ERC721.isGetActiveClaimConditionIdSupported +## ERC20.burn -Checks if the `getActiveClaimConditionId` method is supported by the given contract. +Prepares a transaction to call the "burn" function on the contract. ### Example ```ts -import { isGetActiveClaimConditionIdSupported } from "thirdweb/extensions/erc721"; -const supported = isGetActiveClaimConditionIdSupported(["0x..."]); +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 isGetActiveClaimConditionIdSupported( - availableSelectors: Array, -): boolean; +function burn( + options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "burn" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + BurnParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getActiveClaimConditionId` method is supported. +A prepared transaction object. --- -## ERC721.isGetActiveClaimConditionSupported +## ERC20.burnFrom -Checks if the `getActiveClaimCondition` method is supported by the given contract. This method is only available on the `DropERC721` contract. +Prepares a transaction to call the "burnFrom" function on the contract. ### Example ```ts -import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; +import { burnFrom } from "thirdweb/extensions/erc20"; -const supported = isGetActiveClaimConditionSupported(["0x..."]); -``` - -```ts -function isGetActiveClaimConditionSupported( - availableSelectors: Array, -): boolean; -``` - -### Parameters +const transaction = burnFrom({ + contract, + account: ..., + amount: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); +``` -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. +```ts +function burnFrom( + options: BaseTransactionOptions< + BurnFromParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; +``` + +### Parameters + +The options for the "burnFrom" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + BurnFromParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getActiveClaimCondition` method is supported. +A prepared transaction object. --- -## ERC721.isGetApprovedSupported +## ERC20.claimConditionsUpdatedEvent -Checks if the `getApproved` method is supported by the given contract. +Creates an event object for the ClaimConditionsUpdated event. ### Example ```ts -import { isGetApprovedSupported } from "thirdweb/extensions/erc721"; -const supported = isGetApprovedSupported(["0x..."]); -``` - -```ts -function isGetApprovedSupported( - availableSelectors: Array, -): boolean; +import { getContractEvents } from "thirdweb"; +import { claimConditionsUpdatedEvent } from "thirdweb/extensions/erc20"; + +const events = await getContractEvents({ + contract, + events: [claimConditionsUpdatedEvent()], +}); ``` -### 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; +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: boolean; +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"; +}>; ``` -A boolean indicating if the `getApproved` method is supported. +The prepared event object. --- -## ERC721.isGetBatchesToRevealSupported +## ERC20.claimTo -Checks if the `getBatchesToReveal` method is supported by the given contract. +Claim ERC20 NFTs to a specified address ### Example +#### Basic usage + ```ts -import { isGetBatchesToRevealSupported } from "thirdweb/extensions/erc721"; +import { claimTo } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; -const supported = isGetBatchesToRevealSupported(["0x..."]); +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 -function isGetBatchesToRevealSupported( - availableSelectors: Array, -): boolean; +const transaction = claimTo({ + contract, + to: "0x...", + quantity: 100n, + from: "0x...", // address of the one claiming +}); +``` + +```ts +function claimTo( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The options for the transaction #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getBatchesToReveal` method is supported. +A promise that resolves with the submitted transaction hash. --- -## ERC721.isGetClaimConditionByIdSupported +## ERC20.decimals -Checks if the `getClaimConditionById` method is supported by the given contract. +Retrieves the number of decimal places for a given ERC20 contract. ### Example ```ts -import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc721"; -const supported = isGetClaimConditionByIdSupported(["0x..."]); +import { decimals } from "thirdweb/extensions/erc20"; + +const tokenDecimals = await decimals({ contract }); ``` ```ts -function isGetClaimConditionByIdSupported( - availableSelectors: Array, -): boolean; +function decimals(options: BaseTransactionOptions): Promise; ``` ### 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. +The options for the transaction. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getClaimConditionById` method is supported. +A promise that resolves to the number of decimal places. --- -## ERC721.isGetClaimConditionsSupported +## ERC20.delegate -Checks if the `getClaimConditions` method is supported by the given contract. +Prepares a transaction to call the "delegate" function on the contract. ### Example ```ts -import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; +import { delegate } from "thirdweb/extensions/erc20"; -const supported = isGetClaimConditionsSupported(["0x..."]); +const transaction = delegate({ + contract, + delegatee: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function isGetClaimConditionsSupported( - availableSelectors: Array, -): boolean; +function delegate( + options: BaseTransactionOptions< + DelegateParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "delegate" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + DelegateParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getClaimConditions` method is supported. +A prepared transaction object. --- -## ERC721.isGetNFTsSupported +## ERC20.delegates -Checks if the `getNFTs` method is supported by the given contract. +Calls the "delegates" function on the contract. ### Example ```ts -import { isGetNFTsSupported } from "thirdweb/extensions/erc721"; +import { delegates } from "thirdweb/extensions/erc20"; -const supported = isGetNFTsSupported(["0x..."]); +const result = await delegates({ + contract, + account: ..., +}); ``` ```ts -function isGetNFTsSupported( - availableSelectors: Array, -): boolean; +function delegates( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the delegates function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getNFTs` method is supported. +The parsed result of the function call. --- -## ERC721.isGetNFTSupported +## ERC20.deposit -Checks if the `tokenURI` method is supported by the given contract. +Calls the "deposit" function on the contract (useful to wrap ETH). ### Example ```ts -import { isTokenURISupported } from "thirdweb/extensions/erc721"; -const supported = isTokenURISupported(["0x..."]); +import { deposit } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; + +const transaction = deposit({ contract, amount: "0.1" }); + +await sendTransaction({ transaction, account }); ``` ```ts -function isGetNFTSupported( - availableSelectors: Array, -): boolean; +function deposit( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The options for the "deposit" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `tokenURI` method is supported. +A prepared transaction object. --- -## ERC721.isLazyMintSupported +## ERC20.generateMintSignature -Checks if the `lazyMint` method is supported by the given contract. +Generates the payload and signature for minting an ERC20 token. ### Example ```ts -import { isLazyMintSupported } from "thirdweb/extensions/erc721"; +import { + mintWithSignature, + generateMintSignature, +} from "thirdweb/extensions/erc20"; -const supported = isLazyMintSupported(["0x..."]); +const { payload, signature } = await generateMintSignature({ + account, + contract, + mintRequest: { + to: "0x...", + quantity: "10", + }, +}); + +const transaction = mintWithSignature({ + contract, + payload, + signature, +}); +await sendTransaction({ transaction, account }); ``` ```ts -function isLazyMintSupported( - availableSelectors: Array, -): boolean; +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 -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. +The options for the minting process. #### Type ```ts -let availableSelectors: Array; +let options: { + account: Account; + contract: ThirdwebContract; + contractType?: "TokenERC1155" | "SignatureMintERC1155"; + mintRequest: GeneratePayloadInput; +}; ``` ### Returns ```ts -let returnType: boolean; +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 boolean indicating if the `lazyMint` method is supported. +A promise that resolves to the payload and signature. --- -## ERC721.isMintToSupported +## ERC20.getActiveClaimCondition -Checks if the `mintTo` method is supported by the given contract. +Retrieves the active claim condition. ### Example ```ts -import { isMintToSupported } from "thirdweb/extensions/erc721"; - -const supported = isMintToSupported(["0x..."]); +import { getActiveClaimCondition } from "thirdweb/extensions/erc20"; +const activeClaimCondition = await getActiveClaimCondition({ + contract, +}); ``` ```ts -function isMintToSupported( - availableSelectors: Array, -): boolean; +function getActiveClaimCondition( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `mintTo` method is supported. +A promise that resolves to the active claim condition. --- -## ERC721.isNextTokenIdToMintSupported +## ERC20.getActiveClaimConditionId -Checks if the `nextTokenIdToMint` method is supported by the given contract. +Calls the "getActiveClaimConditionId" function on the contract. ### Example ```ts -import { isNextTokenIdToMintSupported } from "thirdweb/extensions/erc721"; -const supported = isNextTokenIdToMintSupported(["0x..."]); +import { getActiveClaimConditionId } from "thirdweb/extensions/erc20"; + +const result = await getActiveClaimConditionId({ + contract, +}); ``` ```ts -function isNextTokenIdToMintSupported( - availableSelectors: Array, -): boolean; +function getActiveClaimConditionId( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the getActiveClaimConditionId function. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `nextTokenIdToMint` method is supported. +The parsed result of the function call. --- -## ERC721.isResetClaimEligibilitySupported +## ERC20.getBalance -Checks if the `resetClaimEligibility` method is supported by the given contract. +Retrieves the balance of an ERC20 token for a specific address. ### Example ```ts -import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc721"; +import { getBalance } from "thirdweb/extensions/erc20"; -const supported = isResetClaimEligibilitySupported(["0x..."]); +const balance = await getBalance({ contract, address: "0x..." }); ``` ```ts -function isResetClaimEligibilitySupported( - availableSelectors: Array, -): boolean; +function getBalance( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The transaction options including the address. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: { + decimals: number; + displayValue: string; + name: string; + symbol: string; + value: bigint; +}; ``` -A boolean indicating if the `resetClaimEligibility` method is supported. +An object containing the balance value, display value, and symbol. --- -## ERC721.isRevealSupported +## ERC20.getClaimConditionById -Checks if the `reveal` method is supported by the given contract. +Calls the "getClaimConditionById" function on the contract. ### Example ```ts -import { isRevealSupported } from "thirdweb/extensions/erc721"; +import { getClaimConditionById } from "thirdweb/extensions/erc20"; -const supported = isRevealSupported(["0x..."]); +const result = await getClaimConditionById({ + contract, + conditionId: ..., +}); ``` ```ts -function isRevealSupported( - availableSelectors: Array, -): boolean; +function getClaimConditionById( + options: BaseTransactionOptions, +): Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; ``` ### 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. +The options for the getClaimConditionById function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise<{ + currency: string; + maxClaimableSupply: bigint; + merkleRoot: `0x${string}`; + metadata: string; + pricePerToken: bigint; + quantityLimitPerWallet: bigint; + startTimestamp: bigint; + supplyClaimed: bigint; +}>; ``` -A boolean indicating if the `reveal` method is supported. +The parsed result of the function call. --- -## ERC721.isSetClaimConditionsSupported +## ERC20.getClaimConditions -Checks if the `setClaimConditions` method is supported by the given contract. +Retrieves all claim conditions. ### Example ```ts -import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc721"; - -const supported = isSetClaimConditionsSupported(["0x..."]); +import { getClaimConditions } from "thirdweb/extensions/erc20"; +const conditions = await getClaimConditions({ contract }); ``` ```ts -function isSetClaimConditionsSupported( - availableSelectors: Array, -): boolean; +function getClaimConditions( + options: BaseTransactionOptions, +): Promise>; ``` ### 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. +The transaction options. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise>; ``` -A boolean indicating if the `setClaimConditions` method is supported. +A promise that resolves to all claim conditions. --- -## ERC721.isSetSharedMetadataSupported +## ERC20.getCurrencyMetadata -Checks if the `setSharedMetadata` method is supported by the given contract. +Retrieves the metadata of a currency. ### Example ```ts -import { isSetSharedMetadataSupported } from "thirdweb/extensions/erc721"; +import { getCurrencyMetadata } from "thirdweb/extensions/erc20"; -const supported = isSetSharedMetadataSupported(["0x..."]); +const currencyMetadata = await getCurrencyMetadata({ contract }); ``` ```ts -function isSetSharedMetadataSupported( - availableSelectors: Array, -): boolean; +function getCurrencyMetadata( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the transaction. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: { decimals: number; name: string; symbol: string }; ``` -A boolean indicating if the `setSharedMetadata` method is supported. +A promise that resolves to an object containing the currency metadata. --- -## ERC721.isSharedMetadataSupported +## ERC20.isClaimToSupported -Checks if the `sharedMetadata` method is supported by the given contract. +Checks if the `claimTo` method is supported by the given contract. ### Example ```ts -import { isSharedMetadataSupported } from "thirdweb/extensions/erc721"; -const supported = isSharedMetadataSupported(["0x..."]); +import { isClaimToSupported } from "thirdweb/extensions/erc20"; + +const supported = isClaimToSupported(["0x..."]); ``` ```ts -function isSharedMetadataSupported( +function isClaimToSupported( availableSelectors: Array, ): boolean; ``` @@ -17527,30 +16197,33 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `sharedMetadata` method is supported. +A boolean indicating if the `claimTo` method is supported. --- -## ERC721.isTokenByIndexSupported +## ERC20.isERC20 -Checks if the `tokenByIndex` method is supported by the given contract. +Check if a contract is an ERC20 token. ### Example ```ts -import { isTokenByIndexSupported } from "thirdweb/extensions/erc721"; -const supported = isTokenByIndexSupported(["0x..."]); +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 isTokenByIndexSupported( - availableSelectors: Array, -): boolean; +function isERC20(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 @@ -17563,22 +16236,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `tokenByIndex` method is supported. +A boolean indicating whether the contract is an ERC20 token. --- -## ERC721.isTotalSupplySupported +## ERC20.isGetActiveClaimConditionIdSupported -Checks if the `totalSupply` method is supported by the given contract. +Checks if the `getActiveClaimConditionId` method is supported by the given contract. ### Example ```ts -import { isTotalSupplySupported } from "thirdweb/extensions/erc721"; -const supported = isTotalSupplySupported(["0x..."]); +import { isGetActiveClaimConditionIdSupported } from "thirdweb/extensions/erc20"; +const supported = isGetActiveClaimConditionIdSupported(["0x..."]); ``` ```ts -function isTotalSupplySupported( +function isGetActiveClaimConditionIdSupported( availableSelectors: Array, ): boolean; ``` @@ -17599,23 +16272,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `totalSupply` method is supported. +A boolean indicating if the `getActiveClaimConditionId` method is supported. --- -## ERC721.isUpdateMetadataSupported +## ERC20.isGetActiveClaimConditionSupported -Checks if the `updateMetadata` method is supported by the given contract. +Checks if the `getActiveClaimCondition` method is supported by the given contract. ### Example ```ts -import { isUpdateMetadataSupported } from "thirdweb/extensions/erc721"; +import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc20"; -const supported = isUpdateMetadataSupported(["0x..."]); +const supported = isGetActiveClaimConditionSupported(["0x..."]); ``` ```ts -function isUpdateMetadataSupported( +function isGetActiveClaimConditionSupported( availableSelectors: Array, ): boolean; ``` @@ -17636,23 +16309,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `updateMetadata` method is supported. +A boolean indicating if the `getActiveClaimCondition` method is supported. --- -## ERC721.isUpdateTokenURISupported +## ERC20.isGetClaimConditionByIdSupported -Checks if the `setTokenURI` method is supported by the given contract. +Checks if the `getClaimConditionById` method is supported by the given contract. ### Example ```ts -import { isSetTokenURISupported } from "thirdweb/extensions/erc721"; - -const supported = isSetTokenURISupported(["0x..."]); +import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc20"; +const supported = isGetClaimConditionByIdSupported(["0x..."]); ``` ```ts -function isUpdateTokenURISupported( +function isGetClaimConditionByIdSupported( availableSelectors: Array, ): boolean; ``` @@ -17673,338 +16345,153 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `setTokenURI` method is supported. ---- - -## ERC721.lazyMint - -Lazily mints ERC721 tokens. This method is only available on the `DropERC721` contract. - -### 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. ---- - -## ERC721.mintTo - -Mints a new ERC721 token and assigns it to the specified address. This method is only available on the `TokenERC721` contract. - -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. +A boolean indicating if the `getClaimConditionById` method is supported. --- -## ERC721.mintWithSignature +## ERC20.isMintToSupported -Mints a new ERC721 token with the given minter signature This method is only available on the `TokenERC721` contract. +Checks if the `mintTo` method is supported by the given contract. ### Example ```ts -import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc721"; -import { sendTransaction } from "thirdweb"; - -const { payload, signature } = await generateMintSignature(...) - -const transaction = mintWithSignature({ - contract, - payload, - signature, -}); +import { isMintToSupported } from "thirdweb/extensions/erc20"; -await sendTransaction({ transaction, account }); +const supported = isMintToSupported(["0x..."]); ``` ```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; +function isMintToSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The transaction options. +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 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}`; - } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A promise that resolves to the transaction result. +A boolean indicating if the `mintTo` method is supported. --- -## ERC721.nextTokenIdToMint +## ERC20.isResetClaimEligibilitySupported -Calls the "nextTokenIdToMint" function on the contract. +Checks if the `resetClaimEligibility` method is supported by the given contract. ### Example ```ts -import { nextTokenIdToMint } from "thirdweb/extensions/erc721"; +import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc20"; -const result = await nextTokenIdToMint({ - contract, -}); +const supported = isResetClaimEligibilitySupported(["0x..."]); ``` ```ts -function nextTokenIdToMint( - options: BaseTransactionOptions, -): Promise; +function isResetClaimEligibilitySupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the nextTokenIdToMint function. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `resetClaimEligibility` method is supported. --- -## ERC721.ownerOf +## ERC20.isSetClaimConditionsSupported -Calls the "ownerOf" function on the contract. +Checks if the `setClaimConditions` method is supported by the given contract. ### Example ```ts -import { ownerOf } from "thirdweb/extensions/erc721"; +import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc20"; -const result = await ownerOf({ - contract, - tokenId: ..., -}); +const supported = isSetClaimConditionsSupported(["0x..."]); ``` ```ts -function ownerOf( - options: BaseTransactionOptions, -): Promise; +function isSetClaimConditionsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the ownerOf function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `setClaimConditions` method is supported. --- -## ERC721.resetClaimEligibility +## ERC20.mintTo -Reset the claim eligibility for all users. This method is only available on the `DropERC721` contract. +Mints a specified amount of tokens to a given address. ### Example ```ts -import { resetClaimEligibility } from "thirdweb/extensions/erc721"; +import { mintTo } from "thirdweb/extensions/erc20"; import { sendTransaction } from "thirdweb"; -const transaction = resetClaimEligibility({ +const transaction = mintTo({ contract, + to: "0x...", + amount: 100, }); await sendTransaction({ transaction, account }); ``` ```ts -function resetClaimEligibility( - options: BaseTransactionOptions, +function mintTo( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters +The options for minting tokens. + #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -18017,44 +16504,44 @@ let returnType: PreparedTransaction< >; ``` -the prepared transaction +A prepared transaction object. --- -## ERC721.reveal +## ERC20.mintWithSignature -Reveals a previously lazy minted batch of NFTs. This method is only available on the `DropERC721` contract. +Mints a new ERC20 token with the given minter signature ### Example ```ts -import { reveal } from "thirdweb/extensions/erc721"; +import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; -const transaction = await reveal({ - contract: contract, - batchId: 0, - password: "password", -}); +const { payload, signature } = await generateMintSignature(...) -const { transactionHash } = await sendTransaction({ - transaction, - account, +const transaction = mintWithSignature({ + contract, + payload, + signature, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function reveal( - options: BaseTransactionOptions, +function mintWithSignature( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -{RevealParams} - The reveal parameters. +The transaction options. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -18067,52 +16554,38 @@ let returnType: PreparedTransaction< >; ``` -The prepared transaction to send. +A promise that resolves to the transaction result. --- -## ERC721.setApprovalForAll +## ERC20.resetClaimEligibility -Prepares a transaction to call the "setApprovalForAll" function on the contract. +Reset the claim eligibility for all users. ### Example ```ts +import { resetClaimEligibility } from "thirdweb/extensions/erc20"; import { sendTransaction } from "thirdweb"; -import { setApprovalForAll } from "thirdweb/extensions/erc721"; -const transaction = setApprovalForAll({ - contract, - operator: ..., - approved: ..., - overrides: { - ... - } +const transaction = resetClaimEligibility({ + contract, }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function setApprovalForAll( - options: BaseTransactionOptions< - | SetApprovalForAllParams - | { asyncParams: () => Promise } - >, +function resetClaimEligibility( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "setApprovalForAll" function. - #### Type ```ts -let options: BaseTransactionOptions< - | SetApprovalForAllParams - | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns @@ -18125,17 +16598,17 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +the prepared transaction --- -## ERC721.setClaimConditions +## ERC20.setClaimConditions -Set the claim conditions for a ERC721 drop This method is only available on the `DropERC721` contract. +Set the claim conditions for a ERC20 drop ### Example ```ts -import { setClaimConditions } from "thirdweb/extensions/erc721"; +import { setClaimConditions } from "thirdweb/extensions/erc20"; import { sendTransaction } from "thirdweb"; const transaction = setClaimConditions({ @@ -18181,309 +16654,487 @@ let returnType: PreparedTransaction< the prepared transaction --- -## ERC721.setSharedMetadata +## ERC20.tokensClaimedEvent -Sets the shared metadata for a OpenEdition contract. +Creates an event object for the TokensClaimed event. + +### Example ```ts -function setSharedMetadata( - options: BaseTransactionOptions, -): PreparedTransaction; +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 -The options for the transaction. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + claimConditionIndex: bigint; + claimer: string; + receiver: string; +}>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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 transaction. +The prepared event object. --- -## ERC721.setTokenURI +## ERC20.tokensMintedEvent -Prepares a transaction to call the "setTokenURI" function on the contract. +Creates an event object for the TokensMinted event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { setTokenURI } from "thirdweb/extensions/erc721"; +import { getContractEvents } from "thirdweb"; +import { tokensMintedEvent } from "thirdweb/extensions/erc20"; -const transaction = setTokenURI({ - contract, - tokenId: ..., - uri: ..., - overrides: { - ... - } +const events = await getContractEvents({ +contract, +events: [ + tokensMintedEvent({ + mintedTo: ..., +}) +], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function setTokenURI( - options: BaseTransactionOptions< - | SetTokenURIParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 -The options for the "setTokenURI" function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions< - | SetTokenURIParams - | { asyncParams: () => Promise } ->; +let filters: Partial<{ mintedTo: string }>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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"; +}>; ``` -A prepared transaction object. +The prepared event object. --- -## ERC721.sharedMetadata +## ERC20.tokensMintedWithSignatureEvent -Calls the "sharedMetadata" function on the contract. +Creates an event object for the TokensMintedWithSignature event. ### Example ```ts -import { sharedMetadata } from "thirdweb/extensions/erc721"; +import { getContractEvents } from "thirdweb"; +import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc20"; -const result = await sharedMetadata({ - contract, +const events = await getContractEvents({ +contract, +events: [ + tokensMintedWithSignatureEvent({ + signer: ..., + mintedTo: ..., +}) +], }); ``` ```ts -function sharedMetadata( - options: BaseTransactionOptions, -): Promise; +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 -The options for the sharedMetadata function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ mintedTo: string; signer: string }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## ERC721.sharedMetadataUpdatedEvent +## ERC20.totalSupply -Creates an event object for the SharedMetadataUpdated event. +Calls the "totalSupply" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { sharedMetadataUpdatedEvent } from "thirdweb/extensions/erc721"; +import { totalSupply } from "thirdweb/extensions/erc20"; -const events = await getContractEvents({ +const result = await totalSupply({ 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"; -}>; +function totalSupply( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + +The options for the totalSupply function. + +#### Type + +```ts +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC721.startTokenId +## ERC20.transfer -Calls the "startTokenId" function on the contract. +Transfers ERC20 tokens from the sender's address to the specified recipient address. ### Example ```ts -import { startTokenId } from "thirdweb/extensions/erc721"; +import { transfer } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; -const result = await startTokenId({ +const transaction = transfer({ contract, + to: "0x...", + amount: 100, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function startTokenId( - options: BaseTransactionOptions, -): Promise; +function transfer( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the startTokenId function. +The options for the transfer transaction. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A promise that resolves to the prepared transaction. --- -## ERC721.tokenOfOwnerByIndex +## ERC20.transferBatch -Calls the "tokenOfOwnerByIndex" function on the contract. +Transfers a batch of ERC20 tokens from the sender's address to the specified recipient address. ### Example ```ts -import { tokenOfOwnerByIndex } from "thirdweb/extensions/erc721"; +import { transferBatch } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; -const result = await tokenOfOwnerByIndex({ +const transaction = transferBatch({ contract, - owner: ..., - index: ..., -}); + batch: [ + { + to: "0x...", + amount: 100, + }, + { + to: "0x...", + amount: "0.1", + }, +]); + +await sendTransaction({ transaction, account }); ``` ```ts -function tokenOfOwnerByIndex( - options: BaseTransactionOptions, -): Promise; +function transferBatch( + options: BaseTransactionOptions<{ + batch: Array< + { to: string } & ( + | { amount: string | number } + | { amountWei: bigint } + ) + >; + }>, +): PreparedTransaction; ``` ### Parameters -The options for the tokenOfOwnerByIndex function. +The options for the batch transfer transaction. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions<{ + batch: Array< + { to: string } & ( + | { amount: string | number } + | { amountWei: bigint } + ) + >; +}>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A promise that resolves to the prepared transaction. --- -## ERC721.tokensClaimedEvent +## ERC20.transferEvent -Creates an event object for the TokensClaimed event. +Creates an event object for the Transfer event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { tokensClaimedEvent } from "thirdweb/extensions/erc721"; +import { transferEvent } from "thirdweb/extensions/erc20"; const events = await getContractEvents({ contract, events: [ - tokensClaimedEvent({ - claimConditionIndex: ..., - claimer: ..., - receiver: ..., + transferEvent({ + from: ..., + to: ..., }) ], }); ``` ```ts -function tokensClaimedEvent( - filters: Partial, +function transferEvent( + filters: Partial<{ from: string; to: string }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "claimConditionIndex"; - readonly type: "uint256"; - }, - { - readonly indexed: true; - readonly name: "claimer"; + readonly name: "from"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "receiver"; + readonly name: "to"; readonly type: "address"; }, - { readonly name: "startTokenId"; readonly type: "uint256" }, - { readonly name: "quantityClaimed"; readonly type: "uint256" }, + { readonly name: "value"; readonly type: "uint256" }, ]; - readonly name: "TokensClaimed"; + readonly name: "Transfer"; readonly type: "event"; }>; ``` @@ -18495,7 +17146,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ from: string; to: string }>; ``` ### Returns @@ -18505,23 +17156,17 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "claimConditionIndex"; - readonly type: "uint256"; - }, - { - readonly indexed: true; - readonly name: "claimer"; + readonly name: "from"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "receiver"; + readonly name: "to"; readonly type: "address"; }, - { readonly name: "startTokenId"; readonly type: "uint256" }, - { readonly name: "quantityClaimed"; readonly type: "uint256" }, + { readonly name: "value"; readonly type: "uint256" }, ]; - readonly name: "TokensClaimed"; + readonly name: "Transfer"; readonly type: "event"; }>; ``` @@ -18529,149 +17174,152 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC721.tokensLazyMintedEvent +## ERC20.transferFrom -Creates an event object for the TokensLazyMinted event. +Transfers a specified amount of tokens from one address to another address on the ERC20 contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { tokensLazyMintedEvent } from "thirdweb/extensions/erc721"; +import { transferFrom } from "thirdweb/extensions/erc20"; +import { sendTransaction } from "thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - tokensLazyMintedEvent({ - startTokenId: ..., -}) -], +const transaction = transferFrom({ + contract: USDC_CONTRACT, + from: "0x1234...", + to: "0x5678...", + amount: 100, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function tokensLazyMintedEvent( - filters: Partial, -): 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"; -}>; +function transferFrom( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The transaction options including from, to, amount, and gas price. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A promise that resolves to the prepared transaction object. --- -## ERC721.tokensMintedWithSignatureEvent +## ERC20.withdraw -Creates an event object for the TokensMintedWithSignature event. +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 +--- + +## ERC4337.accountDeployedEvent + +Creates an event object for the AccountDeployed event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc721"; +import { accountDeployedEvent } from "thirdweb/extensions/erc4337"; const events = await getContractEvents({ contract, events: [ - tokensMintedWithSignatureEvent({ - signer: ..., - mintedTo: ..., - tokenIdMinted: ..., + accountDeployedEvent({ + userOpHash: ..., + sender: ..., }) ], }); ``` ```ts -function tokensMintedWithSignatureEvent( - filters: Partial, +function accountDeployedEvent( + filters: Partial<{ sender: string; userOpHash: `0x${string}` }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "signer"; - readonly type: "address"; + readonly name: "userOpHash"; + readonly type: "bytes32"; }, { readonly indexed: true; - readonly name: "mintedTo"; + readonly name: "sender"; 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: "factory"; readonly type: "address" }, + { readonly name: "paymaster"; readonly type: "address" }, ]; - readonly name: "TokensMintedWithSignature"; + readonly name: "AccountDeployed"; readonly type: "event"; }>; ``` @@ -18683,7 +17331,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ sender: string; userOpHash: `0x${string}` }>; ``` ### Returns @@ -18693,49 +17341,18 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "signer"; - readonly type: "address"; + readonly name: "userOpHash"; + readonly type: "bytes32"; }, { readonly indexed: true; - readonly name: "mintedTo"; + readonly name: "sender"; 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: "factory"; readonly type: "address" }, + { readonly name: "paymaster"; readonly type: "address" }, ]; - readonly name: "TokensMintedWithSignature"; + readonly name: "AccountDeployed"; readonly type: "event"; }>; ``` @@ -18743,117 +17360,143 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC721.tokensOfOwner +## ERC4337.addAdmin -Calls the "tokensOfOwner" function on the contract. +Adds admin permissions for a specified address. ### Example ```ts -import { tokensOfOwner } from "thirdweb/extensions/erc721"; +import { addAdmin } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; -const result = await tokensOfOwner({ - contract, - owner: ..., +const transaction = addAdmin({ + contract, + account, + adminAddress: "0x...", }); + +await sendTransaction({ transaction, account }); ``` ```ts -function tokensOfOwner(options: BaseTransactionOptions) : Promise> +function addAdmin( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the tokensOfOwner function. +The options for the addAdmin function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise> +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +The transaction object to be sent. --- -## ERC721.tokenURI +## ERC4337.addSessionKey -Calls the "tokenURI" function on the contract. +Adds session key permissions for a specified address. ### Example ```ts -import { tokenURI } from "thirdweb/extensions/erc721"; +import { addSessionKey } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; -const result = await tokenURI({ - contract, - tokenId: ..., +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 tokenURI( - options: BaseTransactionOptions, -): Promise; +function addSessionKey( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the tokenURI function. +The options for the removeSessionKey function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +The transaction object to be sent. --- -## ERC721.tokenURIRevealedEvent +## ERC4337.adminUpdatedEvent -Creates an event object for the TokenURIRevealed event. +Creates an event object for the AdminUpdated event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { tokenURIRevealedEvent } from "thirdweb/extensions/erc721"; +import { adminUpdatedEvent } from "thirdweb/extensions/erc4337"; const events = await getContractEvents({ contract, events: [ - tokenURIRevealedEvent({ - index: ..., + adminUpdatedEvent({ + signer: ..., }) ], }); ``` ```ts -function tokenURIRevealedEvent( - filters: Partial, +function adminUpdatedEvent( + filters: Partial<{ signer: string }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "index"; - readonly type: "uint256"; + readonly name: "signer"; + readonly type: "address"; }, - { readonly name: "revealedURI"; readonly type: "string" }, + { readonly name: "isAdmin"; readonly type: "bool" }, ]; - readonly name: "TokenURIRevealed"; + readonly name: "AdminUpdated"; readonly type: "event"; }>; ``` @@ -18865,7 +17508,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ signer: string }>; ``` ### Returns @@ -18875,12 +17518,12 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "index"; - readonly type: "uint256"; + readonly name: "signer"; + readonly type: "address"; }, - { readonly name: "revealedURI"; readonly type: "string" }, + { readonly name: "isAdmin"; readonly type: "bool" }, ]; - readonly name: "TokenURIRevealed"; + readonly name: "AdminUpdated"; readonly type: "event"; }>; ``` @@ -18888,1421 +17531,979 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC721.totalSupply +## ERC4337.createAccount -Calls the "totalSupply" function on the contract. +Prepares a transaction to call the "createAccount" function on the contract. ### Example ```ts -import { totalSupply } from "thirdweb/extensions/erc721"; +import { sendTransaction } from "thirdweb"; +import { createAccount } from "thirdweb/extensions/erc4337"; -const result = await totalSupply({ - contract, +const transaction = createAccount({ + contract, + admin: ..., + data: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function totalSupply( - options: BaseTransactionOptions, -): Promise; +function createAccount( + options: BaseTransactionOptions< + | CreateAccountParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the totalSupply function. +The options for the "createAccount" function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + | CreateAccountParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## ERC721.transferEvent +## ERC4337.getAccounts -Creates an event object for the Transfer event. +Calls the "getAccounts" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { transferEvent } from "thirdweb/extensions/erc721"; +import { getAccounts } from "thirdweb/extensions/erc4337"; -const events = await getContractEvents({ -contract, -events: [ - transferEvent({ - from: ..., - to: ..., - tokenId: ..., -}) -], +const result = await getAccounts({ + contract, + start: ..., + end: ..., }); ``` ```ts -function transferEvent( - filters: Partial, -): 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"; -}>; +function getAccounts(options: BaseTransactionOptions) : Promise> ``` ### Parameters -Optional filters to apply to the event. +The options for the getAccounts function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise> ``` -The prepared event object. +The parsed result of the function call. --- -## ERC721.transferFrom +## ERC4337.getAccountsOfSigner -Prepares a transaction to call the "transferFrom" function on the contract. +Calls the "getAccountsOfSigner" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { transferFrom } from "thirdweb/extensions/erc721"; +import { getAccountsOfSigner } from "thirdweb/extensions/erc4337"; -const transaction = transferFrom({ +const result = await getAccountsOfSigner({ contract, - from: ..., - to: ..., - tokenId: ..., - overrides: { - ... - } + signer: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function transferFrom( - options: BaseTransactionOptions< - | TransferFromParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getAccountsOfSigner(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the "transferFrom" function. +The options for the getAccountsOfSigner function. #### Type ```ts -let options: BaseTransactionOptions< - | TransferFromParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise> ``` -A prepared transaction object. +The parsed result of the function call. --- -## ERC721.updateMetadata +## ERC4337.getAllAccounts -Update the metadata of the single token in an NFT Drop (DropERC721) collection For NFT Collection, please use `setTokenURI` +Calls the "getAllAccounts" function on the contract. ### Example ```ts -import { updateMetadata } from "thirdweb/extensions/erc721"; +import { getAllAccounts } from "thirdweb/extensions/erc4337"; -const transaction = updateMetadata({ +const result = await getAllAccounts({ contract, - targetTokenId: 0n, - client: thirdwebClient, - newMetadata: { - name: "this is the new nft name", - description: "...", - image: "new image uri", - // ... - }, }); ``` ```ts -function updateMetadata( - options: BaseTransactionOptions, -): PreparedTransaction; +function getAllAccounts(options: BaseTransactionOptions) : Promise> ``` ### Parameters +The options for the getAllAccounts function. + #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise> ``` -the prepared transaction +The parsed result of the function call. --- -## 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. +## ERC4337.getAllActiveSigners -This extension does not validate the NFTInput so make sure you are passing the proper content that you want to update. This method is only available on the `TokenERC721` contract. +Calls the "getAllActiveSigners" function on the contract. ### Example ```ts -import { updateTokenURI } from "thirdweb/extensions/erc721"; +import { getAllActiveSigners } from "thirdweb/extensions/erc4337"; -const transaction = updateTokenURI({ - tokenId: 0n, - nft: { - name: "new name", - description: "new description", - image: "https://image-host.com/new-image.png", - }, +const result = await getAllActiveSigners({ + contract, }); ``` ```ts -function updateTokenURI( - options: BaseTransactionOptions, -): PreparedTransaction; +function getAllActiveSigners(options: BaseTransactionOptions) : Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> ``` ### Parameters +The options for the getAllActiveSigners function. + #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> ``` -the prepared transaction from `setTokenURI` ---- -## ERC1271 +The parsed result of the function call. --- -## ERC1271.checkContractWalletSignature - -Deprecated - -Use `verifySignature` instead +## ERC4337.getAllAdmins -Checks if a contract wallet signature is valid. +Calls the "getAllAdmins" function on the contract. ### Example ```ts -import { checkContractWalletSignature } from "thirdweb/extensions/erc1271"; -const isValid = await checkContractWalletSignature({ - contract: myContract, - message: "hello world", - signature: "0x...", +import { getAllAdmins } from "thirdweb/extensions/erc4337"; + +const result = await getAllAdmins({ + contract, }); ``` ```ts -function checkContractWalletSignature( - options: CheckContractWalletSignatureOptions, -): Promise; +function getAllAdmins(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the checkContractWalletSignature function. +The options for the getAllAdmins function. #### Type ```ts -let options: { - contract: ThirdwebContract; - message: SignableMessage; - signature: string; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise> ``` -A promise that resolves with a boolean indicating if the signature is valid. +The parsed result of the function call. --- -## ERC1271.checkContractWalletSignedTypedData - -Deprecated - -Use `verifyTypedData` instead +## ERC4337.getAllSigners -Checks if a contract wallet signature is valid. +Calls the "getAllSigners" function on the contract. ### 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, - }, +import { getAllSigners } from "thirdweb/extensions/erc4337"; + +const result = await getAllSigners({ + contract, }); ``` ```ts -function checkContractWalletSignedTypedData( - options: CheckContractWalletSignTypedDataOptions< - typedData, - primaryType - >, -): Promise; +function getAllSigners(options: BaseTransactionOptions) : Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> ``` ### Parameters -The options for the checkContractWalletSignature function. +The options for the getAllSigners function. #### Type ```ts -let options: CheckContractWalletSignTypedDataOptions< - typedData, - primaryType ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> ``` -A promise that resolves with a boolean indicating if the signature is valid. ---- -## ERC20 +The parsed result of the function call. --- -## ERC20.allowance +## ERC4337.getPermissionsForSigner -Calls the "allowance" function on the contract. +Calls the "getPermissionsForSigner" function on the contract. ### Example ```ts -import { allowance } from "thirdweb/extensions/erc20"; +import { getPermissionsForSigner } from "thirdweb/extensions/erc4337"; -const result = await allowance({ +const result = await getPermissionsForSigner({ contract, - owner: ..., - spender: ..., + signer: ..., }); ``` ```ts -function allowance( - options: BaseTransactionOptions, -): Promise; +function getPermissionsForSigner(options: BaseTransactionOptions) : Promise<{ approvedTargets: readonly Array; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }> ``` ### Parameters -The options for the allowance function. +The options for the getPermissionsForSigner function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<{ approvedTargets: readonly Array; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }> ``` The parsed result of the function call. --- -## ERC20.approvalEvent +## ERC4337.getUserOpHash -Creates an event object for the Approval event. +Calls the "getUserOpHash" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { approvalEvent } from "thirdweb/extensions/erc20"; +import { getUserOpHash } from "thirdweb/extensions/erc4337"; -const events = await getContractEvents({ -contract, -events: [ - approvalEvent({ - owner: ..., - spender: ..., -}) -], +const result = await getUserOpHash({ + contract, + userOp: ..., }); ``` ```ts -function approvalEvent( - filters: Partial, -): 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"; -}>; +function getUserOpHash( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -Optional filters to apply to the event. +The options for the getUserOpHash function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise<`0x${string}`>; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC20.approve +## ERC4337.isAccountDeployed -Approves the spending of tokens by a specific address. +Adds admin permissions for a specified address. ### Example ```ts -import { approve } from "thirdweb/extensions/erc20"; -import { sendTransaction } from "thirdweb"; +import { isAccountDeployed } from "thirdweb/extensions/erc4337"; -const transaction = await approve({ +const transaction = addAdmin({ contract, - spender: "0x...", - amount: 100, + account, + adminAddress: "0x...", }); -await sendTransaction({ transaction, account }); +await isAccountDeployed({ contract, adminSigner }); ``` ```ts -function approve( - options: BaseTransactionOptions, -): PreparedTransaction; +function isAccountDeployed( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options. +The options for the addAdmin function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The transaction object to be sent. --- -## ERC20.balanceOf +## ERC4337.isActiveSigner -Calls the "balanceOf" function on the contract. +Calls the "isActiveSigner" function on the contract. ### Example ```ts -import { balanceOf } from "thirdweb/extensions/erc20"; +import { isActiveSigner } from "thirdweb/extensions/erc4337"; -const result = await balanceOf({ +const result = await isActiveSigner({ contract, - address: ..., + signer: ..., }); ``` ```ts -function balanceOf( - options: BaseTransactionOptions, -): Promise; +function isActiveSigner( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the balanceOf function. +The options for the isActiveSigner function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC20.burn +## ERC4337.isAddAdminSupported -Prepares a transaction to call the "burn" function on the contract. +Checks if the `isAddAdminSupported` method is supported by the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { burn } from "thirdweb/extensions/erc20"; - -const transaction = burn({ - contract, - amount: ..., - overrides: { - ... - } -}); +import { isAddAdminSupported } from "thirdweb/extensions/erc4337"; -// Send the transaction -await sendTransaction({ transaction, account }); +const supported = isAddAdminSupported(["0x..."]); ``` ```ts -function burn( - options: BaseTransactionOptions< - BurnParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isAddAdminSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "burn" function. +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 options: BaseTransactionOptions< - BurnParams | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `isAddAdminSupported` method is supported. --- -## ERC20.burnFrom +## ERC4337.isAddSessionKeySupported -Prepares a transaction to call the "burnFrom" function on the contract. +Checks if the `isAddSessionKeySupported` method is supported by the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { burnFrom } from "thirdweb/extensions/erc20"; - -const transaction = burnFrom({ - contract, - account: ..., - amount: ..., - overrides: { - ... - } -}); +import { isAddSessionKeySupported } from "thirdweb/extensions/erc4337"; -// Send the transaction -await sendTransaction({ transaction, account }); +const supported = isAddSessionKeySupported(["0x..."]); ``` ```ts -function burnFrom( - options: BaseTransactionOptions< - BurnFromParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isAddSessionKeySupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "burnFrom" function. +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 options: BaseTransactionOptions< - BurnFromParams | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `isAddSessionKeySupported` method is supported. --- -## ERC20.canClaim +## ERC4337.isAdmin -Check if a user can claim a drop. This method is only available on the `DropERC20` contract. +Calls the "isAdmin" function on the contract. ### Example ```ts -const claimResult = await canClaim({ - contract: contract, - claimer: "0x1234567890123456789012345678901234567890", - quantity: "1", +import { isAdmin } from "thirdweb/extensions/erc4337"; + +const result = await isAdmin({ + contract, + signer: ..., }); ``` ```ts -function canClaim( - options: BaseTransactionOptions, -): Promise; +function isAdmin( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the transaction. +The options for the isAdmin function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: { reason?: string; result: boolean }; +let returnType: Promise; ``` -Whether the user can claim the drop. +The parsed result of the function call. --- -## ERC20.claimConditionsUpdatedEvent +## ERC4337.isCreateAccountSupported -Creates an event object for the ClaimConditionsUpdated event. +Checks if the `createAccount` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { claimConditionsUpdatedEvent } from "thirdweb/extensions/erc20"; +import { isCreateAccountSupported } from "thirdweb/extensions/erc4337"; -const events = await getContractEvents({ - contract, - events: [claimConditionsUpdatedEvent()], -}); +const supported = isCreateAccountSupported(["0x..."]); ``` ```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"; -}>; +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: 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `createAccount` method is supported. --- -## ERC20.claimTo +## ERC4337.isGetAccountsOfSignerSupported -Claim ERC20 NFTs to a specified address This method is only available on the `DropERC20` contract. +Checks if the `getAccountsOfSigner` method is supported by the given contract. ### 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 -}); +import { isGetAccountsOfSignerSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAccountsOfSignerSupported(["0x..."]); ``` ```ts -function claimTo( - options: BaseTransactionOptions, -): PreparedTransaction; +function isGetAccountsOfSignerSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the transaction +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A promise that resolves with the submitted transaction hash. +A boolean indicating if the `getAccountsOfSigner` method is supported. --- -## ERC20.decimals +## ERC4337.isGetAccountsSupported -Retrieves the number of decimal places for a given ERC20 contract. +Checks if the `getAccounts` method is supported by the given contract. ### Example ```ts -import { decimals } from "thirdweb/extensions/erc20"; - -const tokenDecimals = await decimals({ contract }); +import { isGetAccountsSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAccountsSupported(["0x..."]); ``` ```ts -function decimals(options: BaseTransactionOptions): Promise; +function isGetAccountsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the transaction. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -A promise that resolves to the number of decimal places. +A boolean indicating if the `getAccounts` method is supported. --- -## ERC20.delegate +## ERC4337.isGetAllAccountsSupported -Prepares a transaction to call the "delegate" function on the contract. +Checks if the `getAllAccounts` method is supported by the given 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 }); +import { isGetAllAccountsSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllAccountsSupported(["0x..."]); ``` ```ts -function delegate( - options: BaseTransactionOptions< - DelegateParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isGetAllAccountsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "delegate" function. +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 options: BaseTransactionOptions< - DelegateParams | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `getAllAccounts` method is supported. --- -## ERC20.delegates +## ERC4337.isGetAllActiveSignersSupported -Calls the "delegates" function on the contract. +Checks if the `getAllActiveSigners` method is supported by the given contract. ### Example ```ts -import { delegates } from "thirdweb/extensions/erc20"; - -const result = await delegates({ - contract, - account: ..., -}); +import { isGetAllActiveSignersSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllActiveSignersSupported(["0x..."]); ``` ```ts -function delegates( - options: BaseTransactionOptions, -): Promise; +function isGetAllActiveSignersSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the delegates function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `getAllActiveSigners` method is supported. --- -## ERC20.deposit +## ERC4337.isGetAllAdminsSupported -Calls the "deposit" function on the contract (useful to wrap ETH). +Checks if the `getAllAdmins` method is supported by the given contract. ### Example ```ts -import { deposit } from "thirdweb/extensions/erc20"; -import { sendTransaction } from "thirdweb"; - -const transaction = deposit({ contract, amount: "0.1" }); - -await sendTransaction({ transaction, account }); +import { isGetAllAdminsSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllAdminsSupported(["0x..."]); ``` ```ts -function deposit( - options: BaseTransactionOptions, -): PreparedTransaction; +function isGetAllAdminsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "deposit" function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `getAllAdmins` method is supported. --- -## ERC20.generateMintSignature +## ERC4337.isGetAllSignersSupported -Generates the payload and signature for minting an ERC20 token. +Checks if the `getAllSigners` method is supported by the given contract. ### 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 }); +import { isGetAllSignersSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAllSignersSupported(["0x..."]); ``` ```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}`; -}>; +function isGetAllSignersSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the minting process. +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 options: { - account: Account; - contract: ThirdwebContract; - contractType?: "TokenERC1155" | "SignatureMintERC1155"; - mintRequest: GeneratePayloadInput; -}; +let availableSelectors: Array; ``` ### 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}`; -}>; +let returnType: boolean; ``` -A promise that resolves to the payload and signature. +A boolean indicating if the `getAllSigners` method is supported. --- -## ERC20.getActiveClaimCondition +## ERC4337.isIsAccountDeployedSupported -Retrieves the active claim condition. This method is only available on the `DropERC20` contract. +Checks if the `getAddress` method is supported by the given contract. ### Example ```ts -import { getActiveClaimCondition } from "thirdweb/extensions/erc20"; -const activeClaimCondition = await getActiveClaimCondition({ - contract, -}); +import { isGetAddressSupported } from "thirdweb/extensions/erc4337"; +const supported = isGetAddressSupported(["0x..."]); ``` ```ts -function getActiveClaimCondition( - options: BaseTransactionOptions, -): Promise; +function isIsAccountDeployedSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The transaction options. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -A promise that resolves to the active claim condition. +A boolean indicating if the `getAddress` method is supported. --- -## ERC20.getActiveClaimConditionId +## ERC4337.isIsActiveSignerSupported -Calls the "getActiveClaimConditionId" function on the contract. +Checks if the `isActiveSigner` method is supported by the given contract. ### Example ```ts -import { getActiveClaimConditionId } from "thirdweb/extensions/erc20"; - -const result = await getActiveClaimConditionId({ - contract, -}); +import { isIsActiveSignerSupported } from "thirdweb/extensions/erc4337"; +const supported = isIsActiveSignerSupported(["0x..."]); ``` ```ts -function getActiveClaimConditionId( - options: BaseTransactionOptions, -): Promise; +function isIsActiveSignerSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the getActiveClaimConditionId function. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `isActiveSigner` method is supported. --- -## ERC20.getBalance +## ERC4337.isIsAdminSupported -Retrieves the balance of an ERC20 token for a specific address. +Checks if the `isAdmin` method is supported by the given contract. ### Example ```ts -import { getBalance } from "thirdweb/extensions/erc20"; - -const balance = await getBalance({ contract, address: "0x..." }); +import { isIsAdminSupported } from "thirdweb/extensions/erc4337"; +const supported = isIsAdminSupported(["0x..."]); ``` ```ts -function getBalance( - options: BaseTransactionOptions, -): Promise; +function isIsAdminSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The transaction options including the address. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: { - chainId: number; - decimals: number; - displayValue: string; - name: string; - symbol: string; - tokenAddress: string; - value: bigint; -}; +let returnType: boolean; ``` -An object containing the balance value, display value, and symbol. +A boolean indicating if the `isAdmin` method is supported. --- -## ERC20.getClaimConditionById +## ERC4337.isRegistered -Calls the "getClaimConditionById" function on the contract. +Calls the "isRegistered" function on the contract. ### Example ```ts -import { getClaimConditionById } from "thirdweb/extensions/erc20"; +import { isRegistered } from "thirdweb/extensions/erc4337"; -const result = await getClaimConditionById({ +const result = await isRegistered({ contract, - conditionId: ..., + account: ..., }); ``` ```ts -function getClaimConditionById( - options: BaseTransactionOptions, -): Promise<{ - currency: string; - maxClaimableSupply: bigint; - merkleRoot: `0x${string}`; - metadata: string; - pricePerToken: bigint; - quantityLimitPerWallet: bigint; - startTimestamp: bigint; - supplyClaimed: bigint; -}>; +function isRegistered( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getClaimConditionById function. +The options for the isRegistered function. #### Type ```ts -let options: BaseTransactionOptions; +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; -}>; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC20.getClaimConditions - -Retrieves all claim conditions. This method is only available on the `DropERC20` contract. - -### 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. ---- - -## ERC20.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. ---- - -## ERC20.isClaimToSupported +## ERC4337.isRemoveAdminSupported -Checks if the `claimTo` method is supported by the given contract. +Checks if the `isRemoveAdminSupported` method is supported by the given contract. ### Example ```ts -import { isClaimToSupported } from "thirdweb/extensions/erc20"; +import { isRemoveAdminSupported } from "thirdweb/extensions/erc4337"; -const supported = isClaimToSupported(["0x..."]); +const supported = isRemoveAdminSupported(["0x..."]); ``` ```ts -function isClaimToSupported( +function isRemoveAdminSupported( availableSelectors: Array, ): boolean; ``` @@ -20323,33 +18524,31 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `claimTo` method is supported. +A boolean indicating if the `isRemoveAdminSupported` method is supported. --- -## ERC20.isERC20 +## ERC4337.isRemoveSessionKeySupported -Check if a contract is an ERC20 token. +Checks if the `isRemoveSessionKeySupported` method is supported by the given contract. ### 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)); +import { isRemoveSessionKeySupported } from "thirdweb/extensions/erc4337"; -const result = await isERC20(selectors); +const supported = isRemoveSessionKeySupported(["0x..."]); ``` ```ts -function isERC20(availableSelectors: Array): boolean; +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 @@ -20362,22 +18561,22 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating whether the contract is an ERC20 token. +A boolean indicating if the `isRemoveSessionKeySupported` method is supported. --- -## ERC20.isGetActiveClaimConditionIdSupported +## ERC4337.isTotalAccountsSupported -Checks if the `getActiveClaimConditionId` method is supported by the given contract. +Checks if the `totalAccounts` method is supported by the given contract. ### Example ```ts -import { isGetActiveClaimConditionIdSupported } from "thirdweb/extensions/erc20"; -const supported = isGetActiveClaimConditionIdSupported(["0x..."]); +import { isTotalAccountsSupported } from "thirdweb/extensions/erc4337"; +const supported = isTotalAccountsSupported(["0x..."]); ``` ```ts -function isGetActiveClaimConditionIdSupported( +function isTotalAccountsSupported( availableSelectors: Array, ): boolean; ``` @@ -20398,23 +18597,23 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `getActiveClaimConditionId` method is supported. +A boolean indicating if the `totalAccounts` method is supported. --- -## ERC20.isGetActiveClaimConditionSupported +## ERC4337.isValidateUserOpSupported -Checks if the `getActiveClaimCondition` method is supported by the given contract. +Checks if the `validateUserOp` method is supported by the given contract. ### Example ```ts -import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc20"; +import { isValidateUserOpSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetActiveClaimConditionSupported(["0x..."]); +const supported = isValidateUserOpSupported(["0x..."]); ``` ```ts -function isGetActiveClaimConditionSupported( +function isValidateUserOpSupported( availableSelectors: Array, ): boolean; ``` @@ -20435,189 +18634,338 @@ let availableSelectors: Array; let returnType: boolean; ``` -A boolean indicating if the `getActiveClaimCondition` method is supported. +A boolean indicating if the `validateUserOp` method is supported. --- -## ERC20.isGetClaimConditionByIdSupported +## ERC4337.predictAccountAddress -Checks if the `getClaimConditionById` method is supported by the given contract. +Calls the "getAddress" function on the contract. ### Example ```ts -import { isGetClaimConditionByIdSupported } from "thirdweb/extensions/erc20"; -const supported = isGetClaimConditionByIdSupported(["0x..."]); +import { getAddress } from "thirdweb/extensions/erc4337"; + +const result = await getAddress({ + contract, + adminSigner: ..., + data: ..., +}); ``` ```ts -function isGetClaimConditionByIdSupported( - availableSelectors: Array, -): boolean; +function predictAccountAddress( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the getAddress function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getClaimConditionById` method is supported. +The parsed result of the function call. --- -## ERC20.isMintToSupported +## ERC4337.removeAdmin -Checks if the `mintTo` method is supported by the given contract. +Removes admin permissions for a specified address. ### Example ```ts -import { isMintToSupported } from "thirdweb/extensions/erc20"; +import { removeAdmin } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; -const supported = isMintToSupported(["0x..."]); +const transaction = removeAdmin({ + contract, + account, + adminAddress: "0x...", +}); + +await sendTransaction({ transaction, account }); ``` ```ts -function isMintToSupported( - availableSelectors: Array, -): boolean; +function removeAdmin( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The options for the removeAdmin function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `mintTo` method is supported. +The transaction object to be sent. --- -## ERC20.isResetClaimEligibilitySupported +## ERC4337.removeSessionKey -Checks if the `resetClaimEligibility` method is supported by the given contract. +Removes session key permissions for a specified address. ### Example ```ts -import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc20"; +import { removeSessionKey } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; -const supported = isResetClaimEligibilitySupported(["0x..."]); +const transaction = removeSessionKey({ + contract, + account, + sessionKeyAddress, +}); + +await sendTransaction({ transaction, account }); ``` ```ts -function isResetClaimEligibilitySupported( - availableSelectors: Array, -): boolean; +function removeSessionKey( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### 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. +The options for the removeSessionKey function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `resetClaimEligibility` method is supported. +The transaction object to be sent. --- -## ERC20.isSetClaimConditionsSupported +## ERC4337.signerPermissionsUpdatedEvent -Checks if the `setClaimConditions` method is supported by the given contract. +Creates an event object for the SignerPermissionsUpdated event. ### Example ```ts -import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc20"; +import { getContractEvents } from "thirdweb"; +import { signerPermissionsUpdatedEvent } from "thirdweb/extensions/erc4337"; -const supported = isSetClaimConditionsSupported(["0x..."]); +const events = await getContractEvents({ +contract, +events: [ + signerPermissionsUpdatedEvent({ + authorizingSigner: ..., + targetSigner: ..., +}) +], +}); ``` ```ts -function isSetClaimConditionsSupported( - availableSelectors: Array, -): boolean; +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 -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. +Optional filters to apply to the event. #### Type ```ts -let availableSelectors: Array; +let filters: Partial<{ + authorizingSigner: string; + targetSigner: string; +}>; ``` ### Returns ```ts -let returnType: boolean; +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"; +}>; ``` -A boolean indicating if the `setClaimConditions` method is supported. +The prepared event object. --- -## ERC20.mintTo +## ERC4337.simulateHandleOp -Mints a specified amount of tokens to a given address. This method is only available on the `TokenERC20` contract. +Prepares a transaction to call the "simulateHandleOp" function on the contract. ### Example ```ts -import { mintTo } from "thirdweb/extensions/erc20"; import { sendTransaction } from "thirdweb"; +import { simulateHandleOp } from "thirdweb/extensions/erc4337"; -const transaction = mintTo({ - contract, - to: "0x...", - amount: 100, +const transaction = simulateHandleOp({ + contract, + op: ..., + target: ..., + targetCallData: ..., + overrides: { + ... + } }); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function mintTo( - options: BaseTransactionOptions, +function simulateHandleOp( + options: BaseTransactionOptions< + | SimulateHandleOpParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for minting tokens. +The options for the "simulateHandleOp" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SimulateHandleOpParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -20633,198 +18981,97 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ERC20.mintWithSignature +## ERC4337.totalAccounts -Mints a new ERC20 token with the given minter signature This method is only available on the `TokenERC20` contract. +Calls the "totalAccounts" function on the contract. ### Example ```ts -import { mintWithSignature, generateMintSignature } from "thirdweb/extensions/erc20"; -import { sendTransaction } from "thirdweb"; - -const { payload, signature } = await generateMintSignature(...) +import { totalAccounts } from "thirdweb/extensions/erc4337"; -const transaction = mintWithSignature({ +const result = await totalAccounts({ contract, - payload, - signature, }); - -await sendTransaction({ transaction, account }); ``` ```ts -function mintWithSignature( - options: BaseTransactionOptions, -): PreparedTransaction; +function totalAccounts( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options. +The options for the totalAccounts function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +The parsed result of the function call. --- -## ERC20.resetClaimEligibility +## ERC4337.userOperationEventEvent -Reset the claim eligibility for all users. This method is only available on the `DropERC20` contract. +Creates an event object for the UserOperationEvent event. ### Example ```ts -import { resetClaimEligibility } from "thirdweb/extensions/erc20"; -import { sendTransaction } from "thirdweb"; +import { getContractEvents } from "thirdweb"; +import { userOperationEventEvent } from "thirdweb/extensions/erc4337"; -const transaction = resetClaimEligibility({ - contract, +const events = await getContractEvents({ +contract, +events: [ + userOperationEventEvent({ + userOpHash: ..., + sender: ..., + paymaster: ..., +}) +], }); - -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 ---- - -## ERC20.setClaimConditions - -Set the claim conditions for a ERC20 drop This method is only available on the `DropERC20` contract. - -### 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 ---- - -## ERC20.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, +function userOperationEventEvent( + filters: Partial<{ + paymaster: string; + sender: string; + userOpHash: `0x${string}`; + }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "claimConditionIndex"; - readonly type: "uint256"; + readonly name: "userOpHash"; + readonly type: "bytes32"; }, { readonly indexed: true; - readonly name: "claimer"; + readonly name: "sender"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "receiver"; + readonly name: "paymaster"; readonly type: "address"; }, - { readonly name: "quantityClaimed"; readonly type: "uint256" }, + { 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: "TokensClaimed"; + readonly name: "UserOperationEvent"; readonly type: "event"; }>; ``` @@ -20836,7 +19083,11 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ + paymaster: string; + sender: string; + userOpHash: `0x${string}`; +}>; ``` ### Returns @@ -20846,22 +19097,25 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "claimConditionIndex"; - readonly type: "uint256"; + readonly name: "userOpHash"; + readonly type: "bytes32"; }, { readonly indexed: true; - readonly name: "claimer"; + readonly name: "sender"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "receiver"; + readonly name: "paymaster"; readonly type: "address"; }, - { readonly name: "quantityClaimed"; readonly type: "uint256" }, + { 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: "TokensClaimed"; + readonly name: "UserOperationEvent"; readonly type: "event"; }>; ``` @@ -20869,39 +19123,46 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC20.tokensMintedEvent +## ERC4337.userOperationRevertReasonEvent -Creates an event object for the TokensMinted event. +Creates an event object for the UserOperationRevertReason event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { tokensMintedEvent } from "thirdweb/extensions/erc20"; +import { userOperationRevertReasonEvent } from "thirdweb/extensions/erc4337"; const events = await getContractEvents({ contract, events: [ - tokensMintedEvent({ - mintedTo: ..., + userOperationRevertReasonEvent({ + userOpHash: ..., + sender: ..., }) ], }); ``` ```ts -function tokensMintedEvent( - filters: Partial, +function userOperationRevertReasonEvent( + filters: Partial<{ sender: string; userOpHash: `0x${string}` }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "mintedTo"; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; readonly type: "address"; }, - { readonly name: "quantityMinted"; readonly type: "uint256" }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "revertReason"; readonly type: "bytes" }, ]; - readonly name: "TokensMinted"; + readonly name: "UserOperationRevertReason"; readonly type: "event"; }>; ``` @@ -20913,7 +19174,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ sender: string; userOpHash: `0x${string}` }>; ``` ### Returns @@ -20923,169 +19184,93 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "mintedTo"; + readonly name: "userOpHash"; + readonly type: "bytes32"; + }, + { + readonly indexed: true; + readonly name: "sender"; readonly type: "address"; }, - { readonly name: "quantityMinted"; readonly type: "uint256" }, + { readonly name: "nonce"; readonly type: "uint256" }, + { readonly name: "revertReason"; readonly type: "bytes" }, ]; - readonly name: "TokensMinted"; + readonly name: "UserOperationRevertReason"; readonly type: "event"; }>; ``` The prepared event object. --- +## ERC4626 +--- -## ERC20.tokensMintedWithSignatureEvent +## ERC4626.asset -Creates an event object for the TokensMintedWithSignature event. +Calls the "asset" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { tokensMintedWithSignatureEvent } from "thirdweb/extensions/erc20"; +import { asset } from "thirdweb/extensions/erc4626"; -const events = await getContractEvents({ -contract, -events: [ - tokensMintedWithSignatureEvent({ - signer: ..., - mintedTo: ..., -}) -], +const result = await asset({ + contract, }); ``` ```ts -function tokensMintedWithSignatureEvent( - filters: Partial, -): 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"; -}>; +function asset(options: BaseTransactionOptions): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the asset function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC20.totalSupply +## ERC4626.convertToAssets -Calls the "totalSupply" function on the contract. +Calls the "convertToAssets" function on the contract. ### Example ```ts -import { totalSupply } from "thirdweb/extensions/erc20"; +import { convertToAssets } from "thirdweb/extensions/erc4626"; -const result = await totalSupply({ - contract, +const result = await convertToAssets({ + contract, + shares: ..., }); ``` ```ts -function totalSupply( - options: BaseTransactionOptions, +function convertToAssets( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the totalSupply function. +The options for the convertToAssets function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -21097,108 +19282,87 @@ let returnType: Promise; The parsed result of the function call. --- -## ERC20.transfer +## ERC4626.convertToShares -Transfers ERC20 tokens from the sender's address to the specified recipient address. +Calls the "convertToShares" function on the contract. ### Example ```ts -import { transfer } from "thirdweb/extensions/erc20"; -import { sendTransaction } from "thirdweb"; +import { convertToShares } from "thirdweb/extensions/erc4626"; -const transaction = transfer({ - contract, - to: "0x...", - amount: 100, +const result = await convertToShares({ + contract, + assets: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function transfer( - options: BaseTransactionOptions, -): PreparedTransaction; +function convertToShares( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the transfer transaction. +The options for the convertToShares function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the prepared transaction. +The parsed result of the function call. --- -## ERC20.transferBatch +## ERC4626.deposit -Transfers a batch of ERC20 tokens from the sender's address to the specified recipient address. +Prepares a transaction to call the "deposit" function on the contract. ### Example ```ts -import { transferBatch } from "thirdweb/extensions/erc20"; import { sendTransaction } from "thirdweb"; +import { deposit } from "thirdweb/extensions/erc4626"; -const transaction = transferBatch({ +const transaction = deposit({ contract, - batch: [ - { - to: "0x...", - amount: 100, - }, - { - to: "0x...", - amount: "0.1", - }, -]); + assets: ..., + receiver: ..., + overrides: { + ... + } +}); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function transferBatch( - options: BaseTransactionOptions<{ - batch: Array< - { to: string } & ( - | { amount: string | number } - | { amountWei: bigint } - ) - >; - }>, +function deposit( + options: BaseTransactionOptions< + DepositParams | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for the batch transfer transaction. +The options for the "deposit" function. #### Type ```ts -let options: BaseTransactionOptions<{ - batch: Array< - { to: string } & ( - | { amount: string | number } - | { amountWei: bigint } - ) - >; -}>; +let options: BaseTransactionOptions< + DepositParams | { asyncParams: () => Promise } +>; ``` ### Returns @@ -21211,48 +19375,49 @@ let returnType: PreparedTransaction< >; ``` -A promise that resolves to the prepared transaction. +A prepared transaction object. --- -## ERC20.transferEvent +## ERC4626.depositEvent -Creates an event object for the Transfer event. +Creates an event object for the Deposit event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { transferEvent } from "thirdweb/extensions/erc20"; +import { depositEvent } from "thirdweb/extensions/erc4626"; const events = await getContractEvents({ contract, events: [ - transferEvent({ - from: ..., - to: ..., + depositEvent({ + caller: ..., + owner: ..., }) ], }); ``` ```ts -function transferEvent( - filters: Partial, +function depositEvent( + filters: Partial<{ caller: string; owner: string }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "from"; + readonly name: "caller"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "to"; + readonly name: "owner"; readonly type: "address"; }, - { readonly name: "value"; readonly type: "uint256" }, + { readonly name: "assets"; readonly type: "uint256" }, + { readonly name: "shares"; readonly type: "uint256" }, ]; - readonly name: "Transfer"; + readonly name: "Deposit"; readonly type: "event"; }>; ``` @@ -21264,7 +19429,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ caller: string; owner: string }>; ``` ### Returns @@ -21274,17 +19439,18 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "from"; + readonly name: "caller"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "to"; + readonly name: "owner"; readonly type: "address"; }, - { readonly name: "value"; readonly type: "uint256" }, + { readonly name: "assets"; readonly type: "uint256" }, + { readonly name: "shares"; readonly type: "uint256" }, ]; - readonly name: "Transfer"; + readonly name: "Deposit"; readonly type: "event"; }>; ``` @@ -21292,281 +19458,207 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC20.transferFrom +## ERC4626.maxDeposit -Transfers a specified amount of tokens from one address to another address on the ERC20 contract. +Calls the "maxDeposit" function on the contract. ### Example ```ts -import { transferFrom } from "thirdweb/extensions/erc20"; -import { sendTransaction } from "thirdweb"; +import { maxDeposit } from "thirdweb/extensions/erc4626"; -const transaction = transferFrom({ - contract: USDC_CONTRACT, - from: "0x1234...", - to: "0x5678...", - amount: 100, +const result = await maxDeposit({ + contract, + receiver: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function transferFrom( - options: BaseTransactionOptions, -): PreparedTransaction; +function maxDeposit( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The transaction options including from, to, amount, and gas price. +The options for the maxDeposit function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A promise that resolves to the prepared transaction object. +The parsed result of the function call. --- -## ERC20.withdraw +## ERC4626.maxMint -Prepares a transaction to call the "withdraw" function on the contract. +Calls the "maxMint" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { withdraw } from "thirdweb/extensions/erc20"; +import { maxMint } from "thirdweb/extensions/erc4626"; -const transaction = withdraw({ +const result = await maxMint({ contract, - amount: ..., - overrides: { - ... - } + receiver: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function withdraw( - options: BaseTransactionOptions< - WithdrawParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function maxMint( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "withdraw" function. +The options for the maxMint function. #### Type ```ts -let options: BaseTransactionOptions< - WithdrawParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. ---- -## ERC4337 +The parsed result of the function call. --- -## ERC4337.accountDeployedEvent +## ERC4626.maxRedeem -Creates an event object for the AccountDeployed event. +Calls the "maxRedeem" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { accountDeployedEvent } from "thirdweb/extensions/erc4337"; +import { maxRedeem } from "thirdweb/extensions/erc4626"; -const events = await getContractEvents({ -contract, -events: [ - accountDeployedEvent({ - userOpHash: ..., - sender: ..., -}) -], +const result = await maxRedeem({ + contract, + owner: ..., }); ``` ```ts -function accountDeployedEvent( - filters: Partial, -): 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"; -}>; +function maxRedeem( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the maxRedeem function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC4337.addAdmin +## ERC4626.maxWithdraw -Adds admin permissions for a specified address. +Calls the "maxWithdraw" function on the contract. ### Example ```ts -import { addAdmin } from "thirdweb/extensions/erc4337"; -import { sendTransaction } from "thirdweb"; +import { maxWithdraw } from "thirdweb/extensions/erc4626"; -const transaction = addAdmin({ - contract, - account, - adminAddress: "0x...", +const result = await maxWithdraw({ + contract, + owner: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function addAdmin( - options: BaseTransactionOptions, -): PreparedTransaction; +function maxWithdraw( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the addAdmin function. +The options for the maxWithdraw function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -The transaction object to be sent. +The parsed result of the function call. --- -## ERC4337.addSessionKey +## ERC4626.mint -Adds session key permissions for a specified address. +Prepares a transaction to call the "mint" function on the contract. ### Example ```ts -import { addSessionKey } from "thirdweb/extensions/erc4337"; import { sendTransaction } from "thirdweb"; +import { mint } from "thirdweb/extensions/erc4626"; -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 - }, +const transaction = mint({ + contract, + shares: ..., + receiver: ..., + overrides: { + ... + } }); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function addSessionKey( - options: BaseTransactionOptions, +function mint( + options: BaseTransactionOptions< + MintParams | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for the removeSessionKey function. +The options for the "mint" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + MintParams | { asyncParams: () => Promise } +>; ``` ### Returns @@ -21579,269 +19671,249 @@ let returnType: PreparedTransaction< >; ``` -The transaction object to be sent. +A prepared transaction object. --- -## ERC4337.adminUpdatedEvent +## ERC4626.previewDeposit -Creates an event object for the AdminUpdated event. +Calls the "previewDeposit" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { adminUpdatedEvent } from "thirdweb/extensions/erc4337"; +import { previewDeposit } from "thirdweb/extensions/erc4626"; -const events = await getContractEvents({ -contract, -events: [ - adminUpdatedEvent({ - signer: ..., -}) -], +const result = await previewDeposit({ + contract, + assets: ..., }); ``` ```ts -function adminUpdatedEvent( - filters: Partial, -): 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"; -}>; +function previewDeposit( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the previewDeposit function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC4337.createAccount +## ERC4626.previewMint -Prepares a transaction to call the "createAccount" function on the contract. +Calls the "previewMint" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { createAccount } from "thirdweb/extensions/erc4337"; +import { previewMint } from "thirdweb/extensions/erc4626"; -const transaction = createAccount({ +const result = await previewMint({ contract, - admin: ..., - data: ..., - overrides: { - ... - } + shares: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function createAccount( - options: BaseTransactionOptions< - | CreateAccountParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function previewMint( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "createAccount" function. +The options for the previewMint function. #### Type ```ts -let options: BaseTransactionOptions< - | CreateAccountParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## ERC4337.getAccounts +## ERC4626.previewRedeem -Calls the "getAccounts" function on the contract. +Calls the "previewRedeem" function on the contract. ### Example ```ts -import { getAccounts } from "thirdweb/extensions/erc4337"; +import { previewRedeem } from "thirdweb/extensions/erc4626"; -const result = await getAccounts({ +const result = await previewRedeem({ contract, - start: ..., - end: ..., + shares: ..., }); ``` ```ts -function getAccounts(options: BaseTransactionOptions) : Promise> +function previewRedeem( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getAccounts function. +The options for the previewRedeem function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise> +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4337.getAccountsOfSigner +## ERC4626.previewWithdraw -Calls the "getAccountsOfSigner" function on the contract. +Calls the "previewWithdraw" function on the contract. ### Example ```ts -import { getAccountsOfSigner } from "thirdweb/extensions/erc4337"; +import { previewWithdraw } from "thirdweb/extensions/erc4626"; -const result = await getAccountsOfSigner({ +const result = await previewWithdraw({ contract, - signer: ..., + assets: ..., }); ``` ```ts -function getAccountsOfSigner(options: BaseTransactionOptions) : Promise> +function previewWithdraw( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getAccountsOfSigner function. +The options for the previewWithdraw function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise> +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4337.getAllAccounts +## ERC4626.redeem -Calls the "getAllAccounts" function on the contract. +Prepares a transaction to call the "redeem" function on the contract. ### Example ```ts -import { getAllAccounts } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; +import { redeem } from "thirdweb/extensions/erc4626"; -const result = await getAllAccounts({ - contract, +const transaction = redeem({ + contract, + shares: ..., + receiver: ..., + owner: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getAllAccounts(options: BaseTransactionOptions) : Promise> +function redeem( + options: BaseTransactionOptions< + RedeemParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the getAllAccounts function. +The options for the "redeem" function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + RedeemParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise> +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## ERC4337.getAllActiveSigners +## ERC4626.totalAssets -Calls the "getAllActiveSigners" function on the contract. +Calls the "totalAssets" function on the contract. ### Example ```ts -import { getAllActiveSigners } from "thirdweb/extensions/erc4337"; +import { totalAssets } from "thirdweb/extensions/erc4626"; -const result = await getAllActiveSigners({ +const result = await totalAssets({ contract, }); ``` ```ts -function getAllActiveSigners(options: BaseTransactionOptions) : Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +function totalAssets( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getAllActiveSigners function. +The options for the totalAssets function. #### Type @@ -21852,1639 +19924,1762 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4337.getAllAdmins +## ERC4626.withdraw -Calls the "getAllAdmins" function on the contract. +Prepares a transaction to call the "withdraw" function on the contract. ### Example ```ts -import { getAllAdmins } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; +import { withdraw } from "thirdweb/extensions/erc4626"; -const result = await getAllAdmins({ - contract, +const transaction = withdraw({ + contract, + assets: ..., + receiver: ..., + owner: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getAllAdmins(options: BaseTransactionOptions) : Promise> +function withdraw( + options: BaseTransactionOptions< + WithdrawParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the getAllAdmins function. +The options for the "withdraw" function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + WithdrawParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise> +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## ERC4337.getAllSigners +## ERC4626.withdrawEvent -Calls the "getAllSigners" function on the contract. +Creates an event object for the Withdraw event. ### Example ```ts -import { getAllSigners } from "thirdweb/extensions/erc4337"; +import { getContractEvents } from "thirdweb"; +import { withdrawEvent } from "thirdweb/extensions/erc4626"; -const result = await getAllSigners({ - contract, +const events = await getContractEvents({ +contract, +events: [ + withdrawEvent({ + caller: ..., + receiver: ..., + owner: ..., +}) +], }); ``` ```ts -function getAllSigners(options: BaseTransactionOptions) : Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +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 -The options for the getAllSigners function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ + caller: string; + owner: string; + receiver: string; +}>; ``` ### Returns ```ts -let returnType: Promise; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }>> +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 parsed result of the function call. +The prepared event object. +--- +## FARCASTER --- -## ERC4337.getPermissionsForSigner +## FARCASTER.addSigner -Calls the "getPermissionsForSigner" function on the contract. +Adds farcaster signer for the given account. ### Example ```ts -import { getPermissionsForSigner } from "thirdweb/extensions/erc4337"; +import { addSigner } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; -const result = await getPermissionsForSigner({ - contract, - signer: ..., +const transaction = addSigner({ + client, + appAccount, + signerPublicKey, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function getPermissionsForSigner(options: BaseTransactionOptions) : Promise<{ approvedTargets: readonly Array; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }> +function addSigner( + options: AddSignerParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; ``` ### Parameters -The options for the getPermissionsForSigner function. +The options for adding the signer. #### Type ```ts -let options: BaseTransactionOptions; +let options: Prettify< + { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + signerPublicKey: Hex; + } & ( + | { appAccount: Account } + | { + appAccountAddress: Address; + deadline: bigint; + signedKeyRequestMetadata: Hex; + } + ) +>; ``` ### Returns ```ts -let returnType: Promise<{ approvedTargets: readonly Array; endTimestamp: bigint; nativeTokenLimitPerTransaction: bigint; signer: string; startTimestamp: bigint }> +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object to add the signer to the account. --- -## ERC4337.getUserOpHash +## FARCASTER.addSignerFor -Calls the "getUserOpHash" function on the contract. +Adds farcaster signer for a given user. Helpful if you want to cover the gas fee for a user. ### Example ```ts -import { getUserOpHash } from "thirdweb/extensions/erc4337"; +import { addSignerFor } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; -const result = await getUserOpHash({ - contract, - userOp: ..., +const transaction = addSignerFor({ + client, + appAccount, + userAccount, + signerPublicKey, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function getUserOpHash( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function addSignerFor( + options: AddSignerForParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; ``` ### Parameters -The options for the getUserOpHash function. +The options for adding the signer. #### Type ```ts -let options: BaseTransactionOptions; -``` - -### Returns - -```ts -let returnType: Promise<`0x${string}`>; -``` - -The parsed result of the function call. ---- - -## ERC4337.isAccountDeployed - -Adds admin permissions for a specified address. - -### Example - -```ts -import { isAccountDeployed } from "thirdweb/extensions/erc4337"; - -const isDeployed = await isAccountDeployed({ - contract, - account, - adminSigner: "0x...", -}); - -await isAccountDeployed({ contract, adminSigner }); +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 -function isAccountDeployed( - options: BaseTransactionOptions, -): Promise; +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; ``` -### Parameters +A prepared transaction object to add the signer to the account. +--- -The options for the addAdmin function. +## FARCASTER.createEd25519Keypair -#### Type +Generates an Ed25519 keypair to be used as an account signer. + +### Example ```ts -let options: BaseTransactionOptions; +createSigner(); +``` + +```ts +function createEd25519Keypair(): Promise; ``` ### Returns ```ts -let returnType: Promise; +let returnType: { privateKey: Hex; publicKey: Hex }; ``` -The transaction object to be sent. +A promise resolving to the generated keypair. --- -## ERC4337.isActiveSigner +## FARCASTER.encodeSignedKeyRequestMetadata -Calls the "isActiveSigner" function on the contract. +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 -import { isActiveSigner } from "thirdweb/extensions/erc4337"; - -const result = await isActiveSigner({ - contract, - signer: ..., +const encodedMetadata = encodeSignedKeyRequestMetadata({ + requestSigner: "0x123...", + keyRequestSignature: "0xabcd...", + requestFid: 123456789n, + deadline: 1657758061n, }); ``` ```ts -function isActiveSigner( - options: BaseTransactionOptions, -): Promise; +function encodeSignedKeyRequestMetadata(options: { + deadline: bigint; + keyRequestSignature: `0x${string}`; + requestFid: bigint; + requestSigner: string; +}): Hex; ``` ### Parameters -The options for the isActiveSigner function. +The options for encoding the signed key request metadata. #### Type ```ts -let options: BaseTransactionOptions; +let options: { + deadline: bigint; + keyRequestSignature: `0x${string}`; + requestFid: bigint; + requestSigner: string; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: ox__Hex.Hex; ``` -The parsed result of the function call. +The encoded ABI parameters as a hexadecimal string. --- -## ERC4337.isAddAdminSupported +## FARCASTER.getAddData -Checks if the `isAddAdminSupported` method is supported by the given contract. +Prepares the data required for signing an Add message according to EIP-712. ### Example -```ts -import { isAddAdminSupported } from "thirdweb/extensions/erc4337"; +```typescript +const message: AddMessage = { + owner: "0xYourAddress", + keyType: 1, + key: "0xYourPublicKey", + metadataType: 1, + metadata: "0xYourMetadata", + nonce: BigInt("YourNonce"), + deadline: BigInt("YourDeadline"), +}; -const supported = isAddAdminSupported(["0x..."]); +const data = getAddData(message); ``` ```ts -function isAddAdminSupported( - availableSelectors: Array, -): boolean; +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 -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. +The AddMessage object containing the message to be signed. #### Type ```ts -let availableSelectors: Array; +let message: { + deadline: bigint; + key: Hex; + keyType: number; + metadata: Hex; + metadataType: number; + nonce: bigint; + owner: Address; +}; ``` ### Returns ```ts -let returnType: boolean; +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" }, + ]; + }; +}; ``` -A boolean indicating if the `isAddAdminSupported` method is supported. +The data object structured according to EIP-712, ready for signing. --- -## ERC4337.isAddSessionKeySupported +## FARCASTER.getBundler -Checks if the `isAddSessionKeySupported` method is supported by the given contract. +Retrieves the Bundler contract. ### Example ```ts -import { isAddSessionKeySupported } from "thirdweb/extensions/erc4337"; +import { getBundler } from "thirdweb/extensions/farcaster"; -const supported = isAddSessionKeySupported(["0x..."]); +const bundler = await getBundler({ + client, +}); ``` ```ts -function isAddSessionKeySupported( - availableSelectors: Array, -): boolean; +function getBundler( + options: FarcasterContractOptions, +): ThirdwebContract; ``` ### 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. +The thirdweb client and an optional custom chain. #### Type ```ts -let availableSelectors: Array; +let options: { chain?: Chain; client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Readonly>; ``` -A boolean indicating if the `isAddSessionKeySupported` method is supported. +The Bundler contract instance. --- -## ERC4337.isAdmin +## FARCASTER.getFid -Calls the "isAdmin" function on the contract. +Retrieves the current fid for an account. ### Example ```ts -import { isAdmin } from "thirdweb/extensions/erc4337"; +import { getFid } from "thirdweb/extensions/farcaster"; -const result = await isAdmin({ - contract, - signer: ..., +const price = await getFid({ + client, + address, }); ``` ```ts -function isAdmin( - options: BaseTransactionOptions, -): Promise; +function getFid(options: GetFidParams): Promise; ``` ### Parameters -The options for the isAdmin function. +Parameters to pass to the function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { + address: Address; + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +A promise that resolves to the account's fid, if one exists, otherwise 0. --- -## ERC4337.isCreateAccountSupported +## FARCASTER.getIdGateway -Checks if the `createAccount` method is supported by the given contract. +Retrieves the IdGateway contract. ### Example ```ts -import { isCreateAccountSupported } from "thirdweb/extensions/erc4337"; +import { getIdGatway } from "thirdweb/extensions/farcaster"; -const supported = isCreateAccountSupported(["0x..."]); +const idGateway = await getIdGateway({ + client, +}); ``` ```ts -function isCreateAccountSupported( - availableSelectors: Array, -): boolean; +function getIdGateway( + options: FarcasterContractOptions, +): ThirdwebContract; ``` ### 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. +The thirdweb client and an optional custom chain. #### Type ```ts -let availableSelectors: Array; +let options: { chain?: Chain; client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Readonly>; ``` -A boolean indicating if the `createAccount` method is supported. +The IdGateway contract instance. --- -## ERC4337.isGetAccountsOfSignerSupported +## FARCASTER.getIdRegistry -Checks if the `getAccountsOfSigner` method is supported by the given contract. +Retrieves the IdRegistry contract. ### Example ```ts -import { isGetAccountsOfSignerSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAccountsOfSignerSupported(["0x..."]); +import { getIdRegistry } from "thirdweb/extensions/farcaster"; + +const idRegistry = await getIdRegistry({ + client, +}); ``` ```ts -function isGetAccountsOfSignerSupported( - availableSelectors: Array, -): boolean; +function getIdRegistry( + options: FarcasterContractOptions, +): ThirdwebContract; ``` ### 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. +The thirdweb client and an optional custom chain. #### Type ```ts -let availableSelectors: Array; +let options: { chain?: Chain; client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Readonly>; ``` -A boolean indicating if the `getAccountsOfSigner` method is supported. +The IdRegistry contract instance. --- -## ERC4337.isGetAccountsSupported +## FARCASTER.getKeyGateway -Checks if the `getAccounts` method is supported by the given contract. +Retrieves the KeyGateway contract. ### Example ```ts -import { isGetAccountsSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAccountsSupported(["0x..."]); +import { getKeyGateway } from "thirdweb/extensions/farcaster"; + +const keyGateway = await getKeyGateway({ + client, +}); ``` ```ts -function isGetAccountsSupported( - availableSelectors: Array, -): boolean; +function getKeyGateway( + options: FarcasterContractOptions, +): ThirdwebContract; ``` ### 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. +The thirdweb client and an optional custom chain. #### Type ```ts -let availableSelectors: Array; +let options: { chain?: Chain; client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Readonly>; ``` -A boolean indicating if the `getAccounts` method is supported. +The KeyGateway contract instance. --- -## ERC4337.isGetAllAccountsSupported +## FARCASTER.getKeyRequestData -Checks if the `getAllAccounts` method is supported by the given contract. +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 -import { isGetAllAccountsSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAllAccountsSupported(["0x..."]); +const message = { + requestFid: 123456789n, + key: "0x04bfc...", + deadline: 1657758061n, +}; +const eip712Data = getKeyRequestData(message); ``` ```ts -function isGetAllAccountsSupported( - availableSelectors: Array, -): boolean; +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 -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. +The message to be signed, containing the request FID, key, and deadline. #### Type ```ts -let availableSelectors: Array; +let message: { deadline: bigint; key: Hex; requestFid: bigint }; ``` ### Returns ```ts -let returnType: boolean; +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 }>; + }; +}; ``` -A boolean indicating if the `getAllAccounts` method is supported. +An object containing the domain, types, primary type, and the message for EIP-712 signing. --- -## ERC4337.isGetAllActiveSignersSupported +## FARCASTER.getNonce -Checks if the `getAllActiveSigners` method is supported by the given contract. +Retrieves the current key gateway nonce for an account. ### Example ```ts -import { isGetAllActiveSignersSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAllActiveSignersSupported(["0x..."]); +import { getNonce } from "thirdweb/extensions/farcaster"; + +const nonce = await getNonce({ + client, + address, +}); ``` ```ts -function isGetAllActiveSignersSupported( - availableSelectors: Array, -): boolean; +function getNonce(options: GetNonceParams): Promise; ``` ### 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. +Parameters to pass to the function. #### Type ```ts -let availableSelectors: Array; +let options: { + address: Address; + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; +}; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getAllActiveSigners` method is supported. +A promise that resolves to the current nonce. --- -## ERC4337.isGetAllAdminsSupported +## FARCASTER.getRegisterData -Checks if the `getAllAdmins` method is supported by the given contract. +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 { isGetAllAdminsSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAllAdminsSupported(["0x..."]); +import { getRegisterData } from "thirdweb/extensions/farcaster"; + +const data = getRegisterData(message); ``` ```ts -function isGetAllAdminsSupported( - availableSelectors: Array, -): boolean; +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 -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. +The register message containing the necessary information for the signature. #### Type ```ts -let availableSelectors: Array; +let message: { + deadline: bigint; + nonce: bigint; + recovery: Address; + to: Address; +}; ``` ### Returns ```ts -let returnType: boolean; +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" }, + ]; + }; +}; ``` -A boolean indicating if the `getAllAdmins` method is supported. +An object containing the EIP-712 domain, types, and the message, ready to be signed. --- -## ERC4337.isGetAllSignersSupported +## FARCASTER.getRegistrationPrice -Checks if the `getAllSigners` method is supported by the given contract. +Retrieves the current cost to register a Farcaster fid in wei. ### Example ```ts -import { isGetAllSignersSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAllSignersSupported(["0x..."]); +import { getRegistrationPrice } from "thirdweb/extensions/farcaster"; + +const price = await getRegistrationPrice({ + client, +}); ``` ```ts -function isGetAllSignersSupported( - availableSelectors: Array, -): boolean; +function getRegistrationPrice( + options: GetRegistrationPriceParams, +): Promise; ``` ### 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. +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 availableSelectors: Array; +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | number | string; +}; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getAllSigners` method is supported. +A promise that resolves to the current cost of a Farcaster fid in wei. --- -## ERC4337.isIsAccountDeployedSupported +## FARCASTER.getSignedKeyRequestMetadata -Checks if the `getAddress` method is supported by the given contract. +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 { isGetAddressSupported } from "thirdweb/extensions/erc4337"; -const supported = isGetAddressSupported(["0x..."]); +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 isIsAccountDeployedSupported( - availableSelectors: Array, -): boolean; +function getSignedKeyRequestMetadata( + options: SignedKeyRequestMetadataOptions, +): Promise; ``` ### 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. +The options for signing the key request or using an existing signature. #### Type ```ts -let availableSelectors: Array; +let options: Prettify< + { message: SignedKeyRequestMessage } & ( + | { account: Account } + | { accountAddress: Address; keyRequestSignature: Hex } + ) +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: ox__Hex.Hex; ``` -A boolean indicating if the `getAddress` method is supported. +A promise that resolves to the hexadecimal string of the encoded ABI parameters. --- -## ERC4337.isIsActiveSignerSupported +## FARCASTER.getStoragePrice -Checks if the `isActiveSigner` method is supported by the given contract. +Retrieves the current cost to register a Farcaster fid in wei. ### Example ```ts -import { isIsActiveSignerSupported } from "thirdweb/extensions/erc4337"; -const supported = isIsActiveSignerSupported(["0x..."]); +import { getStoragePrice } from "thirdweb/extensions/farcaster"; + +const price = await getStoragePrice({ + client, +}); ``` ```ts -function isIsActiveSignerSupported( - availableSelectors: Array, -): boolean; +function getStoragePrice( + options: GetStoragePriceParams, +): Promise; ``` ### 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. +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 availableSelectors: Array; +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + units?: bigint | number | string; +}; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `isActiveSigner` method is supported. +A promise that resolves to the current cost of a Farcaster fid in USD. --- -## ERC4337.isIsAdminSupported +## FARCASTER.getStorageRegistry -Checks if the `isAdmin` method is supported by the given contract. +Retrieves the StorageRegistry contract. ### Example ```ts -import { isIsAdminSupported } from "thirdweb/extensions/erc4337"; -const supported = isIsAdminSupported(["0x..."]); +import { getStorageRegistry } from "thirdweb/extensions/farcaster"; + +const storageRegistry = await getStorageRegistry({ + client, +}); ``` ```ts -function isIsAdminSupported( - availableSelectors: Array, -): boolean; +function getStorageRegistry( + options: FarcasterContractOptions, +): ThirdwebContract; ``` ### 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. +The thirdweb client and an optional custom chain. #### Type ```ts -let availableSelectors: Array; +let options: { chain?: Chain; client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Readonly>; ``` -A boolean indicating if the `isAdmin` method is supported. +The StorageRegistry contract instance. --- -## ERC4337.isRegistered +## FARCASTER.getUsdRegistrationPrice -Calls the "isRegistered" function on the contract. +Retrieves the current cost to register a Farcaster fid in USD. ### Example ```ts -import { isRegistered } from "thirdweb/extensions/erc4337"; +import { getUsdRegistrationPrice } from "thirdweb/extensions/farcaster"; -const result = await isRegistered({ - contract, - account: ..., +const price = await getUsdRegistrationPrice({ + client, }); ``` ```ts -function isRegistered( - options: BaseTransactionOptions, -): Promise; +function getUsdRegistrationPrice( + options: GetUsdRegistrationPriceParams, +): Promise; ``` ### Parameters -The options for the isRegistered function. +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: BaseTransactionOptions; +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | number | string; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +A promise that resolves to the current cost of a Farcaster fid in USD. --- -## ERC4337.isRemoveAdminSupported +## FARCASTER.getUsdStoragePrice -Checks if the `isRemoveAdminSupported` method is supported by the given contract. +Retrieves the current cost to register a Farcaster fid in USD. ### Example ```ts -import { isRemoveAdminSupported } from "thirdweb/extensions/erc4337"; +import { getUsdStoragePrice } from "thirdweb/extensions/farcaster"; -const supported = isRemoveAdminSupported(["0x..."]); +const price = await getUsdStoragePrice({ + client, +}); ``` ```ts -function isRemoveAdminSupported( - availableSelectors: Array, -): boolean; +function getUsdStoragePrice( + options: GetUsdStoragePriceParams, +): Promise; ``` ### 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. +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 availableSelectors: Array; +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + units?: bigint | number | string; +}; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `isRemoveAdminSupported` method is supported. +A promise that resolves to the current cost of a Farcaster fid in USD. --- -## ERC4337.isRemoveSessionKeySupported +## FARCASTER.registerFid -Checks if the `isRemoveSessionKeySupported` method is supported by the given contract. +Registers a Farcaster fid for the given wallet. ### Example ```ts -import { isRemoveSessionKeySupported } from "thirdweb/extensions/erc4337"; +import { registerFid } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; -const supported = isRemoveSessionKeySupported(["0x..."]); +const transaction = registerFid({ + client, + recoveryAddress, +}); + +await sendTransaction({ transaction, account }); ``` ```ts -function isRemoveSessionKeySupported( - availableSelectors: Array, -): boolean; +function registerFid( + options: RegisterFidParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; ``` ### 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. +The options for registering an account. #### Type ```ts -let availableSelectors: Array; +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + extraStorage?: bigint | string | number; + recoveryAddress: Address; +}; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `isRemoveSessionKeySupported` method is supported. +A prepared transaction object to register the account. --- -## ERC4337.isTotalAccountsSupported +## FARCASTER.registerFidAndSigner -Checks if the `totalAccounts` method is supported by the given contract. +Registers a Farcaster fid and signer for the given wallet using the provided app account. ### Example ```ts -import { isTotalAccountsSupported } from "thirdweb/extensions/erc4337"; -const supported = isTotalAccountsSupported(["0x..."]); +import { registerFidAndSigner } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; + +const transaction = registerFidAndSigner({ + client, + userAccount, + appAccount, + recoveryAddress, + signerPublicKey, +}); + +await sendTransaction({ transaction, account }); ``` ```ts -function isTotalAccountsSupported( - availableSelectors: Array, -): boolean; +function registerFidAndSigner( + options: RegisterFidAndSignerParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; ``` ### 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. +The options for registering an account. #### Type ```ts -let availableSelectors: Array; +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: boolean; +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `totalAccounts` method is supported. +A prepared transaction object to register the account. --- -## ERC4337.isValidateUserOpSupported +## FARCASTER.rentStorage -Checks if the `validateUserOp` method is supported by the given contract. +Rent storage for the provided farcaster fid. ### Example ```ts -import { isValidateUserOpSupported } from "thirdweb/extensions/erc4337"; +import { rentStorage } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; -const supported = isValidateUserOpSupported(["0x..."]); +const transaction = rentStorage({ + client, + fid, + units, +}); + +await sendTransaction({ transaction, account }); ``` ```ts -function isValidateUserOpSupported( - availableSelectors: Array, -): boolean; +function rentStorage( + options: RentStorageParams, +): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; ``` ### 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. +The options for calling the `rentStorage` function. #### Type ```ts -let availableSelectors: Array; +let options: { + chain?: Chain; + client: ThirdwebClient; + disableCache?: boolean; + fid: bigint | number | string; + units?: bigint | number | string; +}; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + [], + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `validateUserOp` method is supported. +A prepared transaction object to rent the storage. --- -## ERC4337.predictAccountAddress +## FARCASTER.signAdd -Calls the "getAddress" function on the contract. +Signs an Add message using the account's signTypedData method. ### Example -```ts -import { getAddress } from "thirdweb/extensions/erc4337"; - -const result = await getAddress({ - contract, - adminSigner: ..., - data: ..., +```typescript +const signedMessage = await signAdd({ + account: yourAccount, + message: yourAddMessage, }); ``` ```ts -function predictAccountAddress( - options: BaseTransactionOptions, -): Promise; +function signAdd(options: SignAddOptions): Promise; ``` ### Parameters -The options for the getAddress function. +The options for signing the Add message. #### Type ```ts -let options: BaseTransactionOptions; +let options: { account: Account; message: AddMessage }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: ox__Hex.Hex; ``` -The parsed result of the function call. +A promise that resolves to the signature of the Add message. --- -## ERC4337.removeAdmin +## FARCASTER.signKeyRequest -Removes admin permissions for a specified address. +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 -import { removeAdmin } from "thirdweb/extensions/erc4337"; -import { sendTransaction } from "thirdweb"; - -const transaction = removeAdmin({ - contract, - account, - adminAddress: "0x...", -}); +const message = { + requestFid: 123456789n, + key: "0x04bfc...", + deadline: 1657758061n, +}; -await sendTransaction({ transaction, account }); +const signature = signKeyRequest({ account: signerAccount, message }); ``` ```ts -function removeAdmin( - options: BaseTransactionOptions, -): PreparedTransaction; +function signKeyRequest(options: SignKeyRequestOptions): Promise; ``` ### Parameters -The options for the removeAdmin function. +The options for signing the key request, including the account and the message. #### Type ```ts -let options: BaseTransactionOptions; +let options: { account: Account; message: SignedKeyRequestMessage }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: ox__Hex.Hex; ``` -The transaction object to be sent. +A promise that resolves to the signature of the key request. --- -## ERC4337.removeSessionKey +## FARCASTER.signRegister -Removes session key permissions for a specified address. +Signs the register message for Farcaster ID Gateway. ### Example ```ts -import { removeSessionKey } from "thirdweb/extensions/erc4337"; -import { sendTransaction } from "thirdweb"; - -const transaction = removeSessionKey({ - contract, - account, - sessionKeyAddress, -}); - -await sendTransaction({ transaction, account }); +const signature = await signRegister({ account, message }); ``` ```ts -function removeSessionKey( - options: BaseTransactionOptions, -): PreparedTransaction; +function signRegister(options: SignRegisterOptions): Promise; ``` ### Parameters -The options for the removeSessionKey function. +The signing options. #### Type ```ts -let options: BaseTransactionOptions; +let options: { account: Account; message: RegisterMessage }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: ox__Hex.Hex; ``` -The transaction object to be sent. +A promise that resolves to the signature. --- -## ERC4337.shouldUpdateSessionKey +## FARCASTER.idGateway -Checks if the session key should be updated. +Calls the "idGateway" function on the contract. ### Example ```ts -import { shouldUpdateSessionKey } from "thirdweb/extensions/erc4337"; +import { idGateway } from "thirdweb/extensions/farcaster"; -const shouldUpdate = await shouldUpdateSessionKey({ - accountContract, - sessionKeyAddress, - newPermissions, +const result = await idGateway({ + contract, }); ``` ```ts -function shouldUpdateSessionKey(args: { - accountContract: Readonly; - newPermissions: AccountPermissions; - sessionKeyAddress: string; -}): Promise; +function idGateway(options: BaseTransactionOptions): Promise; ``` ### Parameters +The options for the idGateway function. + #### Type ```ts -let args: { - accountContract: Readonly; - newPermissions: AccountPermissions; - sessionKeyAddress: string; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A boolean indicating if the session key should be updated. +The parsed result of the function call. --- -## ERC4337.signerPermissionsUpdatedEvent +## FARCASTER.keyGateway -Creates an event object for the SignerPermissionsUpdated event. +Calls the "keyGateway" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { signerPermissionsUpdatedEvent } from "thirdweb/extensions/erc4337"; +import { keyGateway } from "thirdweb/extensions/farcaster"; -const events = await getContractEvents({ -contract, -events: [ - signerPermissionsUpdatedEvent({ - authorizingSigner: ..., - targetSigner: ..., -}) -], +const result = await keyGateway({ + contract, }); ``` ```ts -function signerPermissionsUpdatedEvent( - filters: Partial, -): 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"; -}>; +function keyGateway(options: BaseTransactionOptions): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the keyGateway function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## ERC4337.simulateHandleOp +## FARCASTER.price -Prepares a transaction to call the "simulateHandleOp" function on the contract. +Calls the "price" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { simulateHandleOp } from "thirdweb/extensions/erc4337"; +import { price } from "thirdweb/extensions/farcaster"; -const transaction = simulateHandleOp({ +const result = await price({ contract, - op: ..., - target: ..., - targetCallData: ..., - overrides: { - ... - } + extraStorage: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function simulateHandleOp( - options: BaseTransactionOptions< - | SimulateHandleOpParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function price( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "simulateHandleOp" function. +The options for the price function. #### Type ```ts -let options: BaseTransactionOptions< - | SimulateHandleOpParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## ERC4337.totalAccounts +## FARCASTER.register -Calls the "totalAccounts" function on the contract. +Prepares a transaction to call the "register" function on the contract. ### Example ```ts -import { totalAccounts } from "thirdweb/extensions/erc4337"; +import { sendTransaction } from "thirdweb"; +import { register } from "thirdweb/extensions/farcaster"; -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. ---- - -## ERC4337.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: ..., -}) -], +const transaction = register({ + contract, + recovery: ..., + extraStorage: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function userOperationEventEvent( - filters: Partial, -): 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"; -}>; +function register( + options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The options for the "register" function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## ERC4337.userOperationRevertReasonEvent +## FARCASTER.idRegistry -Creates an event object for the UserOperationRevertReason event. +Calls the "idRegistry" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { userOperationRevertReasonEvent } from "thirdweb/extensions/erc4337"; +import { idRegistry } from "thirdweb/extensions/farcaster"; -const events = await getContractEvents({ -contract, -events: [ - userOperationRevertReasonEvent({ - userOpHash: ..., - sender: ..., -}) -], +const result = await idRegistry({ + contract, }); ``` ```ts -function userOperationRevertReasonEvent( - filters: Partial, -): 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"; -}>; +function idRegistry(options: BaseTransactionOptions): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the idRegistry function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. ---- -## ERC4626 +The parsed result of the function call. --- -## ERC4626.asset +## FARCASTER.price -Calls the "asset" function on the contract. +Calls the "price" function on the contract. ### Example ```ts -import { asset } from "thirdweb/extensions/erc4626"; +import { price } from "thirdweb/extensions/farcaster"; -const result = await asset({ - contract, +const result = await price({ + contract, + extraStorage: ..., }); ``` ```ts -function asset(options: BaseTransactionOptions): Promise; +function price( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the asset function. +The options for the price function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4626.convertToAssets +## FARCASTER.register -Calls the "convertToAssets" function on the contract. +Prepares a transaction to call the "register" function on the contract. ### Example ```ts -import { convertToAssets } from "thirdweb/extensions/erc4626"; +import { sendTransaction } from "thirdweb"; +import { register } from "thirdweb/extensions/farcaster"; -const result = await convertToAssets({ +const transaction = register({ contract, - shares: ..., + recovery: ..., + extraStorage: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function convertToAssets( - options: BaseTransactionOptions, -): Promise; +function register( + options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the convertToAssets function. +The options for the "register" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + RegisterParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## ERC4626.convertToShares +## FARCASTER.REGISTER\_TYPEHASH -Calls the "convertToShares" function on the contract. +Calls the "REGISTER\_TYPEHASH" function on the contract. ### Example ```ts -import { convertToShares } from "thirdweb/extensions/erc4626"; +import { REGISTER_TYPEHASH } from "thirdweb/extensions/farcaster"; -const result = await convertToShares({ - contract, - assets: ..., +const result = await REGISTER_TYPEHASH({ + contract, }); ``` ```ts -function convertToShares( - options: BaseTransactionOptions, -): Promise; +function REGISTER_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for the convertToShares function. +The options for the REGISTER\_TYPEHASH function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` The parsed result of the function call. --- -## ERC4626.deposit +## FARCASTER.registerFor -Prepares a transaction to call the "deposit" function on the contract. +Prepares a transaction to call the "registerFor" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { deposit } from "thirdweb/extensions/erc4626"; +import { registerFor } from "thirdweb/extensions/farcaster"; -const transaction = deposit({ +const transaction = registerFor({ contract, - assets: ..., - receiver: ..., + to: ..., + recovery: ..., + deadline: ..., + sig: ..., + extraStorage: ..., overrides: { ... } @@ -23495,22 +21690,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function deposit( +function registerFor( options: BaseTransactionOptions< - DepositParams | { asyncParams: () => Promise } + | RegisterForParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "deposit" function. +The options for the "registerFor" function. #### Type ```ts let options: BaseTransactionOptions< - DepositParams | { asyncParams: () => Promise } + | RegisterForParams + | { asyncParams: () => Promise } >; ``` @@ -23527,79 +21724,42 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ERC4626.depositEvent +## FARCASTER.setStorageRegistryEvent -Creates an event object for the Deposit event. +Creates an event object for the SetStorageRegistry event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { depositEvent } from "thirdweb/extensions/erc4626"; +import { setStorageRegistryEvent } from "thirdweb/extensions/farcaster"; const events = await getContractEvents({ -contract, -events: [ - depositEvent({ - caller: ..., - owner: ..., -}) -], + contract, + events: [setStorageRegistryEvent()], }); ``` ```ts -function depositEvent( - filters: Partial, -): PreparedEvent<{ +function setStorageRegistryEvent(): 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: "oldStorageRegistry"; readonly type: "address" }, + { readonly name: "newStorageRegistry"; readonly type: "address" }, ]; - readonly name: "Deposit"; + readonly name: "SetStorageRegistry"; readonly type: "event"; }>; ``` -### Parameters - -Optional filters to apply to the event. - -#### Type - -```ts -let filters: Partial; -``` - ### 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: "oldStorageRegistry"; readonly type: "address" }, + { readonly name: "newStorageRegistry"; readonly type: "address" }, ]; - readonly name: "Deposit"; + readonly name: "SetStorageRegistry"; readonly type: "event"; }>; ``` @@ -23607,371 +21767,441 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## ERC4626.maxDeposit +## FARCASTER.storageRegistry -Calls the "maxDeposit" function on the contract. +Calls the "storageRegistry" function on the contract. ### Example ```ts -import { maxDeposit } from "thirdweb/extensions/erc4626"; +import { storageRegistry } from "thirdweb/extensions/farcaster"; -const result = await maxDeposit({ - contract, - receiver: ..., +const result = await storageRegistry({ + contract, }); ``` ```ts -function maxDeposit( - options: BaseTransactionOptions, -): Promise; +function storageRegistry( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the maxDeposit function. +The options for the storageRegistry function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4626.maxMint +## FARCASTER.adminResetEvent -Calls the "maxMint" function on the contract. +Creates an event object for the AdminReset event. ### Example ```ts -import { maxMint } from "thirdweb/extensions/erc4626"; +import { getContractEvents } from "thirdweb"; +import { adminResetEvent } from "thirdweb/extensions/farcaster"; -const result = await maxMint({ - contract, - receiver: ..., +const events = await getContractEvents({ +contract, +events: [ + adminResetEvent({ + fid: ..., + key: ..., +}) +], }); ``` ```ts -function maxMint( - options: BaseTransactionOptions, -): Promise; +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 -The options for the maxMint function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ fid: bigint; key: `0x${string}` }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## ERC4626.maxRedeem +## FARCASTER.CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH -Calls the "maxRedeem" function on the contract. +Calls the "CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH" function on the contract. ### Example ```ts -import { maxRedeem } from "thirdweb/extensions/erc4626"; +import { CHANGE_RECOVERY_ADDRESS_TYPEHASH } from "thirdweb/extensions/farcaster"; -const result = await maxRedeem({ - contract, - owner: ..., +const result = await CHANGE_RECOVERY_ADDRESS_TYPEHASH({ + contract, }); ``` ```ts -function maxRedeem( - options: BaseTransactionOptions, -): Promise; +function CHANGE_RECOVERY_ADDRESS_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for the maxRedeem function. +The options for the CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` The parsed result of the function call. --- -## ERC4626.maxWithdraw +## FARCASTER.changeRecoveryAddress -Calls the "maxWithdraw" function on the contract. +Prepares a transaction to call the "changeRecoveryAddress" function on the contract. ### Example ```ts -import { maxWithdraw } from "thirdweb/extensions/erc4626"; +import { sendTransaction } from "thirdweb"; +import { changeRecoveryAddress } from "thirdweb/extensions/farcaster"; -const result = await maxWithdraw({ +const transaction = changeRecoveryAddress({ contract, - owner: ..., + recovery: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function maxWithdraw( - options: BaseTransactionOptions, -): Promise; +function changeRecoveryAddress( + options: BaseTransactionOptions< + | ChangeRecoveryAddressParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the maxWithdraw function. +The options for the "changeRecoveryAddress" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | ChangeRecoveryAddressParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## ERC4626.mint +## FARCASTER.changeRecoveryAddressEvent -Prepares a transaction to call the "mint" function on the contract. +Creates an event object for the ChangeRecoveryAddress event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { mint } from "thirdweb/extensions/erc4626"; +import { getContractEvents } from "thirdweb"; +import { changeRecoveryAddressEvent } from "thirdweb/extensions/farcaster"; -const transaction = mint({ - contract, - shares: ..., - receiver: ..., - overrides: { - ... - } +const events = await getContractEvents({ +contract, +events: [ + changeRecoveryAddressEvent({ + id: ..., + recovery: ..., +}) +], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function mint( - options: BaseTransactionOptions< - MintParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 -The options for the "mint" function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions< - MintParams | { asyncParams: () => Promise } ->; +let filters: Partial<{ id: bigint; recovery: string }>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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"; +}>; ``` -A prepared transaction object. +The prepared event object. --- -## ERC4626.previewDeposit +## FARCASTER.custodyOf -Calls the "previewDeposit" function on the contract. +Calls the "custodyOf" function on the contract. ### Example ```ts -import { previewDeposit } from "thirdweb/extensions/erc4626"; +import { custodyOf } from "thirdweb/extensions/farcaster"; -const result = await previewDeposit({ +const result = await custodyOf({ contract, - assets: ..., + fid: ..., }); ``` ```ts -function previewDeposit( - options: BaseTransactionOptions, -): Promise; +function custodyOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the previewDeposit function. +The options for the custodyOf function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4626.previewMint +## FARCASTER.freezeIdGatewayEvent -Calls the "previewMint" function on the contract. +Creates an event object for the FreezeIdGateway event. ### Example ```ts -import { previewMint } from "thirdweb/extensions/erc4626"; +import { getContractEvents } from "thirdweb"; +import { freezeIdGatewayEvent } from "thirdweb/extensions/farcaster"; -const result = await previewMint({ - contract, - shares: ..., +const events = await getContractEvents({ + contract, + events: [freezeIdGatewayEvent()], }); ``` ```ts -function previewMint( - options: BaseTransactionOptions, -): Promise; -``` - -### Parameters - -The options for the previewMint function. - -#### Type - -```ts -let options: BaseTransactionOptions; +function freezeIdGatewayEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "idGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeIdGateway"; + readonly type: "event"; +}>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "idGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeIdGateway"; + readonly type: "event"; +}>; ``` -The parsed result of the function call. +The prepared event object. --- -## ERC4626.previewRedeem +## FARCASTER.gatewayFrozen -Calls the "previewRedeem" function on the contract. +Calls the "gatewayFrozen" function on the contract. ### Example ```ts -import { previewRedeem } from "thirdweb/extensions/erc4626"; +import { gatewayFrozen } from "thirdweb/extensions/farcaster"; -const result = await previewRedeem({ - contract, - shares: ..., +const result = await gatewayFrozen({ + contract, }); ``` ```ts -function previewRedeem( - options: BaseTransactionOptions, -): Promise; +function gatewayFrozen( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the previewRedeem function. +The options for the gatewayFrozen function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## ERC4626.previewWithdraw +## FARCASTER.idCounter -Calls the "previewWithdraw" function on the contract. +Calls the "idCounter" function on the contract. ### Example ```ts -import { previewWithdraw } from "thirdweb/extensions/erc4626"; +import { idCounter } from "thirdweb/extensions/farcaster"; -const result = await previewWithdraw({ - contract, - assets: ..., +const result = await idCounter({ + contract, }); ``` ```ts -function previewWithdraw( - options: BaseTransactionOptions, -): Promise; +function idCounter(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the previewWithdraw function. +The options for the idCounter function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns @@ -23983,91 +22213,72 @@ let returnType: Promise; The parsed result of the function call. --- -## ERC4626.redeem +## FARCASTER.idGateway -Prepares a transaction to call the "redeem" function on the contract. +Calls the "idGateway" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { redeem } from "thirdweb/extensions/erc4626"; +import { idGateway } from "thirdweb/extensions/farcaster"; -const transaction = redeem({ - contract, - shares: ..., - receiver: ..., - owner: ..., - overrides: { - ... - } +const result = await idGateway({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function redeem( - options: BaseTransactionOptions< - RedeemParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function idGateway(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the "redeem" function. +The options for the idGateway function. #### Type ```ts -let options: BaseTransactionOptions< - RedeemParams | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## ERC4626.totalAssets +## FARCASTER.idOf -Calls the "totalAssets" function on the contract. +Calls the "idOf" function on the contract. ### Example ```ts -import { totalAssets } from "thirdweb/extensions/erc4626"; +import { idOf } from "thirdweb/extensions/farcaster"; -const result = await totalAssets({ - contract, +const result = await idOf({ + contract, + owner: ..., }); ``` ```ts -function totalAssets( - options: BaseTransactionOptions, +function idOf( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the totalAssets function. +The options for the idOf function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -24079,21 +22290,22 @@ let returnType: Promise; The parsed result of the function call. --- -## ERC4626.withdraw +## FARCASTER.recover -Prepares a transaction to call the "withdraw" function on the contract. +Prepares a transaction to call the "recover" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { withdraw } from "thirdweb/extensions/erc4626"; +import { recover } from "thirdweb/extensions/farcaster"; -const transaction = withdraw({ +const transaction = recover({ contract, - assets: ..., - receiver: ..., - owner: ..., + from: ..., + to: ..., + deadline: ..., + sig: ..., overrides: { ... } @@ -24104,22 +22316,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function withdraw( +function recover( options: BaseTransactionOptions< - WithdrawParams | { asyncParams: () => Promise } + RecoverParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "withdraw" function. +The options for the "recover" function. #### Type ```ts let options: BaseTransactionOptions< - WithdrawParams | { asyncParams: () => Promise } + RecoverParams | { asyncParams: () => Promise } >; ``` @@ -24136,52 +22348,50 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ERC4626.withdrawEvent +## FARCASTER.recoverEvent -Creates an event object for the Withdraw event. +Creates an event object for the Recover event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { withdrawEvent } from "thirdweb/extensions/erc4626"; +import { recoverEvent } from "thirdweb/extensions/farcaster"; const events = await getContractEvents({ contract, events: [ - withdrawEvent({ - caller: ..., - receiver: ..., - owner: ..., + recoverEvent({ + from: ..., + to: ..., + id: ..., }) ], }); ``` ```ts -function withdrawEvent( - filters: Partial, +function recoverEvent( + filters: Partial<{ from: string; id: bigint; to: string }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "caller"; + readonly name: "from"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "receiver"; + readonly name: "to"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "owner"; - readonly type: "address"; + readonly name: "id"; + readonly type: "uint256"; }, - { readonly name: "assets"; readonly type: "uint256" }, - { readonly name: "shares"; readonly type: "uint256" }, ]; - readonly name: "Withdraw"; + readonly name: "Recover"; readonly type: "event"; }>; ``` @@ -24193,7 +22403,7 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ from: string; id: bigint; to: string }>; ``` ### Returns @@ -24203,78 +22413,73 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "caller"; + readonly name: "from"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "receiver"; + readonly name: "to"; readonly type: "address"; }, { readonly indexed: true; - readonly name: "owner"; - readonly type: "address"; + readonly name: "id"; + readonly type: "uint256"; }, - { readonly name: "assets"; readonly type: "uint256" }, - { readonly name: "shares"; readonly type: "uint256" }, ]; - readonly name: "Withdraw"; + readonly name: "Recover"; readonly type: "event"; }>; ``` The prepared event object. --- -## FARCASTER ---- -## FARCASTER.addSigner +## FARCASTER.recoverFor -Adds farcaster signer for the given account. +Prepares a transaction to call the "recoverFor" function on the contract. ### Example ```ts -import { addSigner } from "thirdweb/extensions/farcaster"; import { sendTransaction } from "thirdweb"; +import { recoverFor } from "thirdweb/extensions/farcaster"; -const transaction = addSigner({ - client, - appAccount, - signerPublicKey, +const transaction = recoverFor({ + contract, + from: ..., + to: ..., + recoveryDeadline: ..., + recoverySig: ..., + toDeadline: ..., + toSig: ..., + overrides: { + ... + } }); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function addSigner( - options: AddSignerParams, -): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +function recoverFor( + options: BaseTransactionOptions< + | RecoverForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for adding the signer. +The options for the "recoverFor" function. #### Type ```ts -let options: Prettify< - { - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; - signerPublicKey: Hex; - } & ( - | { appAccount: Account } - | { - appAccountAddress: Address; - deadline: bigint; - signedKeyRequestMetadata: Hex; - } - ) +let options: BaseTransactionOptions< + RecoverForParams | { asyncParams: () => Promise } >; ``` @@ -24282,1095 +22487,1161 @@ let options: Prettify< ```ts let returnType: PreparedTransaction< - [], + any, AbiFunction, PrepareTransactionOptions >; ``` -A prepared transaction object to add the signer to the account. +A prepared transaction object. --- -## FARCASTER.addSignerFor +## FARCASTER.recoveryOf -Adds farcaster signer for a given user. Helpful if you want to cover the gas fee for a user. +Calls the "recoveryOf" function on the contract. ### Example ```ts -import { addSignerFor } from "thirdweb/extensions/farcaster"; -import { sendTransaction } from "thirdweb"; +import { recoveryOf } from "thirdweb/extensions/farcaster"; -const transaction = addSignerFor({ - client, - appAccount, - userAccount, - signerPublicKey, +const result = await recoveryOf({ + contract, + fid: ..., }); - -await sendTransaction({ transaction, account }); ``` ```ts -function addSignerFor( - options: AddSignerForParams, -): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +function recoveryOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for adding the signer. +The options for the recoveryOf function. #### 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 } - ) ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - [], - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object to add the signer to the account. +The parsed result of the function call. --- -## FARCASTER.createEd25519Keypair +## FARCASTER.registerEvent -Generates an Ed25519 keypair to be used as an account signer. +Creates an event object for the Register event. ### Example ```ts -createSigner(); +import { getContractEvents } from "thirdweb"; +import { registerEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ +contract, +events: [ + registerEvent({ + to: ..., + id: ..., +}) +], +}); ``` ```ts -function createEd25519Keypair(): Promise; +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: { privateKey: Hex; publicKey: Hex }; +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"; +}>; ``` -A promise resolving to the generated keypair. +The prepared event object. --- -## FARCASTER.encodeSignedKeyRequestMetadata +## FARCASTER.setIdCounterEvent -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. +Creates an event object for the SetIdCounter event. ### Example ```ts -const encodedMetadata = encodeSignedKeyRequestMetadata({ - requestSigner: "0x123...", - keyRequestSignature: "0xabcd...", - requestFid: 123456789n, - deadline: 1657758061n, +import { getContractEvents } from "thirdweb"; +import { setIdCounterEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setIdCounterEvent()], }); ``` ```ts -function encodeSignedKeyRequestMetadata(options: { - deadline: bigint; - keyRequestSignature: `0x${string}`; - requestFid: bigint; - requestSigner: string; -}): `0x${string}`; -``` - -### Parameters - -The options for encoding the signed key request metadata. - -#### Type - -```ts -let options: { - deadline: bigint; - keyRequestSignature: `0x${string}`; - requestFid: bigint; - requestSigner: string; -}; +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: `0x${string}`; +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 encoded ABI parameters as a hexadecimal string. +The prepared event object. --- -## FARCASTER.getAddData +## FARCASTER.setIdGatewayEvent -Prepares the data required for signing an Add message according to EIP-712. +Creates an event object for the SetIdGateway event. ### 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" }, - ]; - }; -}; +import { getContractEvents } from "thirdweb"; +import { setIdGatewayEvent } from "thirdweb/extensions/farcaster"; + +const events = await getContractEvents({ + contract, + events: [setIdGatewayEvent()], +}); ``` -### 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; -}; +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: { - 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" }, - ]; - }; -}; +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 data object structured according to EIP-712, ready for signing. +The prepared event object. --- -## FARCASTER.getBundler +## FARCASTER.transfer -Retrieves the Bundler contract. +Prepares a transaction to call the "transfer" function on the contract. ### Example ```ts -import { getBundler } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { transfer } from "thirdweb/extensions/farcaster"; -const bundler = await getBundler({ - client, +const transaction = transfer({ + contract, + to: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getBundler(options: FarcasterContractOptions): Readonly; +function transfer( + options: BaseTransactionOptions< + TransferParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The thirdweb client and an optional custom chain. +The options for the "transfer" function. #### Type ```ts -let options: { chain?: Chain; client: ThirdwebClient }; +let options: BaseTransactionOptions< + TransferParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Readonly; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The Bundler contract instance. +A prepared transaction object. --- -## FARCASTER.getFid +## FARCASTER.TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH -Retrieves the current fid for an account. +Calls the "TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH" function on the contract. ### Example ```ts -import { getFid } from "thirdweb/extensions/farcaster"; +import { TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH } from "thirdweb/extensions/farcaster"; -const price = await getFid({ - client, - address, +const result = await TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH({ + contract, }); ``` ```ts -function getFid(options: GetFidParams): Promise; +function TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -Parameters to pass to the function. +The options for the TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH function. #### Type ```ts -let options: { - address: Address; - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` -A promise that resolves to the account's fid, if one exists, otherwise 0. +The parsed result of the function call. --- -## FARCASTER.getIdGateway +## FARCASTER.TRANSFER\_TYPEHASH -Retrieves the IdGateway contract. +Calls the "TRANSFER\_TYPEHASH" function on the contract. ### Example ```ts -import { getIdGatway } from "thirdweb/extensions/farcaster"; +import { TRANSFER_TYPEHASH } from "thirdweb/extensions/farcaster"; -const idGateway = await getIdGateway({ - client, +const result = await TRANSFER_TYPEHASH({ + contract, }); ``` ```ts -function getIdGateway(options: FarcasterContractOptions): Readonly; +function TRANSFER_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The thirdweb client and an optional custom chain. +The options for the TRANSFER\_TYPEHASH function. #### Type ```ts -let options: { chain?: Chain; client: ThirdwebClient }; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Readonly; +let returnType: Promise<`0x${string}`>; ``` -The IdGateway contract instance. +The parsed result of the function call. --- -## FARCASTER.getIdRegistry +## FARCASTER.transferAndChangeRecovery -Retrieves the IdRegistry contract. +Prepares a transaction to call the "transferAndChangeRecovery" function on the contract. ### Example ```ts -import { getIdRegistry } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { transferAndChangeRecovery } from "thirdweb/extensions/farcaster"; -const idRegistry = await getIdRegistry({ - client, +const transaction = transferAndChangeRecovery({ + contract, + to: ..., + recovery: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getIdRegistry(options: FarcasterContractOptions): Readonly; +function transferAndChangeRecovery( + options: BaseTransactionOptions< + | TransferAndChangeRecoveryParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The thirdweb client and an optional custom chain. +The options for the "transferAndChangeRecovery" function. #### Type ```ts -let options: { chain?: Chain; client: ThirdwebClient }; +let options: BaseTransactionOptions< + | TransferAndChangeRecoveryParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Readonly; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The IdRegistry contract instance. +A prepared transaction object. --- -## FARCASTER.getKeyGateway +## FARCASTER.transferEvent -Retrieves the KeyGateway contract. +Creates an event object for the Transfer event. ### Example ```ts -import { getKeyGateway } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { transferEvent } from "thirdweb/extensions/farcaster"; -const keyGateway = await getKeyGateway({ - client, +const events = await getContractEvents({ +contract, +events: [ + transferEvent({ + from: ..., + to: ..., +}) +], }); ``` ```ts -function getKeyGateway(options: FarcasterContractOptions): Readonly; +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 -The thirdweb client and an optional custom chain. +Optional filters to apply to the event. #### Type ```ts -let options: { chain?: Chain; client: ThirdwebClient }; +let filters: Partial<{ from: string; to: string }>; ``` ### Returns ```ts -let returnType: Readonly; +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 KeyGateway contract instance. +The prepared event object. --- -## FARCASTER.getKeyRequestData +## FARCASTER.transferFor -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. +Prepares a transaction to call the "transferFor" function on the contract. ### Example ```ts -const message = { - requestFid: 123456789n, - key: "0x04bfc...", - deadline: 1657758061n, -}; -const eip712Data = getKeyRequestData(message); +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 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 }>; - }; -}; +function transferFor( + options: BaseTransactionOptions< + | TransferForParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The message to be signed, containing the request FID, key, and deadline. +The options for the "transferFor" function. #### Type ```ts -let message: { deadline: bigint; key: Hex; requestFid: bigint }; +let options: BaseTransactionOptions< + | TransferForParams + | { asyncParams: () => Promise } +>; ``` ### 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 }>; - }; -}; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -An object containing the domain, types, primary type, and the message for EIP-712 signing. +A prepared transaction object. --- -## FARCASTER.getNonce +## FARCASTER.verifyFidSignature -Retrieves the current key gateway nonce for an account. +Calls the "verifyFidSignature" function on the contract. ### Example ```ts -import { getNonce } from "thirdweb/extensions/farcaster"; +import { verifyFidSignature } from "thirdweb/extensions/farcaster"; -const nonce = await getNonce({ - client, - address, +const result = await verifyFidSignature({ + contract, + custodyAddress: ..., + fid: ..., + digest: ..., + sig: ..., }); ``` ```ts -function getNonce(options: GetNonceParams): Promise; +function verifyFidSignature( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Parameters to pass to the function. +The options for the verifyFidSignature function. #### Type ```ts -let options: { - address: Address; - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; -}; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the current nonce. +The parsed result of the function call. --- -## FARCASTER.getRegisterData +## FARCASTER.add -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. +Prepares a transaction to call the "add" function on the contract. ### Example ```ts -import { getRegisterData } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { add } from "thirdweb/extensions/farcaster"; -const data = getRegisterData(message); +const transaction = add({ + contract, + keyType: ..., + key: ..., + metadataType: ..., + metadata: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```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" }, - ]; - }; -}; +function add( + options: BaseTransactionOptions< + AddParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The register message containing the necessary information for the signature. +The options for the "add" function. #### Type ```ts -let message: { - deadline: bigint; - nonce: bigint; - recovery: Address; - to: Address; -}; +let options: BaseTransactionOptions< + AddParams | { asyncParams: () => Promise } +>; ``` ### 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" }, - ]; - }; -}; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -An object containing the EIP-712 domain, types, and the message, ready to be signed. +A prepared transaction object. --- -## FARCASTER.getRegistrationPrice +## FARCASTER.ADD\_TYPEHASH -Retrieves the current cost to register a Farcaster fid in wei. +Calls the "ADD\_TYPEHASH" function on the contract. ### Example ```ts -import { getRegistrationPrice } from "thirdweb/extensions/farcaster"; +import { ADD_TYPEHASH } from "thirdweb/extensions/farcaster"; -const price = await getRegistrationPrice({ - client, +const result = await ADD_TYPEHASH({ + contract, }); ``` ```ts -function getRegistrationPrice( - options: GetRegistrationPriceParams, -): Promise; +function ADD_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. +The options for the ADD\_TYPEHASH function. #### Type ```ts -let options: { - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; - extraStorage?: bigint | number | string; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` -A promise that resolves to the current cost of a Farcaster fid in wei. +The parsed result of the function call. --- -## FARCASTER.getSignedKeyRequestMetadata +## FARCASTER.addFor -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. +Prepares a transaction to call the "addFor" function on the contract. ### Example ```ts -import { getSignedKeyRequestMetadata } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { addFor } from "thirdweb/extensions/farcaster"; -// Using an existing signature -const signedMetadata = await getSignedKeyRequestMetadata({ - keyRequestSignature: "0xabcd...", - accountAddress: "0x123...", - message: { - requestFid: 123456789n, - deadline: 1657758061n, - }, +const transaction = addFor({ + contract, + fidOwner: ..., + keyType: ..., + key: ..., + metadataType: ..., + metadata: ..., + deadline: ..., + sig: ..., + overrides: { + ... + } }); -// Signing a new key request -const signedMetadata = await getSignedKeyRequestMetadata({ - account, - message: { - requestFid: 123456789n, - deadline: 1657758061n, - }, -}); +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getSignedKeyRequestMetadata( - options: SignedKeyRequestMetadataOptions, -): Promise<`0x${string}`>; +function addFor( + options: BaseTransactionOptions< + AddForParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for signing the key request or using an existing signature. +The options for the "addFor" function. #### Type ```ts -let options: Prettify< - { message: SignedKeyRequestMessage } & ( - | { account: Account } - | { accountAddress: Address; keyRequestSignature: Hex } - ) +let options: BaseTransactionOptions< + AddForParams | { asyncParams: () => Promise } >; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the hexadecimal string of the encoded ABI parameters. +A prepared transaction object. --- -## FARCASTER.getStoragePrice +## FARCASTER.keyRegistry -Retrieves the current cost to register a Farcaster fid in wei. +Calls the "keyRegistry" function on the contract. ### Example ```ts -import { getStoragePrice } from "thirdweb/extensions/farcaster"; +import { keyRegistry } from "thirdweb/extensions/farcaster"; -const price = await getStoragePrice({ - client, +const result = await keyRegistry({ + contract, }); ``` ```ts -function getStoragePrice( - options: GetStoragePriceParams, -): Promise; +function keyRegistry( + options: BaseTransactionOptions, +): 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. +The options for the keyRegistry function. #### Type ```ts -let options: { - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; - units?: bigint | number | string; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the current cost of a Farcaster fid in USD. +The parsed result of the function call. --- -## FARCASTER.getStorageRegistry +## FARCASTER.nonces -Retrieves the StorageRegistry contract. +Calls the "nonces" function on the contract. ### Example ```ts -import { getStorageRegistry } from "thirdweb/extensions/farcaster"; +import { nonces } from "thirdweb/extensions/farcaster"; -const storageRegistry = await getStorageRegistry({ - client, +const result = await nonces({ + contract, + account: ..., }); ``` ```ts -function getStorageRegistry( - options: FarcasterContractOptions, -): Readonly; +function nonces( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The thirdweb client and an optional custom chain. +The options for the nonces function. #### Type ```ts -let options: { chain?: Chain; client: ThirdwebClient }; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Readonly; +let returnType: Promise; ``` -The StorageRegistry contract instance. +The parsed result of the function call. --- -## FARCASTER.getUsdRegistrationPrice +## FARCASTER.addEvent -Retrieves the current cost to register a Farcaster fid in USD. +Creates an event object for the Add event. ### Example ```ts -import { getUsdRegistrationPrice } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { addEvent } from "thirdweb/extensions/farcaster"; -const price = await getUsdRegistrationPrice({ - client, +const events = await getContractEvents({ +contract, +events: [ + addEvent({ + fid: ..., + keyType: ..., + key: ..., +}) +], }); ``` ```ts -function getUsdRegistrationPrice( - options: GetUsdRegistrationPriceParams, -): Promise; +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 -An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. +Optional filters to apply to the event. #### Type ```ts -let options: { - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; - extraStorage?: bigint | number | string; -}; +let filters: Partial<{ + fid: bigint; + key: `0x${string}`; + keyType: number; +}>; ``` ### Returns ```ts -let returnType: Promise; +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"; +}>; ``` -A promise that resolves to the current cost of a Farcaster fid in USD. +The prepared event object. --- -## FARCASTER.getUsdStoragePrice +## FARCASTER.adminResetEvent -Retrieves the current cost to register a Farcaster fid in USD. +Creates an event object for the AdminReset event. ### Example ```ts -import { getUsdStoragePrice } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { adminResetEvent } from "thirdweb/extensions/farcaster"; -const price = await getUsdStoragePrice({ - client, +const events = await getContractEvents({ +contract, +events: [ + adminResetEvent({ + fid: ..., + key: ..., +}) +], }); ``` ```ts -function getUsdStoragePrice( - options: GetUsdStoragePriceParams, -): Promise; +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 -An object containing a client to use to fetch the price and the amount of extra storage to include in the returned price. +Optional filters to apply to the event. #### Type ```ts -let options: { - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; - units?: bigint | number | string; -}; +let filters: Partial<{ fid: bigint; key: `0x${string}` }>; ``` ### Returns ```ts -let returnType: Promise; +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"; +}>; ``` -A promise that resolves to the current cost of a Farcaster fid in USD. +The prepared event object. --- -## FARCASTER.registerFid +## FARCASTER.freezeKeyGatewayEvent -Registers a Farcaster fid for the given wallet. +Creates an event object for the FreezeKeyGateway event. ### Example ```ts -import { registerFid } from "thirdweb/extensions/farcaster"; -import { sendTransaction } from "thirdweb"; +import { getContractEvents } from "thirdweb"; +import { freezeKeyGatewayEvent } from "thirdweb/extensions/farcaster"; -const transaction = registerFid({ - client, - recoveryAddress, +const events = await getContractEvents({ + contract, + events: [freezeKeyGatewayEvent()], }); - -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; -}; +function freezeKeyGatewayEvent(): PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "keyGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeKeyGateway"; + readonly type: "event"; +}>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - [], - AbiFunction, - PrepareTransactionOptions ->; +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "keyGateway"; readonly type: "address" }, + ]; + readonly name: "FreezeKeyGateway"; + readonly type: "event"; +}>; ``` -A prepared transaction object to register the account. +The prepared event object. --- -## FARCASTER.registerFidAndSigner +## FARCASTER.gatewayFrozen -Registers a Farcaster fid and signer for the given wallet using the provided app account. +Calls the "gatewayFrozen" function on the contract. ### Example ```ts -import { registerFidAndSigner } from "thirdweb/extensions/farcaster"; -import { sendTransaction } from "thirdweb"; +import { gatewayFrozen } from "thirdweb/extensions/farcaster"; -const transaction = registerFidAndSigner({ - client, - userAccount, - appAccount, - recoveryAddress, - signerPublicKey, +const result = await gatewayFrozen({ + contract, }); - -await sendTransaction({ transaction, account }); ``` ```ts -function registerFidAndSigner( - options: RegisterFidAndSignerParams, -): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +function gatewayFrozen( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for registering an account. +The options for the gatewayFrozen function. #### 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; - } - ) ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - [], - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object to register the account. +The parsed result of the function call. --- -## FARCASTER.rentStorage +## FARCASTER.idRegistry -Rent storage for the provided farcaster fid. +Calls the "idRegistry" function on the contract. ### Example ```ts -import { rentStorage } from "thirdweb/extensions/farcaster"; -import { sendTransaction } from "thirdweb"; +import { idRegistry } from "thirdweb/extensions/farcaster"; -const transaction = rentStorage({ - client, - fid, - units, +const result = await idRegistry({ + contract, }); - -await sendTransaction({ transaction, account }); ``` ```ts -function rentStorage( - options: RentStorageParams, -): PreparedTransaction<[], AbiFunction, PrepareTransactionOptions>; +function idRegistry(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for calling the `rentStorage` function. +The options for the idRegistry function. #### Type ```ts -let options: { - chain?: Chain; - client: ThirdwebClient; - disableCache?: boolean; - fid: bigint | number | string; - units?: bigint | number | string; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - [], - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object to rent the storage. +The parsed result of the function call. --- -## FARCASTER.signAdd +## FARCASTER.keyAt -Signs an Add message using the account's signTypedData method. +Calls the "keyAt" function on the contract. ### Example -```typescript -const signedMessage = await signAdd({ - account: yourAccount, - message: yourAddMessage, +```ts +import { keyAt } from "thirdweb/extensions/farcaster"; + +const result = await keyAt({ + contract, + fid: ..., + state: ..., + index: ..., }); ``` ```ts -function signAdd(options: SignAddOptions): Promise<`0x${string}`>; +function keyAt( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for signing the Add message. +The options for the keyAt function. #### Type ```ts -let options: { account: Account; message: AddMessage }; +let options: BaseTransactionOptions; ``` ### Returns @@ -25379,188 +23650,154 @@ let options: { account: Account; message: AddMessage }; let returnType: Promise<`0x${string}`>; ``` -A promise that resolves to the signature of the Add message. +The parsed result of the function call. --- -## FARCASTER.signKeyRequest +## FARCASTER.keyDataOf -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. +Calls the "keyDataOf" function on the contract. ### Example ```ts -const message = { - requestFid: 123456789n, - key: "0x04bfc...", - deadline: 1657758061n, -}; +import { keyDataOf } from "thirdweb/extensions/farcaster"; -const signature = signKeyRequest({ account: signerAccount, message }); +const result = await keyDataOf({ + contract, + fid: ..., + key: ..., +}); ``` ```ts -function signKeyRequest( - options: SignKeyRequestOptions, -): Promise<`0x${string}`>; +function keyDataOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for signing the key request, including the account and the message. +The options for the keyDataOf function. #### Type ```ts -let options: { account: Account; message: SignedKeyRequestMessage }; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise; ``` -A promise that resolves to the signature of the key request. +The parsed result of the function call. --- -## FARCASTER.signRegister +## FARCASTER.keyGateway -Signs the register message for Farcaster ID Gateway. +Calls the "keyGateway" function on the contract. ### Example ```ts -const signature = await signRegister({ account, message }); +import { keyGateway } from "thirdweb/extensions/farcaster"; + +const result = await keyGateway({ + contract, +}); ``` ```ts -function signRegister( - options: SignRegisterOptions, -): Promise<`0x${string}`>; +function keyGateway(options: BaseTransactionOptions): Promise; ``` ### Parameters -The signing options. +The options for the keyGateway function. #### Type ```ts -let options: { account: Account; message: RegisterMessage }; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise; ``` -A promise that resolves to the signature. +The parsed result of the function call. --- -## FARCASTER.idGateway +## FARCASTER.keysOf -Calls the "idGateway" function on the contract. +Calls the "keysOf" function on the contract. ### Example ```ts -import { idGateway } from "thirdweb/extensions/farcaster"; +import { keysOf } from "thirdweb/extensions/farcaster"; -const result = await idGateway({ - contract, +const result = await keysOf({ + contract, + fid: ..., + state: ..., }); ``` ```ts -function idGateway(options: BaseTransactionOptions): Promise; +function keysOf(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the idGateway function. +The options for the keysOf function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise> ``` The parsed result of the function call. --- -## FARCASTER.keyGateway +## FARCASTER.maxKeysPerFid -Calls the "keyGateway" function on the contract. +Calls the "maxKeysPerFid" function on the contract. ### Example ```ts -import { keyGateway } from "thirdweb/extensions/farcaster"; +import { maxKeysPerFid } from "thirdweb/extensions/farcaster"; -const result = await keyGateway({ +const result = await maxKeysPerFid({ 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. ---- - -## FARCASTER.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, +function maxKeysPerFid( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the price function. +The options for the maxKeysPerFid function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns @@ -25572,20 +23809,19 @@ let returnType: Promise; The parsed result of the function call. --- -## FARCASTER.register +## FARCASTER.remove -Prepares a transaction to call the "register" function on the contract. +Prepares a transaction to call the "remove" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { register } from "thirdweb/extensions/farcaster"; +import { remove } from "thirdweb/extensions/farcaster"; -const transaction = register({ +const transaction = remove({ contract, - recovery: ..., - extraStorage: ..., + key: ..., overrides: { ... } @@ -25596,22 +23832,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function register( +function remove( options: BaseTransactionOptions< - RegisterParams | { asyncParams: () => Promise } + RemoveParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "register" function. +The options for the "remove" function. #### Type ```ts let options: BaseTransactionOptions< - RegisterParams | { asyncParams: () => Promise } + RemoveParams | { asyncParams: () => Promise } >; ``` @@ -25628,27 +23864,29 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## FARCASTER.idRegistry +## FARCASTER.REMOVE\_TYPEHASH -Calls the "idRegistry" function on the contract. +Calls the "REMOVE\_TYPEHASH" function on the contract. ### Example ```ts -import { idRegistry } from "thirdweb/extensions/farcaster"; +import { REMOVE_TYPEHASH } from "thirdweb/extensions/farcaster"; -const result = await idRegistry({ +const result = await REMOVE_TYPEHASH({ contract, }); ``` ```ts -function idRegistry(options: BaseTransactionOptions): Promise; +function REMOVE_TYPEHASH( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for the idRegistry function. +The options for the REMOVE\_TYPEHASH function. #### Type @@ -25659,66 +23897,106 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` The parsed result of the function call. --- -## FARCASTER.price +## FARCASTER.removeEvent -Calls the "price" function on the contract. +Creates an event object for the Remove event. ### Example ```ts -import { price } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { removeEvent } from "thirdweb/extensions/farcaster"; -const result = await price({ - contract, - extraStorage: ..., +const events = await getContractEvents({ +contract, +events: [ + removeEvent({ + fid: ..., + key: ..., +}) +], }); ``` ```ts -function price( - options: BaseTransactionOptions, -): Promise; +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 -The options for the price function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ fid: bigint; key: `0x${string}` }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## FARCASTER.register +## FARCASTER.removeFor -Prepares a transaction to call the "register" function on the contract. +Prepares a transaction to call the "removeFor" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { register } from "thirdweb/extensions/farcaster"; +import { removeFor } from "thirdweb/extensions/farcaster"; -const transaction = register({ +const transaction = removeFor({ contract, - recovery: ..., - extraStorage: ..., + fidOwner: ..., + key: ..., + deadline: ..., + sig: ..., overrides: { ... } @@ -25729,22 +24007,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function register( +function removeFor( options: BaseTransactionOptions< - RegisterParams | { asyncParams: () => Promise } + RemoveForParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "register" function. +The options for the "removeFor" function. #### Type ```ts let options: BaseTransactionOptions< - RegisterParams | { asyncParams: () => Promise } + RemoveForParams | { asyncParams: () => Promise } >; ``` @@ -25761,129 +24039,72 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## FARCASTER.REGISTER\_TYPEHASH +## FARCASTER.setIdRegistryEvent -Calls the "REGISTER\_TYPEHASH" function on the contract. +Creates an event object for the SetIdRegistry event. ### Example ```ts -import { REGISTER_TYPEHASH } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { setIdRegistryEvent } from "thirdweb/extensions/farcaster"; -const result = await REGISTER_TYPEHASH({ +const events = await getContractEvents({ contract, + events: [setIdRegistryEvent()], }); ``` ```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. ---- - -## FARCASTER.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 } ->; +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: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: PreparedEvent<{ + readonly inputs: readonly [ + { readonly name: "oldIdRegistry"; readonly type: "address" }, + { readonly name: "newIdRegistry"; readonly type: "address" }, + ]; + readonly name: "SetIdRegistry"; + readonly type: "event"; +}>; ``` -A prepared transaction object. +The prepared event object. --- -## FARCASTER.setStorageRegistryEvent +## FARCASTER.setKeyGatewayEvent -Creates an event object for the SetStorageRegistry event. +Creates an event object for the SetKeyGateway event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { setStorageRegistryEvent } from "thirdweb/extensions/farcaster"; +import { setKeyGatewayEvent } from "thirdweb/extensions/farcaster"; const events = await getContractEvents({ contract, - events: [setStorageRegistryEvent()], + events: [setKeyGatewayEvent()], }); ``` ```ts -function setStorageRegistryEvent(): PreparedEvent<{ +function setKeyGatewayEvent(): PreparedEvent<{ readonly inputs: readonly [ - { readonly name: "oldStorageRegistry"; readonly type: "address" }, - { readonly name: "newStorageRegistry"; readonly type: "address" }, + { readonly name: "oldKeyGateway"; readonly type: "address" }, + { readonly name: "newKeyGateway"; readonly type: "address" }, ]; - readonly name: "SetStorageRegistry"; + readonly name: "SetKeyGateway"; readonly type: "event"; }>; ``` @@ -25893,10 +24114,10 @@ function setStorageRegistryEvent(): PreparedEvent<{ ```ts let returnType: PreparedEvent<{ readonly inputs: readonly [ - { readonly name: "oldStorageRegistry"; readonly type: "address" }, - { readonly name: "newStorageRegistry"; readonly type: "address" }, + { readonly name: "oldKeyGateway"; readonly type: "address" }, + { readonly name: "newKeyGateway"; readonly type: "address" }, ]; - readonly name: "SetStorageRegistry"; + readonly name: "SetKeyGateway"; readonly type: "event"; }>; ``` @@ -25904,116 +24125,89 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## FARCASTER.storageRegistry +## FARCASTER.setMaxKeysPerFidEvent -Calls the "storageRegistry" function on the contract. +Creates an event object for the SetMaxKeysPerFid event. ### Example ```ts -import { storageRegistry } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { setMaxKeysPerFidEvent } from "thirdweb/extensions/farcaster"; -const result = await storageRegistry({ +const events = await getContractEvents({ contract, + events: [setMaxKeysPerFidEvent()], }); ``` ```ts -function storageRegistry( - options: BaseTransactionOptions, -): Promise; -``` - -### Parameters - -The options for the storageRegistry function. - -#### Type - -```ts -let options: { contract: ThirdwebContract } & T; +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: Promise; +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 parsed result of the function call. +The prepared event object. --- -## FARCASTER.adminResetEvent +## FARCASTER.setValidatorEvent -Creates an event object for the AdminReset event. +Creates an event object for the SetValidator event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { adminResetEvent } from "thirdweb/extensions/farcaster"; +import { setValidatorEvent } from "thirdweb/extensions/farcaster"; const events = await getContractEvents({ -contract, -events: [ - adminResetEvent({ - fid: ..., - key: ..., -}) -], + contract, + events: [setValidatorEvent()], }); ``` ```ts -function adminResetEvent( - filters: Partial, -): PreparedEvent<{ +function setValidatorEvent(): 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: "keyType"; readonly type: "uint32" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "oldValidator"; readonly type: "address" }, + { readonly name: "newValidator"; readonly type: "address" }, ]; - readonly name: "AdminReset"; + readonly name: "SetValidator"; readonly type: "event"; }>; ``` -### Parameters - -Optional filters to apply to the event. - -#### Type - -```ts -let filters: Partial; -``` - ### 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: "keyType"; readonly type: "uint32" }, + { readonly name: "metadataType"; readonly type: "uint8" }, + { readonly name: "oldValidator"; readonly type: "address" }, + { readonly name: "newValidator"; readonly type: "address" }, ]; - readonly name: "AdminReset"; + readonly name: "SetValidator"; readonly type: "event"; }>; ``` @@ -26021,58 +24215,61 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## FARCASTER.CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH +## FARCASTER.totalKeys -Calls the "CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH" function on the contract. +Calls the "totalKeys" function on the contract. ### Example ```ts -import { CHANGE_RECOVERY_ADDRESS_TYPEHASH } from "thirdweb/extensions/farcaster"; +import { totalKeys } from "thirdweb/extensions/farcaster"; -const result = await CHANGE_RECOVERY_ADDRESS_TYPEHASH({ - contract, +const result = await totalKeys({ + contract, + fid: ..., + state: ..., }); ``` ```ts -function CHANGE_RECOVERY_ADDRESS_TYPEHASH( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function totalKeys( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the CHANGE\_RECOVERY\_ADDRESS\_TYPEHASH function. +The options for the totalKeys function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.changeRecoveryAddress +## FARCASTER.batchRent -Prepares a transaction to call the "changeRecoveryAddress" function on the contract. +Prepares a transaction to call the "batchRent" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { changeRecoveryAddress } from "thirdweb/extensions/farcaster"; +import { batchRent } from "thirdweb/extensions/farcaster"; -const transaction = changeRecoveryAddress({ +const transaction = batchRent({ contract, - recovery: ..., + fids: ..., + units: ..., overrides: { ... } @@ -26083,24 +24280,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function changeRecoveryAddress( +function batchRent( options: BaseTransactionOptions< - | ChangeRecoveryAddressParams - | { asyncParams: () => Promise } + BatchRentParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "changeRecoveryAddress" function. +The options for the "batchRent" function. #### Type ```ts let options: BaseTransactionOptions< - | ChangeRecoveryAddressParams - | { asyncParams: () => Promise } + BatchRentParams | { asyncParams: () => Promise } >; ``` @@ -26117,223 +24312,201 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## FARCASTER.changeRecoveryAddressEvent +## FARCASTER.deprecationTimestamp -Creates an event object for the ChangeRecoveryAddress event. +Calls the "deprecationTimestamp" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { changeRecoveryAddressEvent } from "thirdweb/extensions/farcaster"; +import { deprecationTimestamp } from "thirdweb/extensions/farcaster"; -const events = await getContractEvents({ -contract, -events: [ - changeRecoveryAddressEvent({ - id: ..., - recovery: ..., -}) -], +const result = await deprecationTimestamp({ + contract, }); ``` ```ts -function changeRecoveryAddressEvent( - filters: Partial, -): 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"; -}>; +function deprecationTimestamp( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the deprecationTimestamp function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.custodyOf +## FARCASTER.maxUnits -Calls the "custodyOf" function on the contract. +Calls the "maxUnits" function on the contract. ### Example ```ts -import { custodyOf } from "thirdweb/extensions/farcaster"; +import { maxUnits } from "thirdweb/extensions/farcaster"; -const result = await custodyOf({ - contract, - fid: ..., +const result = await maxUnits({ + contract, }); ``` ```ts -function custodyOf( - options: BaseTransactionOptions, -): Promise; +function maxUnits(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the custodyOf function. +The options for the maxUnits function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.freezeIdGatewayEvent +## FARCASTER.price -Creates an event object for the FreezeIdGateway event. +Calls the "price" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { freezeIdGatewayEvent } from "thirdweb/extensions/farcaster"; +import { price } from "thirdweb/extensions/farcaster"; -const events = await getContractEvents({ - contract, - events: [freezeIdGatewayEvent()], +const result = await price({ + contract, + units: ..., }); ``` ```ts -function freezeIdGatewayEvent(): PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "idGateway"; readonly type: "address" }, - ]; - readonly name: "FreezeIdGateway"; - readonly type: "event"; -}>; +function price( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + +The options for the price function. + +#### Type + +```ts +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "idGateway"; readonly type: "address" }, - ]; - readonly name: "FreezeIdGateway"; - readonly type: "event"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.gatewayFrozen +## FARCASTER.rent -Calls the "gatewayFrozen" function on the contract. +Prepares a transaction to call the "rent" function on the contract. ### Example ```ts -import { gatewayFrozen } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { rent } from "thirdweb/extensions/farcaster"; -const result = await gatewayFrozen({ - contract, +const transaction = rent({ + contract, + fid: ..., + units: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function gatewayFrozen( - options: BaseTransactionOptions, -): Promise; +function rent( + options: BaseTransactionOptions< + RentParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the gatewayFrozen function. +The options for the "rent" function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + RentParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## FARCASTER.idCounter +## FARCASTER.rentedUnits -Calls the "idCounter" function on the contract. +Calls the "rentedUnits" function on the contract. ### Example ```ts -import { idCounter } from "thirdweb/extensions/farcaster"; +import { rentedUnits } from "thirdweb/extensions/farcaster"; -const result = await idCounter({ +const result = await rentedUnits({ contract, }); ``` ```ts -function idCounter(options: BaseTransactionOptions): Promise; +function rentedUnits( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the idCounter function. +The options for the rentedUnits function. #### Type @@ -26350,27 +24523,27 @@ let returnType: Promise; The parsed result of the function call. --- -## FARCASTER.idGateway +## FARCASTER.unitPrice -Calls the "idGateway" function on the contract. +Calls the "unitPrice" function on the contract. ### Example ```ts -import { idGateway } from "thirdweb/extensions/farcaster"; +import { unitPrice } from "thirdweb/extensions/farcaster"; -const result = await idGateway({ +const result = await unitPrice({ contract, }); ``` ```ts -function idGateway(options: BaseTransactionOptions): Promise; +function unitPrice(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the idGateway function. +The options for the unitPrice function. #### Type @@ -26381,41 +24554,40 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.idOf +## FARCASTER.usdUnitPrice -Calls the "idOf" function on the contract. +Calls the "usdUnitPrice" function on the contract. ### Example ```ts -import { idOf } from "thirdweb/extensions/farcaster"; +import { usdUnitPrice } from "thirdweb/extensions/farcaster"; -const result = await idOf({ - contract, - owner: ..., +const result = await usdUnitPrice({ + contract, }); ``` ```ts -function idOf( - options: BaseTransactionOptions, +function usdUnitPrice( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the idOf function. +The options for the usdUnitPrice function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns @@ -26426,1272 +24598,951 @@ let returnType: Promise; The parsed result of the function call. --- +## LENS +--- -## FARCASTER.recover +## LENS.exists -Prepares a transaction to call the "recover" function on the contract. +Calls the "exists" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { recover } from "thirdweb/extensions/farcaster"; +import { exists } from "thirdweb/extensions/lens"; -const transaction = recover({ +const result = await exists({ contract, - from: ..., - to: ..., - deadline: ..., - sig: ..., - overrides: { - ... - } + tokenId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function recover( - options: BaseTransactionOptions< - RecoverParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function exists( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "recover" function. +The options for the exists function. #### Type ```ts -let options: BaseTransactionOptions< - RecoverParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## FARCASTER.recoverEvent +## LENS.getContentURI -Creates an event object for the Recover event. +Calls the "getContentURI" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { recoverEvent } from "thirdweb/extensions/farcaster"; +import { getContentURI } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ -contract, -events: [ - recoverEvent({ - from: ..., - to: ..., - id: ..., -}) -], +const result = await getContentURI({ + contract, + profileId: ..., + pubId: ..., }); ``` ```ts -function recoverEvent( - filters: Partial, -): 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"; -}>; +function getContentURI( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getContentURI function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.recoverFor +## LENS.getDefaultHandle -Prepares a transaction to call the "recoverFor" function on the contract. +Calls the "getDefaultHandle" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { recoverFor } from "thirdweb/extensions/farcaster"; +import { getDefaultHandle } from "thirdweb/extensions/lens"; -const transaction = recoverFor({ +const result = await getDefaultHandle({ contract, - from: ..., - to: ..., - recoveryDeadline: ..., - recoverySig: ..., - toDeadline: ..., - toSig: ..., - overrides: { - ... - } + profileId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function recoverFor( - options: BaseTransactionOptions< - | RecoverForParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getDefaultHandle( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "recoverFor" function. +The options for the getDefaultHandle function. #### Type ```ts -let options: BaseTransactionOptions< - RecoverForParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## FARCASTER.recoveryOf +## LENS.getFollowData -Calls the "recoveryOf" function on the contract. +Calls the "getFollowData" function on the contract. ### Example ```ts -import { recoveryOf } from "thirdweb/extensions/farcaster"; +import { getFollowData } from "thirdweb/extensions/lens"; -const result = await recoveryOf({ +const result = await getFollowData({ contract, - fid: ..., + followTokenId: ..., }); ``` ```ts -function recoveryOf( - options: BaseTransactionOptions, -): Promise; +function getFollowData( + options: BaseTransactionOptions, +): Promise<{ + followerProfileId: bigint; + followTimestamp: number; + originalFollowTimestamp: number; + profileIdAllowedToRecover: bigint; +}>; ``` ### Parameters -The options for the recoveryOf function. +The options for the getFollowData function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<{ + followerProfileId: bigint; + followTimestamp: number; + originalFollowTimestamp: number; + profileIdAllowedToRecover: bigint; +}>; ``` The parsed result of the function call. --- -## FARCASTER.registerEvent +## LENS.getFollowerCount -Creates an event object for the Register event. +Calls the "getFollowerCount" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { registerEvent } from "thirdweb/extensions/farcaster"; +import { getFollowerCount } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ -contract, -events: [ - registerEvent({ - to: ..., - id: ..., -}) -], +const result = await getFollowerCount({ + contract, }); ``` ```ts -function registerEvent( - filters: Partial, -): 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"; -}>; +function getFollowerCount( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getFollowerCount function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.setIdCounterEvent +## LENS.getFollowerProfileId -Creates an event object for the SetIdCounter event. +Calls the "getFollowerProfileId" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { setIdCounterEvent } from "thirdweb/extensions/farcaster"; +import { getFollowerProfileId } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ - contract, - events: [setIdCounterEvent()], +const result = await getFollowerProfileId({ + contract, + followTokenId: ..., }); ``` ```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"; -}>; +function getFollowerProfileId( + options: BaseTransactionOptions, +): Promise; ``` -The prepared event object. ---- - -## FARCASTER.setIdGatewayEvent - -Creates an event object for the SetIdGateway event. +### Parameters -### Example +The options for the getFollowerProfileId function. -```ts -import { getContractEvents } from "thirdweb"; -import { setIdGatewayEvent } from "thirdweb/extensions/farcaster"; - -const events = await getContractEvents({ - contract, - events: [setIdGatewayEvent()], -}); -``` +#### Type ```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"; -}>; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.transfer +## LENS.getFollowTokenId -Prepares a transaction to call the "transfer" function on the contract. +Calls the "getFollowTokenId" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { transfer } from "thirdweb/extensions/farcaster"; +import { getFollowTokenId } from "thirdweb/extensions/lens"; -const transaction = transfer({ +const result = await getFollowTokenId({ contract, - to: ..., - deadline: ..., - sig: ..., - overrides: { - ... - } + followerProfileId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function transfer( - options: BaseTransactionOptions< - TransferParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getFollowTokenId( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "transfer" function. +The options for the getFollowTokenId function. #### Type ```ts -let options: BaseTransactionOptions< - TransferParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## FARCASTER.TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH +## LENS.getFullProfile -Calls the "TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH" function on the contract. +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 { TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH } from "thirdweb/extensions/farcaster"; +import { getFullProfile } from "thirdweb/extension/lens"; -const result = await TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH({ - contract, -}); +const profileId = 10000n; // profileId is the tokenId of the NFT +const lensProfile = await getFullProfile({ profileId, client }); ``` ```ts -function TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function getFullProfile( + options: GetFullProfileParams, +): Promise; ``` ### Parameters -The options for the TRANSFER\_AND\_CHANGE\_RECOVERY\_TYPEHASH function. - #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: { + client: ThirdwebClient; + includeJoinDate?: boolean; + overrides?: { + chain?: Chain; + lensHandleAddress?: string; + lensHubAddress?: string; + tokenHandleRegistryAddress?: string; + }; + profileId: bigint; +}; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: { + handle: string; + joinDate: bigint | null; + profileData: LensProfileSchema | null; +} | null; ``` - -The parsed result of the function call. --- -## FARCASTER.TRANSFER\_TYPEHASH +## LENS.getHandle -Calls the "TRANSFER\_TYPEHASH" function on the contract. +Calls the "getHandle" function on the contract. ### Example ```ts -import { TRANSFER_TYPEHASH } from "thirdweb/extensions/farcaster"; +import { getHandle } from "thirdweb/extensions/lens"; -const result = await TRANSFER_TYPEHASH({ - contract, +const result = await getHandle({ + contract, + tokenId: ..., }); ``` ```ts -function TRANSFER_TYPEHASH( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function getHandle( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the TRANSFER\_TYPEHASH function. +The options for the getHandle function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.transferAndChangeRecovery +## LENS.getHandleFromProfileId -Prepares a transaction to call the "transferAndChangeRecovery" function on the contract. +Return the Lens handle of a profile in the format: lens/@`` ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { transferAndChangeRecovery } from "thirdweb/extensions/farcaster"; - -const transaction = transferAndChangeRecovery({ - contract, - to: ..., - recovery: ..., - deadline: ..., - sig: ..., - overrides: { - ... - } -}); +import { getHandleFromProfileId } from "thirdweb/extensions/lens"; -// Send the transaction -await sendTransaction({ transaction, account }); +const profileId = 461662n; +const handle = await getHandleFromProfileId({ profileId, client }); // "lens/@captain_jack" ``` ```ts -function transferAndChangeRecovery( - options: BaseTransactionOptions< - | TransferAndChangeRecoveryParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getHandleFromProfileId( + options: GetHandleFromProfileIdParams, +): Promise; ``` ### Parameters -The options for the "transferAndChangeRecovery" function. - #### Type ```ts -let options: BaseTransactionOptions< - | TransferAndChangeRecoveryParams - | { asyncParams: () => Promise } ->; +let options: { + client: ThirdwebClient; + overrides?: { + chain?: Chain; + lensHandleAddress?: string; + tokenHandleRegistryAddress?: string; + }; + profileId: bigint; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` - -A prepared transaction object. --- -## FARCASTER.transferEvent +## LENS.getHandleTokenURIContract -Creates an event object for the Transfer event. +Calls the "getHandleTokenURIContract" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { transferEvent } from "thirdweb/extensions/farcaster"; +import { getHandleTokenURIContract } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ -contract, -events: [ - transferEvent({ - from: ..., - to: ..., -}) -], +const result = await getHandleTokenURIContract({ + contract, }); ``` ```ts -function transferEvent( - filters: Partial, -): 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"; -}>; +function getHandleTokenURIContract( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getHandleTokenURIContract function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.transferFor +## LENS.getLocalName -Prepares a transaction to call the "transferFor" function on the contract. +Calls the "getLocalName" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { transferFor } from "thirdweb/extensions/farcaster"; +import { getLocalName } from "thirdweb/extensions/lens"; -const transaction = transferFor({ +const result = await getLocalName({ contract, - from: ..., - to: ..., - fromDeadline: ..., - fromSig: ..., - toDeadline: ..., - toSig: ..., - overrides: { - ... - } + tokenId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function transferFor( - options: BaseTransactionOptions< - | TransferForParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getLocalName( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "transferFor" function. +The options for the getLocalName function. #### Type ```ts -let options: BaseTransactionOptions< - | TransferForParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## FARCASTER.verifyFidSignature +## LENS.getModuleTypes -Calls the "verifyFidSignature" function on the contract. +Calls the "getModuleTypes" function on the contract. ### Example ```ts -import { verifyFidSignature } from "thirdweb/extensions/farcaster"; +import { getModuleTypes } from "thirdweb/extensions/lens"; -const result = await verifyFidSignature({ +const result = await getModuleTypes({ contract, - custodyAddress: ..., - fid: ..., - digest: ..., - sig: ..., + moduleAddress: ..., }); ``` ```ts -function verifyFidSignature( - options: BaseTransactionOptions, -): Promise; +function getModuleTypes( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the verifyFidSignature function. +The options for the getModuleTypes function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.add +## LENS.getOriginalFollowTimestamp -Prepares a transaction to call the "add" function on the contract. +Calls the "getOriginalFollowTimestamp" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { add } from "thirdweb/extensions/farcaster"; +import { getOriginalFollowTimestamp } from "thirdweb/extensions/lens"; -const transaction = add({ +const result = await getOriginalFollowTimestamp({ contract, - keyType: ..., - key: ..., - metadataType: ..., - metadata: ..., - overrides: { - ... - } + followTokenId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function add( - options: BaseTransactionOptions< - AddParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getOriginalFollowTimestamp( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "add" function. +The options for the getOriginalFollowTimestamp function. #### Type ```ts -let options: BaseTransactionOptions< - AddParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## FARCASTER.ADD\_TYPEHASH +## LENS.getProfile -Calls the "ADD\_TYPEHASH" function on the contract. +Calls the "getProfile" function on the contract. ### Example ```ts -import { ADD_TYPEHASH } from "thirdweb/extensions/farcaster"; +import { getProfile } from "thirdweb/extensions/lens"; -const result = await ADD_TYPEHASH({ - contract, +const result = await getProfile({ + contract, + profileId: ..., }); ``` ```ts -function ADD_TYPEHASH( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +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 ADD\_TYPEHASH function. +The options for the getProfile function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +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. --- -## FARCASTER.addFor +## LENS.getProfileIdAllowedToRecover -Prepares a transaction to call the "addFor" function on the contract. +Calls the "getProfileIdAllowedToRecover" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { addFor } from "thirdweb/extensions/farcaster"; +import { getProfileIdAllowedToRecover } from "thirdweb/extensions/lens"; -const transaction = addFor({ +const result = await getProfileIdAllowedToRecover({ contract, - fidOwner: ..., - keyType: ..., - key: ..., - metadataType: ..., - metadata: ..., - deadline: ..., - sig: ..., - overrides: { - ... - } + followTokenId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function addFor( - options: BaseTransactionOptions< - AddForParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getProfileIdAllowedToRecover( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "addFor" function. +The options for the getProfileIdAllowedToRecover function. #### Type ```ts -let options: BaseTransactionOptions< - AddForParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## FARCASTER.keyRegistry +## LENS.getProfileIdByHandleHash -Calls the "keyRegistry" function on the contract. +Calls the "getProfileIdByHandleHash" function on the contract. ### Example ```ts -import { keyRegistry } from "thirdweb/extensions/farcaster"; +import { getProfileIdByHandleHash } from "thirdweb/extensions/lens"; -const result = await keyRegistry({ - contract, +const result = await getProfileIdByHandleHash({ + contract, + handleHash: ..., }); ``` ```ts -function keyRegistry( - options: BaseTransactionOptions, -): Promise; +function getProfileIdByHandleHash( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the keyRegistry function. +The options for the getProfileIdByHandleHash function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.nonces +## LENS.getProfileMetadata -Calls the "nonces" function on the contract. +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 { nonces } from "thirdweb/extensions/farcaster"; +import { getProfileMetadata } from "thirdweb/extensions/lens"; -const result = await nonces({ - contract, - account: ..., -}); +const profileData = await getProfileMetadata({ profileId, client }); + +if (profileData) { + console.log("Display name: ", profileData.lens.name); + console.log("Bio: ", profileData.lens.bio); +} ``` ```ts -function nonces( - options: BaseTransactionOptions, -): Promise; +function getProfileMetadata( + options: GetProfileMetadataParams, +): Promise; ``` ### Parameters -The options for the nonces function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: { + client: ThirdwebClient; + overrides?: { chain?: Chain; lensHubAddress?: string }; + profileId: bigint; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: { + lens: { + appId?: string; + attributes: Array; + bio: string; + coverPicture: string; + id: string; + name: string; + picture: string; + }; + signature: string; +}; ``` -The parsed result of the function call. +LensProfileSchema | null --- -## FARCASTER.addEvent +## LENS.getPublication -Creates an event object for the Add event. +Calls the "getPublication" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { addEvent } from "thirdweb/extensions/farcaster"; +import { getPublication } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ -contract, -events: [ - addEvent({ - fid: ..., - keyType: ..., - key: ..., -}) -], +const result = await getPublication({ + contract, + profileId: ..., + pubId: ..., }); ``` ```ts -function addEvent( - filters: Partial, -): 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"; +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 -Optional filters to apply to the event. +The options for the getPublication function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; +let returnType: Promise<{ + __DEPRECATED__collectModule: string; + __DEPRECATED__collectNFT: string; + contentURI: string; + pointedProfileId: bigint; + pointedPubId: bigint; + pubType: number; + referenceModule: string; + rootProfileId: bigint; + rootPubId: bigint; }>; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.adminResetEvent +## LENS.getTokenId -Creates an event object for the AdminReset event. +Calls the "getTokenId" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { adminResetEvent } from "thirdweb/extensions/farcaster"; +import { getTokenId } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ -contract, -events: [ - adminResetEvent({ - fid: ..., - key: ..., -}) -], +const result = await getTokenId({ + contract, + localName: ..., }); ``` ```ts -function adminResetEvent( - filters: Partial, -): 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"; -}>; +function getTokenId( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getTokenId function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.freezeKeyGatewayEvent +## LENS.isErc20CurrencyRegistered -Creates an event object for the FreezeKeyGateway event. +Calls the "isErc20CurrencyRegistered" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { freezeKeyGatewayEvent } from "thirdweb/extensions/farcaster"; +import { isErc20CurrencyRegistered } from "thirdweb/extensions/lens"; -const events = await getContractEvents({ - contract, - events: [freezeKeyGatewayEvent()], +const result = await isErc20CurrencyRegistered({ + contract, + currencyAddress: ..., }); ``` ```ts -function freezeKeyGatewayEvent(): PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "keyGateway"; readonly type: "address" }, - ]; - readonly name: "FreezeKeyGateway"; - readonly type: "event"; -}>; +function isErc20CurrencyRegistered( + options: BaseTransactionOptions, +): Promise; +``` + +### Parameters + +The options for the isErc20CurrencyRegistered function. + +#### Type + +```ts +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "keyGateway"; readonly type: "address" }, - ]; - readonly name: "FreezeKeyGateway"; - readonly type: "event"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## FARCASTER.gatewayFrozen +## LENS.isFollowing -Calls the "gatewayFrozen" function on the contract. +Calls the "isFollowing" function on the contract. ### Example ```ts -import { gatewayFrozen } from "thirdweb/extensions/farcaster"; +import { isFollowing } from "thirdweb/extensions/lens"; -const result = await gatewayFrozen({ - contract, +const result = await isFollowing({ + contract, + followerProfileId: ..., }); ``` ```ts -function gatewayFrozen( - options: BaseTransactionOptions, +function isFollowing( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the gatewayFrozen function. +The options for the isFollowing function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -27703,230 +25554,236 @@ let returnType: Promise; The parsed result of the function call. --- -## FARCASTER.idRegistry +## LENS.isModuleRegistered -Calls the "idRegistry" function on the contract. +Calls the "isModuleRegistered" function on the contract. ### Example ```ts -import { idRegistry } from "thirdweb/extensions/farcaster"; +import { isModuleRegistered } from "thirdweb/extensions/lens"; -const result = await idRegistry({ - contract, +const result = await isModuleRegistered({ + contract, + moduleAddress: ..., }); ``` ```ts -function idRegistry(options: BaseTransactionOptions): Promise; +function isModuleRegistered( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the idRegistry function. +The options for the isModuleRegistered function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.keyAt +## LENS.isModuleRegisteredAs -Calls the "keyAt" function on the contract. +Calls the "isModuleRegisteredAs" function on the contract. ### Example ```ts -import { keyAt } from "thirdweb/extensions/farcaster"; +import { isModuleRegisteredAs } from "thirdweb/extensions/lens"; -const result = await keyAt({ +const result = await isModuleRegisteredAs({ contract, - fid: ..., - state: ..., - index: ..., + moduleAddress: ..., + moduleType: ..., }); ``` ```ts -function keyAt( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function isModuleRegisteredAs( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the keyAt function. +The options for the isModuleRegisteredAs function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.keyDataOf +## LENS.mintTimestampOf -Calls the "keyDataOf" function on the contract. +Calls the "mintTimestampOf" function on the contract. ### Example ```ts -import { keyDataOf } from "thirdweb/extensions/farcaster"; +import { mintTimestampOf } from "thirdweb/extensions/lens"; -const result = await keyDataOf({ +const result = await mintTimestampOf({ contract, - fid: ..., - key: ..., + tokenId: ..., }); ``` ```ts -function keyDataOf( - options: BaseTransactionOptions, -): Promise; +function mintTimestampOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the keyDataOf function. +The options for the mintTimestampOf function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.keyGateway +## LENS.mintTimestampOfFollowNFT -Calls the "keyGateway" function on the contract. +Calls the "mintTimestampOf" function on the contract. ### Example ```ts -import { keyGateway } from "thirdweb/extensions/farcaster"; +import { mintTimestampOf } from "thirdweb/extensions/lens"; -const result = await keyGateway({ - contract, +const result = await mintTimestampOf({ + contract, + tokenId: ..., }); ``` ```ts -function keyGateway(options: BaseTransactionOptions): Promise; +function mintTimestampOfFollowNFT( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the keyGateway function. +The options for the mintTimestampOf function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.keysOf +## LENS.nonces -Calls the "keysOf" function on the contract. +Calls the "nonces" function on the contract. ### Example ```ts -import { keysOf } from "thirdweb/extensions/farcaster"; +import { nonces } from "thirdweb/extensions/lens"; -const result = await keysOf({ +const result = await nonces({ contract, - fid: ..., - state: ..., + signer: ..., }); ``` ```ts -function keysOf(options: BaseTransactionOptions) : Promise> +function nonces( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the keysOf function. +The options for the nonces function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise> +let returnType: Promise; ``` The parsed result of the function call. --- -## FARCASTER.maxKeysPerFid +## LENS.resolve -Calls the "maxKeysPerFid" function on the contract. +Calls the "resolve" function on the contract. ### Example ```ts -import { maxKeysPerFid } from "thirdweb/extensions/farcaster"; +import { resolve } from "thirdweb/extensions/lens"; -const result = await maxKeysPerFid({ - contract, +const result = await resolve({ + contract, + handleId: ..., }); ``` ```ts -function maxKeysPerFid( - options: BaseTransactionOptions, +function resolve( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the maxKeysPerFid function. +The options for the resolve function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -27938,139 +25795,140 @@ let returnType: Promise; The parsed result of the function call. --- -## FARCASTER.remove +## LENS.resolveAddress -Prepares a transaction to call the "remove" function on the contract. +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 { sendTransaction } from "thirdweb"; -import { remove } from "thirdweb/extensions/farcaster"; +import { resolveAddress } from "thirdweb/extensions/lens"; -const transaction = remove({ - contract, - key: ..., - overrides: { - ... - } +const walletAddress = await resolveAddress({ + name: "vitalik", + client, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function remove( - options: BaseTransactionOptions< - RemoveParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function resolveAddress( + options: ResolveLensAddressParams, +): Promise; ``` ### Parameters -The options for the "remove" function. - #### Type ```ts -let options: BaseTransactionOptions< - RemoveParams | { asyncParams: () => Promise } ->; +let options: { + client: ThirdwebClient; + name: string; + overrides?: { chain?: Chain; lensHandleContractAddress?: string }; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` - -A prepared transaction object. --- -## FARCASTER.REMOVE\_TYPEHASH +## LENS.tokenDataOf -Calls the "REMOVE\_TYPEHASH" function on the contract. +Calls the "tokenDataOf" function on the contract. ### Example ```ts -import { REMOVE_TYPEHASH } from "thirdweb/extensions/farcaster"; +import { tokenDataOf } from "thirdweb/extensions/lens"; -const result = await REMOVE_TYPEHASH({ - contract, +const result = await tokenDataOf({ + contract, + tokenId: ..., }); ``` ```ts -function REMOVE_TYPEHASH( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function tokenDataOf( + options: BaseTransactionOptions, +): Promise<{ mintTimestamp: bigint; owner: string }>; ``` ### Parameters -The options for the REMOVE\_TYPEHASH function. +The options for the tokenDataOf function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise<{ mintTimestamp: bigint; owner: string }>; ``` The parsed result of the function call. --- +## MARKETPLACE +--- -## FARCASTER.removeEvent +## MARKETPLACE.acceptedOfferEvent -Creates an event object for the Remove event. +Creates an event object for the AcceptedOffer event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { removeEvent } from "thirdweb/extensions/farcaster"; +import { acceptedOfferEvent } from "thirdweb/extensions/marketplace"; const events = await getContractEvents({ contract, events: [ - removeEvent({ - fid: ..., - key: ..., + acceptedOfferEvent({ + offeror: ..., + offerId: ..., + assetContract: ..., }) ], }); ``` ```ts -function removeEvent( - filters: Partial, +function acceptedOfferEvent( + filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; + }>, ): PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "fid"; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; readonly type: "uint256"; }, { readonly indexed: true; - readonly name: "key"; - readonly type: "bytes"; + readonly name: "assetContract"; + readonly type: "address"; }, - { readonly name: "keyBytes"; readonly type: "bytes" }, + { 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: "Remove"; + readonly name: "AcceptedOffer"; readonly type: "event"; }>; ``` @@ -28082,7 +25940,11 @@ Optional filters to apply to the event. #### Type ```ts -let filters: Partial; +let filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; +}>; ``` ### Returns @@ -28092,17 +25954,25 @@ let returnType: PreparedEvent<{ readonly inputs: readonly [ { readonly indexed: true; - readonly name: "fid"; + readonly name: "offeror"; + readonly type: "address"; + }, + { + readonly indexed: true; + readonly name: "offerId"; readonly type: "uint256"; }, { readonly indexed: true; - readonly name: "key"; - readonly type: "bytes"; + readonly name: "assetContract"; + readonly type: "address"; }, - { readonly name: "keyBytes"; readonly type: "bytes" }, + { 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: "Remove"; + readonly name: "AcceptedOffer"; readonly type: "event"; }>; ``` @@ -28110,49 +25980,38 @@ let returnType: PreparedEvent<{ The prepared event object. --- -## FARCASTER.removeFor +## MARKETPLACE.acceptOffer -Prepares a transaction to call the "removeFor" function on the contract. +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"; -import { removeFor } from "thirdweb/extensions/farcaster"; -const transaction = removeFor({ - contract, - fidOwner: ..., - key: ..., - deadline: ..., - sig: ..., - overrides: { - ... - } +const acceptOfferTx = acceptOffer({ + contract, + offerId: 1n, }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function removeFor( - options: BaseTransactionOptions< - RemoveForParams | { asyncParams: () => Promise } - >, +function acceptOffer( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "removeFor" function. +The options for accepting the offer. #### Type ```ts -let options: BaseTransactionOptions< - RemoveForParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -28165,267 +26024,261 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A transaction object that can be sent to accept the offer. --- -## FARCASTER.setIdRegistryEvent +## MARKETPLACE.approveBuyerForListing -Creates an event object for the SetIdRegistry event. +Prepares a transaction to call the "approveBuyerForListing" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { setIdRegistryEvent } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { approveBuyerForListing } from "thirdweb/extensions/marketplace"; -const events = await getContractEvents({ - contract, - events: [setIdRegistryEvent()], +const transaction = approveBuyerForListing({ + contract, + listingId: ..., + buyer: ..., + toApprove: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```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"; -}>; +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: PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "oldIdRegistry"; readonly type: "address" }, - { readonly name: "newIdRegistry"; readonly type: "address" }, - ]; - readonly name: "SetIdRegistry"; - readonly type: "event"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## FARCASTER.setKeyGatewayEvent +## MARKETPLACE.approveCurrencyForListing -Creates an event object for the SetKeyGateway event. +Prepares a transaction to call the "approveCurrencyForListing" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { setKeyGatewayEvent } from "thirdweb/extensions/farcaster"; +import { sendTransaction } from "thirdweb"; +import { approveCurrencyForListing } from "thirdweb/extensions/marketplace"; -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"; -}>; +const transaction = approveCurrencyForListing({ + contract, + listingId: ..., + currency: ..., + pricePerTokenInCurrency: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` -### 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"; -}>; +function approveCurrencyForListing( + options: BaseTransactionOptions< + | ApproveCurrencyForListingParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` -The prepared event object. ---- - -## FARCASTER.setMaxKeysPerFidEvent - -Creates an event object for the SetMaxKeysPerFid event. +### Parameters -### Example +The options for the "approveCurrencyForListing" function. -```ts -import { getContractEvents } from "thirdweb"; -import { setMaxKeysPerFidEvent } from "thirdweb/extensions/farcaster"; - -const events = await getContractEvents({ - contract, - events: [setMaxKeysPerFidEvent()], -}); -``` +#### Type ```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"; -}>; +let options: BaseTransactionOptions< + | ApproveCurrencyForListingParams + | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## FARCASTER.setValidatorEvent +## MARKETPLACE.auctionClosedEvent -Creates an event object for the SetValidator event. +Creates an event object for the AuctionClosed event. ### Example ```ts import { getContractEvents } from "thirdweb"; -import { setValidatorEvent } from "thirdweb/extensions/farcaster"; +import { auctionClosedEvent } from "thirdweb/extensions/marketplace"; const events = await getContractEvents({ - contract, - events: [setValidatorEvent()], +contract, +events: [ + auctionClosedEvent({ + auctionId: ..., + assetContract: ..., + closer: ..., +}) +], }); ``` ```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<{ +function auctionClosedEvent( + filters: Partial<{ + assetContract: string; + auctionId: bigint; + closer: string; + }>, +): 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 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: "SetValidator"; + readonly name: "AuctionClosed"; readonly type: "event"; }>; ``` -The prepared event object. ---- - -## FARCASTER.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. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + assetContract: string; + auctionId: bigint; + closer: string; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## FARCASTER.batchRent +## MARKETPLACE.bidInAuction -Prepares a transaction to call the "batchRent" function on the contract. +Places a bid in an English auction. ### Example ```ts +import { bidInAuction } from "thirdweb/extensions/marketplace"; import { sendTransaction } from "thirdweb"; -import { batchRent } from "thirdweb/extensions/farcaster"; -const transaction = batchRent({ - contract, - fids: ..., - units: ..., - overrides: { - ... - } +const transaction = bidInAuction({ + contract, + auctionId: 0n, + bidAmount: "100", }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function batchRent( - options: BaseTransactionOptions< - BatchRentParams | { asyncParams: () => Promise } - >, +function bidInAuction( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "batchRent" function. +The options for placing the bid. #### Type ```ts -let options: BaseTransactionOptions< - BatchRentParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -28438,166 +26291,217 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A transaction that can be sent to place the bid. --- -## FARCASTER.deprecationTimestamp +## MARKETPLACE.buyerApprovedForListingEvent -Calls the "deprecationTimestamp" function on the contract. +Creates an event object for the BuyerApprovedForListing event. ### Example ```ts -import { deprecationTimestamp } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { buyerApprovedForListingEvent } from "thirdweb/extensions/marketplace"; -const result = await deprecationTimestamp({ - contract, +const events = await getContractEvents({ +contract, +events: [ + buyerApprovedForListingEvent({ + listingId: ..., + buyer: ..., +}) +], }); ``` ```ts -function deprecationTimestamp( - options: BaseTransactionOptions, -): Promise; +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 -The options for the deprecationTimestamp function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ buyer: string; listingId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## FARCASTER.maxUnits +## MARKETPLACE.buyFromListing -Calls the "maxUnits" function on the contract. +Buys a listing from the marketplace. ### Example ```ts -import { maxUnits } from "thirdweb/extensions/farcaster"; +import { buyFromListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; -const result = await maxUnits({ +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 maxUnits(options: BaseTransactionOptions): Promise; +function buyFromListing( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the maxUnits function. +The options for buying from a listing. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A promise that resolves to the transaction result. --- -## FARCASTER.price +## MARKETPLACE.buyoutAuction -Calls the "price" function on the contract. +Buys out an English auction. ### Example ```ts -import { price } from "thirdweb/extensions/farcaster"; +import { buyoutAuction } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; -const result = await price({ - contract, - units: ..., +const transaction = buyoutAuction({ + contract, + auctionId: 0n, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function price( - options: BaseTransactionOptions, -): Promise; +function buyoutAuction( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the price function. +The options for buying out the auction. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A transaction that can be sent to buy out the auction. --- -## FARCASTER.rent +## MARKETPLACE.cancelAuction -Prepares a transaction to call the "rent" function on the contract. +Cancels an auction by providing the necessary options. ### Example ```ts +import { cancelAuction } from "thirdweb/extensions/marketplace"; import { sendTransaction } from "thirdweb"; -import { rent } from "thirdweb/extensions/farcaster"; -const transaction = rent({ - contract, - fid: ..., - units: ..., - overrides: { - ... - } +const transaction = cancelAuction({ + contract, + auctionId: 0n, }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function rent( - options: BaseTransactionOptions< - RentParams | { asyncParams: () => Promise } - >, +function cancelAuction( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "rent" function. +The options for canceling the auction. #### Type ```ts -let options: BaseTransactionOptions< - RentParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -28610,1028 +26514,1338 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A transaction that can be sent to cancel the auction. --- -## FARCASTER.rentedUnits +## MARKETPLACE.cancelledAuctionEvent -Calls the "rentedUnits" function on the contract. +Creates an event object for the CancelledAuction event. ### Example ```ts -import { rentedUnits } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { cancelledAuctionEvent } from "thirdweb/extensions/marketplace"; -const result = await rentedUnits({ - contract, +const events = await getContractEvents({ +contract, +events: [ + cancelledAuctionEvent({ + auctionCreator: ..., + auctionId: ..., +}) +], }); ``` ```ts -function rentedUnits( - options: BaseTransactionOptions, -): Promise; +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 -The options for the rentedUnits function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ auctionCreator: string; auctionId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## FARCASTER.unitPrice +## MARKETPLACE.cancelledListingEvent -Calls the "unitPrice" function on the contract. +Creates an event object for the CancelledListing event. ### Example ```ts -import { unitPrice } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { cancelledListingEvent } from "thirdweb/extensions/marketplace"; -const result = await unitPrice({ - contract, +const events = await getContractEvents({ +contract, +events: [ + cancelledListingEvent({ + listingCreator: ..., + listingId: ..., +}) +], }); ``` ```ts -function unitPrice(options: BaseTransactionOptions): Promise; +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 -The options for the unitPrice function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ listingCreator: string; listingId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## FARCASTER.usdUnitPrice +## MARKETPLACE.cancelledOfferEvent -Calls the "usdUnitPrice" function on the contract. +Creates an event object for the CancelledOffer event. ### Example ```ts -import { usdUnitPrice } from "thirdweb/extensions/farcaster"; +import { getContractEvents } from "thirdweb"; +import { cancelledOfferEvent } from "thirdweb/extensions/marketplace"; -const result = await usdUnitPrice({ - contract, +const events = await getContractEvents({ +contract, +events: [ + cancelledOfferEvent({ + offeror: ..., + offerId: ..., +}) +], }); ``` ```ts -function usdUnitPrice( - options: BaseTransactionOptions, -): Promise; +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 -The options for the usdUnitPrice function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ offerId: bigint; offeror: string }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. ---- -## LENS +The prepared event object. --- -## LENS.exists +## MARKETPLACE.cancelListing -Calls the "exists" function on the contract. +Prepares a transaction to call the "cancelListing" function on the contract. ### Example ```ts -import { exists } from "thirdweb/extensions/lens"; +import { sendTransaction } from "thirdweb"; +import { cancelListing } from "thirdweb/extensions/marketplace"; -const result = await exists({ +const transaction = cancelListing({ contract, - tokenId: ..., + listingId: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function exists( - options: BaseTransactionOptions, -): Promise; +function cancelListing( + options: BaseTransactionOptions< + | CancelListingParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the exists function. +The options for the "cancelListing" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CancelListingParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## LENS.getContentURI +## MARKETPLACE.cancelOffer -Calls the "getContentURI" function on the contract. +Prepares a transaction to call the "cancelOffer" function on the contract. ### Example ```ts -import { getContentURI } from "thirdweb/extensions/lens"; +import { sendTransaction } from "thirdweb"; +import { cancelOffer } from "thirdweb/extensions/marketplace"; -const result = await getContentURI({ +const transaction = cancelOffer({ contract, - profileId: ..., - pubId: ..., + offerId: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getContentURI( - options: BaseTransactionOptions, -): Promise; +function cancelOffer( + options: BaseTransactionOptions< + | CancelOfferParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the getContentURI function. +The options for the "cancelOffer" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CancelOfferParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## LENS.getDefaultHandle +## MARKETPLACE.collectAuctionPayout -Calls the "getDefaultHandle" function on the contract. +Prepares a transaction to call the "collectAuctionPayout" function on the contract. ### Example ```ts -import { getDefaultHandle } from "thirdweb/extensions/lens"; +import { sendTransaction } from "thirdweb"; +import { collectAuctionPayout } from "thirdweb/extensions/marketplace"; -const result = await getDefaultHandle({ +const transaction = collectAuctionPayout({ contract, - profileId: ..., + auctionId: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getDefaultHandle( - options: BaseTransactionOptions, -): Promise; +function collectAuctionPayout( + options: BaseTransactionOptions< + | CollectAuctionPayoutParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the getDefaultHandle function. +The options for the "collectAuctionPayout" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CollectAuctionPayoutParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## LENS.getFollowData +## MARKETPLACE.collectAuctionTokens -Calls the "getFollowData" function on the contract. +Prepares a transaction to call the "collectAuctionTokens" function on the contract. ### Example ```ts -import { getFollowData } from "thirdweb/extensions/lens"; +import { sendTransaction } from "thirdweb"; +import { collectAuctionTokens } from "thirdweb/extensions/marketplace"; -const result = await getFollowData({ +const transaction = collectAuctionTokens({ contract, - followTokenId: ..., + auctionId: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getFollowData( - options: BaseTransactionOptions, -): Promise<{ - followerProfileId: bigint; - followTimestamp: number; - originalFollowTimestamp: number; - profileIdAllowedToRecover: bigint; -}>; +function collectAuctionTokens( + options: BaseTransactionOptions< + | CollectAuctionTokensParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the getFollowData function. +The options for the "collectAuctionTokens" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CollectAuctionTokensParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise<{ - followerProfileId: bigint; - followTimestamp: number; - originalFollowTimestamp: number; - profileIdAllowedToRecover: bigint; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## LENS.getFollowerCount +## MARKETPLACE.createAuction -Calls the "getFollowerCount" function on the contract. +Creates an auction. ### Example -```ts -import { getFollowerCount } from "thirdweb/extensions/lens"; +```typescript +import { createAuction } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; -const result = await getFollowerCount({ - contract, -}); +const transaction = createAuction({...}); + +await sendTransaction({ transaction, account }); ``` ```ts -function getFollowerCount( - options: BaseTransactionOptions, -): Promise; +function createAuction( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the getFollowerCount function. +The options for creating the auction. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +The result of creating the auction. --- -## LENS.getFollowerProfileId +## MARKETPLACE.createListing -Calls the "getFollowerProfileId" function on the contract. +Creates a direct listing. ### Example -```ts -import { getFollowerProfileId } from "thirdweb/extensions/lens"; +```typescript +import { createListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; -const result = await getFollowerProfileId({ - contract, - followTokenId: ..., +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 getFollowerProfileId( - options: BaseTransactionOptions, -): Promise; +function createListing( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the getFollowerProfileId function. +The options for creating the direct listing. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +The result of creating the direct listing. --- -## LENS.getFollowTokenId +## MARKETPLACE.currencyApprovedForListingEvent -Calls the "getFollowTokenId" function on the contract. +Creates an event object for the CurrencyApprovedForListing event. ### Example ```ts -import { getFollowTokenId } from "thirdweb/extensions/lens"; +import { getContractEvents } from "thirdweb"; +import { currencyApprovedForListingEvent } from "thirdweb/extensions/marketplace"; -const result = await getFollowTokenId({ - contract, - followerProfileId: ..., +const events = await getContractEvents({ +contract, +events: [ + currencyApprovedForListingEvent({ + listingId: ..., + currency: ..., +}) +], }); ``` ```ts -function getFollowTokenId( - options: BaseTransactionOptions, -): Promise; +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 -The options for the getFollowTokenId function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ currency: string; listingId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## LENS.getFullProfile - -Return the profile data _with Lens handle_ and optional join date +## MARKETPLACE.currencyPriceForListing -In Lens Protocol, each profile is associated with an ERC721 token, thus, the tokenId represent profileId and the 2 terms can be used interchangeably +Retrieves the currency price for a listing. ### Example ```ts -import { getFullProfile } from "thirdweb/extension/lens"; +import { currencyPriceForListing } from "thirdweb/extensions/marketplace"; -const profileId = 10000n; // profileId is the tokenId of the NFT -const lensProfile = await getFullProfile({ profileId, client }); +const price = await currencyPriceForListing({ + contract, + listingId: 1n, + currency: "0x...", +}); ``` ```ts -function getFullProfile( - options: GetFullProfileParams, -): Promise; +function currencyPriceForListing( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters +The options for retrieving the currency price. + #### Type ```ts -let options: { - client: ThirdwebClient; - includeJoinDate?: boolean; - overrides?: { - chain?: Chain; - lensHandleAddress?: string; - lensHubAddress?: string; - tokenHandleRegistryAddress?: string; - }; - profileId: bigint; -}; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: { - handle: string; - joinDate: bigint | null; - profileData: LensProfileSchema | null; -} | null; +let returnType: Promise; ``` + +A promise that resolves to the currency price as a bigint. --- -## LENS.getHandle +## MARKETPLACE.executeSale -Calls the "getHandle" function on the contract. +Executes a sale for an English auction. ### Example ```ts -import { getHandle } from "thirdweb/extensions/lens"; +import { executeSale } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; -const result = await getHandle({ - contract, - tokenId: ..., +const transaction = executeSale({ + contract, + auctionId: 0n, }); + +await sendTransaction({ transaction, account }); ``` ```ts -function getHandle( - options: BaseTransactionOptions, -): Promise; +function executeSale( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the getHandle function. +The options for executing the sale. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A transaction that can be sent to execute the sale. --- -## LENS.getHandleFromProfileId +## MARKETPLACE.getAllAuctions -Return the Lens handle of a profile in the format: lens/@`` +Retrieves all auctions based on the provided options. ### Example ```ts -import { getHandleFromProfileId } from "thirdweb/extensions/lens"; +import { getAllAuctions } from "thirdweb/extensions/marketplace"; -const profileId = 461662n; -const handle = await getHandleFromProfileId({ profileId, client }); // "lens/@captain_jack" +const listings = await getAllAuctions({ + contract, + start: 0, + count: 10, +}); ``` ```ts -function getHandleFromProfileId( - options: GetHandleFromProfileIdParams, -): Promise; +function getAllAuctions( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters +The options for retrieving the auctions. + #### Type ```ts -let options: { - client: ThirdwebClient; - overrides?: { - chain?: Chain; - lensHandleAddress?: string; - tokenHandleRegistryAddress?: string; - }; - profileId: bigint; -}; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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. --- -## LENS.getHandleTokenURIContract +## MARKETPLACE.getAllListings -Calls the "getHandleTokenURIContract" function on the contract. +Retrieves all direct listings based on the provided options. ### Example ```ts -import { getHandleTokenURIContract } from "thirdweb/extensions/lens"; +import { getAllListings } from "thirdweb/extensions/marketplace"; -const result = await getHandleTokenURIContract({ +const listings = await getAllListings({ contract, + start: 0, + count: 10, }); ``` ```ts -function getHandleTokenURIContract( - options: BaseTransactionOptions, -): Promise; +function getAllListings( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the getHandleTokenURIContract function. +The options for retrieving the listing. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; -``` - -The parsed result of the function call. ---- +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"; +}; +``` -## LENS.getLocalName +A promise that resolves to the direct listings array. +--- -Calls the "getLocalName" function on the contract. +## MARKETPLACE.getAllOffers + +Retrieves all offers based on the provided options. ### Example ```ts -import { getLocalName } from "thirdweb/extensions/lens"; +import { getAllOffers } from "thirdweb/extensions/marketplace"; -const result = await getLocalName({ - contract, - tokenId: ..., +const listings = await getAllOffers({ + contract, + start: 0, + count: 10, }); ``` ```ts -function getLocalName( - options: BaseTransactionOptions, -): Promise; +function getAllOffers( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the getLocalName function. +The options for retrieving the offers. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: { + asset: NFT; + assetContractAddress: Address; + currencyContractAddress: Address; + currencyValue: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + offerorAddress: Address; + quantity: bigint; + status: ListingStatus; + tokenId: bigint; + totalPrice: bigint; +}; ``` -The parsed result of the function call. +A promise that resolves to the offers array. --- -## LENS.getModuleTypes +## MARKETPLACE.getAllValidAuctions -Calls the "getModuleTypes" function on the contract. +Retrieves all valid auctions based on the provided options. ### Example ```ts -import { getModuleTypes } from "thirdweb/extensions/lens"; +import { getAllValidAuctions } from "thirdweb/extensions/marketplace"; -const result = await getModuleTypes({ - contract, - moduleAddress: ..., +const validAuctions = await getAllValidAuctions({ + contract, + start: 0, + count: 10, }); ``` ```ts -function getModuleTypes( - options: BaseTransactionOptions, -): Promise; +function getAllValidAuctions( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the getModuleTypes function. +The options for retrieving the listing. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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"; +}; ``` -The parsed result of the function call. +A promise that resolves to the valid auctions array. --- -## LENS.getOriginalFollowTimestamp +## MARKETPLACE.getAllValidListings -Calls the "getOriginalFollowTimestamp" function on the contract. +Retrieves all valid direct listings based on the provided options. ### Example ```ts -import { getOriginalFollowTimestamp } from "thirdweb/extensions/lens"; +import { getAllValidListings } from "thirdweb/extensions/marketplace"; -const result = await getOriginalFollowTimestamp({ - contract, - followTokenId: ..., +const validListings = await getAllValidListings({ + contract, + start: 0, + count: 10, }); ``` ```ts -function getOriginalFollowTimestamp( - options: BaseTransactionOptions, -): Promise; +function getAllValidListings( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the getOriginalFollowTimestamp function. +The options for retrieving the valid listing. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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"; +}; ``` -The parsed result of the function call. +A promise that resolves to the direct listings array. --- -## LENS.getProfile +## MARKETPLACE.getAllValidOffers -Calls the "getProfile" function on the contract. +Retrieves all valid offers based on the provided options. ### Example ```ts -import { getProfile } from "thirdweb/extensions/lens"; +import { getAllValidOffers } from "thirdweb/extensions/marketplace"; -const result = await getProfile({ - contract, - profileId: ..., +const validOffers = await getAllValidOffers({ + contract, + start: 0, + count: 10, }); ``` ```ts -function getProfile( - options: BaseTransactionOptions, -): Promise<{ - __DEPRECATED__followNFTURI: string; - __DEPRECATED__handle: string; - __DEPRECATED__imageURI: string; - followModule: string; - followNFT: string; - metadataURI: string; - pubCount: bigint; -}>; +function getAllValidOffers( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the getProfile function. +The options for retrieving the valid offers. #### Type ```ts -let options: BaseTransactionOptions; +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; -}>; +let returnType: { + asset: NFT; + assetContractAddress: Address; + currencyContractAddress: Address; + currencyValue: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + offerorAddress: Address; + quantity: bigint; + status: ListingStatus; + tokenId: bigint; + totalPrice: bigint; +}; ``` -The parsed result of the function call. +A promise that resolves to the offers array. --- -## LENS.getProfileIdAllowedToRecover +## MARKETPLACE.getAuction -Calls the "getProfileIdAllowedToRecover" function on the contract. +Retrieves an auction listing based on the provided options. ### Example ```ts -import { getProfileIdAllowedToRecover } from "thirdweb/extensions/lens"; +import { getListing } from "thirdweb/extensions/marketplace"; -const result = await getProfileIdAllowedToRecover({ - contract, - followTokenId: ..., -}); +const listing = await getListing({ contract, listingId: 1n }); ``` ```ts -function getProfileIdAllowedToRecover( - options: BaseTransactionOptions, -): Promise; +function getAuction( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getProfileIdAllowedToRecover function. +The options for retrieving the listing. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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"; +}; ``` -The parsed result of the function call. +A promise that resolves to the direct listing. --- -## LENS.getProfileIdByHandleHash +## MARKETPLACE.getListing -Calls the "getProfileIdByHandleHash" function on the contract. +Retrieves a direct listing based on the provided options. ### Example ```ts -import { getProfileIdByHandleHash } from "thirdweb/extensions/lens"; +import { getListing } from "thirdweb/extensions/marketplace"; -const result = await getProfileIdByHandleHash({ - contract, - handleHash: ..., -}); +const listing = await getListing({ contract, listingId: 1n }); ``` ```ts -function getProfileIdByHandleHash( - options: BaseTransactionOptions, -): Promise; +function getListing( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getProfileIdByHandleHash function. +The options for retrieving the listing. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +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"; +}; ``` -The parsed result of the function call. +A promise that resolves to the direct listing. --- -## LENS.getProfileMetadata +## MARKETPLACE.getOffer -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. +Retrieves an offer based on the provided options. ### Example ```ts -import { getProfileMetadata } from "thirdweb/extensions/lens"; - -const profileData = await getProfileMetadata({ profileId, client }); +import { getOffer } from "thirdweb/extensions/marketplace"; -if (profileData) { - console.log("Display name: ", profileData.lens.name); - console.log("Bio: ", profileData.lens.bio); -} +const listing = await getOffer({ contract, listingId: 1n }); ``` ```ts -function getProfileMetadata( - options: GetProfileMetadataParams, -): Promise; +function getOffer( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters +The options for retrieving the offer. + #### Type ```ts -let options: { - client: ThirdwebClient; - overrides?: { chain?: Chain; lensHubAddress?: string }; - profileId: bigint; -}; +let options: BaseTransactionOptions; ``` ### Returns ```ts let returnType: { - lens: { - appId?: string; - attributes: Array; - bio: string; - coverPicture: string; - id: string; - name: string; - picture: string; - }; - signature: string; + asset: NFT; + assetContractAddress: Address; + currencyContractAddress: Address; + currencyValue: GetBalanceResult; + endTimeInSeconds: bigint; + id: bigint; + offerorAddress: Address; + quantity: bigint; + status: ListingStatus; + tokenId: bigint; + totalPrice: bigint; }; ``` -LensProfileSchema | null +A promise that resolves to the offer. --- -## LENS.getPublication +## MARKETPLACE.getWinningBid -Calls the "getPublication" function on the contract. +Retrieves the winning bid information for a given auction. ### Example ```ts -import { getPublication } from "thirdweb/extensions/lens"; +import { getWinningBid } from "thirdweb/extensions/marketplace"; -const result = await getPublication({ - contract, - profileId: ..., - pubId: ..., +const winningBid = await getWinningBid({ + contract, + auctionId: 0n, }); ``` ```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; -}>; +function getWinningBid( + options: BaseTransactionOptions, +): Promise< + | undefined + | { + bidAmountWei: bigint; + bidderAddress: string; + currencyAddress: string; + currencyValue: CurrencyValue; + } +>; ``` ### Parameters -The options for the getPublication function. +The options for retrieving the winning bid. #### Type ```ts -let options: BaseTransactionOptions; +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; -}>; +let returnType: Promise< + | undefined + | { + bidAmountWei: bigint; + bidderAddress: string; + currencyAddress: string; + currencyValue: CurrencyValue; + } +>; ``` -The parsed result of the function call. +The winning bid information, or undefined if there is no winning bid. --- -## LENS.getTokenId +## MARKETPLACE.isBidInAuctionSupported -Calls the "getTokenId" function on the contract. +Checks if the `bidInAuction` method is supported by the given contract. ### Example ```ts -import { getTokenId } from "thirdweb/extensions/lens"; +import { isBidInAuctionSupported } from "thirdweb/extensions/marketplace"; -const result = await getTokenId({ - contract, - localName: ..., -}); +const supported = isBidInAuctionSupported(["0x..."]); ``` ```ts -function getTokenId( - options: BaseTransactionOptions, -): Promise; +function isBidInAuctionSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the getTokenId function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `bidInAuction` method is supported. --- -## LENS.isErc20CurrencyRegistered +## MARKETPLACE.isBuyerApprovedForListing -Calls the "isErc20CurrencyRegistered" function on the contract. +Checks if the buyer is approved for a listing. ### Example ```ts -import { isErc20CurrencyRegistered } from "thirdweb/extensions/lens"; +import { isBuyerApprovedForListing } from "thirdweb/extensions/marketplace"; -const result = await isErc20CurrencyRegistered({ - contract, - currencyAddress: ..., +const isApproved = await isBuyerApprovedForListing({ + contract, + listingId: 1n, + buyer: "0x...", }); ``` ```ts -function isErc20CurrencyRegistered( - options: BaseTransactionOptions, +function isBuyerApprovedForListing( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the isErc20CurrencyRegistered function. +The options for checking buyer approval. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -29640,468 +27854,424 @@ let options: BaseTransactionOptions; let returnType: Promise; ``` -The parsed result of the function call. +A promise that resolves to a boolean indicating whether the buyer is approved for the listing. --- -## LENS.isFollowing +## MARKETPLACE.isBuyFromListingSupported -Calls the "isFollowing" function on the contract. +Checks if the `buyFromListing` method is supported by the given contract. ### Example ```ts -import { isFollowing } from "thirdweb/extensions/lens"; +import { isBuyFromListingSupported } from "thirdweb/extensions/marketplace"; -const result = await isFollowing({ - contract, - followerProfileId: ..., -}); +const supported = isBuyFromListingSupported(["0x..."]); ``` ```ts -function isFollowing( - options: BaseTransactionOptions, -): Promise; +function isBuyFromListingSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the isFollowing function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `buyFromListing` method is supported. --- -## LENS.isModuleRegistered +## MARKETPLACE.isCancelAuctionSupported -Calls the "isModuleRegistered" function on the contract. +Checks if the `cancelAuction` method is supported by the given contract. ### Example ```ts -import { isModuleRegistered } from "thirdweb/extensions/lens"; +import { isCancelAuctionSupported } from "thirdweb/extensions/marketplace"; -const result = await isModuleRegistered({ - contract, - moduleAddress: ..., -}); +const supported = isCancelAuctionSupported(["0x..."]); ``` ```ts -function isModuleRegistered( - options: BaseTransactionOptions, -): Promise; +function isCancelAuctionSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the isModuleRegistered function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `cancelAuction` method is supported. --- -## LENS.isModuleRegisteredAs +## MARKETPLACE.isCancelListingSupported -Calls the "isModuleRegisteredAs" function on the contract. +Checks if the `cancelListing` method is supported by the given contract. ### Example ```ts -import { isModuleRegisteredAs } from "thirdweb/extensions/lens"; +import { isCancelListingSupported } from "thirdweb/extensions/marketplace"; -const result = await isModuleRegisteredAs({ - contract, - moduleAddress: ..., - moduleType: ..., -}); +const supported = isCancelListingSupported(["0x..."]); ``` ```ts -function isModuleRegisteredAs( - options: BaseTransactionOptions, -): Promise; +function isCancelListingSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the isModuleRegisteredAs function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `cancelListing` method is supported. --- -## LENS.mintTimestampOf +## MARKETPLACE.isCreateAuctionSupported -Calls the "mintTimestampOf" function on the contract. +Checks if the `createAuction` method is supported by the given contract. ### Example ```ts -import { mintTimestampOf } from "thirdweb/extensions/lens"; +import { isCreateAuctionSupported } from "thirdweb/extensions/marketplace"; -const result = await mintTimestampOf({ - contract, - tokenId: ..., -}); +const supported = isCreateAuctionSupported(["0x..."]); ``` ```ts -function mintTimestampOf( - options: BaseTransactionOptions, -): Promise; +function isCreateAuctionSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the mintTimestampOf function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `createAuction` method is supported. --- -## LENS.mintTimestampOfFollowNFT +## MARKETPLACE.isCreateListingSupported -Calls the "mintTimestampOf" function on the contract. +Checks if the `createListing` method is supported by the given contract. ### Example ```ts -import { mintTimestampOf } from "thirdweb/extensions/lens"; +import { isCreateAuctionSupported } from "thirdweb/extensions/marketplace"; -const result = await mintTimestampOf({ - contract, - tokenId: ..., -}); +const supported = isCreateAuctionSupported(["0x..."]); ``` ```ts -function mintTimestampOfFollowNFT( - options: BaseTransactionOptions, -): Promise; +function isCreateListingSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the mintTimestampOf function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `createListing` method is supported. --- -## LENS.nonces +## MARKETPLACE.isCurrencyApprovedForListing -Calls the "nonces" function on the contract. +Calls the "isCurrencyApprovedForListing" function on the contract. ### Example ```ts -import { nonces } from "thirdweb/extensions/lens"; +import { isCurrencyApprovedForListing } from "thirdweb/extensions/marketplace"; -const result = await nonces({ +const result = await isCurrencyApprovedForListing({ contract, - signer: ..., + listingId: ..., + currency: ..., }); ``` ```ts -function nonces( - options: BaseTransactionOptions, -): Promise; +function isCurrencyApprovedForListing( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the nonces function. +The options for the isCurrencyApprovedForListing function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## LENS.resolve +## MARKETPLACE.isGetAuctionSupported -Calls the "resolve" function on the contract. +Checks if the `getAuction` method is supported by the given contract. ### Example ```ts -import { resolve } from "thirdweb/extensions/lens"; +import { isGetAuctionSupported } from "thirdweb/extensions/marketplace"; -const result = await resolve({ - contract, - handleId: ..., -}); +const supported = isGetAuctionSupported(["0x..."]); ``` ```ts -function resolve( - options: BaseTransactionOptions, -): Promise; +function isGetAuctionSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the resolve function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `getAuction` method is supported. --- -## LENS.resolveAddress +## MARKETPLACE.isGetListingSupported -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 +Checks if the `isGetListingSupported` method is supported by the given contract. ### Example ```ts -import { resolveAddress } from "thirdweb/extensions/lens"; +import { isGetListingSupported } from "thirdweb/extensions/marketplace"; -const walletAddress = await resolveAddress({ - name: "vitalik", - client, -}); +const supported = isGetListingSupported(["0x..."]); ``` ```ts -function resolveAddress( - options: ResolveLensAddressParams, -): Promise; +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 options: { - client: ThirdwebClient; - name: string; - overrides?: { chain?: Chain; lensHandleContractAddress?: string }; -}; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` + +A boolean indicating if the `isGetListingSupported` method is supported. --- -## LENS.tokenDataOf +## MARKETPLACE.isGetWinningBidSupported -Calls the "tokenDataOf" function on the contract. +Checks if the `getWinningBid` method is supported by the given contract. ### Example ```ts -import { tokenDataOf } from "thirdweb/extensions/lens"; +import { isGetWinningBidSupported } from "thirdweb/extensions/marketplace"; -const result = await tokenDataOf({ - contract, - tokenId: ..., -}); +const supported = isGetWinningBidSupported(["0x..."]); ``` ```ts -function tokenDataOf( - options: BaseTransactionOptions, -): Promise<{ mintTimestamp: bigint; owner: string }>; +function isGetWinningBidSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the tokenDataOf function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise<{ mintTimestamp: bigint; owner: string }>; +let returnType: boolean; ``` -The parsed result of the function call. ---- -## MULTICALL3 +A boolean indicating if the `getWinningBid` method is supported. --- -## MULTICALL3.aggregate +## MARKETPLACE.isNewWinningBid -Prepares a transaction to call the "aggregate" function on the contract. +Calls the "isNewWinningBid" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { aggregate } from "thirdweb/extensions/multicall3"; +import { isNewWinningBid } from "thirdweb/extensions/marketplace"; -const transaction = aggregate({ +const result = await isNewWinningBid({ contract, - calls: ..., - overrides: { - ... - } + auctionId: ..., + bidAmount: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function aggregate( - options: BaseTransactionOptions< - AggregateParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isNewWinningBid( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "aggregate" function. +The options for the isNewWinningBid function. #### Type ```ts -let options: BaseTransactionOptions< - AggregateParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## MULTICALL3.aggregate3 +## MARKETPLACE.makeOffer -Prepares a transaction to call the "aggregate3" function on the contract. +Makes an offer for any asset (ERC721 or ERC1155). ### Example ```ts +import { makeOffer } from "thirdweb/extensions/marketplace"; import { sendTransaction } from "thirdweb"; -import { aggregate3 } from "thirdweb/extensions/multicall3"; -const transaction = aggregate3({ - contract, - calls: ..., - overrides: { - ... - } +const offerTx = makeOffer({ + contract, + assetContractAddress: "0x1234567890123456789012345678901234567890", + tokenId: 1n, + currencyContractAddress: + "0x1234567890123456789012345678901234567890", + offerExpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24), + totalOffer: "1.0", }); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function aggregate3( - options: BaseTransactionOptions< - | Aggregate3Params - | { asyncParams: () => Promise } - >, +function makeOffer( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "aggregate3" function. +The options for making the offer. #### Type ```ts -let options: BaseTransactionOptions< - Aggregate3Params | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -30114,299 +28284,707 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A transaction object that can be sent to make the offer. --- -## MULTICALL3.aggregate3Value +## MARKETPLACE.newAuctionEvent -Prepares a transaction to call the "aggregate3Value" function on the contract. +Creates an event object for the NewAuction event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { aggregate3Value } from "thirdweb/extensions/multicall3"; +import { getContractEvents } from "thirdweb"; +import { newAuctionEvent } from "thirdweb/extensions/marketplace"; -const transaction = aggregate3Value({ - contract, - calls: ..., - overrides: { - ... - } +const events = await getContractEvents({ +contract, +events: [ + newAuctionEvent({ + auctionCreator: ..., + auctionId: ..., + assetContract: ..., +}) +], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function aggregate3Value( - options: BaseTransactionOptions< - | Aggregate3ValueParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 -The options for the "aggregate3Value" function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions< - | Aggregate3ValueParams - | { asyncParams: () => Promise } ->; +let filters: Partial<{ + assetContract: string; + auctionCreator: string; + auctionId: bigint; +}>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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"; +}>; ``` -A prepared transaction object. +The prepared event object. --- -## MULTICALL3.blockAndAggregate +## MARKETPLACE.newBidEvent -Prepares a transaction to call the "blockAndAggregate" function on the contract. +Creates an event object for the NewBid event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { blockAndAggregate } from "thirdweb/extensions/multicall3"; +import { getContractEvents } from "thirdweb"; +import { newBidEvent } from "thirdweb/extensions/marketplace"; -const transaction = blockAndAggregate({ - contract, - calls: ..., - overrides: { - ... - } +const events = await getContractEvents({ +contract, +events: [ + newBidEvent({ + auctionId: ..., + bidder: ..., + assetContract: ..., +}) +], }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function blockAndAggregate( - options: BaseTransactionOptions< - | BlockAndAggregateParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 -The options for the "blockAndAggregate" function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions< - | BlockAndAggregateParams - | { asyncParams: () => Promise } ->; +let filters: Partial<{ + assetContract: string; + auctionId: bigint; + bidder: string; +}>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; -``` - -A prepared transaction object. ---- - -## MULTICALL3.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; +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 parsed result of the function call. +The prepared event object. --- -## MULTICALL3.getBlockHash +## MARKETPLACE.newListingEvent -Calls the "getBlockHash" function on the contract. +Creates an event object for the NewListing event. ### Example ```ts -import { getBlockHash } from "thirdweb/extensions/multicall3"; +import { getContractEvents } from "thirdweb"; +import { newListingEvent } from "thirdweb/extensions/marketplace"; -const result = await getBlockHash({ - contract, - blockNumber: ..., +const events = await getContractEvents({ +contract, +events: [ + newListingEvent({ + listingCreator: ..., + listingId: ..., + assetContract: ..., +}) +], }); ``` ```ts -function getBlockHash( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +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 -The options for the getBlockHash function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; +}>; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +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 parsed result of the function call. +The prepared event object. --- -## MULTICALL3.getBlockNumber +## MARKETPLACE.newOfferEvent -Calls the "getBlockNumber" function on the contract. +Creates an event object for the NewOffer event. ### Example ```ts -import { getBlockNumber } from "thirdweb/extensions/multicall3"; +import { getContractEvents } from "thirdweb"; +import { newOfferEvent } from "thirdweb/extensions/marketplace"; -const result = await getBlockNumber({ - contract, +const events = await getContractEvents({ +contract, +events: [ + newOfferEvent({ + offeror: ..., + offerId: ..., + assetContract: ..., +}) +], }); ``` ```ts -function getBlockNumber( - options: BaseTransactionOptions, -): Promise; +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 -The options for the getBlockNumber function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ + assetContract: string; + offerId: bigint; + offeror: string; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## MULTICALL3.getChainId +## MARKETPLACE.newSaleEvent -Calls the "getChainId" function on the contract. +Creates an event object for the NewSale event. ### Example ```ts -import { getChainId } from "thirdweb/extensions/multicall3"; +import { getContractEvents } from "thirdweb"; +import { newSaleEvent } from "thirdweb/extensions/marketplace"; -const result = await getChainId({ - contract, +const events = await getContractEvents({ +contract, +events: [ + newSaleEvent({ + listingCreator: ..., + listingId: ..., + assetContract: ..., +}) +], }); ``` ```ts -function getChainId(options: BaseTransactionOptions): Promise; +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 -The options for the getChainId function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## MULTICALL3.getCurrentBlockCoinbase +## MARKETPLACE.totalAuctions -Calls the "getCurrentBlockCoinbase" function on the contract. +Calls the "totalAuctions" function on the contract. ### Example ```ts -import { getCurrentBlockCoinbase } from "thirdweb/extensions/multicall3"; +import { totalAuctions } from "thirdweb/extensions/marketplace"; -const result = await getCurrentBlockCoinbase({ +const result = await totalAuctions({ contract, }); ``` ```ts -function getCurrentBlockCoinbase( +function totalAuctions( options: BaseTransactionOptions, -): Promise; +): Promise; ``` ### Parameters -The options for the getCurrentBlockCoinbase function. +The options for the totalAuctions function. #### Type @@ -30417,35 +28995,35 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## MULTICALL3.getCurrentBlockDifficulty +## MARKETPLACE.totalListings -Calls the "getCurrentBlockDifficulty" function on the contract. +Calls the "totalListings" function on the contract. ### Example ```ts -import { getCurrentBlockDifficulty } from "thirdweb/extensions/multicall3"; +import { totalListings } from "thirdweb/extensions/marketplace"; -const result = await getCurrentBlockDifficulty({ +const result = await totalListings({ contract, }); ``` ```ts -function getCurrentBlockDifficulty( +function totalListings( options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the getCurrentBlockDifficulty function. +The options for the totalListings function. #### Type @@ -30462,29 +29040,29 @@ let returnType: Promise; The parsed result of the function call. --- -## MULTICALL3.getCurrentBlockGasLimit +## MARKETPLACE.totalOffers -Calls the "getCurrentBlockGasLimit" function on the contract. +Calls the "totalOffers" function on the contract. ### Example ```ts -import { getCurrentBlockGasLimit } from "thirdweb/extensions/multicall3"; +import { totalOffers } from "thirdweb/extensions/marketplace"; -const result = await getCurrentBlockGasLimit({ +const result = await totalOffers({ contract, }); ``` ```ts -function getCurrentBlockGasLimit( +function totalOffers( options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the getCurrentBlockGasLimit function. +The options for the totalOffers function. #### Type @@ -30501,137 +29079,195 @@ let returnType: Promise; The parsed result of the function call. --- -## MULTICALL3.getCurrentBlockTimestamp +## MARKETPLACE.updatedListingEvent -Calls the "getCurrentBlockTimestamp" function on the contract. +Creates an event object for the UpdatedListing event. ### Example ```ts -import { getCurrentBlockTimestamp } from "thirdweb/extensions/multicall3"; +import { getContractEvents } from "thirdweb"; +import { updatedListingEvent } from "thirdweb/extensions/marketplace"; -const result = await getCurrentBlockTimestamp({ - contract, +const events = await getContractEvents({ +contract, +events: [ + updatedListingEvent({ + listingCreator: ..., + listingId: ..., + assetContract: ..., +}) +], }); ``` ```ts -function getCurrentBlockTimestamp( - options: BaseTransactionOptions, -): Promise; +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 -The options for the getCurrentBlockTimestamp function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ + assetContract: string; + listingCreator: string; + listingId: bigint; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## MULTICALL3.getEthBalance +## MARKETPLACE.updateListing -Calls the "getEthBalance" function on the contract. +Updates an existing direct listing. ### Example -```ts -import { getEthBalance } from "thirdweb/extensions/multicall3"; +```typescript +import { updateListing } from "thirdweb/extensions/marketplace"; +import { sendTransaction } from "thirdweb"; -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. ---- - -## MULTICALL3.getLastBlockHash - -Calls the "getLastBlockHash" function on the contract. - -### Example - -```ts -import { getLastBlockHash } from "thirdweb/extensions/multicall3"; +const transaction = updateListing({...}); -const result = await getLastBlockHash({ - contract, -}); +await sendTransaction({ transaction, account }); ``` ```ts -function getLastBlockHash( - options: BaseTransactionOptions, -): Promise<`0x${string}`>; +function updateListing( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the getLastBlockHash function. +The options for updating the direct listing. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +The result of updating the direct listing. +--- +## MULTICALL3 --- -## MULTICALL3.tryAggregate +## MULTICALL3.aggregate -Prepares a transaction to call the "tryAggregate" function on the contract. +Prepares a transaction to call the "aggregate" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { tryAggregate } from "thirdweb/extensions/multicall3"; +import { aggregate } from "thirdweb/extensions/multicall3"; -const transaction = tryAggregate({ +const transaction = aggregate({ contract, - requireSuccess: ..., calls: ..., overrides: { ... @@ -30643,24 +29279,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function tryAggregate( +function aggregate( options: BaseTransactionOptions< - | TryAggregateParams - | { asyncParams: () => Promise } + AggregateParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "tryAggregate" function. +The options for the "aggregate" function. #### Type ```ts let options: BaseTransactionOptions< - | TryAggregateParams - | { asyncParams: () => Promise } + AggregateParams | { asyncParams: () => Promise } >; ``` @@ -30677,19 +29311,18 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MULTICALL3.tryBlockAndAggregate +## MULTICALL3.aggregate3 -Prepares a transaction to call the "tryBlockAndAggregate" function on the contract. +Prepares a transaction to call the "aggregate3" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { tryBlockAndAggregate } from "thirdweb/extensions/multicall3"; +import { aggregate3 } from "thirdweb/extensions/multicall3"; -const transaction = tryBlockAndAggregate({ +const transaction = aggregate3({ contract, - requireSuccess: ..., calls: ..., overrides: { ... @@ -30701,24 +29334,23 @@ await sendTransaction({ transaction, account }); ``` ```ts -function tryBlockAndAggregate( +function aggregate3( options: BaseTransactionOptions< - | TryBlockAndAggregateParams - | { asyncParams: () => Promise } + | Aggregate3Params + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "tryBlockAndAggregate" function. +The options for the "aggregate3" function. #### Type ```ts let options: BaseTransactionOptions< - | TryBlockAndAggregateParams - | { asyncParams: () => Promise } + Aggregate3Params | { asyncParams: () => Promise } >; ``` @@ -30734,67 +29366,48 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## PACK ---- - -## PACK.createNewPack -Deprecated +## MULTICALL3.aggregate3Value -\[Pack contract is incompatible with Pectra update. Support for this contract is being removed in next release.\] +Prepares a transaction to call the "aggregate3Value" function on the contract. ### Example ```ts -import { createNewPack } from "thirdweb/extensions/pack"; +import { sendTransaction } from "thirdweb"; +import { aggregate3Value } from "thirdweb/extensions/multicall3"; -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, - }, - ], +const transaction = aggregate3Value({ + contract, + calls: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function createNewPack( - options: WithOverrides>, +function aggregate3Value( + options: BaseTransactionOptions< + | Aggregate3ValueParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters +The options for the "aggregate3Value" function. + #### Type ```ts -let options: WithOverrides< - BaseTransactionOptions +let options: BaseTransactionOptions< + | Aggregate3ValueParams + | { asyncParams: () => Promise } >; ``` @@ -30807,26 +29420,23 @@ let returnType: PreparedTransaction< PrepareTransactionOptions >; ``` + +A prepared transaction object. --- -## PACK.createPack +## MULTICALL3.blockAndAggregate -Prepares a transaction to call the "createPack" function on the contract. +Prepares a transaction to call the "blockAndAggregate" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { createPack } from "thirdweb/extensions/pack"; +import { blockAndAggregate } from "thirdweb/extensions/multicall3"; -const transaction = createPack({ +const transaction = blockAndAggregate({ contract, - contents: ..., - numOfRewardUnits: ..., - packUri: ..., - openStartTimestamp: ..., - amountDistributedPerOpen: ..., - recipient: ..., + calls: ..., overrides: { ... } @@ -30837,23 +29447,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function createPack( +function blockAndAggregate( options: BaseTransactionOptions< - | CreatePackParams - | { asyncParams: () => Promise } + | BlockAndAggregateParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "createPack" function. +The options for the "blockAndAggregate" function. #### Type ```ts let options: BaseTransactionOptions< - CreatePackParams | { asyncParams: () => Promise } + | BlockAndAggregateParams + | { asyncParams: () => Promise } >; ``` @@ -30870,605 +29481,495 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## PACK.getPackContents +## MULTICALL3.getBasefee -Calls the "getPackContents" function on the contract. +Calls the "getBasefee" function on the contract. ### Example ```ts -import { getPackContents } from "thirdweb/extensions/pack"; +import { getBasefee } from "thirdweb/extensions/multicall3"; -const result = await getPackContents({ - contract, - packId: ..., +const result = await getBasefee({ + contract, }); ``` ```ts -function getPackContents(options: BaseTransactionOptions) : Promise, readonly Array]> +function getBasefee(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the getPackContents function. +The options for the getBasefee function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise, readonly Array]> +let returnType: Promise; ``` The parsed result of the function call. --- -## PACK.getTokenCountOfBundle +## MULTICALL3.getBlockHash -Calls the "getTokenCountOfBundle" function on the contract. +Calls the "getBlockHash" function on the contract. ### Example ```ts -import { getTokenCountOfBundle } from "thirdweb/extensions/pack"; +import { getBlockHash } from "thirdweb/extensions/multicall3"; -const result = await getTokenCountOfBundle({ +const result = await getBlockHash({ contract, - bundleId: ..., + blockNumber: ..., }); ``` ```ts -function getTokenCountOfBundle( - options: BaseTransactionOptions, -): Promise; +function getBlockHash( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for the getTokenCountOfBundle function. +The options for the getBlockHash function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` The parsed result of the function call. --- -## PACK.openPack +## MULTICALL3.getBlockNumber -Prepares a transaction to call the "openPack" function on the contract. +Calls the "getBlockNumber" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { openPack } from "thirdweb/extensions/pack"; +import { getBlockNumber } from "thirdweb/extensions/multicall3"; -const transaction = openPack({ - contract, - packId: ..., - amountToOpen: ..., - overrides: { - ... - } +const result = await getBlockNumber({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function openPack( - options: BaseTransactionOptions< - OpenPackParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getBlockNumber( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "openPack" function. +The options for the getBlockNumber function. #### Type ```ts -let options: BaseTransactionOptions< - OpenPackParams | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## PACK.packCreatedEvent +## MULTICALL3.getChainId -Creates an event object for the PackCreated event. +Calls the "getChainId" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { packCreatedEvent } from "thirdweb/extensions/pack"; +import { getChainId } from "thirdweb/extensions/multicall3"; -const events = await getContractEvents({ -contract, -events: [ - packCreatedEvent({ - packId: ..., -}) -], +const result = await getChainId({ + contract, }); ``` ```ts -function packCreatedEvent( - filters: Partial, -): 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"; -}>; +function getChainId(options: BaseTransactionOptions): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getChainId function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## PACK.packOpenedEvent +## MULTICALL3.getCurrentBlockCoinbase -Creates an event object for the PackOpened event. +Calls the "getCurrentBlockCoinbase" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { packOpenedEvent } from "thirdweb/extensions/pack"; +import { getCurrentBlockCoinbase } from "thirdweb/extensions/multicall3"; -const events = await getContractEvents({ -contract, -events: [ - packOpenedEvent({ - packId: ..., - opener: ..., -}) -], +const result = await getCurrentBlockCoinbase({ + contract, }); ``` ```ts -function packOpenedEvent( - filters: Partial, -): 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"; -}>; +function getCurrentBlockCoinbase( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getCurrentBlockCoinbase function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## PACK.packUpdatedEvent +## MULTICALL3.getCurrentBlockDifficulty -Creates an event object for the PackUpdated event. +Calls the "getCurrentBlockDifficulty" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { packUpdatedEvent } from "thirdweb/extensions/pack"; +import { getCurrentBlockDifficulty } from "thirdweb/extensions/multicall3"; -const events = await getContractEvents({ -contract, -events: [ - packUpdatedEvent({ - packId: ..., -}) -], +const result = await getCurrentBlockDifficulty({ + contract, }); ``` ```ts -function packUpdatedEvent( - filters: Partial, -): 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"; -}>; +function getCurrentBlockDifficulty( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for the getCurrentBlockDifficulty function. #### Type ```ts -let filters: Partial; +let options: { contract: ThirdwebContract } & T; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. ---- -## PERMISSIONS +The parsed result of the function call. --- -## PERMISSIONS.getAllRoleMembers +## MULTICALL3.getCurrentBlockGasLimit -Retrieves all members of a specific role. +Calls the "getCurrentBlockGasLimit" function on the contract. ### Example ```ts -import { getAllRoleMembers } from "thirdweb/extensions/permissions"; +import { getCurrentBlockGasLimit } from "thirdweb/extensions/multicall3"; -const result = await getAllRoleMembers({ +const result = await getCurrentBlockGasLimit({ contract, - role: "admin", }); ``` ```ts -function getAllRoleMembers( - options: BaseTransactionOptions, -): Promise>; +function getCurrentBlockGasLimit( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for retrieving role members. +The options for the getCurrentBlockGasLimit function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise>; +let returnType: Promise; ``` -A promise that resolves to an array of strings representing the role members. +The parsed result of the function call. --- -## PERMISSIONS.getRoleAdmin +## MULTICALL3.getCurrentBlockTimestamp -Gets the admin of a role. +Calls the "getCurrentBlockTimestamp" function on the contract. ### Example ```ts -import { getRoleAdmin } from "thirdweb/extensions/permissions"; +import { getCurrentBlockTimestamp } from "thirdweb/extensions/multicall3"; -const result = await getRoleAdmin({ +const result = await getCurrentBlockTimestamp({ contract, - role: "admin", }); ``` ```ts -function getRoleAdmin( - options: BaseTransactionOptions, -): Promise; +function getCurrentBlockTimestamp( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for getting the role's admin. +The options for the getCurrentBlockTimestamp function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The address of the role's admin. +The parsed result of the function call. --- -## PERMISSIONS.getRoleHash +## MULTICALL3.getEthBalance -Get a hex value of a smart contract role You need the hex value to interact with the smart contracts. +Calls the "getEthBalance" function on the contract. ### Example ```ts -const adminRoleHash = getRoleHash("admin"); // 0x0000000...000000 +import { getEthBalance } from "thirdweb/extensions/multicall3"; + +const result = await getEthBalance({ + contract, + addr: ..., +}); ``` ```ts -function getRoleHash(role: RoleInput): `0x${string}`; +function getEthBalance( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -string +The options for the getEthBalance function. #### Type ```ts -let role: RoleInput; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: Promise; ``` -hex value of the contract role +The parsed result of the function call. --- -## PERMISSIONS.getRoleMember +## MULTICALL3.getLastBlockHash -Retrieves a specific member of a specific role. +Calls the "getLastBlockHash" function on the contract. ### Example ```ts -import { getRoleMember } from "thirdweb/extensions/permissions"; +import { getLastBlockHash } from "thirdweb/extensions/multicall3"; -const address = await getRoleMember({ +const result = await getLastBlockHash({ contract, - role: "admin", - index: 0n, }); ``` ```ts -function getRoleMember( - options: BaseTransactionOptions, -): Promise; +function getLastBlockHash( + options: BaseTransactionOptions, +): Promise<`0x${string}`>; ``` ### Parameters -The options for retrieving the role member. +The options for the getLastBlockHash function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<`0x${string}`>; ``` -A promise that resolves to the address of the role member. +The parsed result of the function call. --- -## PERMISSIONS.getRoleMemberCount +## MULTICALL3.tryAggregate -Retrieves the number of members of a specific role. +Prepares a transaction to call the "tryAggregate" function on the contract. ### Example ```ts -import { getRoleMemberCount } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; +import { tryAggregate } from "thirdweb/extensions/multicall3"; -const result = await getRoleMemberCount({ - contract, - role: "admin", +const transaction = tryAggregate({ + contract, + requireSuccess: ..., + calls: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getRoleMemberCount( - options: BaseTransactionOptions, -): Promise; +function tryAggregate( + options: BaseTransactionOptions< + | TryAggregateParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for retrieving role member count. +The options for the "tryAggregate" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | TryAggregateParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves to the number of members of the role. +A prepared transaction object. --- -## PERMISSIONS.grantRole +## MULTICALL3.tryBlockAndAggregate -Grants a role to a target account. +Prepares a transaction to call the "tryBlockAndAggregate" function on the contract. ### Example ```ts -import { grantRole } from "thirdweb/extensions/permissions"; import { sendTransaction } from "thirdweb"; +import { tryBlockAndAggregate } from "thirdweb/extensions/multicall3"; -const transaction = grantRole({ - contract, - role: "admin", - targetAccountAddress: "0x1234567890123456789012345678901234567890", +const transaction = tryBlockAndAggregate({ + contract, + requireSuccess: ..., + calls: ..., + overrides: { + ... + } }); +// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function grantRole( - options: BaseTransactionOptions, +function tryBlockAndAggregate( + options: BaseTransactionOptions< + | TryBlockAndAggregateParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for granting the role. +The options for the "tryBlockAndAggregate" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | TryBlockAndAggregateParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -31481,730 +29982,739 @@ let returnType: PreparedTransaction< >; ``` -A transaction that grants the role when sent. +A prepared transaction object. +--- +## PACK --- -## PERMISSIONS.hasRole - -Checks if the target account has the role. +## PACK.createNewPack ### Example ```ts -import { hasRole } from "thirdweb/extensions/permissions"; +import { createNewPack } from "thirdweb/extensions/pack"; -const result = await hasRole({ - contract, - role: "admin", - targetAccountAddress: "0x1234567890123456789012345678901234567890", +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 hasRole( - options: BaseTransactionOptions, -): Promise; +function createNewPack( + options: WithOverrides>, +): PreparedTransaction; ``` ### Parameters -The options for checking the role. - #### Type ```ts -let options: BaseTransactionOptions; +let options: WithOverrides< + BaseTransactionOptions +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` - -A boolean that is true if the target account has the role. --- -## PERMISSIONS.isGetAllRoleMembersSupported +## PACK.createPack -Checks if the `getAllRoleMembers` method is supported by the given contract. +Prepares a transaction to call the "createPack" function on the contract. ### Example ```ts -import { isGetAllRoleMembersSupported } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; +import { createPack } from "thirdweb/extensions/pack"; -const supported = isGetAllRoleMembersSupported(["0x..."]); +const transaction = createPack({ + contract, + contents: ..., + numOfRewardUnits: ..., + packUri: ..., + openStartTimestamp: ..., + amountDistributedPerOpen: ..., + recipient: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function isGetAllRoleMembersSupported( - availableSelectors: Array, -): boolean; +function createPack( + options: BaseTransactionOptions< + | CreatePackParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "createPack" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + CreatePackParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getAllRoleMembers` method is supported. +A prepared transaction object. --- -## PERMISSIONS.isGetRoleAdminSupported +## PACK.getPackContents -Checks if the `getRoleAdmin` method is supported by the given contract. +Calls the "getPackContents" function on the contract. ### Example ```ts -import { isGetRoleAdminSupported } from "thirdweb/extensions/permissions"; -const supported = isGetRoleAdminSupported(["0x..."]); +import { getPackContents } from "thirdweb/extensions/pack"; + +const result = await getPackContents({ + contract, + packId: ..., +}); ``` ```ts -function isGetRoleAdminSupported( - availableSelectors: Array, -): boolean; +function getPackContents(options: BaseTransactionOptions) : Promise, readonly Array]> ``` ### 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. +The options for the getPackContents function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise, readonly Array]> ``` -A boolean indicating if the `getRoleAdmin` method is supported. +The parsed result of the function call. --- -## PERMISSIONS.isGetRoleMemberCountSupported +## PACK.getTokenCountOfBundle -Checks if the `getRoleMemberCount` method is supported by the given contract. +Calls the "getTokenCountOfBundle" function on the contract. ### Example ```ts -import { isGetRoleMemberCountSupported } from "thirdweb/extensions/permissions"; -const supported = isGetRoleMemberCountSupported(["0x..."]); +import { getTokenCountOfBundle } from "thirdweb/extensions/pack"; + +const result = await getTokenCountOfBundle({ + contract, + bundleId: ..., +}); ``` ```ts -function isGetRoleMemberCountSupported( - availableSelectors: Array, -): boolean; +function getTokenCountOfBundle( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the getTokenCountOfBundle function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getRoleMemberCount` method is supported. +The parsed result of the function call. --- -## PERMISSIONS.isGetRoleMemberSupported +## PACK.openPack -Checks if the `getRoleMember` method is supported by the given contract. +Prepares a transaction to call the "openPack" function on the contract. ### Example ```ts -import { isGetRoleMemberSupported } from "thirdweb/extensions/permissions"; -const supported = isGetRoleMemberSupported(["0x..."]); +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 isGetRoleMemberSupported( - availableSelectors: Array, -): boolean; +function openPack( + options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "openPack" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + OpenPackParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getRoleMember` method is supported. +A prepared transaction object. --- -## PERMISSIONS.isGrantRoleSupported +## PACK.packCreatedEvent -Checks if the `grantRole` method is supported by the given contract. +Creates an event object for the PackCreated event. ### Example ```ts -import { isGrantRoleSupported } from "thirdweb/extensions/permissions"; +import { getContractEvents } from "thirdweb"; +import { packCreatedEvent } from "thirdweb/extensions/pack"; -const supported = isGrantRoleSupported(["0x..."]); +const events = await getContractEvents({ +contract, +events: [ + packCreatedEvent({ + packId: ..., +}) +], +}); ``` ```ts -function isGrantRoleSupported( - availableSelectors: Array, -): boolean; +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 -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. +Optional filters to apply to the event. #### Type ```ts -let availableSelectors: Array; +let filters: Partial<{ packId: bigint }>; ``` ### Returns ```ts -let returnType: boolean; +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"; +}>; ``` -A boolean indicating if the `grantRole` method is supported. +The prepared event object. --- -## PERMISSIONS.isHasRoleSupported +## PACK.packOpenedEvent -Checks if the `hasRole` method is supported by the given contract. +Creates an event object for the PackOpened event. ### Example ```ts -import { isHasRoleSupported } from "thirdweb/extensions/permissions"; -const supported = isHasRoleSupported(["0x..."]); +import { getContractEvents } from "thirdweb"; +import { packOpenedEvent } from "thirdweb/extensions/pack"; + +const events = await getContractEvents({ +contract, +events: [ + packOpenedEvent({ + packId: ..., + opener: ..., +}) +], +}); ``` ```ts -function isHasRoleSupported( - availableSelectors: Array, -): boolean; +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 -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. +Optional filters to apply to the event. #### Type ```ts -let availableSelectors: Array; +let filters: Partial<{ opener: string; packId: bigint }>; ``` ### Returns ```ts -let returnType: boolean; +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"; +}>; ``` -A boolean indicating if the `hasRole` method is supported. +The prepared event object. --- -## PERMISSIONS.isRenounceRoleSupported +## PACK.packUpdatedEvent -Checks if the `renounceRole` method is supported by the given contract. +Creates an event object for the PackUpdated event. ### Example ```ts -import { isRenounceRoleSupported } from "thirdweb/extensions/permissions"; +import { getContractEvents } from "thirdweb"; +import { packUpdatedEvent } from "thirdweb/extensions/pack"; -const supported = isRenounceRoleSupported(["0x..."]); +const events = await getContractEvents({ +contract, +events: [ + packUpdatedEvent({ + packId: ..., +}) +], +}); ``` ```ts -function isRenounceRoleSupported( - availableSelectors: Array, -): boolean; +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 -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. +Optional filters to apply to the event. #### Type ```ts -let availableSelectors: Array; +let filters: Partial<{ packId: bigint }>; ``` ### Returns ```ts -let returnType: boolean; +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"; +}>; ``` -A boolean indicating if the `renounceRole` method is supported. +The prepared event object. --- - -## PERMISSIONS.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. +## PERMISSIONS --- -## PERMISSIONS.renounceRole +## PERMISSIONS.getAllRoleMembers -Lets the target account renounce the role. (The target account must be the sender of the transaction.) +Retrieves all members of a specific role. ### Example ```ts -import { renounceRole } from "thirdweb/extensions/permissions"; -import { sendTransaction } from "thirdweb"; +import { getAllRoleMembers } from "thirdweb/extensions/permissions"; -const transaction = renounceRole({ +const result = await getAllRoleMembers({ contract, role: "admin", - targetAccountAddress: "0x1234567890123456789012345678901234567890", }); -await sendTransaction({ transaction, account }); ``` ```ts -function renounceRole( - options: BaseTransactionOptions, -): PreparedTransaction; +function getAllRoleMembers( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for renouncing the role. +The options for retrieving role members. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise>; ``` -A transaction that revokes the role when sent. +A promise that resolves to an array of strings representing the role members. --- -## PERMISSIONS.revokeRole +## PERMISSIONS.getRoleAdmin -Revokes a role from a target account. +Gets the admin of a role. ### Example ```ts -import { revokeRole } from "thirdweb/extensions/permissions"; -import { sendTransaction } from "thirdweb"; +import { getRoleAdmin } from "thirdweb/extensions/permissions"; -const transaction = revokeRole({ +const result = await getRoleAdmin({ contract, role: "admin", - targetAccountAddress: "0x1234567890123456789012345678901234567890", }); - -await sendTransaction({ transaction, account }); ``` ```ts -function revokeRole( - options: BaseTransactionOptions, -): PreparedTransaction; +function getRoleAdmin( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for revoking the role. +The options for getting the role's admin. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A transaction that revokes the role when sent. +The address of the role's admin. --- -## PERMISSIONS.roleAdminChangedEvent +## PERMISSIONS.getRoleHash -Creates an event object for the RoleAdminChanged event. +Get a hex value of a smart contract role You need the hex value to interact with the smart contracts. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { roleAdminChangedEvent } from "thirdweb/extensions/permissions"; - -const events = await getContractEvents({ -contract, -events: [ - roleAdminChangedEvent({ - role: ..., - previousAdminRole: ..., - newAdminRole: ..., -}) -], -}); +const adminRoleHash = getRoleHash("admin"); // 0x0000000...000000 ``` ```ts -function roleAdminChangedEvent( - filters: Partial, -): 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"; -}>; +function getRoleHash(role: RoleInput): `0x${string}`; ``` ### Parameters -Optional filters to apply to the event. +string #### Type ```ts -let filters: Partial; +let role: RoleInput; ``` ### 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"; -}>; +let returnType: `0x${string}`; ``` -The prepared event object. +hex value of the contract role --- -## PERMISSIONS.roleGrantedEvent +## PERMISSIONS.getRoleMember -Creates an event object for the RoleGranted event. +Retrieves a specific member of a specific role. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { roleGrantedEvent } from "thirdweb/extensions/permissions"; +import { getRoleMember } from "thirdweb/extensions/permissions"; -const events = await getContractEvents({ -contract, -events: [ - roleGrantedEvent({ - role: ..., - account: ..., - sender: ..., -}) -], +const address = await getRoleMember({ + contract, + role: "admin", + index: 0n, }); ``` ```ts -function roleGrantedEvent( - filters: Partial, -): 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"; -}>; +function getRoleMember( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for retrieving the role member. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +A promise that resolves to the address of the role member. --- -## PERMISSIONS.roleRevokedEvent +## PERMISSIONS.getRoleMemberCount -Creates an event object for the RoleRevoked event. +Retrieves the number of members of a specific role. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { roleRevokedEvent } from "thirdweb/extensions/permissions"; +import { getRoleMemberCount } from "thirdweb/extensions/permissions"; -const events = await getContractEvents({ -contract, -events: [ - roleRevokedEvent({ - role: ..., - account: ..., - sender: ..., -}) -], +const result = await getRoleMemberCount({ + contract, + role: "admin", }); ``` ```ts -function roleRevokedEvent( - filters: Partial, -): 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"; -}>; +function getRoleMemberCount( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -Optional filters to apply to the event. +The options for retrieving role member count. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. ---- -## SPLIT +A promise that resolves to the number of members of the role. --- -## SPLIT.distribute +## PERMISSIONS.grantRole -Prepares a transaction to call the "distribute" function on the contract. +Grants a role to a target account. ### Example ```ts +import { grantRole } from "thirdweb/extensions/permissions"; import { sendTransaction } from "thirdweb"; -import { distribute } from "thirdweb/extensions/split"; -const transaction = distribute(); +const transaction = grantRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", +}); -// Send the transaction await sendTransaction({ transaction, account }); ``` ```ts -function distribute( - options: BaseTransactionOptions, +function grantRole( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for the "distribute" function. +The options for granting the role. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -32217,449 +30727,374 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +A transaction that grants the role when sent. --- -## SPLIT.distributeByToken +## PERMISSIONS.hasRole -This extension is similar to the `distribute` extension, however it require you to specify the token (address) that you want to distribute +Checks if the target account has the role. ### Example ```ts -import { distributeByToken } from "thirdweb/extensions/split"; - -const transaction = distributeByToken(); +import { hasRole } from "thirdweb/extensions/permissions"; -// Send the transaction -... +const result = await hasRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", +}); ``` ```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 ->; +function hasRole( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters +The options for checking the role. + #### Type ```ts -let options: BaseTransactionOptions<{ tokenAddress: string }>; +let options: BaseTransactionOptions; ``` ### 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 ->; +let returnType: Promise; ``` -A prepared transaction object. +A boolean that is true if the target account has the role. --- -## SPLIT.getAllRecipientsAddresses +## PERMISSIONS.isGetAllRoleMembersSupported -Get the addresses of all recipients of a [thirdweb Split contract](https://thirdweb.com/thirdweb.eth/Split) +Checks if the `getAllRoleMembers` method is supported by the given contract. ### Example ```ts -import { getAllRecipientsAddresses } from "thirdweb/extensions/split"; +import { isGetAllRoleMembersSupported } from "thirdweb/extensions/permissions"; -const addresses = await getAllRecipientsAddresses({ contract }); +const supported = isGetAllRoleMembersSupported(["0x..."]); ``` ```ts -function getAllRecipientsAddresses( - options: BaseTransactionOptions, -): Promise>; +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise>; +let returnType: boolean; ``` -an array of wallet addresses +A boolean indicating if the `getAllRoleMembers` method is supported. --- -## SPLIT.getAllRecipientsPercentages +## PERMISSIONS.isGetRoleAdminSupported -Get all the recipients of a Split contracts +Checks if the `getRoleAdmin` method is supported by the given contract. ### 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% - }, -]; +import { isGetRoleAdminSupported } from "thirdweb/extensions/permissions"; +const supported = isGetRoleAdminSupported(["0x..."]); ``` ```ts -function getAllRecipientsPercentages( - options: BaseTransactionOptions, -): Promise>; +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: { address: string; splitPercentage: number }; +let returnType: boolean; ``` -an array of recipients' addresses and split percentage of each +A boolean indicating if the `getRoleAdmin` method is supported. --- -## SPLIT.getRecipientSplitPercentage +## PERMISSIONS.isGetRoleMemberCountSupported -Get the split percentage of a recipient +Checks if the `getRoleMemberCount` method is supported by the given contract. ### Example ```ts -import { getRecipientSplitPercentage } from "thirdweb/extensions/split"; - -const percentage = await getRecipientSplitPercentage({ - recipientAddress: "0x...", -}); +import { isGetRoleMemberCountSupported } from "thirdweb/extensions/permissions"; +const supported = isGetRoleMemberCountSupported(["0x..."]); ``` ```ts -function getRecipientSplitPercentage( - options: BaseTransactionOptions<{ recipientAddress: string }>, -): Promise; +function isGetRoleMemberCountSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the transaction +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 options: BaseTransactionOptions<{ recipientAddress: string }>; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: { address: string; splitPercentage: number }; +let returnType: boolean; ``` -The split percentage of the recipient +A boolean indicating if the `getRoleMemberCount` method is supported. --- -## SPLIT.payee +## PERMISSIONS.isGetRoleMemberSupported -Calls the "payee" function on the contract. +Checks if the `getRoleMember` method is supported by the given contract. ### Example ```ts -import { payee } from "thirdweb/extensions/split"; - -const result = await payee({ - contract, - index: ..., -}); +import { isGetRoleMemberSupported } from "thirdweb/extensions/permissions"; +const supported = isGetRoleMemberSupported(["0x..."]); ``` ```ts -function payee( - options: BaseTransactionOptions, -): Promise; +function isGetRoleMemberSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the payee function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `getRoleMember` method is supported. --- -## SPLIT.payeeCount +## PERMISSIONS.isGrantRoleSupported -Calls the "payeeCount" function on the contract. +Checks if the `grantRole` method is supported by the given contract. ### Example ```ts -import { payeeCount } from "thirdweb/extensions/split"; +import { isGrantRoleSupported } from "thirdweb/extensions/permissions"; -const result = await payeeCount({ - contract, -}); +const supported = isGrantRoleSupported(["0x..."]); ``` ```ts -function payeeCount(options: BaseTransactionOptions): Promise; +function isGrantRoleSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the payeeCount function. +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 options: { contract: ThirdwebContract } & T; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `grantRole` method is supported. --- -## SPLIT.releasable +## PERMISSIONS.isHasRoleSupported -Calls the "releasable" function on the contract. +Checks if the `hasRole` method is supported by the given contract. ### Example ```ts -import { releasable } from "thirdweb/extensions/split"; - -const result = await releasable({ - contract, - account: ..., -}); +import { isHasRoleSupported } from "thirdweb/extensions/permissions"; +const supported = isHasRoleSupported(["0x..."]); ``` ```ts -function releasable( - options: BaseTransactionOptions, -): Promise; +function isHasRoleSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the releasable function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `hasRole` method is supported. --- -## SPLIT.releasableByToken +## PERMISSIONS.isRenounceRoleSupported -Calls the "releasable" function on the contract. +Checks if the `renounceRole` method is supported by the given contract. ### Example ```ts -import { releasableByToken } from "thirdweb/extensions/split"; +import { isRenounceRoleSupported } from "thirdweb/extensions/permissions"; -const result = await releasableByToken({ - contract, - account: ..., -}); +const supported = isRenounceRoleSupported(["0x..."]); ``` ```ts -function releasableByToken( - options: BaseTransactionOptions, -): Promise; +function isRenounceRoleSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the releasable function. +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 options: BaseTransactionOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise; +let returnType: boolean; ``` -The parsed result of the function call. +A boolean indicating if the `renounceRole` method is supported. --- -## SPLIT.release +## PERMISSIONS.isRevokeRoleSupported -Prepares a transaction to call the "release" function on the contract. +Checks if the `revokeRole` method is supported by the given contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { release } from "thirdweb/extensions/split"; - -const transaction = release({ - contract, - account: ..., - overrides: { - ... - } -}); +import { isRevokeRoleSupported } from "thirdweb/extensions/permissions"; -// Send the transaction -await sendTransaction({ transaction, account }); +const supported = isRevokeRoleSupported(["0x..."]); ``` ```ts -function release( - options: BaseTransactionOptions< - ReleaseParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function isRevokeRoleSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the "release" function. +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 options: BaseTransactionOptions< - ReleaseParams | { asyncParams: () => Promise } ->; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: boolean; ``` -A prepared transaction object. +A boolean indicating if the `revokeRole` method is supported. --- -## SPLIT.releaseByToken +## PERMISSIONS.renounceRole -Similar to the `release` extension, however this one requires you to specify a tokenAddress to release +Lets the target account renounce the role. (The target account must be the sender of the transaction.) ### Example ```ts -import { releaseByToken } from "thirdweb/extensions/split"; +import { renounceRole } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; -const transaction = releaseByToken({ - contract, - account: ..., - overrides: { - ... - } +const transaction = renounceRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", }); - -// Send the transaction -... +await sendTransaction({ transaction, account }); ``` ```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 ->; +function renounceRole( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters +The options for renouncing the role. + #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -32667,270 +31102,433 @@ let options: BaseTransactionOptions; ```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"; - }, + AbiFunction, PrepareTransactionOptions >; ``` + +A transaction that revokes the role when sent. --- -## SPLIT.released +## PERMISSIONS.revokeRole -Calls the "released" function on the contract. +Revokes a role from a target account. ### Example ```ts -import { released } from "thirdweb/extensions/split"; +import { revokeRole } from "thirdweb/extensions/permissions"; +import { sendTransaction } from "thirdweb"; -const result = await released({ - contract, - account: ..., +const transaction = revokeRole({ + contract, + role: "admin", + targetAccountAddress: "0x1234567890123456789012345678901234567890", }); + +await sendTransaction({ transaction, account }); ``` ```ts -function released( - options: BaseTransactionOptions, -): Promise; +function revokeRole( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the released function. +The options for revoking the role. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A transaction that revokes the role when sent. --- -## SPLIT.releasedByToken +## PERMISSIONS.roleAdminChangedEvent -Calls the "released" function on the contract. Similar to the `released` extension, however this one requires you to specify a tokenAddress +Creates an event object for the RoleAdminChanged event. ### Example ```ts -import { releasedByToken } from "thirdweb/extensions/split"; +import { getContractEvents } from "thirdweb"; +import { roleAdminChangedEvent } from "thirdweb/extensions/permissions"; -const result = await releasedByToken({ - contract, - account: "0x...", - tokenAddress: "0x...", +const events = await getContractEvents({ +contract, +events: [ + roleAdminChangedEvent({ + role: ..., + previousAdminRole: ..., + newAdminRole: ..., +}) +], }); ``` ```ts -function releasedByToken( - options: BaseTransactionOptions< - ReleasedParams & { tokenAddress: string } - >, -): Promise; +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 -The options for the released function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions< - ReleasedParams & { tokenAddress: string } ->; +let filters: Partial<{ + newAdminRole: `0x${string}`; + previousAdminRole: `0x${string}`; + role: `0x${string}`; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## SPLIT.shares +## PERMISSIONS.roleGrantedEvent -Calls the "shares" function on the contract. +Creates an event object for the RoleGranted event. ### Example ```ts -import { shares } from "thirdweb/extensions/split"; +import { getContractEvents } from "thirdweb"; +import { roleGrantedEvent } from "thirdweb/extensions/permissions"; -const result = await shares({ - contract, +const events = await getContractEvents({ +contract, +events: [ + roleGrantedEvent({ + role: ..., account: ..., + sender: ..., +}) +], }); ``` ```ts -function shares( - options: BaseTransactionOptions, -): Promise; +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 -The options for the shares function. +Optional filters to apply to the event. #### Type ```ts -let options: BaseTransactionOptions; +let filters: Partial<{ + account: string; + role: `0x${string}`; + sender: string; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. --- -## SPLIT.totalReleased +## PERMISSIONS.roleRevokedEvent -Calls the "totalReleased" function on the contract. +Creates an event object for the RoleRevoked event. ### Example ```ts -import { totalReleased } from "thirdweb/extensions/split"; +import { getContractEvents } from "thirdweb"; +import { roleRevokedEvent } from "thirdweb/extensions/permissions"; -const result = await totalReleased({ - contract, +const events = await getContractEvents({ +contract, +events: [ + roleRevokedEvent({ + role: ..., + account: ..., + sender: ..., +}) +], }); ``` ```ts -function totalReleased( - options: BaseTransactionOptions, -): Promise; +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 -The options for the totalReleased function. +Optional filters to apply to the event. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let filters: Partial<{ + account: string; + role: `0x${string}`; + sender: string; +}>; ``` ### Returns ```ts -let returnType: Promise; +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 parsed result of the function call. +The prepared event object. +--- +## SPLIT --- -## SPLIT.totalReleasedByToken +## SPLIT.distribute -Calls the "totalReleased" function on the contract. Similar to the `release` extension, however this one requires you to specify a tokenAddress +Prepares a transaction to call the "distribute" function on the contract. ### Example ```ts -import { totalReleasedByToken } from "thirdweb/extensions/split"; +import { sendTransaction } from "thirdweb"; +import { distribute } from "thirdweb/extensions/split"; -const result = await totalReleasedByToken({ - contract, - tokenAddress: "0x...", -}); +const transaction = distribute(); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function totalReleasedByToken( - options: BaseTransactionOptions<{ tokenAddress: string }>, -): Promise; +function distribute( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the totalReleased function. +The options for the "distribute" function. #### Type ```ts -let options: BaseTransactionOptions<{ tokenAddress: string }>; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. ---- -## THIRDWEB +A prepared transaction object. --- -## THIRDWEB.add +## SPLIT.distributeByToken -Prepares a transaction to call the "add" function on the contract. +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 { sendTransaction } from "thirdweb"; -import { add } from "thirdweb/extensions/thirdweb"; +import { distributeByToken } from "thirdweb/extensions/split"; -const transaction = add({ - contract, - deployer: ..., - deployment: ..., - chainId: ..., - metadataUri: ..., - overrides: { - ... - } -}); +const transaction = distributeByToken(); // Send the transaction -await sendTransaction({ transaction, account }); +... ``` ```ts -function add( - options: BaseTransactionOptions< - AddParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 -The options for the "add" function. - #### Type ```ts -let options: BaseTransactionOptions< - AddParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions<{ tokenAddress: string }>; ``` ### Returns @@ -32938,7 +31536,15 @@ let options: BaseTransactionOptions< ```ts let returnType: PreparedTransaction< any, - AbiFunction, + { + readonly inputs: readonly [ + { readonly name: "token"; readonly type: "address" }, + ]; + readonly name: "distribute"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, PrepareTransactionOptions >; ``` @@ -32946,30 +31552,26 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## THIRDWEB.contractType +## SPLIT.getAllRecipientsAddresses -Calls the "contractType" function on the contract. +Get the addresses of all recipients of a [thirdweb Split contract](https://thirdweb.com/thirdweb.eth/Split) ### Example ```ts -import { contractType } from "thirdweb/extensions/thirdweb"; +import { getAllRecipientsAddresses } from "thirdweb/extensions/split"; -const result = await contractType({ - contract, -}); +const addresses = await getAllRecipientsAddresses({ contract }); ``` ```ts -function contractType( +function getAllRecipientsAddresses( options: BaseTransactionOptions, -): Promise; +): Promise>; ``` ### Parameters -The options for the contractType function. - #### Type ```ts @@ -32979,609 +31581,599 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: Promise>; ``` -The parsed result of the function call. +an array of wallet addresses --- -## THIRDWEB.count +## SPLIT.getAllRecipientsPercentages -Calls the "count" function on the contract. +Get all the recipients of a Split contracts ### Example ```ts -import { count } from "thirdweb/extensions/thirdweb"; +import { getAllRecipientsPercentages } from "thirdweb/extensions/split"; -const result = await count({ - contract, - deployer: ..., -}); +const allRecipients = await getAllRecipientsPercentages({ contract }); +// Example result: +[ + { + address: "0x1...", + splitPercentage: 25, // 25% + }, + { + address: "0x2...", + splitPercentage: 75, // 75% + }, +]; ``` ```ts -function count( - options: BaseTransactionOptions, -): Promise; +function getAllRecipientsPercentages( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the count function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +let returnType: { address: string; splitPercentage: number }; ``` -The parsed result of the function call. +an array of recipients' addresses and split percentage of each --- -## THIRDWEB.deployProxyByImplementation +## SPLIT.getRecipientSplitPercentage -Prepares a transaction to call the "deployProxyByImplementation" function on the contract. +Get the split percentage of a recipient ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { deployProxyByImplementation } from "thirdweb/extensions/thirdweb"; +import { getRecipientSplitPercentage } from "thirdweb/extensions/split"; -const transaction = deployProxyByImplementation({ - contract, - implementation: ..., - data: ..., - salt: ..., - overrides: { - ... - } +const percentage = await getRecipientSplitPercentage({ + recipientAddress: "0x...", }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function deployProxyByImplementation( - options: BaseTransactionOptions< - | DeployProxyByImplementationParams - | { - asyncParams: () => Promise; - } - >, -): PreparedTransaction; +function getRecipientSplitPercentage( + options: BaseTransactionOptions<{ recipientAddress: string }>, +): Promise; ``` ### Parameters -The options for the "deployProxyByImplementation" function. +The options for the transaction #### Type ```ts -let options: BaseTransactionOptions< - | DeployProxyByImplementationParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions<{ recipientAddress: string }>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: { address: string; splitPercentage: number }; ``` -A prepared transaction object. +The split percentage of the recipient --- -## THIRDWEB.getAll +## SPLIT.payee -Calls the "getAll" function on the contract. +Calls the "payee" function on the contract. ### Example ```ts -import { getAll } from "thirdweb/extensions/thirdweb"; +import { payee } from "thirdweb/extensions/split"; -const result = await getAll({ +const result = await payee({ contract, - deployer: ..., + index: ..., }); ``` ```ts -function getAll(options: BaseTransactionOptions) : Promise> +function payee( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getAll function. +The options for the payee function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise> +let returnType: Promise; ``` The parsed result of the function call. --- -## THIRDWEB.getAllPublishedContracts +## SPLIT.payeeCount -Calls the "getAllPublishedContracts" function on the contract. +Calls the "payeeCount" function on the contract. ### Example ```ts -import { getAllPublishedContracts } from "thirdweb/extensions/thirdweb"; +import { payeeCount } from "thirdweb/extensions/split"; -const result = await getAllPublishedContracts({ - contract, - publisher: ..., +const result = await payeeCount({ + contract, }); ``` ```ts -function getAllPublishedContracts(options: BaseTransactionOptions) : Promise> +function payeeCount(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the getAllPublishedContracts function. +The options for the payeeCount function. #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise> +let returnType: Promise; ``` The parsed result of the function call. --- -## THIRDWEB.getMetadataUri +## SPLIT.releasable -Calls the "getMetadataUri" function on the contract. +Calls the "releasable" function on the contract. ### Example ```ts -import { getMetadataUri } from "thirdweb/extensions/thirdweb"; +import { releasable } from "thirdweb/extensions/split"; -const result = await getMetadataUri({ +const result = await releasable({ contract, - chainId: ..., - deployment: ..., + account: ..., }); ``` ```ts -function getMetadataUri( - options: BaseTransactionOptions, -): Promise; +function releasable( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getMetadataUri function. +The options for the releasable function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## THIRDWEB.getPublishedContract +## SPLIT.releasableByToken -Calls the "getPublishedContract" function on the contract. +Calls the "releasable" function on the contract. ### Example ```ts -import { getPublishedContract } from "thirdweb/extensions/thirdweb"; +import { releasableByToken } from "thirdweb/extensions/split"; -const result = await getPublishedContract({ +const result = await releasableByToken({ contract, - publisher: ..., - contractId: ..., + account: ..., }); ``` ```ts -function getPublishedContract( - options: BaseTransactionOptions, -): Promise<{ - bytecodeHash: `0x${string}`; - contractId: string; - implementation: string; - publishMetadataUri: string; - publishTimestamp: bigint; -}>; +function releasableByToken( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getPublishedContract function. +The options for the releasable function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<{ - bytecodeHash: `0x${string}`; - contractId: string; - implementation: string; - publishMetadataUri: string; - publishTimestamp: bigint; -}>; +let returnType: Promise; ``` The parsed result of the function call. --- -## THIRDWEB.getPublishedContractVersions +## SPLIT.release -Calls the "getPublishedContractVersions" function on the contract. +Prepares a transaction to call the "release" function on the contract. ### Example ```ts -import { getPublishedContractVersions } from "thirdweb/extensions/thirdweb"; +import { sendTransaction } from "thirdweb"; +import { release } from "thirdweb/extensions/split"; -const result = await getPublishedContractVersions({ +const transaction = release({ contract, - publisher: ..., - contractId: ..., + account: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getPublishedContractVersions(options: BaseTransactionOptions) : Promise> +function release( + options: BaseTransactionOptions< + ReleaseParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the getPublishedContractVersions function. +The options for the "release" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + ReleaseParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise> +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## THIRDWEB.getPublishedUriFromCompilerUri +## SPLIT.releaseByToken -Calls the "getPublishedUriFromCompilerUri" function on the contract. +Similar to the `release` extension, however this one requires you to specify a tokenAddress to release ### Example ```ts -import { getPublishedUriFromCompilerUri } from "thirdweb/extensions/thirdweb"; +import { releaseByToken } from "thirdweb/extensions/split"; -const result = await getPublishedUriFromCompilerUri({ +const transaction = releaseByToken({ contract, - compilerMetadataUri: ..., + account: ..., + overrides: { + ... + } }); + +// Send the transaction +... ``` ```ts -function getPublishedUriFromCompilerUri(options: BaseTransactionOptions) : Promise> +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 -The options for the getPublishedUriFromCompilerUri function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise> +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 +>; ``` - -The parsed result of the function call. --- -## THIRDWEB.getPublisherProfileUri +## SPLIT.released -Calls the "getPublisherProfileUri" function on the contract. +Calls the "released" function on the contract. ### Example ```ts -import { getPublisherProfileUri } from "thirdweb/extensions/thirdweb"; +import { released } from "thirdweb/extensions/split"; -const result = await getPublisherProfileUri({ +const result = await released({ contract, - publisher: ..., + account: ..., }); ``` ```ts -function getPublisherProfileUri( - options: BaseTransactionOptions, -): Promise; +function released( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getPublisherProfileUri function. +The options for the released function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## THIRDWEB.isContractTypeSupported +## SPLIT.releasedByToken -Checks if the `contractType` method is supported by the given contract. +Calls the "released" function on the contract. Similar to the `released` extension, however this one requires you to specify a tokenAddress ### Example ```ts -import { isContractTypeSupported } from "thirdweb/extensions/thirdweb"; +import { releasedByToken } from "thirdweb/extensions/split"; -const supported = isContractTypeSupported(["0x..."]); +const result = await releasedByToken({ + contract, + account: "0x...", + tokenAddress: "0x...", +}); ``` ```ts -function isContractTypeSupported( - availableSelectors: Array, -): boolean; +function releasedByToken( + options: BaseTransactionOptions< + ReleasedParams & { tokenAddress: string } + >, +): Promise; ``` ### 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. +The options for the released function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + ReleasedParams & { tokenAddress: string } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `contractType` method is supported. +The parsed result of the function call. --- -## THIRDWEB.publishContract +## SPLIT.shares -Publish a contract to the contract publisher. +Calls the "shares" function on the contract. ### Example ```ts -const tx = publishContract({ - contract, - account, - metadata, +import { shares } from "thirdweb/extensions/split"; + +const result = await shares({ + contract, + account: ..., }); ``` ```ts -function publishContract( - options: BaseTransactionOptions, -): PreparedTransaction; +function shares( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for publishing the contract. +The options for the shares function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -The transaction to publish the contract. +The parsed result of the function call. --- -## THIRDWEB.remove +## SPLIT.totalReleased -Prepares a transaction to call the "remove" function on the contract. +Calls the "totalReleased" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { remove } from "thirdweb/extensions/thirdweb"; +import { totalReleased } from "thirdweb/extensions/split"; -const transaction = remove({ - contract, - deployer: ..., - deployment: ..., - chainId: ..., - overrides: { - ... - } +const result = await totalReleased({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function remove( - options: BaseTransactionOptions< - RemoveParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function totalReleased( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "remove" function. +The options for the totalReleased function. #### Type ```ts -let options: BaseTransactionOptions< - RemoveParams | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## THIRDWEB.setPublisherProfileUri +## SPLIT.totalReleasedByToken -Prepares a transaction to call the "setPublisherProfileUri" function on the contract. +Calls the "totalReleased" function on the contract. Similar to the `release` extension, however this one requires you to specify a tokenAddress ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { setPublisherProfileUri } from "thirdweb/extensions/thirdweb"; +import { totalReleasedByToken } from "thirdweb/extensions/split"; -const transaction = setPublisherProfileUri({ - contract, - publisher: ..., - uri: ..., - overrides: { - ... - } +const result = await totalReleasedByToken({ + contract, + tokenAddress: "0x...", }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function setPublisherProfileUri( - options: BaseTransactionOptions< - | SetPublisherProfileUriParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function totalReleasedByToken( + options: BaseTransactionOptions<{ tokenAddress: string }>, +): Promise; ``` ### Parameters -The options for the "setPublisherProfileUri" function. +The options for the totalReleased function. #### Type ```ts -let options: BaseTransactionOptions< - | SetPublisherProfileUriParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions<{ tokenAddress: string }>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. +--- +## THIRDWEB --- -## THIRDWEB.unpublishContract +## THIRDWEB.add -Prepares a transaction to call the "unpublishContract" function on the contract. +Prepares a transaction to call the "add" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { unpublishContract } from "thirdweb/extensions/thirdweb"; +import { add } from "thirdweb/extensions/thirdweb"; -const transaction = unpublishContract({ +const transaction = add({ contract, - publisher: ..., - contractId: ..., + deployer: ..., + deployment: ..., + chainId: ..., + metadataUri: ..., overrides: { ... } @@ -33592,24 +32184,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function unpublishContract( +function add( options: BaseTransactionOptions< - | UnpublishContractParams - | { asyncParams: () => Promise } + AddParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "unpublishContract" function. +The options for the "add" function. #### Type ```ts let options: BaseTransactionOptions< - | UnpublishContractParams - | { asyncParams: () => Promise } + AddParams | { asyncParams: () => Promise } >; ``` @@ -33625,138 +32215,101 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## UNISWAP ---- -## UNISWAP.createPool +## THIRDWEB.contractType -Prepares a transaction to call the "createPool" function on the contract. +Calls the "contractType" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { createPool } from "thirdweb/extensions/uniswap"; +import { contractType } from "thirdweb/extensions/thirdweb"; -const transaction = createPool({ - contract, - tokenA: ..., - tokenB: ..., - fee: ..., - overrides: { - ... - } +const result = await contractType({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function createPool( - options: BaseTransactionOptions< - | CreatePoolParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function contractType( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "createPool" function. +The options for the contractType function. #### Type ```ts -let options: BaseTransactionOptions< - CreatePoolParams | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## UNISWAP.enableFeeAmount +## THIRDWEB.count -Prepares a transaction to call the "enableFeeAmount" function on the contract. +Calls the "count" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { enableFeeAmount } from "thirdweb/extensions/uniswap"; +import { count } from "thirdweb/extensions/thirdweb"; -const transaction = enableFeeAmount({ +const result = await count({ contract, - fee: ..., - tickSpacing: ..., - overrides: { - ... - } + deployer: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function enableFeeAmount( - options: BaseTransactionOptions< - | EnableFeeAmountParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function count( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "enableFeeAmount" function. +The options for the count function. #### Type ```ts -let options: BaseTransactionOptions< - | EnableFeeAmountParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## UNISWAP.exactInput +## THIRDWEB.deployProxyByImplementation -Prepares a transaction to call the "exactInput" function on the contract. +Prepares a transaction to call the "deployProxyByImplementation" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { exactInput } from "thirdweb/extensions/uniswap"; +import { deployProxyByImplementation } from "thirdweb/extensions/thirdweb"; -const transaction = exactInput({ +const transaction = deployProxyByImplementation({ contract, - params: ..., + implementation: ..., + data: ..., + salt: ..., overrides: { ... } @@ -33767,23 +32320,26 @@ await sendTransaction({ transaction, account }); ``` ```ts -function exactInput( +function deployProxyByImplementation( options: BaseTransactionOptions< - | ExactInputParams - | { asyncParams: () => Promise } + | DeployProxyByImplementationParams + | { + asyncParams: () => Promise; + } >, ): PreparedTransaction; ``` ### Parameters -The options for the "exactInput" function. +The options for the "deployProxyByImplementation" function. #### Type ```ts let options: BaseTransactionOptions< - ExactInputParams | { asyncParams: () => Promise } + | DeployProxyByImplementationParams + | { asyncParams: () => Promise } >; ``` @@ -33800,371 +32356,282 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## UNISWAP.exactInputSingle +## THIRDWEB.getAll -Prepares a transaction to call the "exactInputSingle" function on the contract. +Calls the "getAll" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { exactInputSingle } from "thirdweb/extensions/uniswap"; +import { getAll } from "thirdweb/extensions/thirdweb"; -const transaction = exactInputSingle({ +const result = await getAll({ contract, - params: ..., - overrides: { - ... - } + deployer: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function exactInputSingle( - options: BaseTransactionOptions< - | ExactInputSingleParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getAll(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the "exactInputSingle" function. +The options for the getAll function. #### Type ```ts -let options: BaseTransactionOptions< - | ExactInputSingleParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise> ``` -A prepared transaction object. +The parsed result of the function call. --- -## UNISWAP.exactOutput +## THIRDWEB.getAllPublishedContracts -Prepares a transaction to call the "exactOutput" function on the contract. +Calls the "getAllPublishedContracts" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { exactOutput } from "thirdweb/extensions/uniswap"; +import { getAllPublishedContracts } from "thirdweb/extensions/thirdweb"; -const transaction = exactOutput({ +const result = await getAllPublishedContracts({ contract, - params: ..., - overrides: { - ... - } + publisher: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function exactOutput( - options: BaseTransactionOptions< - | ExactOutputParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getAllPublishedContracts(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the "exactOutput" function. +The options for the getAllPublishedContracts function. #### Type ```ts -let options: BaseTransactionOptions< - | ExactOutputParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise> ``` -A prepared transaction object. +The parsed result of the function call. --- -## UNISWAP.exactOutputSingle +## THIRDWEB.getMetadataUri -Prepares a transaction to call the "exactOutputSingle" function on the contract. +Calls the "getMetadataUri" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { exactOutputSingle } from "thirdweb/extensions/uniswap"; +import { getMetadataUri } from "thirdweb/extensions/thirdweb"; -const transaction = exactOutputSingle({ +const result = await getMetadataUri({ contract, - params: ..., - overrides: { - ... - } + chainId: ..., + deployment: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function exactOutputSingle( - options: BaseTransactionOptions< - | ExactOutputSingleParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getMetadataUri( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "exactOutputSingle" function. +The options for the getMetadataUri function. #### Type ```ts -let options: BaseTransactionOptions< - | ExactOutputSingleParams - | { asyncParams: () => Promise } ->; -``` - -### Returns - -```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; -``` - -A prepared transaction object. ---- - -## UNISWAP.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"; -}>; +let options: BaseTransactionOptions; ``` ### 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"; -}>; +let returnType: Promise; ``` -The prepared event object. +The parsed result of the function call. --- -## UNISWAP.feeAmountTickSpacing +## THIRDWEB.getPublishedContract -Calls the "feeAmountTickSpacing" function on the contract. +Calls the "getPublishedContract" function on the contract. ### Example ```ts -import { feeAmountTickSpacing } from "thirdweb/extensions/uniswap"; +import { getPublishedContract } from "thirdweb/extensions/thirdweb"; -const result = await feeAmountTickSpacing({ +const result = await getPublishedContract({ contract, - fee: ..., + publisher: ..., + contractId: ..., }); ``` ```ts -function feeAmountTickSpacing( - options: BaseTransactionOptions, -): Promise; +function getPublishedContract( + options: BaseTransactionOptions, +): Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; ``` ### Parameters -The options for the feeAmountTickSpacing function. +The options for the getPublishedContract function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; ``` The parsed result of the function call. --- -## UNISWAP.getPool +## THIRDWEB.getPublishedContractVersions -Calls the "getPool" function on the contract. +Calls the "getPublishedContractVersions" function on the contract. ### Example ```ts -import { getPool } from "thirdweb/extensions/uniswap"; +import { getPublishedContractVersions } from "thirdweb/extensions/thirdweb"; -const result = await getPool({ +const result = await getPublishedContractVersions({ contract, - tokenA: ..., - tokenB: ..., - fee: ..., + publisher: ..., + contractId: ..., }); ``` ```ts -function getPool( - options: BaseTransactionOptions, -): Promise; +function getPublishedContractVersions(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the getPool function. +The options for the getPublishedContractVersions function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise> ``` The parsed result of the function call. --- -## UNISWAP.getUniswapV3Pool +## THIRDWEB.getPublishedUriFromCompilerUri -Finds the Uniswap V3 pools for the two tokens. +Calls the "getPublishedUriFromCompilerUri" function on the contract. ### Example ```ts -import { getUniswapV3Pool } from "thirdweb/extensions/uniswap"; -const pools = await getUniswapV3Pool({ - tokenA: "0x...", - tokenB: "0x...", - contract: factoryContract, +import { getPublishedUriFromCompilerUri } from "thirdweb/extensions/thirdweb"; + +const result = await getPublishedUriFromCompilerUri({ + contract, + compilerMetadataUri: ..., }); ``` ```ts -function getUniswapV3Pool( - options: BaseTransactionOptions, -): Promise>; +function getPublishedUriFromCompilerUri(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The token pair to find any pools for any Uniswap contract that implements getPool. +The options for the getPublishedUriFromCompilerUri function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: { - poolAddress: Address; - poolFee: (typeof UniswapFee)[keyof typeof UniswapFee]; -}; +let returnType: Promise> ``` -The pools' addresses and fees. +The parsed result of the function call. --- -## UNISWAP.owner +## THIRDWEB.getPublisherProfileUri -Calls the "owner" function on the contract. +Calls the "getPublisherProfileUri" function on the contract. ### Example ```ts -import { owner } from "thirdweb/extensions/uniswap"; +import { getPublisherProfileUri } from "thirdweb/extensions/thirdweb"; -const result = await owner({ - contract, +const result = await getPublisherProfileUri({ + contract, + publisher: ..., }); ``` ```ts -function owner(options: BaseTransactionOptions): Promise; +function getPublisherProfileUri( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the owner function. +The options for the getPublisherProfileUri function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -34176,191 +32643,114 @@ let returnType: Promise; The parsed result of the function call. --- -## UNISWAP.ownerChangedEvent +## THIRDWEB.isContractTypeSupported -Creates an event object for the OwnerChanged event. +Checks if the `contractType` method is supported by the given contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { ownerChangedEvent } from "thirdweb/extensions/uniswap"; +import { isContractTypeSupported } from "thirdweb/extensions/thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - ownerChangedEvent({ - oldOwner: ..., - newOwner: ..., -}) -], -}); +const supported = isContractTypeSupported(["0x..."]); ``` ```ts -function ownerChangedEvent( - filters: Partial, -): 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"; -}>; +function isContractTypeSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -Optional filters to apply to the event. +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 filters: Partial; +let availableSelectors: Array; ``` ### 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"; -}>; +let returnType: boolean; ``` -The prepared event object. +A boolean indicating if the `contractType` method is supported. --- -## UNISWAP.poolCreatedEvent +## THIRDWEB.remove -Creates an event object for the PoolCreated event. +Prepares a transaction to call the "remove" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { poolCreatedEvent } from "thirdweb/extensions/uniswap"; +import { sendTransaction } from "thirdweb"; +import { remove } from "thirdweb/extensions/thirdweb"; -const events = await getContractEvents({ -contract, -events: [ - poolCreatedEvent({ - token0: ..., - token1: ..., - sender: ..., -}) -], +const transaction = remove({ + contract, + deployer: ..., + deployment: ..., + chainId: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function poolCreatedEvent( - filters: Partial, -): 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"; -}>; +function remove( + options: BaseTransactionOptions< + RemoveParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -Optional filters to apply to the event. +The options for the "remove" function. #### Type ```ts -let filters: Partial; +let options: BaseTransactionOptions< + RemoveParams | { asyncParams: () => Promise } +>; ``` ### 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## UNISWAP.quoteExactInput +## THIRDWEB.setPublisherProfileUri -Prepares a transaction to call the "quoteExactInput" function on the contract. +Prepares a transaction to call the "setPublisherProfileUri" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { quoteExactInput } from "thirdweb/extensions/uniswap"; +import { setPublisherProfileUri } from "thirdweb/extensions/thirdweb"; -const transaction = quoteExactInput({ +const transaction = setPublisherProfileUri({ contract, - path: ..., - amountIn: ..., + publisher: ..., + uri: ..., overrides: { ... } @@ -34371,24 +32761,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function quoteExactInput( +function setPublisherProfileUri( options: BaseTransactionOptions< - | QuoteExactInputParams - | { asyncParams: () => Promise } + | SetPublisherProfileUriParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "quoteExactInput" function. +The options for the "setPublisherProfileUri" function. #### Type ```ts let options: BaseTransactionOptions< - | QuoteExactInputParams - | { asyncParams: () => Promise } + | SetPublisherProfileUriParams + | { asyncParams: () => Promise } >; ``` @@ -34405,23 +32795,20 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## UNISWAP.quoteExactInputSingle +## THIRDWEB.unpublishContract -Prepares a transaction to call the "quoteExactInputSingle" function on the contract. +Prepares a transaction to call the "unpublishContract" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { quoteExactInputSingle } from "thirdweb/extensions/uniswap"; +import { unpublishContract } from "thirdweb/extensions/thirdweb"; -const transaction = quoteExactInputSingle({ +const transaction = unpublishContract({ contract, - tokenIn: ..., - tokenOut: ..., - fee: ..., - amountIn: ..., - sqrtPriceLimitX96: ..., + publisher: ..., + contractId: ..., overrides: { ... } @@ -34432,24 +32819,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function quoteExactInputSingle( +function unpublishContract( options: BaseTransactionOptions< - | QuoteExactInputSingleParams - | { asyncParams: () => Promise } + | UnpublishContractParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "quoteExactInputSingle" function. +The options for the "unpublishContract" function. #### Type ```ts let options: BaseTransactionOptions< - | QuoteExactInputSingleParams - | { asyncParams: () => Promise } + | UnpublishContractParams + | { asyncParams: () => Promise } >; ``` @@ -34465,21 +32852,69 @@ let returnType: PreparedTransaction< A prepared transaction object. --- +## thirdweb +--- -## UNISWAP.quoteExactOutput +## thirdweb.publishContract -Prepares a transaction to call the "quoteExactOutput" function on the contract. +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 +--- + +## UNISWAP.createPool + +Prepares a transaction to call the "createPool" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { quoteExactOutput } from "thirdweb/extensions/uniswap"; +import { createPool } from "thirdweb/extensions/uniswap"; -const transaction = quoteExactOutput({ +const transaction = createPool({ contract, - path: ..., - amountOut: ..., + tokenA: ..., + tokenB: ..., + fee: ..., overrides: { ... } @@ -34490,24 +32925,23 @@ await sendTransaction({ transaction, account }); ``` ```ts -function quoteExactOutput( +function createPool( options: BaseTransactionOptions< - | QuoteExactOutputParams - | { asyncParams: () => Promise } + | CreatePoolParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "quoteExactOutput" function. +The options for the "createPool" function. #### Type ```ts let options: BaseTransactionOptions< - | QuoteExactOutputParams - | { asyncParams: () => Promise } + CreatePoolParams | { asyncParams: () => Promise } >; ``` @@ -34524,23 +32958,20 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## UNISWAP.quoteExactOutputSingle +## UNISWAP.enableFeeAmount -Prepares a transaction to call the "quoteExactOutputSingle" function on the contract. +Prepares a transaction to call the "enableFeeAmount" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { quoteExactOutputSingle } from "thirdweb/extensions/uniswap"; +import { enableFeeAmount } from "thirdweb/extensions/uniswap"; -const transaction = quoteExactOutputSingle({ +const transaction = enableFeeAmount({ contract, - tokenIn: ..., - tokenOut: ..., fee: ..., - amountOut: ..., - sqrtPriceLimitX96: ..., + tickSpacing: ..., overrides: { ... } @@ -34551,24 +32982,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function quoteExactOutputSingle( +function enableFeeAmount( options: BaseTransactionOptions< - | QuoteExactOutputSingleParams - | { asyncParams: () => Promise } + | EnableFeeAmountParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "quoteExactOutputSingle" function. +The options for the "enableFeeAmount" function. #### Type ```ts let options: BaseTransactionOptions< - | QuoteExactOutputSingleParams - | { asyncParams: () => Promise } + | EnableFeeAmountParams + | { asyncParams: () => Promise } >; ``` @@ -34585,19 +33016,19 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## UNISWAP.setOwner +## UNISWAP.exactInput -Prepares a transaction to call the "setOwner" function on the contract. +Prepares a transaction to call the "exactInput" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { setOwner } from "thirdweb/extensions/uniswap"; +import { exactInput } from "thirdweb/extensions/uniswap"; -const transaction = setOwner({ +const transaction = exactInput({ contract, - newOwner: ..., + params: ..., overrides: { ... } @@ -34608,22 +33039,23 @@ await sendTransaction({ transaction, account }); ``` ```ts -function setOwner( +function exactInput( options: BaseTransactionOptions< - SetOwnerParams | { asyncParams: () => Promise } + | ExactInputParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "setOwner" function. +The options for the "exactInput" function. #### Type ```ts let options: BaseTransactionOptions< - SetOwnerParams | { asyncParams: () => Promise } + ExactInputParams | { asyncParams: () => Promise } >; ``` @@ -34639,438 +33071,576 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## UNSTOPPABLE-DOMAINS ---- -## UNSTOPPABLE-DOMAINS.namehash +## UNISWAP.exactInputSingle -Calls the "namehash" function on the contract. +Prepares a transaction to call the "exactInputSingle" function on the contract. ### Example ```ts -import { namehash } from "thirdweb/extensions/unstoppable-domains"; +import { sendTransaction } from "thirdweb"; +import { exactInputSingle } from "thirdweb/extensions/uniswap"; -const result = await namehash({ +const transaction = exactInputSingle({ contract, - labels: ..., + params: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function namehash( - options: BaseTransactionOptions, -): Promise; +function exactInputSingle( + options: BaseTransactionOptions< + | ExactInputSingleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the namehash function. +The options for the "exactInputSingle" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | ExactInputSingleParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## UNSTOPPABLE-DOMAINS.resolveAddress +## UNISWAP.exactOutput -Resolve an Unstoppable-Domain domain to an Ethereum address +Prepares a transaction to call the "exactOutput" function on the contract. ### Example -#### Basic usage - ```ts -import { resolveAddress } from "thirdweb/extension/unstoppable-domains"; +import { sendTransaction } from "thirdweb"; +import { exactOutput } from "thirdweb/extensions/uniswap"; -const address = await resolveAddress({ - client, - name: "thirdweb.crypto", +const transaction = exactOutput({ + contract, + params: ..., + overrides: { + ... + } }); -``` - -#### 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, -}); +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function resolveAddress( - options: ResolveAddressOptions, -): Promise; +function exactOutput( + options: BaseTransactionOptions< + | ExactOutputParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for resolving an UD domain +The options for the "exactOutput" function. #### Type ```ts -let options: { - client: ThirdwebClient; - name: string; - resolverAddress?: string; - resolverChain?: Chain; -}; +let options: BaseTransactionOptions< + | ExactOutputParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The Ethereum address associated with the domain name. [Learn more](https://docs.unstoppabledomains.com/reverse-resolution/) +A prepared transaction object. --- -## UNSTOPPABLE-DOMAINS.resolveName +## UNISWAP.exactOutputSingle -Resolves the primary Untoppable-Domains name for a specified address. +Prepares a transaction to call the "exactOutputSingle" function on the contract. ### Example -#### Basic usage - ```ts -import { resolveName } from "thirdweb/extension/unstoppable-domains"; +import { sendTransaction } from "thirdweb"; +import { exactOutputSingle } from "thirdweb/extensions/uniswap"; -const name = await resolveName({ - client, - address: "0x...", +const transaction = exactOutputSingle({ + contract, + params: ..., + overrides: { + ... + } }); -``` - -#### 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, -}); +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function resolveName(options: ResolveUDNameOptions): Promise; +function exactOutputSingle( + options: BaseTransactionOptions< + | ExactOutputSingleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for resolving an UD domain +The options for the "exactOutputSingle" function. #### Type ```ts -let options: { - address: string; - client: ThirdwebClient; - resolverAddress?: string; - resolverChain?: Chain; -}; +let options: BaseTransactionOptions< + | ExactOutputSingleParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` + +A prepared transaction object. --- -## UNSTOPPABLE-DOMAINS.reverseNameOf +## UNISWAP.feeAmountEnabledEvent -Calls the "reverseNameOf" function on the contract. +Creates an event object for the FeeAmountEnabled event. ### Example ```ts -import { reverseNameOf } from "thirdweb/extensions/unstoppable-domains"; +import { getContractEvents } from "thirdweb"; +import { feeAmountEnabledEvent } from "thirdweb/extensions/uniswap"; -const result = await reverseNameOf({ - contract, - addr: ..., +const events = await getContractEvents({ + contract, + events: [feeAmountEnabledEvent()], }); ``` ```ts -function reverseNameOf( - options: BaseTransactionOptions, -): Promise; -``` - -### Parameters - -The options for the reverseNameOf function. - -#### Type - -```ts -let options: BaseTransactionOptions; +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: Promise; +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 parsed result of the function call. ---- -## VOTE +The prepared event object. --- -## VOTE.canExecute +## UNISWAP.feeAmountTickSpacing -Simulate the `execute` method of the Vote contract, to check if you can execute a proposal +Calls the "feeAmountTickSpacing" function on the contract. ### Example ```ts -import { canExecute } from "thirdweb/extensions/vote"; +import { feeAmountTickSpacing } from "thirdweb/extensions/uniswap"; -const executable = await canExecute({ contract, proposalId }); +const result = await feeAmountTickSpacing({ + contract, + fee: ..., +}); ``` ```ts -function canExecute( - options: BaseTransactionOptions<{ proposalId: bigint }>, -): Promise; +function feeAmountTickSpacing( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters +The options for the feeAmountTickSpacing function. + #### Type ```ts -let options: BaseTransactionOptions<{ proposalId: bigint }>; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -boolean - `true` if the proposal is executable, else `false` +The parsed result of the function call. --- -## VOTE.castVote +## UNISWAP.getPool -Prepares a transaction to call the "castVote" function on the contract. +Calls the "getPool" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { castVote } from "thirdweb/extensions/vote"; +import { getPool } from "thirdweb/extensions/uniswap"; -const transaction = castVote({ +const result = await getPool({ contract, - proposalId: ..., - support: ..., - overrides: { - ... - } + tokenA: ..., + tokenB: ..., + fee: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function castVote( - options: BaseTransactionOptions< - CastVoteParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getPool( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "castVote" function. +The options for the getPool function. #### Type ```ts -let options: BaseTransactionOptions< - CastVoteParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.castVoteBySig +## UNISWAP.getUniswapV3Pool -Prepares a transaction to call the "castVoteBySig" function on the contract. +Finds the Uniswap V3 pools for the two tokens. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { castVoteBySig } from "thirdweb/extensions/vote"; - -const transaction = castVoteBySig({ - contract, - proposalId: ..., - support: ..., - v: ..., - r: ..., - s: ..., - overrides: { - ... - } +import { getUniswapV3Pool } from "thirdweb/extensions/uniswap"; +const pools = await getUniswapV3Pool({ + tokenA: "0x...", + tokenB: "0x...", + contract: factoryContract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function castVoteBySig( - options: BaseTransactionOptions< - | CastVoteBySigParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function getUniswapV3Pool( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the "castVoteBySig" function. +The token pair to find any pools for any Uniswap contract that implements getPool. #### Type ```ts -let options: BaseTransactionOptions< - | CastVoteBySigParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: { + poolAddress: Address; + poolFee: (typeof UniswapFee)[keyof typeof UniswapFee]; +}; ``` -A prepared transaction object. +The pools' addresses and fees. --- -## VOTE.castVoteWithReason +## UNISWAP.owner -Prepares a transaction to call the "castVoteWithReason" function on the contract. +Calls the "owner" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { castVoteWithReason } from "thirdweb/extensions/vote"; +import { owner } from "thirdweb/extensions/uniswap"; -const transaction = castVoteWithReason({ - contract, - proposalId: ..., - support: ..., - reason: ..., - overrides: { - ... - } +const result = await owner({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function castVoteWithReason( - options: BaseTransactionOptions< - | CastVoteWithReasonParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function owner(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for the "castVoteWithReason" function. +The options for the owner function. #### Type ```ts -let options: BaseTransactionOptions< - | CastVoteWithReasonParams - | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.castVoteWithReasonAndParams +## UNISWAP.ownerChangedEvent -Prepares a transaction to call the "castVoteWithReasonAndParams" function on the contract. +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. +--- + +## UNISWAP.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. +--- + +## UNISWAP.quoteExactInput + +Prepares a transaction to call the "quoteExactInput" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { castVoteWithReasonAndParams } from "thirdweb/extensions/vote"; +import { quoteExactInput } from "thirdweb/extensions/uniswap"; -const transaction = castVoteWithReasonAndParams({ +const transaction = quoteExactInput({ contract, - proposalId: ..., - support: ..., - reason: ..., - params: ..., + path: ..., + amountIn: ..., overrides: { ... } @@ -35081,26 +33651,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function castVoteWithReasonAndParams( +function quoteExactInput( options: BaseTransactionOptions< - | CastVoteWithReasonAndParamsParams - | { - asyncParams: () => Promise; - } + | QuoteExactInputParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "castVoteWithReasonAndParams" function. +The options for the "quoteExactInput" function. #### Type ```ts let options: BaseTransactionOptions< - | CastVoteWithReasonAndParamsParams - | { asyncParams: () => Promise } + | QuoteExactInputParams + | { asyncParams: () => Promise } >; ``` @@ -35117,25 +33685,23 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## VOTE.castVoteWithReasonAndParamsBySig +## UNISWAP.quoteExactInputSingle -Prepares a transaction to call the "castVoteWithReasonAndParamsBySig" function on the contract. +Prepares a transaction to call the "quoteExactInputSingle" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { castVoteWithReasonAndParamsBySig } from "thirdweb/extensions/vote"; +import { quoteExactInputSingle } from "thirdweb/extensions/uniswap"; -const transaction = castVoteWithReasonAndParamsBySig({ +const transaction = quoteExactInputSingle({ contract, - proposalId: ..., - support: ..., - reason: ..., - params: ..., - v: ..., - r: ..., - s: ..., + tokenIn: ..., + tokenOut: ..., + fee: ..., + amountIn: ..., + sqrtPriceLimitX96: ..., overrides: { ... } @@ -35146,28 +33712,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function castVoteWithReasonAndParamsBySig( +function quoteExactInputSingle( options: BaseTransactionOptions< - | CastVoteWithReasonAndParamsBySigParams - | { - asyncParams: () => Promise; - } + | QuoteExactInputSingleParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "castVoteWithReasonAndParamsBySig" function. +The options for the "quoteExactInputSingle" function. #### Type ```ts let options: BaseTransactionOptions< - | CastVoteWithReasonAndParamsBySigParams - | { - asyncParams: () => Promise; - } + | QuoteExactInputSingleParams + | { asyncParams: () => Promise } >; ``` @@ -35184,22 +33746,20 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## VOTE.execute +## UNISWAP.quoteExactOutput -Prepares a transaction to call the "execute" function on the contract. +Prepares a transaction to call the "quoteExactOutput" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { execute } from "thirdweb/extensions/vote"; +import { quoteExactOutput } from "thirdweb/extensions/uniswap"; -const transaction = execute({ +const transaction = quoteExactOutput({ contract, - targets: ..., - values: ..., - calldatas: ..., - descriptionHash: ..., + path: ..., + amountOut: ..., overrides: { ... } @@ -35210,22 +33770,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function execute( +function quoteExactOutput( options: BaseTransactionOptions< - ExecuteParams | { asyncParams: () => Promise } + | QuoteExactOutputParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "execute" function. +The options for the "quoteExactOutput" function. #### Type ```ts let options: BaseTransactionOptions< - ExecuteParams | { asyncParams: () => Promise } + | QuoteExactOutputParams + | { asyncParams: () => Promise } >; ``` @@ -35242,31 +33804,52 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## VOTE.executeProposal +## UNISWAP.quoteExactOutputSingle -Execute a Proposal +Prepares a transaction to call the "quoteExactOutputSingle" function on the contract. ### Example ```ts -import { executeProposal } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { quoteExactOutputSingle } from "thirdweb/extensions/uniswap"; -const transaction = executeProposal({ contract, proposalId }); -const tx = await sendTransaction({ transaction, account }); +const transaction = quoteExactOutputSingle({ + contract, + tokenIn: ..., + tokenOut: ..., + fee: ..., + amountOut: ..., + sqrtPriceLimitX96: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function executeProposal( - options: BaseTransactionOptions<{ proposalId: bigint }>, +function quoteExactOutputSingle( + options: BaseTransactionOptions< + | QuoteExactOutputSingleParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters +The options for the "quoteExactOutputSingle" function. + #### Type ```ts -let options: BaseTransactionOptions<{ proposalId: bigint }>; +let options: BaseTransactionOptions< + | QuoteExactOutputSingleParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -35279,706 +33862,864 @@ let returnType: PreparedTransaction< >; ``` -a prepared transaction for the `execute` method +A prepared transaction object. --- -## VOTE.getAll +## UNISWAP.setOwner -Get all proposals from a Vote contract with some extra info attached for each proposal (current state and votes) +Prepares a transaction to call the "setOwner" function on the contract. ### Example ```ts -import { getAll } from "thirdweb/extension/getAll"; +import { sendTransaction } from "thirdweb"; +import { setOwner } from "thirdweb/extensions/uniswap"; -const allProposals = await getAll({ contract }); +const transaction = setOwner({ + contract, + newOwner: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function getAll( - options: BaseTransactionOptions, -): Promise>; +function setOwner( + options: BaseTransactionOptions< + SetOwnerParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters +The options for the "setOwner" function. + #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + SetOwnerParams | { asyncParams: () => Promise } +>; ``` ### 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; -}; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -An array containing proposals data +A prepared transaction object. +--- +## UNSTOPPABLE-DOMAINS --- -## VOTE.getAllProposals +## UNSTOPPABLE-DOMAINS.namehash -Calls the "getAllProposals" function on the contract. +Calls the "namehash" function on the contract. ### Example ```ts -import { getAllProposals } from "thirdweb/extensions/vote"; +import { namehash } from "thirdweb/extensions/unstoppable-domains"; -const result = await getAllProposals({ - contract, +const result = await namehash({ + contract, + labels: ..., }); ``` ```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 }>> +function namehash( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getAllProposals function. +The options for the namehash function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; description: string; endBlock: bigint; proposalId: bigint; proposer: string; signatures: readonly Array; startBlock: bigint; targets: readonly Array; values: readonly Array }>> +let returnType: Promise; ``` The parsed result of the function call. --- -## VOTE.getProposalVoteCounts +## UNSTOPPABLE-DOMAINS.resolveAddress -Get the info about Against, For and Abstain votes of a proposal +Resolve an Unstoppable-Domain domain to an Ethereum address ### Example +#### Basic usage + ```ts -import { getProposalVoteCounts } from "thirdweb/extensions/vote"; +import { resolveAddress } from "thirdweb/extension/unstoppable-domains"; -const data = await getProposalVoteCounts({ contract, proposalId }); +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"; -// 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 -} +const address = await resolveAddress({ + client, + name: "thirdweb.crypto", + resolverAddress: "0x...", + resolverChain: ethereum, +}); ``` ```ts -function getProposalVoteCounts( - options: BaseTransactionOptions, -): Promise; +function resolveAddress( + options: ResolveAddressOptions, +): Promise; ``` ### Parameters +The options for resolving an UD domain + #### Type ```ts -let options: BaseTransactionOptions; +let options: { + client: ThirdwebClient; + name: string; + resolverAddress?: string; + resolverChain?: Chain; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -the object containing the info about Against, For and Abstain votes of a proposal Note: the count is displayed in "wei" +The Ethereum address associated with the domain name. [Learn more](https://docs.unstoppabledomains.com/reverse-resolution/) --- -## VOTE.getVotes +## UNSTOPPABLE-DOMAINS.resolveName -Calls the "getVotes" function on the contract. +Resolves the primary Untoppable-Domains name for a specified address. ### Example +#### Basic usage + ```ts -import { getVotes } from "thirdweb/extensions/vote"; +import { resolveName } from "thirdweb/extension/unstoppable-domains"; -const result = await getVotes({ - contract, - account: ..., - blockNumber: ..., +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 -function getVotes( - options: BaseTransactionOptions, -): Promise; +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 the getVotes function. +The options for resolving an UD domain #### Type ```ts -let options: BaseTransactionOptions; +let options: { + address: string; + client: ThirdwebClient; + resolverAddress?: string; + resolverChain?: Chain; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` - -The parsed result of the function call. --- -## VOTE.getVotesWithParams +## UNSTOPPABLE-DOMAINS.reverseNameOf -Calls the "getVotesWithParams" function on the contract. +Calls the "reverseNameOf" function on the contract. ### Example ```ts -import { getVotesWithParams } from "thirdweb/extensions/vote"; +import { reverseNameOf } from "thirdweb/extensions/unstoppable-domains"; -const result = await getVotesWithParams({ +const result = await reverseNameOf({ contract, - account: ..., - blockNumber: ..., - params: ..., + addr: ..., }); ``` ```ts -function getVotesWithParams( - options: BaseTransactionOptions, -): Promise; +function reverseNameOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getVotesWithParams function. +The options for the reverseNameOf function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- +## VOTE +--- -## VOTE.hashProposal +## VOTE.canExecute -Calls the "hashProposal" function on the contract. +Simulate the `execute` method of the Vote contract, to check if you can execute a proposal ### Example ```ts -import { hashProposal } from "thirdweb/extensions/vote"; +import { canExecute } from "thirdweb/extensions/vote"; -const result = await hashProposal({ - contract, - targets: ..., - values: ..., - calldatas: ..., - descriptionHash: ..., -}); +const executable = await canExecute({ contract, proposalId }); ``` ```ts -function hashProposal( - options: BaseTransactionOptions, -): Promise; +function canExecute( + options: BaseTransactionOptions<{ proposalId: bigint }>, +): Promise; ``` ### Parameters -The options for the hashProposal function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions<{ proposalId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +boolean - `true` if the proposal is executable, else `false` --- -## VOTE.hasVoted +## VOTE.castVote -Calls the "hasVoted" function on the contract. +Prepares a transaction to call the "castVote" function on the contract. ### Example ```ts -import { hasVoted } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { castVote } from "thirdweb/extensions/vote"; -const result = await hasVoted({ +const transaction = castVote({ contract, proposalId: ..., - account: ..., + support: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function hasVoted( - options: BaseTransactionOptions, -): Promise; +function castVote( + options: BaseTransactionOptions< + CastVoteParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the hasVoted function. +The options for the "castVote" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + CastVoteParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## VOTE.proposalDeadline +## VOTE.castVoteBySig -Calls the "proposalDeadline" function on the contract. +Prepares a transaction to call the "castVoteBySig" function on the contract. ### Example ```ts -import { proposalDeadline } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { castVoteBySig } from "thirdweb/extensions/vote"; -const result = await proposalDeadline({ +const transaction = castVoteBySig({ contract, proposalId: ..., + support: ..., + v: ..., + r: ..., + s: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function proposalDeadline( - options: BaseTransactionOptions, -): Promise; +function castVoteBySig( + options: BaseTransactionOptions< + | CastVoteBySigParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the proposalDeadline function. +The options for the "castVoteBySig" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CastVoteBySigParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## VOTE.proposalExists +## VOTE.castVoteWithReason -Check if a proposal exists based on a given proposalId +Prepares a transaction to call the "castVoteWithReason" function on the contract. ### Example ```ts -import { proposalExists } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { castVoteWithReason } from "thirdweb/extensions/vote"; -// Check if the proposal with proposalId `4` exists -const exists = await proposalExists({ contract, proposalId: 4n }); // either `true` or `false` +const transaction = castVoteWithReason({ + contract, + proposalId: ..., + support: ..., + reason: ..., + overrides: { + ... + } +}); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function proposalExists( - options: BaseTransactionOptions, -): Promise; +function castVoteWithReason( + options: BaseTransactionOptions< + | CastVoteWithReasonParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters +The options for the "castVoteWithReason" function. + #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CastVoteWithReasonParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -`true` if the proposal exists, else `false` +A prepared transaction object. --- -## VOTE.proposalIndex +## VOTE.castVoteWithReasonAndParams -Calls the "proposalIndex" function on the contract. +Prepares a transaction to call the "castVoteWithReasonAndParams" function on the contract. ### Example ```ts -import { proposalIndex } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { castVoteWithReasonAndParams } from "thirdweb/extensions/vote"; -const result = await proposalIndex({ - contract, +const transaction = castVoteWithReasonAndParams({ + contract, + proposalId: ..., + support: ..., + reason: ..., + params: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function proposalIndex( - options: BaseTransactionOptions, -): Promise; +function castVoteWithReasonAndParams( + options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; ``` ### Parameters -The options for the proposalIndex function. +The options for the "castVoteWithReasonAndParams" function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## VOTE.proposals +## VOTE.castVoteWithReasonAndParamsBySig -Calls the "proposals" function on the contract. +Prepares a transaction to call the "castVoteWithReasonAndParamsBySig" function on the contract. ### Example ```ts -import { proposals } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { castVoteWithReasonAndParamsBySig } from "thirdweb/extensions/vote"; -const result = await proposals({ +const transaction = castVoteWithReasonAndParamsBySig({ contract, - key: ..., + proposalId: ..., + support: ..., + reason: ..., + params: ..., + v: ..., + r: ..., + s: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function proposals( - options: BaseTransactionOptions, -): Promise; +function castVoteWithReasonAndParamsBySig( + options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsBySigParams + | { + asyncParams: () => Promise; + } + >, +): PreparedTransaction; ``` ### Parameters -The options for the proposals function. +The options for the "castVoteWithReasonAndParamsBySig" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CastVoteWithReasonAndParamsBySigParams + | { + asyncParams: () => Promise; + } +>; ``` ### Returns ```ts -let returnType: Promise< - readonly [bigint, string, bigint, bigint, string] +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions >; ``` -The parsed result of the function call. +A prepared transaction object. --- -## VOTE.proposalSnapshot +## VOTE.execute -Calls the "proposalSnapshot" function on the contract. +Prepares a transaction to call the "execute" function on the contract. ### Example ```ts -import { proposalSnapshot } from "thirdweb/extensions/vote"; +import { sendTransaction } from "thirdweb"; +import { execute } from "thirdweb/extensions/vote"; -const result = await proposalSnapshot({ +const transaction = execute({ contract, - proposalId: ..., + targets: ..., + values: ..., + calldatas: ..., + descriptionHash: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function proposalSnapshot( - options: BaseTransactionOptions, -): Promise; +function execute( + options: BaseTransactionOptions< + ExecuteParams | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the proposalSnapshot function. +The options for the "execute" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + ExecuteParams | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## VOTE.proposalThreshold +## VOTE.executeProposal -Calls the "proposalThreshold" function on the contract. +Execute a Proposal ### Example ```ts -import { proposalThreshold } from "thirdweb/extensions/vote"; +import { executeProposal } from "thirdweb/extensions/vote"; -const result = await proposalThreshold({ - contract, -}); +const transaction = executeProposal({ contract, proposalId }); +const tx = await sendTransaction({ transaction, account }); ``` ```ts -function proposalThreshold( - options: BaseTransactionOptions, -): Promise; +function executeProposal( + options: BaseTransactionOptions<{ proposalId: bigint }>, +): PreparedTransaction; ``` ### Parameters -The options for the proposalThreshold function. - #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions<{ proposalId: bigint }>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +a prepared transaction for the `execute` method --- -## VOTE.proposalVotes +## VOTE.getAll -Calls the "proposalVotes" function on the contract. +Get all proposals from a Vote contract with some extra info attached for each proposal (current state and votes) ### Example ```ts -import { proposalVotes } from "thirdweb/extensions/vote"; +import { getAll } from "thirdweb/extension/getAll"; -const result = await proposalVotes({ - contract, - proposalId: ..., -}); +const allProposals = await getAll({ contract }); ``` ```ts -function proposalVotes( - options: BaseTransactionOptions, -): Promise; +function getAll( + options: BaseTransactionOptions, +): Promise>; ``` ### Parameters -The options for the proposalVotes function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: Promise; +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; +}; ``` -The parsed result of the function call. +An array containing proposals data --- -## VOTE.propose +## VOTE.getAllProposals -Prepares a transaction to call the "propose" function on the contract. +Calls the "getAllProposals" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { propose } from "thirdweb/extensions/vote"; +import { getAllProposals } from "thirdweb/extensions/vote"; -const transaction = propose({ - contract, - targets: ..., - values: ..., - calldatas: ..., - description: ..., - overrides: { - ... - } +const result = await getAllProposals({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function propose( - options: BaseTransactionOptions< - ProposeParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 "propose" function. +The options for the getAllProposals function. #### Type ```ts -let options: BaseTransactionOptions< - ProposeParams | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; description: string; endBlock: bigint; proposalId: bigint; proposer: string; signatures: readonly Array; startBlock: bigint; targets: readonly Array; values: readonly Array }>> ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.quorum +## VOTE.getProposalVoteCounts -Calls the "quorum" function on the contract. +Get the info about Against, For and Abstain votes of a proposal ### Example ```ts -import { quorum } from "thirdweb/extensions/vote"; +import { getProposalVoteCounts } from "thirdweb/extensions/vote"; -const result = await quorum({ - contract, - blockNumber: ..., -}); +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 quorum( - options: BaseTransactionOptions, -): Promise; +function getProposalVoteCounts( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the quorum function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +the object containing the info about Against, For and Abstain votes of a proposal Note: the count is displayed in "wei" --- -## VOTE.quorumDenominator +## VOTE.getVotes -Calls the "quorumDenominator" function on the contract. +Calls the "getVotes" function on the contract. ### Example ```ts -import { quorumDenominator } from "thirdweb/extensions/vote"; +import { getVotes } from "thirdweb/extensions/vote"; -const result = await quorumDenominator({ - contract, +const result = await getVotes({ + contract, + account: ..., + blockNumber: ..., }); ``` ```ts -function quorumDenominator( - options: BaseTransactionOptions, +function getVotes( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the quorumDenominator function. +The options for the getVotes function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -35990,35 +34731,37 @@ let returnType: Promise; The parsed result of the function call. --- -## VOTE.quorumNumeratorByBlockNumber +## VOTE.getVotesWithParams -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) +Calls the "getVotesWithParams" function on the contract. ### Example ```ts -import { quorumNumeratorByBlockNumber } from "thirdweb/extensions/vote"; +import { getVotesWithParams } from "thirdweb/extensions/vote"; -const result = await quorumNumeratorByBlockNumber({ - contract, - blockNumber: 13232234232n, +const result = await getVotesWithParams({ + contract, + account: ..., + blockNumber: ..., + params: ..., }); ``` ```ts -function quorumNumeratorByBlockNumber( - options: BaseTransactionOptions<{ blockNumber: bigint }>, +function getVotesWithParams( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the quorumDenominator function. +The options for the getVotesWithParams function. #### Type ```ts -let options: BaseTransactionOptions<{ blockNumber: bigint }>; +let options: BaseTransactionOptions; ``` ### Returns @@ -36030,259 +34773,151 @@ let returnType: Promise; The parsed result of the function call. --- -## VOTE.relay +## VOTE.hashProposal -Prepares a transaction to call the "relay" function on the contract. +Calls the "hashProposal" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { relay } from "thirdweb/extensions/vote"; +import { hashProposal } from "thirdweb/extensions/vote"; -const transaction = relay({ +const result = await hashProposal({ contract, - target: ..., - value: ..., - data: ..., - overrides: { - ... - } + targets: ..., + values: ..., + calldatas: ..., + descriptionHash: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function relay( - options: BaseTransactionOptions< - RelayParams | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function hashProposal( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "relay" function. +The options for the hashProposal function. #### Type ```ts -let options: BaseTransactionOptions< - RelayParams | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; -``` - -A prepared transaction object. ---- - -## VOTE.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 ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.setVotingDelay +## VOTE.hasVoted -Prepares a transaction to call the "setVotingDelay" function on the contract. +Calls the "hasVoted" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { setVotingDelay } from "thirdweb/extensions/vote"; +import { hasVoted } from "thirdweb/extensions/vote"; -const transaction = setVotingDelay({ +const result = await hasVoted({ contract, - newVotingDelay: ..., - overrides: { - ... - } + proposalId: ..., + account: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function setVotingDelay( - options: BaseTransactionOptions< - | SetVotingDelayParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function hasVoted( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "setVotingDelay" function. +The options for the hasVoted function. #### Type ```ts -let options: BaseTransactionOptions< - | SetVotingDelayParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.setVotingPeriod +## VOTE.proposalDeadline -Prepares a transaction to call the "setVotingPeriod" function on the contract. +Calls the "proposalDeadline" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { setVotingPeriod } from "thirdweb/extensions/vote"; +import { proposalDeadline } from "thirdweb/extensions/vote"; -const transaction = setVotingPeriod({ +const result = await proposalDeadline({ contract, - newVotingPeriod: ..., - overrides: { - ... - } + proposalId: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function setVotingPeriod( - options: BaseTransactionOptions< - | SetVotingPeriodParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function proposalDeadline( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "setVotingPeriod" function. +The options for the proposalDeadline function. #### Type ```ts -let options: BaseTransactionOptions< - | SetVotingPeriodParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.state +## VOTE.proposalExists -Calls the "state" function on the contract. +Check if a proposal exists based on a given proposalId ### Example ```ts -import { state } from "thirdweb/extensions/vote"; +import { proposalExists } from "thirdweb/extensions/vote"; -const result = await state({ - contract, - proposalId: ..., -}); +// Check if the proposal with proposalId `4` exists +const exists = await proposalExists({ contract, proposalId: 4n }); // either `true` or `false` ``` ```ts -function state( +function proposalExists( options: BaseTransactionOptions, -): Promise; +): Promise; ``` ### Parameters -The options for the state function. - #### Type ```ts @@ -36292,33 +34927,35 @@ let options: BaseTransactionOptions; ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The parsed result of the function call. +`true` if the proposal exists, else `false` --- -## VOTE.token +## VOTE.proposalIndex -Calls the "token" function on the contract. +Calls the "proposalIndex" function on the contract. ### Example ```ts -import { token } from "thirdweb/extensions/vote"; +import { proposalIndex } from "thirdweb/extensions/vote"; -const result = await token({ +const result = await proposalIndex({ contract, }); ``` ```ts -function token(options: BaseTransactionOptions): Promise; +function proposalIndex( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the token function. +The options for the proposalIndex function. #### Type @@ -36329,97 +34966,83 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## VOTE.updateQuorumNumerator +## VOTE.proposals -Prepares a transaction to call the "updateQuorumNumerator" function on the contract. +Calls the "proposals" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { updateQuorumNumerator } from "thirdweb/extensions/vote"; +import { proposals } from "thirdweb/extensions/vote"; -const transaction = updateQuorumNumerator({ +const result = await proposals({ contract, - newQuorumNumerator: ..., - overrides: { - ... - } + key: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function updateQuorumNumerator( - options: BaseTransactionOptions< - | UpdateQuorumNumeratorParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function proposals( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "updateQuorumNumerator" function. +The options for the proposals function. #### Type ```ts -let options: BaseTransactionOptions< - | UpdateQuorumNumeratorParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions +let returnType: Promise< + readonly [bigint, string, bigint, bigint, string] >; ``` -A prepared transaction object. +The parsed result of the function call. --- -## VOTE.votingDelay +## VOTE.proposalSnapshot -Calls the "votingDelay" function on the contract. +Calls the "proposalSnapshot" function on the contract. ### Example ```ts -import { votingDelay } from "thirdweb/extensions/vote"; +import { proposalSnapshot } from "thirdweb/extensions/vote"; -const result = await votingDelay({ - contract, +const result = await proposalSnapshot({ + contract, + proposalId: ..., }); ``` ```ts -function votingDelay( - options: BaseTransactionOptions, +function proposalSnapshot( + options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the votingDelay function. +The options for the proposalSnapshot function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -36431,29 +35054,29 @@ let returnType: Promise; The parsed result of the function call. --- -## VOTE.votingPeriod +## VOTE.proposalThreshold -Calls the "votingPeriod" function on the contract. +Calls the "proposalThreshold" function on the contract. ### Example ```ts -import { votingPeriod } from "thirdweb/extensions/vote"; +import { proposalThreshold } from "thirdweb/extensions/vote"; -const result = await votingPeriod({ +const result = await proposalThreshold({ contract, }); ``` ```ts -function votingPeriod( +function proposalThreshold( options: BaseTransactionOptions, ): Promise; ``` ### Parameters -The options for the votingPeriod function. +The options for the proposalThreshold function. #### Type @@ -36469,67 +35092,63 @@ let returnType: Promise; The parsed result of the function call. --- -## MODULES ---- -## MODULES.cancelOwnershipHandover +## VOTE.proposalVotes -Prepares a transaction to call the "cancelOwnershipHandover" function on the contract. +Calls the "proposalVotes" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { cancelOwnershipHandover } from "thirdweb/extensions/modules"; - -const transaction = cancelOwnershipHandover(); +import { proposalVotes } from "thirdweb/extensions/vote"; -// Send the transaction -await sendTransaction({ transaction, account }); +const result = await proposalVotes({ + contract, + proposalId: ..., +}); ``` ```ts -function cancelOwnershipHandover( - options: BaseTransactionOptions, -): PreparedTransaction; +function proposalVotes( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "cancelOwnershipHandover" function. +The options for the proposalVotes function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## MODULES.completeOwnershipHandover +## VOTE.propose -Prepares a transaction to call the "completeOwnershipHandover" function on the contract. +Prepares a transaction to call the "propose" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { completeOwnershipHandover } from "thirdweb/extensions/modules"; +import { propose } from "thirdweb/extensions/vote"; -const transaction = completeOwnershipHandover({ +const transaction = propose({ contract, - pendingOwner: ..., + targets: ..., + values: ..., + calldatas: ..., + description: ..., overrides: { ... } @@ -36540,24 +35159,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function completeOwnershipHandover( +function propose( options: BaseTransactionOptions< - | CompleteOwnershipHandoverParams - | { asyncParams: () => Promise } + ProposeParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "completeOwnershipHandover" function. +The options for the "propose" function. #### Type ```ts let options: BaseTransactionOptions< - | CompleteOwnershipHandoverParams - | { asyncParams: () => Promise } + ProposeParams | { asyncParams: () => Promise } >; ``` @@ -36574,64 +35191,69 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MODULES.getInstalledModules +## VOTE.quorum -Calls the "getInstalledModules" function on the contract. +Calls the "quorum" function on the contract. ### Example ```ts -import { getInstalledModules } from "thirdweb/extensions/modules"; +import { quorum } from "thirdweb/extensions/vote"; -const result = await getInstalledModules({ - contract, +const result = await quorum({ + contract, + blockNumber: ..., }); ``` ```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 }>> +function quorum( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getInstalledModules function. +The options for the quorum function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### 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 }>> +let returnType: Promise; ``` The parsed result of the function call. --- -## MODULES.getModuleConfig +## VOTE.quorumDenominator -Calls the "getModuleConfig" function on the contract. +Calls the "quorumDenominator" function on the contract. ### Example ```ts -import { getModuleConfig } from "thirdweb/extensions/modules"; +import { quorumDenominator } from "thirdweb/extensions/vote"; -const result = await getModuleConfig({ +const result = await quorumDenominator({ 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}`> }> +function quorumDenominator( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the getModuleConfig function. +The options for the quorumDenominator function. #### Type @@ -36642,63 +35264,67 @@ 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}`> }> +let returnType: Promise; ``` The parsed result of the function call. --- -## MODULES.getSupportedCallbackFunctions +## VOTE.quorumNumeratorByBlockNumber -Calls the "getSupportedCallbackFunctions" function on the contract. +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 { getSupportedCallbackFunctions } from "thirdweb/extensions/modules"; +import { quorumNumeratorByBlockNumber } from "thirdweb/extensions/vote"; -const result = await getSupportedCallbackFunctions({ +const result = await quorumNumeratorByBlockNumber({ contract, + blockNumber: 13232234232n, }); ``` ```ts -function getSupportedCallbackFunctions(options: BaseTransactionOptions) : Promise> +function quorumNumeratorByBlockNumber( + options: BaseTransactionOptions<{ blockNumber: bigint }>, +): Promise; ``` ### Parameters -The options for the getSupportedCallbackFunctions function. +The options for the quorumDenominator function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions<{ blockNumber: bigint }>; ``` ### Returns ```ts -let returnType: Promise> +let returnType: Promise; ``` The parsed result of the function call. --- -## MODULES.grantRoles +## VOTE.relay -Prepares a transaction to call the "grantRoles" function on the contract. +Prepares a transaction to call the "relay" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { grantRoles } from "thirdweb/extensions/modules"; +import { relay } from "thirdweb/extensions/vote"; -const transaction = grantRoles({ +const transaction = relay({ contract, - user: ..., - roles: ..., + target: ..., + value: ..., + data: ..., overrides: { ... } @@ -36709,23 +35335,22 @@ await sendTransaction({ transaction, account }); ``` ```ts -function grantRoles( +function relay( options: BaseTransactionOptions< - | GrantRolesParams - | { asyncParams: () => Promise } + RelayParams | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "grantRoles" function. +The options for the "relay" function. #### Type ```ts let options: BaseTransactionOptions< - GrantRolesParams | { asyncParams: () => Promise } + RelayParams | { asyncParams: () => Promise } >; ``` @@ -36742,102 +35367,133 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MODULES.hasAllRoles +## VOTE.setProposalThreshold -Calls the "hasAllRoles" function on the contract. +Prepares a transaction to call the "setProposalThreshold" function on the contract. ### Example ```ts -import { hasAllRoles } from "thirdweb/extensions/modules"; +import { sendTransaction } from "thirdweb"; +import { setProposalThreshold } from "thirdweb/extensions/vote"; -const result = await hasAllRoles({ +const transaction = setProposalThreshold({ contract, - user: ..., - roles: ..., + newProposalThreshold: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function hasAllRoles( - options: BaseTransactionOptions, -): Promise; +function setProposalThreshold( + options: BaseTransactionOptions< + | SetProposalThresholdParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the hasAllRoles function. +The options for the "setProposalThreshold" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SetProposalThresholdParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## MODULES.hasAnyRole +## VOTE.setVotingDelay -Calls the "hasAnyRole" function on the contract. +Prepares a transaction to call the "setVotingDelay" function on the contract. ### Example ```ts -import { hasAnyRole } from "thirdweb/extensions/modules"; +import { sendTransaction } from "thirdweb"; +import { setVotingDelay } from "thirdweb/extensions/vote"; -const result = await hasAnyRole({ +const transaction = setVotingDelay({ contract, - user: ..., - roles: ..., + newVotingDelay: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function hasAnyRole( - options: BaseTransactionOptions, -): Promise; +function setVotingDelay( + options: BaseTransactionOptions< + | SetVotingDelayParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the hasAnyRole function. +The options for the "setVotingDelay" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | SetVotingDelayParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## MODULES.installModule +## VOTE.setVotingPeriod -Prepares a transaction to call the "installModule" function on the contract. +Prepares a transaction to call the "setVotingPeriod" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { installModule } from "thirdweb/extensions/modules"; +import { setVotingPeriod } from "thirdweb/extensions/vote"; -const transaction = installModule({ +const transaction = setVotingPeriod({ contract, - moduleContract: ..., - data: ..., + newVotingPeriod: ..., overrides: { ... } @@ -36848,24 +35504,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function installModule( +function setVotingPeriod( options: BaseTransactionOptions< - | InstallModuleParams - | { asyncParams: () => Promise } + | SetVotingPeriodParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "installModule" function. +The options for the "setVotingPeriod" function. #### Type ```ts let options: BaseTransactionOptions< - | InstallModuleParams - | { asyncParams: () => Promise } + | SetVotingPeriodParams + | { asyncParams: () => Promise } >; ``` @@ -36882,254 +35538,245 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MODULES.isGetInstalledModulesSupported +## VOTE.state -Checks if the `getInstalledModules` method is supported by the given contract. +Calls the "state" function on the contract. ### Example ```ts -import { isGetInstalledModulesSupported } from "thirdweb/extensions/modules"; -const supported = isGetInstalledModulesSupported(["0x..."]); -``` - -```ts -function isGetInstalledModulesSupported( - availableSelectors: Array, -): boolean; +import { state } from "thirdweb/extensions/vote"; + +const result = await state({ + contract, + proposalId: ..., +}); +``` + +```ts +function state( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the state function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getInstalledModules` method is supported. +The parsed result of the function call. --- -## MODULES.isGetModuleConfigSupported +## VOTE.token -Checks if the `getModuleConfig` method is supported by the given contract. +Calls the "token" function on the contract. ### Example ```ts -import { isGetModuleConfigSupported } from "thirdweb/extensions/modules"; -const supported = isGetModuleConfigSupported(["0x..."]); +import { token } from "thirdweb/extensions/vote"; + +const result = await token({ + contract, +}); ``` ```ts -function isGetModuleConfigSupported( - availableSelectors: Array, -): boolean; +function token(options: BaseTransactionOptions): Promise; ``` ### 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. +The options for the token function. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `getModuleConfig` method is supported. +The parsed result of the function call. --- -## MODULES.isGetSupportedCallbackFunctionsSupported +## VOTE.updateQuorumNumerator -Checks if the `getSupportedCallbackFunctions` method is supported by the given contract. +Prepares a transaction to call the "updateQuorumNumerator" function on the contract. ### Example ```ts -import { isGetSupportedCallbackFunctionsSupported } from "thirdweb/extensions/modules"; -const supported = isGetSupportedCallbackFunctionsSupported(["0x..."]); +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 isGetSupportedCallbackFunctionsSupported( - availableSelectors: Array, -): boolean; +function updateQuorumNumerator( + options: BaseTransactionOptions< + | UpdateQuorumNumeratorParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### 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. +The options for the "updateQuorumNumerator" function. #### Type ```ts -let availableSelectors: Array; +let options: BaseTransactionOptions< + | UpdateQuorumNumeratorParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: boolean; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A boolean indicating if the `getSupportedCallbackFunctions` method is supported. +A prepared transaction object. --- -## MODULES.isInstallModuleSupported +## VOTE.votingDelay -Checks if the `installModule` method is supported by the given contract. +Calls the "votingDelay" function on the contract. ### Example ```ts -import { isInstallModuleSupported } from "thirdweb/extensions/modules"; +import { votingDelay } from "thirdweb/extensions/vote"; -const supported = isInstallModuleSupported(["0x..."]); +const result = await votingDelay({ + contract, +}); ``` ```ts -function isInstallModuleSupported( - availableSelectors: Array, -): boolean; +function votingDelay( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the votingDelay function. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `installModule` method is supported. +The parsed result of the function call. --- -## MODULES.isUninstallModuleSupported +## VOTE.votingPeriod -Checks if the `uninstallModule` method is supported by the given contract. +Calls the "votingPeriod" function on the contract. ### Example ```ts -import { isUninstallModuleSupported } from "thirdweb/extensions/modules"; +import { votingPeriod } from "thirdweb/extensions/vote"; -const supported = isUninstallModuleSupported(["0x..."]); +const result = await votingPeriod({ + contract, +}); ``` ```ts -function isUninstallModuleSupported( - availableSelectors: Array, -): boolean; +function votingPeriod( + options: BaseTransactionOptions, +): Promise; ``` ### 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. +The options for the votingPeriod function. #### Type ```ts -let availableSelectors: Array; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: boolean; +let returnType: Promise; ``` -A boolean indicating if the `uninstallModule` method is supported. +The parsed result of the function call. --- - -## MODULES.moduleInstalledEvent - -Creates an event object for the ModuleInstalled event. - -### Example - -```ts -import { getContractEvents } from "thirdweb"; -import { moduleInstalledEvent } from "thirdweb/extensions/modules"; - -const events = await getContractEvents({ - contract, - events: [moduleInstalledEvent()], -}); -``` - -```ts -function moduleInstalledEvent(): PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "caller"; readonly type: "address" }, - { readonly name: "implementation"; readonly type: "address" }, - { readonly name: "installedModule"; readonly type: "address" }, - ]; - readonly name: "ModuleInstalled"; - readonly type: "event"; -}>; -``` - -### Returns - -```ts -let returnType: PreparedEvent<{ - readonly inputs: readonly [ - { readonly name: "caller"; readonly type: "address" }, - { readonly name: "implementation"; readonly type: "address" }, - { readonly name: "installedModule"; readonly type: "address" }, - ]; - readonly name: "ModuleInstalled"; - readonly type: "event"; -}>; -``` - -The prepared event object. +## MODULES --- -## MODULES.owner +## MODULES.cancelOwnershipHandover -Calls the "owner" function on the contract. +Prepares a transaction to call the "cancelOwnershipHandover" function on the contract. ### Example ```ts -import { owner } from "thirdweb/extensions/modules"; +import { sendTransaction } from "thirdweb"; +import { cancelOwnershipHandover } from "thirdweb/extensions/modules"; -const result = await owner({ - contract, -}); +const transaction = cancelOwnershipHandover(); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function owner(options: BaseTransactionOptions): Promise; +function cancelOwnershipHandover( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for the owner function. +The options for the "cancelOwnershipHandover" function. #### Type @@ -37140,77 +35787,94 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## MODULES.ownershipHandoverExpiresAt +## MODULES.completeOwnershipHandover -Calls the "ownershipHandoverExpiresAt" function on the contract. +Prepares a transaction to call the "completeOwnershipHandover" function on the contract. ### Example ```ts -import { ownershipHandoverExpiresAt } from "thirdweb/extensions/modules"; +import { sendTransaction } from "thirdweb"; +import { completeOwnershipHandover } from "thirdweb/extensions/modules"; -const result = await ownershipHandoverExpiresAt({ +const transaction = completeOwnershipHandover({ contract, pendingOwner: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function ownershipHandoverExpiresAt( - options: BaseTransactionOptions, -): Promise; +function completeOwnershipHandover( + options: BaseTransactionOptions< + | CompleteOwnershipHandoverParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters -The options for the ownershipHandoverExpiresAt function. +The options for the "completeOwnershipHandover" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | CompleteOwnershipHandoverParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The parsed result of the function call. +A prepared transaction object. --- -## MODULES.renounceOwnership +## MODULES.getInstalledModules -Prepares a transaction to call the "renounceOwnership" function on the contract. +Calls the "getInstalledModules" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { renounceOwnership } from "thirdweb/extensions/modules"; - -const transaction = renounceOwnership(); +import { getInstalledModules } from "thirdweb/extensions/modules"; -// Send the transaction -await sendTransaction({ transaction, account }); +const result = await getInstalledModules({ + contract, +}); ``` ```ts -function renounceOwnership( - options: BaseTransactionOptions, -): PreparedTransaction; +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 "renounceOwnership" function. +The options for the getInstalledModules function. #### Type @@ -37221,98 +35885,70 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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 }>> ``` -A prepared transaction object. +The parsed result of the function call. --- -## MODULES.renounceRoles +## MODULES.getModuleConfig -Prepares a transaction to call the "renounceRoles" function on the contract. +Calls the "getModuleConfig" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { renounceRoles } from "thirdweb/extensions/modules"; +import { getModuleConfig } from "thirdweb/extensions/modules"; -const transaction = renounceRoles({ - contract, - roles: ..., - overrides: { - ... - } +const result = await getModuleConfig({ + contract, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function renounceRoles( - options: BaseTransactionOptions< - | RenounceRolesParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +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 "renounceRoles" function. +The options for the getModuleConfig function. #### Type ```ts -let options: BaseTransactionOptions< - | RenounceRolesParams - | { asyncParams: () => Promise } ->; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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}`> }> ``` -A prepared transaction object. +The parsed result of the function call. --- -## MODULES.requestOwnershipHandover +## MODULES.getSupportedCallbackFunctions -Prepares a transaction to call the "requestOwnershipHandover" function on the contract. +Calls the "getSupportedCallbackFunctions" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { requestOwnershipHandover } from "thirdweb/extensions/modules"; - -const transaction = requestOwnershipHandover(); +import { getSupportedCallbackFunctions } from "thirdweb/extensions/modules"; -// Send the transaction -await sendTransaction({ transaction, account }); +const result = await getSupportedCallbackFunctions({ + contract, +}); ``` ```ts -function requestOwnershipHandover( - options: BaseTransactionOptions, -): PreparedTransaction; +function getSupportedCallbackFunctions(options: BaseTransactionOptions) : Promise> ``` ### Parameters -The options for the "requestOwnershipHandover" function. +The options for the getSupportedCallbackFunctions function. #### Type @@ -37323,27 +35959,23 @@ let options: { contract: ThirdwebContract } & T; ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise> ``` -A prepared transaction object. +The parsed result of the function call. --- -## MODULES.revokeRoles +## MODULES.grantRoles -Prepares a transaction to call the "revokeRoles" function on the contract. +Prepares a transaction to call the "grantRoles" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { revokeRoles } from "thirdweb/extensions/modules"; +import { grantRoles } from "thirdweb/extensions/modules"; -const transaction = revokeRoles({ +const transaction = grantRoles({ contract, user: ..., roles: ..., @@ -37357,24 +35989,23 @@ await sendTransaction({ transaction, account }); ``` ```ts -function revokeRoles( +function grantRoles( options: BaseTransactionOptions< - | RevokeRolesParams - | { asyncParams: () => Promise } + | GrantRolesParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "revokeRoles" function. +The options for the "grantRoles" function. #### Type ```ts let options: BaseTransactionOptions< - | RevokeRolesParams - | { asyncParams: () => Promise } + GrantRolesParams | { asyncParams: () => Promise } >; ``` @@ -37391,114 +36022,99 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MODULES.rolesOf +## MODULES.hasAllRoles -Calls the "rolesOf" function on the contract. +Calls the "hasAllRoles" function on the contract. ### Example ```ts -import { rolesOf } from "thirdweb/extensions/modules"; +import { hasAllRoles } from "thirdweb/extensions/modules"; -const result = await rolesOf({ +const result = await hasAllRoles({ contract, user: ..., + roles: ..., }); ``` ```ts -function rolesOf( - options: BaseTransactionOptions, -): Promise; +function hasAllRoles( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the rolesOf function. +The options for the hasAllRoles function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` The parsed result of the function call. --- -## MODULES.transferOwnership +## MODULES.hasAnyRole -Prepares a transaction to call the "transferOwnership" function on the contract. +Calls the "hasAnyRole" function on the contract. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { transferOwnership } from "thirdweb/extensions/modules"; +import { hasAnyRole } from "thirdweb/extensions/modules"; -const transaction = transferOwnership({ +const result = await hasAnyRole({ contract, - newOwner: ..., - overrides: { - ... - } + user: ..., + roles: ..., }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function transferOwnership( - options: BaseTransactionOptions< - | TransferOwnershipParams - | { asyncParams: () => Promise } - >, -): PreparedTransaction; +function hasAnyRole( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The options for the "transferOwnership" function. +The options for the hasAnyRole function. #### Type ```ts -let options: BaseTransactionOptions< - | TransferOwnershipParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -A prepared transaction object. +The parsed result of the function call. --- -## MODULES.uninstallModule +## MODULES.installModule -Prepares a transaction to call the "uninstallModule" function on the contract. +Prepares a transaction to call the "installModule" function on the contract. ### Example ```ts import { sendTransaction } from "thirdweb"; -import { uninstallModule } from "thirdweb/extensions/modules"; +import { installModule } from "thirdweb/extensions/modules"; -const transaction = uninstallModule({ +const transaction = installModule({ contract, moduleContract: ..., data: ..., @@ -37512,24 +36128,24 @@ await sendTransaction({ transaction, account }); ``` ```ts -function uninstallModule( +function installModule( options: BaseTransactionOptions< - | UninstallModuleParams - | { asyncParams: () => Promise } + | InstallModuleParams + | { asyncParams: () => Promise } >, ): PreparedTransaction; ``` ### Parameters -The options for the "uninstallModule" function. +The options for the "installModule" function. #### Type ```ts let options: BaseTransactionOptions< - | UninstallModuleParams - | { asyncParams: () => Promise } + | InstallModuleParams + | { asyncParams: () => Promise } >; ``` @@ -37546,704 +36162,552 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MODULES.encodeMintParams +## MODULES.isGetInstalledModulesSupported -Encodes the parameters for the "encodeBytesBeforeMintERC20" function. +Checks if the `getInstalledModules` method is supported by the given contract. ### Example ```ts -import { encodeEncodeBytesBeforeMintERC20Params } "thirdweb/extensions/modules"; -const result = encodeEncodeBytesBeforeMintERC20Params({ - params: ..., -}); +import { isGetInstalledModulesSupported } from "thirdweb/extensions/modules"; +const supported = isGetInstalledModulesSupported(["0x..."]); ``` ```ts -function encodeMintParams( - options: EncodeBytesBeforeMintERC20Params, -): `0x${string}`; +function isGetInstalledModulesSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the encodeBytesBeforeMintERC20 function. +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 options: EncodeBytesBeforeMintERC20Params; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: boolean; ``` -The encoded ABI parameters. +A boolean indicating if the `getInstalledModules` method is supported. --- -## MODULES.encodeMintParams +## MODULES.isGetModuleConfigSupported -Encodes the parameters for the "encodeBytesBeforeMintERC20" function. +Checks if the `getModuleConfig` method is supported by the given contract. ### Example ```ts -import { encodeEncodeBytesBeforeMintERC20Params } "thirdweb/extensions/modules"; -const result = encodeEncodeBytesBeforeMintERC20Params({ - params: ..., -}); +import { isGetModuleConfigSupported } from "thirdweb/extensions/modules"; +const supported = isGetModuleConfigSupported(["0x..."]); ``` ```ts -function encodeMintParams( - options: EncodeBytesBeforeMintERC20Params, -): `0x${string}`; +function isGetModuleConfigSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the encodeBytesBeforeMintERC20 function. +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 options: EncodeBytesBeforeMintERC20Params; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: boolean; ``` -The encoded ABI parameters. +A boolean indicating if the `getModuleConfig` method is supported. --- -## MODULES.encodeMintParams +## MODULES.isGetSupportedCallbackFunctionsSupported -Encodes the parameters for the "encodeBytesBeforeMintERC721" function. +Checks if the `getSupportedCallbackFunctions` method is supported by the given contract. ### Example ```ts -import { encodeEncodeBytesBeforeMintERC721Params } "thirdweb/extensions/modules"; -const result = encodeEncodeBytesBeforeMintERC721Params({ - params: ..., -}); +import { isGetSupportedCallbackFunctionsSupported } from "thirdweb/extensions/modules"; +const supported = isGetSupportedCallbackFunctionsSupported(["0x..."]); ``` ```ts -function encodeMintParams( - options: EncodeBytesBeforeMintERC721Params, -): `0x${string}`; +function isGetSupportedCallbackFunctionsSupported( + availableSelectors: Array, +): boolean; ``` ### Parameters -The options for the encodeBytesBeforeMintERC721 function. +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 options: EncodeBytesBeforeMintERC721Params; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: boolean; ``` -The encoded ABI parameters. ---- -## EIP5792 +A boolean indicating if the `getSupportedCallbackFunctions` method is supported. --- -## EIP5792.getCallsStatus - -Get the status of an [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle. +## MODULES.isInstallModuleSupported -This function is dependent on the wallet's support for EIP-5792 and could fail. +Checks if the `installModule` method is supported by the given contract. ### Example ```ts -import { createThirdwebClient } from "thirdweb"; - import { sendCalls, getCallsStatus } from "thirdweb/wallets/eip5792"; - - const client = createThirdwebClient({ clientId: ... }); - - const result = await sendCalls({ wallet, client, calls }); +import { isInstallModuleSupported } from "thirdweb/extensions/modules"; - let result; - while (result.status !== "success") { - result = await getCallsStatus(result); - } +const supported = isInstallModuleSupported(["0x..."]); ``` ```ts -function getCallsStatus( - options: GetCallsStatusOptions, -): Promise<{ - atomic: boolean; - chainId: number; - id: string; - receipts?: Array>; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; -}>; +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 options: { - client: ThirdwebClient; - id: WalletSendCallsId; - wallet: Wallet; -}; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: { - blockHash: Hex; - blockNumber: quantity; - gasUsed: quantity; - logs: Array<{ address: string; data: Hex; topics: Array }>; - status: status; - transactionHash: Hex; -}; +let returnType: boolean; ``` -* A promise that resolves to the bundle's status and receipts (if available). GetCallsStatusResponse +A boolean indicating if the `installModule` method is supported. --- -## EIP5792.getCapabilities - -Get the capabilities of a wallet based on the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) specification. +## MODULES.isUninstallModuleSupported -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._ +Checks if the `uninstallModule` method is supported by the given contract. ### Example ```ts -import { getCapabilities } from "thirdweb/wallets/eip5792"; +import { isUninstallModuleSupported } from "thirdweb/extensions/modules"; -const wallet = createWallet("com.coinbase.wallet"); -const capabilities = await getCapabilities({ wallet }); +const supported = isUninstallModuleSupported(["0x..."]); ``` ```ts -function getCapabilities( - options: GetCapabilitiesOptions, -): Promise<{ message?: string }>; +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 options: GetCapabilitiesOptions; +let availableSelectors: Array; ``` ### Returns ```ts -let returnType: Promise<{ message?: string }>; +let returnType: boolean; ``` -* A promise that resolves to the capabilities of the wallet based on the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) spec. +A boolean indicating if the `uninstallModule` method is supported. --- -## EIP5792.sendAndConfirmCalls - -Send and confirm calls in a single transaction. +## MODULES.owner -This is a convenience function that sends the calls with `sendCalls` and then waits for the receipts with `waitForCallsReceipt`. +Calls the "owner" function on the contract. ### Example ```ts -const call1 = approve({ - contract: USDT_CONTRACT, - amount: 100, - spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709", -}); -const call2 = transfer({ - contract: USDT_CONTRACT, - to: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709", - amount: 100, -}); -const result = await sendAndConfirmCalls({ - calls: [call1, call2], - wallet: wallet, +import { owner } from "thirdweb/extensions/modules"; + +const result = await owner({ + contract, }); -console.log("Transaction receipts:", result.receipts); ``` ```ts -function sendAndConfirmCalls( - options: { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; - } & { maxBlocksWaitTime?: number }, -): Promise<{ - atomic: boolean; - chainId: number; - id: string; - receipts?: Array>; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; -}>; +function owner(options: BaseTransactionOptions): Promise; ``` ### Parameters -The options for sending and confirming calls. +The options for the owner function. #### Type ```ts -let options: { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; -} & { maxBlocksWaitTime?: number }; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: { - blockHash: Hex; - blockNumber: quantity; - gasUsed: quantity; - logs: Array<{ address: string; data: Hex; topics: Array }>; - status: status; - transactionHash: Hex; -}; +let returnType: Promise; ``` -The receipts of the calls. +The parsed result of the function call. --- -## 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. - -This function is dependent on the wallet's support for EIP-5792 and could fail. +## MODULES.ownershipHandoverExpiresAt -* getCallsStatus for how to retrieve the status of the bundle. -* getCapabilities for how to retrieve the capabilities of the wallet. +Calls the "ownershipHandoverExpiresAt" function on the contract. ### Example ```ts -import { createThirdwebClient } from "thirdweb"; -import { sendCalls } from "thirdweb/wallets/eip5792"; - -const client = createThirdwebClient({ clientId: ... }); -const wallet = createWallet("com.coinbase.wallet"); -await wallet.connect({ client }); +import { ownershipHandoverExpiresAt } from "thirdweb/extensions/modules"; -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}`, - }, - }, +const result = await ownershipHandoverExpiresAt({ + contract, + pendingOwner: ..., }); ``` -We recommend proxying any paymaster calls via an API route you setup and control. - ```ts -function sendCalls(options: { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; -}): Promise<{ - chain: Readonly; - client: ThirdwebClient; - id: string; - wallet: Wallet; -}>; +function ownershipHandoverExpiresAt( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters +The options for the ownershipHandoverExpiresAt function. + #### Type ```ts -let options: { - atomicRequired?: boolean; - calls: Array>; - capabilities?: WalletCapabilities; - chain?: Readonly; - version?: string; - wallet: Wallet; -}; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: Promise<{ - chain: Readonly; - client: ThirdwebClient; - id: string; - wallet: Wallet; -}>; +let returnType: Promise; ``` -The ID of the bundle of the calls. +The parsed result of the function call. --- -## EIP5792.waitForCallsReceipt - -Waits for the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle to be confirmed. +## MODULES.renounceOwnership -This function is dependent on the wallet's support for EIP-5792 and could fail. +Prepares a transaction to call the "renounceOwnership" function on the contract. ### Example ```ts -import { waitForCallsReceipt } from "thirdweb/wallets/eip5792"; -const result = await waitForCallsReceipt({ - client, - chain, - wallet, - id: "0x123...", -}); -``` - -Example with useSendCalls: - -```ts -const sendResult = await sendCalls({ - client, - chain, - wallet, - calls: [...], -}); -const confirmResult = await waitForCallsReceipt(sendResult); -console.log("Transaction confirmed: ", confirmResult.receipts?.[0].transactionHash); +import { sendTransaction } from "thirdweb"; +import { renounceOwnership } from "thirdweb/extensions/modules"; + +const transaction = renounceOwnership(); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function waitForCallsReceipt(options: { - chain: Readonly; - client: ThirdwebClient; - id: string; - maxBlocksWaitTime?: number; - wallet: Wallet; -}): Promise<{ - atomic: boolean; - chainId: number; - id: string; - receipts?: Array>; - status: undefined | "pending" | "success" | "failure"; - statusCode: number; - version: string; -}>; +function renounceOwnership( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The options for waiting for the bundle. By default, the max wait time is 100 blocks. +The options for the "renounceOwnership" function. #### Type ```ts -let options: { - chain: Readonly; - client: ThirdwebClient; - id: string; - maxBlocksWaitTime?: number; - wallet: Wallet; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts -let returnType: { - blockHash: Hex; - blockNumber: quantity; - gasUsed: quantity; - logs: Array<{ address: string; data: Hex; topics: Array }>; - status: status; - transactionHash: Hex; -}; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -A promise that resolves with the final getCallsStatus result. ---- -# Modules ---- -## BatchMetadataERC1155 +A prepared transaction object. --- -## BatchMetadataERC1155.batchMetadataUpdateEvent +## MODULES.renounceRoles -Creates an event object for the BatchMetadataUpdate event. +Prepares a transaction to call the "renounceRoles" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { BatchMetadataERC1155 } from "thirdweb/modules"; +import { sendTransaction } from "thirdweb"; +import { renounceRoles } from "thirdweb/extensions/modules"; -const events = await getContractEvents({ - contract, - events: [BatchMetadataERC1155.batchMetadataUpdateEvent()], +const transaction = renounceRoles({ + contract, + roles: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```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"; -}>; +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: 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"; -}>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -The prepared event object. +A prepared transaction object. --- -## BatchMetadataERC1155.encodeInstall +## MODULES.requestOwnershipHandover -Encodes the install data for the BatchMetadataERC1155 module. +Prepares a transaction to call the "requestOwnershipHandover" function on the contract. + +### Example ```ts -function encodeInstall(): string; +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: string; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -* The encoded data. +A prepared transaction object. --- -## BatchMetadataERC1155.install +## MODULES.revokeRoles -Installs the BatchMetadataERC1155 module on a core contract. +Prepares a transaction to call the "revokeRoles" function on the contract. ### Example ```ts -import { BatchMetadataERC1155 } from "thirdweb/modules"; +import { sendTransaction } from "thirdweb"; +import { revokeRoles } from "thirdweb/extensions/modules"; -const transaction = BatchMetadataERC1155.install({ - contract: coreContract, - account: account, +const transaction = revokeRoles({ + contract, + user: ..., + roles: ..., + overrides: { + ... + } }); -await sendTransaction({ - transaction, - account, -}); +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function install(options: { - account: Account; - contract: Readonly; - params?: { publisher?: string }; -}): PreparedTransaction; +function revokeRoles( + options: BaseTransactionOptions< + | RevokeRolesParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` ### Parameters +The options for the "revokeRoles" function. + #### Type ```ts -let options: { - account: Account; - contract: Readonly; - params?: { publisher?: string }; -}; +let options: BaseTransactionOptions< + | RevokeRolesParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: Readonly & { - __contract?: ThirdwebContract; - __preparedMethod?: () => Promise>; -}; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -the transaction to install the module +A prepared transaction object. --- -## BatchMetadataERC1155.module +## MODULES.rolesOf -Convenience function to add the BatchMetadataERC1155 module as a default module on a core contract. +Calls the "rolesOf" function on the contract. ### Example ```ts -import { - BatchMetadataERC1155, - deployModularContract, -} from "thirdweb/modules"; +import { rolesOf } from "thirdweb/extensions/modules"; -const deployed = deployModularContract({ - client, - chain, - account, - core: "ERC1155", - params: { - name: "My Modular Contract", - }, - modules: [BatchMetadataERC1155.module()], +const result = await rolesOf({ + contract, + user: ..., }); ``` ```ts -function module(params?: { - publisher?: string; -}): (args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -}) => Promise<{ data: "0x"; module: `0x${string}` }>; +function rolesOf( + options: BaseTransactionOptions, +): Promise; ``` ### Parameters -The parameters for the module. +The options for the rolesOf function. #### Type ```ts -let params: { publisher?: string }; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: (args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -}) => Promise<{ data: "0x"; module: `0x${string}` }>; +let returnType: Promise; ``` -* The module function. +The parsed result of the function call. --- -## BatchMetadataERC1155.uploadMetadata +## MODULES.transferOwnership -Uploads metadata for a batch of NFTs. +Prepares a transaction to call the "transferOwnership" function on the contract. ### Example ```ts -import { BatchMetadataERC1155 } from "thirdweb/modules"; +import { sendTransaction } from "thirdweb"; +import { transferOwnership } from "thirdweb/extensions/modules"; -const transaction = BatchMetadataERC1155.uploadMetadata({ - contract, - metadatas: [{ name: "My NFT", description: "This is my NFT" }], +const transaction = transferOwnership({ + contract, + newOwner: ..., + overrides: { + ... + } }); -await sendTransaction({ - transaction, - account, -}); +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```ts -function uploadMetadata( - options: BaseTransactionOptions, +function transferOwnership( + options: BaseTransactionOptions< + | TransferOwnershipParams + | { asyncParams: () => Promise } + >, ): PreparedTransaction; ``` ### Parameters -The options for the transaction. +The options for the "transferOwnership" function. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + | TransferOwnershipParams + | { asyncParams: () => Promise } +>; ``` ### Returns @@ -38256,482 +36720,546 @@ let returnType: PreparedTransaction< >; ``` -The transaction to upload the metadata. ---- -## BatchMetadataERC721 +A prepared transaction object. --- -## BatchMetadataERC721.batchMetadataUpdateEvent +## MODULES.uninstallModule -Creates an event object for the BatchMetadataUpdate event. +Prepares a transaction to call the "uninstallModule" function on the contract. ### Example ```ts -import { getContractEvents } from "thirdweb"; -import { BatchMetadataERC721 } from "thirdweb/modules"; +import { sendTransaction } from "thirdweb"; +import { uninstallModule } from "thirdweb/extensions/modules"; -const events = await getContractEvents({ - contract, - events: [BatchMetadataERC721.batchMetadataUpdateEvent()], +const transaction = uninstallModule({ + contract, + moduleContract: ..., + data: ..., + overrides: { + ... + } }); + +// Send the transaction +await sendTransaction({ transaction, account }); ``` ```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"; -}>; +function uninstallModule( + options: BaseTransactionOptions< + | UninstallModuleParams + | { asyncParams: () => Promise } + >, +): PreparedTransaction; ``` -### Returns +### Parameters -```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. ---- - -## BatchMetadataERC721.encodeInstall +The options for the "uninstallModule" function. -Encodes the install data for the BatchMetadataERC721 module. +#### Type ```ts -function encodeInstall(): string; +let options: BaseTransactionOptions< + | UninstallModuleParams + | { asyncParams: () => Promise } +>; ``` ### Returns ```ts -let returnType: string; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -* The encoded data. +A prepared transaction object. --- -## BatchMetadataERC721.install +## MODULES.encodeMintParams -Installs the BatchMetadataERC721 module on a core contract. +Encodes the parameters for the "encodeBytesBeforeMintERC20" function. ### Example ```ts -import { BatchMetadataERC721 } from "thirdweb/modules"; - -const transaction = BatchMetadataERC721.install({ - contract: coreContract, - account: account, -}); - -await sendTransaction({ - transaction, - account, +import { encodeEncodeBytesBeforeMintERC20Params } "thirdweb/extensions/modules"; +const result = encodeEncodeBytesBeforeMintERC20Params({ + params: ..., }); ``` ```ts -function install(options: { - account: Account; - contract: Readonly; - params?: { publisher?: string }; -}): PreparedTransaction; +function encodeMintParams( + options: EncodeBytesBeforeMintERC20Params, +): `0x${string}`; ``` ### Parameters +The options for the encodeBytesBeforeMintERC20 function. + #### Type ```ts -let options: { - account: Account; - contract: Readonly; - params?: { publisher?: string }; -}; +let options: EncodeBytesBeforeMintERC20Params; ``` ### Returns ```ts -let returnType: Readonly & { - __contract?: ThirdwebContract; - __preparedMethod?: () => Promise>; -}; +let returnType: `0x${string}`; ``` -the transaction to install the module +The encoded ABI parameters. --- -## BatchMetadataERC721.module +## MODULES.encodeMintParams -Convenience function to add the BatchMetadataERC721 module as a default module on a core contract. +Encodes the parameters for the "encodeBytesBeforeMintERC20" function. ### Example ```ts -import { - BatchMetadataERC721, - deployModularContract, -} from "thirdweb/modules"; - -const deployed = deployModularContract({ - client, - chain, - account, - core: "ERC721", - params: { - name: "My Modular Contract", - }, - modules: [BatchMetadataERC721.module()], +import { encodeEncodeBytesBeforeMintERC20Params } "thirdweb/extensions/modules"; +const result = encodeEncodeBytesBeforeMintERC20Params({ + params: ..., }); ``` ```ts -function module(params?: { - publisher?: string; -}): (args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -}) => Promise<{ data: "0x"; module: `0x${string}` }>; +function encodeMintParams( + options: EncodeBytesBeforeMintERC20Params, +): `0x${string}`; ``` ### Parameters -The parameters for the module. +The options for the encodeBytesBeforeMintERC20 function. #### Type ```ts -let params: { publisher?: string }; +let options: EncodeBytesBeforeMintERC20Params; ``` ### Returns ```ts -let returnType: (args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -}) => Promise<{ data: "0x"; module: `0x${string}` }>; +let returnType: `0x${string}`; ``` -* The module function. +The encoded ABI parameters. --- -## BatchMetadataERC721.uploadMetadata +## MODULES.encodeMintParams -Uploads metadata for a batch of NFTs. +Encodes the parameters for the "encodeBytesBeforeMintERC721" function. ### 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, +import { encodeEncodeBytesBeforeMintERC721Params } "thirdweb/extensions/modules"; +const result = encodeEncodeBytesBeforeMintERC721Params({ + params: ..., }); ``` ```ts -function uploadMetadata( - options: BaseTransactionOptions, -): PreparedTransaction; +function encodeMintParams( + options: EncodeBytesBeforeMintERC721Params, +): `0x${string}`; ``` ### Parameters -The options for the transaction. +The options for the encodeBytesBeforeMintERC721 function. #### Type ```ts -let options: BaseTransactionOptions; +let options: EncodeBytesBeforeMintERC721Params; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: `0x${string}`; ``` -The transaction to upload the metadata. +The encoded ABI parameters. --- -## ClaimableERC1155 +## EIP5792 --- -## ClaimableERC1155.encodeInstall +## EIP5792.getCallsStatus -Encodes the install data for the ClaimableERC1155 module. +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 -function encodeInstall( - params: EncodeBytesOnInstallParams, -): `0x${string}`; +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 }); + } ``` -### Parameters +```ts +function getCallsStatus( + options: GetCallsStatusOptions, +): Promise; +``` -The parameters for the module. +### Parameters #### Type ```ts -let params: EncodeBytesOnInstallParams; +let options: { + bundleId: WalletSendCallsId; + client: ThirdwebClient; + wallet: Wallet; +}; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: { + receipts: Array>; + status: "PENDING" | "CONFIRMED"; +}; ``` -* The encoded data. +* A promise that resolves to the bundle's status and receipts (if available). GetCallsStatusResponse --- -## ClaimableERC1155.getClaimCondition +## EIP5792.getCapabilities -Calls the "getClaimConditionByTokenId" function on the contract. +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 { ClaimableERC1155 } from "thirdweb/modules"; +import { getCapabilities } from "thirdweb/wallets/eip5792"; -const result = await ClaimableERC1155.getClaimConditionByTokenId({ - contract, - tokenId: ..., -}); +const wallet = createWallet("com.coinbase.wallet"); +const capabilities = await getCapabilities({ wallet }); ``` ```ts -function getClaimCondition( - options: BaseTransactionOptions, -): Promise<{ - allowlistMerkleRoot: `0x${string}`; - auxData: string; - availableSupply: bigint; - currency: string; - endTimestamp: number; - maxMintPerWallet: bigint; - pricePerUnit: bigint; - startTimestamp: number; -}>; +function getCapabilities( + options: GetCapabilitiesOptions, +): Promise; ``` ### Parameters -The options for the getClaimConditionByTokenId function. - #### Type ```ts -let options: BaseTransactionOptions; +let options: GetCapabilitiesOptions; ``` ### Returns ```ts -let returnType: Promise<{ - allowlistMerkleRoot: `0x${string}`; - auxData: string; - availableSupply: bigint; - currency: string; - endTimestamp: number; - maxMintPerWallet: bigint; - pricePerUnit: bigint; - startTimestamp: number; -}>; +let returnType: Prettify< + WalletCapabilitiesRecord +>; ``` -The parsed result of the function call. +* A promise that resolves to the capabilities of the wallet based on the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) spec. --- -## ClaimableERC1155.getSaleConfig +## EIP5792.sendCalls -Calls the "getSaleConfig" function on the contract. +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 { ClaimableERC1155 } from "thirdweb/modules"; +import { createThirdwebClient } from "thirdweb"; +import { sendCalls } from "thirdweb/wallets/eip5792"; -const result = await ClaimableERC1155.getSaleConfig({ - contract, +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 -function getSaleConfig( - options: BaseTransactionOptions, -): Promise; +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. ``` -### Parameters +```ts +function sendCalls( + options: SendCallsOptions, +): Promise; +``` -The options for the getSaleConfig function. +### Parameters #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: SendCallsOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: WalletSendCallsId; ``` -The parsed result of the function call. +The ID of the bundle of the calls. --- -## ClaimableERC1155.install +## EIP5792.waitForBundle -Installs the ClaimableERC1155 module on a core contract. +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 { ClaimableERC1155 } from "thirdweb/modules"; - -const transaction = ClaimableERC1155.install({ - contract: coreContract, - account: account, - params: { - primarySaleRecipient: ..., - }, -}); - -await sendTransaction({ - transaction, - account, +import { waitForBundle } from "thirdweb/wallets/eip5792"; +const result = await waitForBundle({ + client, + chain, + wallet, + bundleId: "0x123...", }); ``` ```ts -function install(options: { - account: Account; - contract: Readonly; - params: EncodeBytesOnInstallParams & { publisher?: string }; -}): PreparedTransaction; +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: { - account: Account; - contract: Readonly; - params: EncodeBytesOnInstallParams & { publisher?: string }; + bundleId: string; + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + wallet: Wallet; }; ``` ### Returns ```ts -let returnType: Readonly & { - __contract?: ThirdwebContract; - __preparedMethod?: () => Promise>; +let returnType: { + receipts: Array>; + status: "PENDING" | "CONFIRMED"; }; ``` -the transaction to install the module +A promise that resolves with the final getCallsStatus result. +--- +# Modules +--- +## BatchMetadataERC1155 --- -## ClaimableERC1155.mint +## BatchMetadataERC1155.batchMetadataUpdateEvent -Mints ERC1155 tokens to a specified address via a ClaimableERC1155 module. +Creates an event object for the BatchMetadataUpdate event. ### Example -```typescript -import { ClaimableERC1155 } from "thirdweb/modules"; +```ts +import { getContractEvents } from "thirdweb"; +import { BatchMetadataERC1155 } from "thirdweb/modules"; -const transaction = ClaimableERC1155.mint({ +const events = await getContractEvents({ contract, - to: "0x...", // Address to mint tokens to - quantity: 2, // Amount of tokens to mint + 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. +--- + +## BatchMetadataERC1155.encodeInstall + +Encodes the install data for the BatchMetadataERC1155 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## BatchMetadataERC1155.install + +Installs the BatchMetadataERC1155 module on a core contract. + +### Example + +```ts +import { BatchMetadataERC1155 } from "thirdweb/modules"; + +const transaction = BatchMetadataERC1155.install({ + contract: coreContract, + account: account, }); -// Send the transaction -await sendTransaction({ transaction, account }); +await sendTransaction({ + transaction, + account, +}); ``` ```ts -function mint( - options: BaseTransactionOptions, -): PreparedTransaction; +function install(options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}): PreparedTransaction; ``` ### Parameters -The options for minting tokens. - #### Type ```ts -let options: BaseTransactionOptions; +let options: { + account: Account; + contract: Readonly>; + params?: { publisher?: string }; +}; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; ``` -A transaction to mint tokens. +the transaction to install the module --- -## ClaimableERC1155.module +## BatchMetadataERC1155.module -Convenience function to add the ClaimableERC1155 module as a default module on a core contract. +Convenience function to add the BatchMetadataERC1155 module as a default module on a core contract. ### Example ```ts -import { ClaimableERC1155, deployModularContract } from "thirdweb/modules"; +import { + BatchMetadataERC1155, + deployModularContract, +} from "thirdweb/modules"; const deployed = deployModularContract({ client, @@ -38741,22 +37269,18 @@ const deployed = deployModularContract({ params: { name: "My Modular Contract", }, - modules: [ - ClaimableERC1155.module({ - primarySaleRecipient: ..., - }), - ], + modules: [BatchMetadataERC1155.module()], }); ``` ```ts -function module( - params: EncodeBytesOnInstallParams & { publisher?: string }, -): (args: { +function module(params?: { + publisher?: string; +}): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; -}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` ### Parameters @@ -38766,7 +37290,7 @@ The parameters for the module. #### Type ```ts -let params: EncodeBytesOnInstallParams & { publisher?: string }; +let params: { publisher?: string }; ``` ### Returns @@ -38774,52 +37298,48 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; -}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +}) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` * The module function. --- -## ClaimableERC1155.setClaimCondition +## BatchMetadataERC1155.uploadMetadata -Sets the claim conditions for a given token ID. +Uploads metadata for a batch of NFTs. ### Example ```ts -import { ClaimableERC1155 } from "thirdweb/modules"; +import { BatchMetadataERC1155 } from "thirdweb/modules"; -const transaction = ClaimableERC1155.setClaimCondition({ - contract: contract, - tokenId: 0n, - pricePerToken: "1", // in ETH - maxClaimableSupply: "1000000", - maxClaimablePerWallet: "1", +const transaction = BatchMetadataERC1155.uploadMetadata({ + contract, + metadatas: [{ name: "My NFT", description: "This is my NFT" }], }); -await sendTransaction({ transaction, account }); +await sendTransaction({ + transaction, + account, +}); ``` ```ts -function setClaimCondition( - options: BaseTransactionOptions< - ClaimConditionInput & { tokenId: bigint } - >, +function uploadMetadata( + options: BaseTransactionOptions, ): PreparedTransaction; ``` ### Parameters -The options for setting the claim conditions. +The options for the transaction. #### Type ```ts -let options: BaseTransactionOptions< - ClaimConditionInput & { tokenId: bigint } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -38832,51 +37352,228 @@ let returnType: PreparedTransaction< >; ``` -A transaction to set the claim conditions. +The transaction to upload the metadata. +--- +## BatchMetadataERC721 --- -## ClaimableERC1155.setSaleConfig +## BatchMetadataERC721.batchMetadataUpdateEvent -Prepares a transaction to call the "setSaleConfig" function on the contract. +Creates an event object for the BatchMetadataUpdate event. ### Example ```ts -import { sendTransaction } from "thirdweb"; -import { ClaimableERC1155 } from "thirdweb/modules"; +import { getContractEvents } from "thirdweb"; +import { BatchMetadataERC721 } from "thirdweb/modules"; -const transaction = ClaimableERC1155.setSaleConfig({ - contract, - primarySaleRecipient: ..., - overrides: { - ... - } +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. +--- + +## BatchMetadataERC721.encodeInstall + +Encodes the install data for the BatchMetadataERC721 module. + +```ts +function encodeInstall(): string; +``` + +### Returns + +```ts +let returnType: string; +``` + +* The encoded data. +--- + +## BatchMetadataERC721.install + +Installs the BatchMetadataERC721 module on a core contract. + +### Example + +```ts +import { BatchMetadataERC721 } from "thirdweb/modules"; -// Send the transaction -await sendTransaction({ transaction, account }); +const transaction = BatchMetadataERC721.install({ + contract: coreContract, + account: account, +}); + +await sendTransaction({ + transaction, + account, +}); ``` ```ts -function setSaleConfig( - options: BaseTransactionOptions< - | SetSaleConfigParams - | { asyncParams: () => Promise } - >, +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 +--- + +## BatchMetadataERC721.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. +--- + +## BatchMetadataERC721.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 "setSaleConfig" function. +The options for the transaction. #### Type ```ts -let options: BaseTransactionOptions< - | SetSaleConfigParams - | { asyncParams: () => Promise } ->; +let options: BaseTransactionOptions; ``` ### Returns @@ -38889,14 +37586,14 @@ let returnType: PreparedTransaction< >; ``` -A prepared transaction object. +The transaction to upload the metadata. --- -## ClaimableERC20 +## ClaimableERC1155 --- -## ClaimableERC20.encodeInstall +## ClaimableERC1155.encodeInstall -Encodes the install data for the ClaimableERC20 module. +Encodes the install data for the ClaimableERC1155 module. ```ts function encodeInstall( @@ -38923,23 +37620,24 @@ let returnType: `0x${string}`; * The encoded data. --- -## ClaimableERC20.getClaimCondition +## ClaimableERC1155.getClaimCondition -Calls the "getClaimCondition" function on the contract. +Calls the "getClaimConditionByTokenId" function on the contract. ### Example ```ts -import { ClaimableERC20 } from "thirdweb/modules"; +import { ClaimableERC1155 } from "thirdweb/modules"; -const result = await ClaimableERC20.getClaimCondition({ - contract, +const result = await ClaimableERC1155.getClaimConditionByTokenId({ + contract, + tokenId: ..., }); ``` ```ts function getClaimCondition( - options: BaseTransactionOptions, + options: BaseTransactionOptions, ): Promise<{ allowlistMerkleRoot: `0x${string}`; auxData: string; @@ -38954,12 +37652,12 @@ function getClaimCondition( ### Parameters -The options for the getClaimCondition function. +The options for the getClaimConditionByTokenId function. #### Type ```ts -let options: { contract: ThirdwebContract } & T; +let options: BaseTransactionOptions; ``` ### Returns @@ -38980,16 +37678,16 @@ let returnType: Promise<{ The parsed result of the function call. --- -## ClaimableERC20.getSaleConfig +## ClaimableERC1155.getSaleConfig Calls the "getSaleConfig" function on the contract. ### Example ```ts -import { ClaimableERC20 } from "thirdweb/modules"; +import { ClaimableERC1155 } from "thirdweb/modules"; -const result = await ClaimableERC20.getSaleConfig({ +const result = await ClaimableERC1155.getSaleConfig({ contract, }); ``` @@ -39019,16 +37717,16 @@ let returnType: Promise; The parsed result of the function call. --- -## ClaimableERC20.install +## ClaimableERC1155.install -Installs the ClaimableERC20 module on a core contract. +Installs the ClaimableERC1155 module on a core contract. ### Example ```ts -import { ClaimableERC20 } from "thirdweb/modules"; +import { ClaimableERC1155 } from "thirdweb/modules"; -const transaction = ClaimableERC20.install({ +const transaction = ClaimableERC1155.install({ contract: coreContract, account: account, params: { @@ -39045,7 +37743,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -39057,7 +37755,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -39074,19 +37772,19 @@ let returnType: Readonly & { the transaction to install the module --- -## ClaimableERC20.mint +## ClaimableERC1155.mint -Mints tokens to a specified address via a ClaimableERC20 module. +Mints ERC1155 tokens to a specified address via a ClaimableERC1155 module. ### Example ```typescript -import { ClaimableERC20 } from "thirdweb/modules"; +import { ClaimableERC1155 } from "thirdweb/modules"; -const transaction = ClaimableERC20.mint({ +const transaction = ClaimableERC1155.mint({ contract, to: "0x...", // Address to mint tokens to - quantity: "0.1", // Amount of tokens to mint (in decimals) + quantity: 2, // Amount of tokens to mint }); // Send the transaction @@ -39122,25 +37820,25 @@ let returnType: PreparedTransaction< A transaction to mint tokens. --- -## ClaimableERC20.module +## ClaimableERC1155.module -Convenience function to add the ClaimableERC20 module as a default module on a core contract. +Convenience function to add the ClaimableERC1155 module as a default module on a core contract. ### Example ```ts -import { ClaimableERC20, deployModularContract } from "thirdweb/modules"; +import { ClaimableERC1155, deployModularContract } from "thirdweb/modules"; const deployed = deployModularContract({ client, chain, account, - core: "ERC20", + core: "ERC1155", params: { name: "My Modular Contract", }, modules: [ - ClaimableERC20.module({ + ClaimableERC1155.module({ primarySaleRecipient: ..., }), ], @@ -39152,7 +37850,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -39172,7 +37870,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -39180,17 +37878,18 @@ let returnType: (args: { * The module function. --- -## ClaimableERC20.setClaimCondition +## ClaimableERC1155.setClaimCondition Sets the claim conditions for a given token ID. ### Example ```ts -import { ClaimableERC20 } from "thirdweb/modules"; +import { ClaimableERC1155 } from "thirdweb/modules"; -const transaction = ClaimableERC20.setClaimCondition({ +const transaction = ClaimableERC1155.setClaimCondition({ contract: contract, + tokenId: 0n, pricePerToken: "1", // in ETH maxClaimableSupply: "1000000", maxClaimablePerWallet: "1", @@ -39201,7 +37900,9 @@ await sendTransaction({ transaction, account }); ```ts function setClaimCondition( - options: BaseTransactionOptions, + options: BaseTransactionOptions< + ClaimConditionInput & { tokenId: bigint } + >, ): PreparedTransaction; ``` @@ -39212,7 +37913,9 @@ The options for setting the claim conditions. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions< + ClaimConditionInput & { tokenId: bigint } +>; ``` ### Returns @@ -39228,7 +37931,7 @@ let returnType: PreparedTransaction< A transaction to set the claim conditions. --- -## ClaimableERC20.setSaleConfig +## ClaimableERC1155.setSaleConfig Prepares a transaction to call the "setSaleConfig" function on the contract. @@ -39236,9 +37939,9 @@ Prepares a transaction to call the "setSaleConfig" function on the contract. ```ts import { sendTransaction } from "thirdweb"; -import { ClaimableERC20 } from "thirdweb/modules"; +import { ClaimableERC1155 } from "thirdweb/modules"; -const transaction = ClaimableERC20.setSaleConfig({ +const transaction = ClaimableERC1155.setSaleConfig({ contract, primarySaleRecipient: ..., overrides: { @@ -39284,12 +37987,12 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## ClaimableERC721 +## ClaimableERC20 --- -## ClaimableERC721.encodeInstall +## ClaimableERC20.encodeInstall -Encodes the install data for the ClaimableERC721 module. +Encodes the install data for the ClaimableERC20 module. ```ts function encodeInstall( @@ -39316,16 +38019,16 @@ let returnType: `0x${string}`; * The encoded data. --- -## ClaimableERC721.getClaimCondition +## ClaimableERC20.getClaimCondition Calls the "getClaimCondition" function on the contract. ### Example ```ts -import { ClaimableERC721 } from "thirdweb/modules"; +import { ClaimableERC20 } from "thirdweb/modules"; -const result = await ClaimableERC721.getClaimCondition({ +const result = await ClaimableERC20.getClaimCondition({ contract, }); ``` @@ -39373,16 +38076,16 @@ let returnType: Promise<{ The parsed result of the function call. --- -## ClaimableERC721.getSaleConfig +## ClaimableERC20.getSaleConfig Calls the "getSaleConfig" function on the contract. ### Example ```ts -import { ClaimableERC721 } from "thirdweb/modules"; +import { ClaimableERC20 } from "thirdweb/modules"; -const result = await ClaimableERC721.getSaleConfig({ +const result = await ClaimableERC20.getSaleConfig({ contract, }); ``` @@ -39412,16 +38115,16 @@ let returnType: Promise; The parsed result of the function call. --- -## ClaimableERC721.install +## ClaimableERC20.install -Installs the ClaimableERC721 module on a core contract. +Installs the ClaimableERC20 module on a core contract. ### Example ```ts -import { ClaimableERC721 } from "thirdweb/modules"; +import { ClaimableERC20 } from "thirdweb/modules"; -const transaction = ClaimableERC721.install({ +const transaction = ClaimableERC20.install({ contract: coreContract, account: account, params: { @@ -39438,7 +38141,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -39450,7 +38153,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -39467,19 +38170,19 @@ let returnType: Readonly & { the transaction to install the module --- -## ClaimableERC721.mint +## ClaimableERC20.mint -Mints ERC721 tokens to a specified address via a ClaimableERC721 module. +Mints tokens to a specified address via a ClaimableERC20 module. ### Example ```typescript -import { ClaimableERC721 } from "thirdweb/modules"; +import { ClaimableERC20 } from "thirdweb/modules"; -const transaction = ClaimableERC721.mint({ +const transaction = ClaimableERC20.mint({ contract, to: "0x...", // Address to mint tokens to - quantity: 2, // Amount of tokens to mint + quantity: "0.1", // Amount of tokens to mint (in decimals) }); // Send the transaction @@ -39515,25 +38218,25 @@ let returnType: PreparedTransaction< A transaction to mint tokens. --- -## ClaimableERC721.module +## ClaimableERC20.module -Convenience function to add the ClaimableERC721 module as a default module on a core contract. +Convenience function to add the ClaimableERC20 module as a default module on a core contract. ### Example ```ts -import { ClaimableERC721, deployModularContract } from "thirdweb/modules"; +import { ClaimableERC20, deployModularContract } from "thirdweb/modules"; const deployed = deployModularContract({ client, chain, account, - core: "ERC721", + core: "ERC20", params: { name: "My Modular Contract", }, modules: [ - ClaimableERC721.module({ + ClaimableERC20.module({ primarySaleRecipient: ..., }), ], @@ -39545,7 +38248,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -39565,7 +38268,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -39573,16 +38276,16 @@ let returnType: (args: { * The module function. --- -## ClaimableERC721.setClaimCondition +## ClaimableERC20.setClaimCondition Sets the claim conditions for a given token ID. ### Example ```ts -import { ClaimableERC721 } from "thirdweb/modules"; +import { ClaimableERC20 } from "thirdweb/modules"; -const transaction = ClaimableERC721.setClaimCondition({ +const transaction = ClaimableERC20.setClaimCondition({ contract: contract, pricePerToken: "1", // in ETH maxClaimableSupply: "1000000", @@ -39621,7 +38324,7 @@ let returnType: PreparedTransaction< A transaction to set the claim conditions. --- -## ClaimableERC721.setSaleConfig +## ClaimableERC20.setSaleConfig Prepares a transaction to call the "setSaleConfig" function on the contract. @@ -39629,9 +38332,9 @@ Prepares a transaction to call the "setSaleConfig" function on the contract. ```ts import { sendTransaction } from "thirdweb"; -import { ClaimableERC721 } from "thirdweb/modules"; +import { ClaimableERC20 } from "thirdweb/modules"; -const transaction = ClaimableERC721.setSaleConfig({ +const transaction = ClaimableERC20.setSaleConfig({ contract, primarySaleRecipient: ..., overrides: { @@ -39677,12 +38380,12 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MintableERC1155 +## ClaimableERC721 --- -## MintableERC1155.encodeInstall +## ClaimableERC721.encodeInstall -Encodes the install data for the MintableERC1155 module. +Encodes the install data for the ClaimableERC721 module. ```ts function encodeInstall( @@ -39709,102 +38412,73 @@ let returnType: `0x${string}`; * The encoded data. --- -## MintableERC1155.generateMintSignature +## ClaimableERC721.getClaimCondition -Generates a payload and signature for minting ERC1155 tokens with a signature. +Calls the "getClaimCondition" function on the contract. ### 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", - }, - }); +```ts +import { ClaimableERC721 } from "thirdweb/modules"; -// prepare the transaction, this is typically done on the client -// can be executed by any wallet -const transaction = MintableERC1155.mintWithSignature({ +const result = await ClaimableERC721.getClaimCondition({ contract, - payload, - signature, }); - -// Send the transaction -await sendTransaction({ transaction, account }); ``` ```ts -function generateMintSignature( - options: GenerateMintSignatureOptions, +function getClaimCondition( + options: BaseTransactionOptions, ): Promise<{ - payload: { - amount: bigint; - baseURI: string; - data: `0x${string}`; - to: `0x${string}`; - tokenId: bigint; - }; - signature: `0x${string}`; + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; }>; ``` ### Parameters -The options for generating the payload and signature. +The options for the getClaimCondition function. #### Type ```ts -let options: { - account: Account; - contract: ThirdwebContract; - contractType?: "TokenERC1155" | "SignatureMintERC1155"; - mintRequest: GeneratePayloadInput; -}; +let options: { contract: ThirdwebContract } & T; ``` ### Returns ```ts let returnType: Promise<{ - payload: { - amount: bigint; - baseURI: string; - data: `0x${string}`; - to: `0x${string}`; - tokenId: bigint; - }; - signature: `0x${string}`; + allowlistMerkleRoot: `0x${string}`; + auxData: string; + availableSupply: bigint; + currency: string; + endTimestamp: number; + maxMintPerWallet: bigint; + pricePerUnit: bigint; + startTimestamp: number; }>; ``` -The payload and signature. +The parsed result of the function call. --- -## MintableERC1155.getSaleConfig +## ClaimableERC721.getSaleConfig Calls the "getSaleConfig" function on the contract. ### Example ```ts -import { MintableERC1155 } from "thirdweb/modules"; +import { ClaimableERC721 } from "thirdweb/modules"; -const result = await MintableERC1155.getSaleConfig({ +const result = await ClaimableERC721.getSaleConfig({ contract, }); ``` @@ -39834,16 +38508,16 @@ let returnType: Promise; The parsed result of the function call. --- -## MintableERC1155.install +## ClaimableERC721.install -Installs the MintableERC1155 module on a core contract. +Installs the ClaimableERC721 module on a core contract. ### Example ```ts -import { MintableERC1155 } from "thirdweb/modules"; +import { ClaimableERC721 } from "thirdweb/modules"; -const transaction = MintableERC1155.install({ +const transaction = ClaimableERC721.install({ contract: coreContract, account: account, params: { @@ -39860,7 +38534,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -39872,7 +38546,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -39889,24 +38563,19 @@ let returnType: Readonly & { the transaction to install the module --- -## MintableERC1155.mintWithRole +## ClaimableERC721.mint -Mints ERC1155 tokens to a specified address via a MintableERC1155 module. +Mints ERC721 tokens to a specified address via a ClaimableERC721 module. ### Example ```typescript -import { MintableERC1155 } from "thirdweb/modules"; +import { ClaimableERC721 } from "thirdweb/modules"; -const transaction = MintableERC1155.mintWithRole({ +const transaction = ClaimableERC721.mint({ 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://...", - }, + quantity: 2, // Amount of tokens to mint }); // Send the transaction @@ -39914,8 +38583,8 @@ await sendTransaction({ transaction, account }); ``` ```ts -function mintWithRole( - options: BaseTransactionOptions, +function mint( + options: BaseTransactionOptions, ): PreparedTransaction; ``` @@ -39926,7 +38595,7 @@ The options for minting tokens. #### Type ```ts -let options: BaseTransactionOptions; +let options: BaseTransactionOptions; ``` ### Returns @@ -39942,150 +38611,113 @@ let returnType: PreparedTransaction< A transaction to mint tokens. --- -## MintableERC1155.mintWithSignature +## ClaimableERC721.module -Mints ERC1155 tokens to a specified address with a signature via a MintableERC1155 module. +Convenience function to add the ClaimableERC721 module as a default module on a core contract. ### 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", - }, - }); +```ts +import { ClaimableERC721, deployModularContract } from "thirdweb/modules"; -// prepare the transaction, this is typically done on the client -// can be executed by any wallet -const transaction = MintableERC1155.mintWithSignature({ - contract, - payload, - signature, +const deployed = deployModularContract({ + client, + chain, + account, + core: "ERC721", + params: { + name: "My Modular Contract", + }, + modules: [ + ClaimableERC721.module({ + primarySaleRecipient: ..., + }), + ], }); - -// 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; +function module( + params: EncodeBytesOnInstallParams & { publisher?: string }, +): (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` ### Parameters -The options for minting tokens. +The parameters for the module. #### Type ```ts -let options: BaseTransactionOptions<{ - payload: { - amount: bigint; - baseURI: string; - data: `0x${string}`; - to: `0x${string}`; - tokenId: bigint; - }; - signature: `0x${string}`; -}>; +let params: EncodeBytesOnInstallParams & { publisher?: string }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +let returnType: (args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` -A transaction to mint tokens. +* The module function. --- -## MintableERC1155.module +## ClaimableERC721.setClaimCondition -Convenience function to add the MintableERC1155 module as a default module on a core contract. +Sets the claim conditions for a given token ID. ### Example ```ts -import { MintableERC1155, deployModularContract } from "thirdweb/modules"; +import { ClaimableERC721 } from "thirdweb/modules"; -const deployed = deployModularContract({ - client, - chain, - account, - core: "ERC1155", - params: { - name: "My Modular Contract", - }, - modules: [ - MintableERC1155.module({ - primarySaleRecipient: ..., - }), - ], +const transaction = ClaimableERC721.setClaimCondition({ + contract: contract, + pricePerToken: "1", // in ETH + maxClaimableSupply: "1000000", + maxClaimablePerWallet: "1", }); + +await sendTransaction({ transaction, account }); ``` ```ts -function module( - params: EncodeBytesOnInstallParams & { publisher?: string }, -): (args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +function setClaimCondition( + options: BaseTransactionOptions, +): PreparedTransaction; ``` ### Parameters -The parameters for the module. +The options for setting the claim conditions. #### Type ```ts -let params: EncodeBytesOnInstallParams & { publisher?: string }; +let options: BaseTransactionOptions; ``` ### Returns ```ts -let returnType: (args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -}) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; +let returnType: PreparedTransaction< + any, + AbiFunction, + PrepareTransactionOptions +>; ``` -* The module function. +A transaction to set the claim conditions. --- -## MintableERC1155.setSaleConfig +## ClaimableERC721.setSaleConfig Prepares a transaction to call the "setSaleConfig" function on the contract. @@ -40093,9 +38725,9 @@ Prepares a transaction to call the "setSaleConfig" function on the contract. ```ts import { sendTransaction } from "thirdweb"; -import { MintableERC1155 } from "thirdweb/modules"; +import { ClaimableERC721 } from "thirdweb/modules"; -const transaction = MintableERC1155.setSaleConfig({ +const transaction = ClaimableERC721.setSaleConfig({ contract, primarySaleRecipient: ..., overrides: { @@ -40141,12 +38773,12 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -## MintableERC20 +## MintableERC1155 --- -## MintableERC20.encodeInstall +## MintableERC1155.encodeInstall -Encodes the install data for the MintableERC20 module. +Encodes the install data for the MintableERC1155 module. ```ts function encodeInstall( @@ -40173,21 +38805,26 @@ let returnType: `0x${string}`; * The encoded data. --- -## MintableERC20.generateMintSignature +## MintableERC1155.generateMintSignature -Generates a mint signature for a given mint request to be used with a MintableERC20 module. +Generates a payload and signature for minting ERC1155 tokens with a signature. ### Example ```typescript -import { MintableERC20 } from "thirdweb/modules"; +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 MintableERC20.generateMintSignature({ + await MintableERC1155.generateMintSignature({ account, contract, + nft: { + name: "My NFT", + description: "This is my NFT", + image: "ipfs://...", + }, mintRequest: { recipient: "0x...", quantity: "10", @@ -40196,7 +38833,7 @@ const { payload, signature } = // prepare the transaction, this is typically done on the client // can be executed by any wallet -const transaction = MintableERC20.mintWithSignature({ +const transaction = MintableERC1155.mintWithSignature({ contract, payload, signature, @@ -40210,14 +38847,20 @@ await sendTransaction({ transaction, account }); function generateMintSignature( options: GenerateMintSignatureOptions, ): Promise<{ - payload: { amount: bigint; data: `0x${string}`; to: `0x${string}` }; + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + tokenId: bigint; + }; signature: `0x${string}`; }>; ``` ### Parameters -The options for minting tokens. +The options for generating the payload and signature. #### Type @@ -40234,24 +38877,477 @@ let options: { ```ts let returnType: Promise<{ - payload: { amount: bigint; data: `0x${string}`; to: `0x${string}` }; + payload: { + amount: bigint; + baseURI: string; + data: `0x${string}`; + to: `0x${string}`; + tokenId: bigint; + }; signature: `0x${string}`; }>; ``` -A transaction to mint tokens. +The payload and signature. --- -## MintableERC20.getSaleConfig +## MintableERC1155.getSaleConfig Calls the "getSaleConfig" function on the contract. ### Example ```ts -import { MintableERC20 } from "thirdweb/modules"; +import { MintableERC1155 } from "thirdweb/modules"; -const result = await MintableERC20.getSaleConfig({ +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. +--- + +## MintableERC1155.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 +--- + +## MintableERC1155.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. +--- + +## MintableERC1155.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. +--- + +## MintableERC1155.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. +--- + +## MintableERC1155.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 +--- + +## 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. +--- + +## MintableERC20.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. +--- + +## MintableERC20.getSaleConfig + +Calls the "getSaleConfig" function on the contract. + +### Example + +```ts +import { MintableERC20 } from "thirdweb/modules"; + +const result = await MintableERC20.getSaleConfig({ contract, }); ``` @@ -40307,7 +39403,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -40319,7 +39415,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -40486,7 +39582,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -40506,7 +39602,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -40752,7 +39848,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -40764,7 +39860,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -40949,7 +40045,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -40969,7 +40065,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -41119,7 +40215,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }): PreparedTransaction; ``` @@ -41131,7 +40227,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }; ``` @@ -41177,7 +40273,7 @@ function module(params?: { publisher?: string; }): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -41197,7 +40293,7 @@ let params: { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -41525,7 +40621,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -41537,7 +40633,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -41586,7 +40682,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -41606,7 +40702,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -42045,7 +41141,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -42057,7 +41153,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -42106,7 +41202,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -42126,7 +41222,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -42406,7 +41502,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }): PreparedTransaction; ``` @@ -42418,7 +41514,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params: EncodeBytesOnInstallParams & { publisher?: string }; }; ``` @@ -42465,7 +41561,7 @@ function module( params: EncodeBytesOnInstallParams & { publisher?: string }, ): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -42485,7 +41581,7 @@ let params: EncodeBytesOnInstallParams & { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: `0x${string}`; module: `0x${string}` }>; ``` @@ -42535,7 +41631,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }): PreparedTransaction; ``` @@ -42547,7 +41643,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }; ``` @@ -42672,7 +41768,7 @@ function module(params?: { publisher?: string; }): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -42692,7 +41788,7 @@ let params: { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -42857,7 +41953,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }): PreparedTransaction; ``` @@ -42869,7 +41965,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }; ``` @@ -42994,7 +42090,7 @@ function module(params?: { publisher?: string; }): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -43014,7 +42110,7 @@ let params: { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -43179,7 +42275,7 @@ await sendTransaction({ ```ts function install(options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }): PreparedTransaction; ``` @@ -43191,7 +42287,7 @@ function install(options: { ```ts let options: { account: Account; - contract: Readonly; + contract: Readonly>; params?: { publisher?: string }; }; ``` @@ -43316,7 +42412,7 @@ function module(params?: { publisher?: string; }): (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -43336,7 +42432,7 @@ let params: { publisher?: string }; ```ts let returnType: (args: { account: Account; - chain: Readonly; + chain: Readonly; client: ThirdwebClient; }) => Promise<{ data: "0x"; module: `0x${string}` }>; ``` @@ -43458,516 +42554,6 @@ let returnType: PreparedTransaction< A prepared transaction object. --- -# Universal Bridge ---- -## Buy ---- - -## Buy.prepare - -Prepares a _finalized_ Universal Bridge quote for the provided buy request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp. - -### Example - -```typescript -import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb"; - -const quote = await Bridge.Buy.prepare({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - client: thirdwebClient, -}); -``` - -This will return a quote that might look like: - -```typescript -{ - originAmount: 2000030000n, - destinationAmount: 1000000000000000000n, - blockNumber: 22026509n, - timestamp: 1741730936680, - estimatedExecutionTimeMs: 1000 - steps: [ - { - originToken: { - chainId: 1, - address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - symbol: "USDC", - name: "USDC", - decimals: 6, - priceUsd: 1, - iconUri: "https://..." - }, - destinationToken: { - chainId: 10, - address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - symbol: "ETH", - name: "Ethereum", - decimals: 18, - priceUsd: 2000, - iconUri: "https://..." - }, - originAmount: 2000030000n, - destinationAmount: 1000000000000000000n, - estimatedExecutionTimeMs: 1000 - transactions: [ - { - action: "approval", - id: "0x", - to: "0x...", - data: "0x...", - chainId: 10, - type: "eip1559" - }, - { - action: "buy", - to: "0x...", - value: 10000026098875381n, - data: "0x...", - chainId: 10, - type: "eip1559" - } - ] - } - ], - expiration: 1741730936680, - intent: { - originChainId: 1, - originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - destinationChainId: 10, - destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - amount: 1000000000000000000n - } -} -``` - -### Sending the transactions - -The `transactions` array is a series of transactions ready to be executed (with `sendTransaction`) one after the other in order to fulfill the complete route. There are a few things to keep in mind when executing these transactions: - -* Approvals will have the `approval` action specified. You can perform approvals with `sendAndConfirmTransaction`, then proceed to the next transaction. -* All transactions are assumed to be executed by the `sender` address, regardless of which chain they are on. The final transaction will use the `receiver` as the recipient address. -* If an `expiration` timestamp is provided, all transactions must be executed before that time to guarantee successful execution at the specified price. - -NOTE: To get the status of each non-approval transaction, use `Bridge.status` rather than checking for transaction inclusion. This function will ensure full bridge completion on the destination chain. - -You can access this functions input and output types with `Buy.prepare.Options` and `Buy.prepare.Result`, respectively. - -You can include arbitrary data to be included on any webhooks and status responses with the `purchaseData` option. - -```ts -const quote = await Bridge.Buy.prepare({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - purchaseData: { - size: "large", - shippingAddress: "123 Main St, New York, NY 10001", - }, - client: thirdwebClient, -}); -``` - -To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option. - -```ts -const quote = await Bridge.Buy.prepare({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps - client: thirdwebClient, -}); -``` - -```ts -function prepare(options: Options): Promise; -``` - -### Parameters - -The options for the quote. - -#### Type - -```ts -let options: Options; -``` - -### Returns - -```ts -let returnType: Promise; -``` - -A promise that resolves to a finalized quote and transactions for the requested buy. ---- - -## Buy.quote - -Retrieves a Universal Bridge quote for the provided buy intent. The quote will specify the necessary `originAmount` to receive the desired `destinationAmount`, which is specified with the `buyAmountWei` option. - -### Example - -```typescript -import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb"; - -const quote = await Bridge.Buy.quote({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - client: thirdwebClient, -}); -``` - -This will return a quote that might look like: - -```typescript -{ - originAmount: 10000026098875381n, - destinationAmount: 1000000000000000000n, - blockNumber: 22026509n, - timestamp: 1741730936680, - estimatedExecutionTimeMs: 1000 - steps: [ - { - originToken: { - chainId: 1, - address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - symbol: "ETH", - name: "Ethereum", - decimals: 18, - priceUsd: 0.0025, - iconUri: "https://..." - }, - destinationToken: { - chainId: 10, - address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - symbol: "ETH", - name: "Ethereum", - decimals: 18, - priceUsd: 0.0025, - iconUri: "https://..." - }, - originAmount: 10000026098875381n, - destinationAmount: 1000000000000000000n, - estimatedExecutionTimeMs: 1000 - } - ], - intent: { - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: 1000000000000000000n - } -} -``` - -The quote is an _estimate_ for how much you would expect to pay for a specific buy. This quote is not guaranteed and you should use `Buy.prepare` to get a finalized quote with transaction data ready for execution. So why use `quote`? The quote function is sometimes slightly faster than `prepare`, and can be used before the user connects their wallet. - -You can access this functions input and output types with `Buy.quote.Options` and `Buy.quote.Result`, respectively. - -To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option. - -```ts -const quote = await Bridge.Buy.quote({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps - client: thirdwebClient, -}); -``` - -```ts -function quote(options: Options): Promise; -``` - -### Parameters - -The options for the quote. - -#### Type - -```ts -let options: Options; -``` - -### Returns - -```ts -let returnType: Promise; -``` - -A promise that resolves to a non-finalized quote for the requested buy. ---- -## Sell ---- - -## Sell.prepare - -Prepares a _finalized_ Universal Bridge quote for the provided sell request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp. - -### Example - -```typescript -import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb"; - -const quote = await Bridge.Sell.prepare({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - client: thirdwebClient, -}); -``` - -This will return a quote that might look like: - -```typescript -{ - originAmount: 2000000000n, - destinationAmount: 9980000000000000000n, - blockNumber: 22026509n, - timestamp: 1741730936680, - estimatedExecutionTimeMs: 1000 - steps: [ - { - originToken: { - chainId: 1, - address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - symbol: "USDC", - name: "USDC", - decimals: 6, - priceUsd: 1, - iconUri: "https://..." - }, - destinationToken: { - chainId: 10, - address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - symbol: "ETH", - name: "Ethereum", - decimals: 18, - priceUsd: 2000, - iconUri: "https://..." - }, - originAmount: 2000000000n, - destinationAmount: 9980000000000000000n, - estimatedExecutionTimeMs: 1000 - } - transactions: [ - { - id: "0x...", - action: "approval", - to: "0x...", - data: "0x...", - chainId: 10, - type: "eip1559" - }, - { - id: "0x...", - action: "sell", - to: "0x...", - data: "0x...", - chainId: 10, - type: "eip1559" - } - ], - ], - expiration: 1741730936680, - intent: { - originChainId: 1, - originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - destinationChainId: 10, - destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - amount: 2000000000n - } -} -``` - -### Sending the transactions - -The `transactions` array is a series of transactions ready to be executed (with `sendTransaction`) must be executed one after the other in order to fulfill the complete route. There are a few things to keep in mind when executing these transactions: - -* Approvals will have the `approval` action specified. You can perform approvals with `sendAndConfirmTransaction`, then proceed to the next transaction. -* All transactions are assumed to be executed by the `sender` address, regardless of which chain they are on. The final transaction will use the `receiver` as the recipient address. -* If an `expiration` timestamp is provided, all transactions must be executed before that time to guarantee successful execution at the specified price. - -NOTE: To get the status of each non-approval transaction, use `Bridge.status` rather than checking for transaction inclusion. This function will ensure full bridge completion on the destination chain. - -You can access this functions input and output types with `Sell.prepare.Options` and `Sell.prepare.Result`, respectively. - -You can include arbitrary data to be included on any webhooks and status responses with the `purchaseData` option. - -```ts -const quote = await Bridge.Sell.prepare({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - purchaseData: { - size: "large", - shippingAddress: "123 Main St, New York, NY 10001", - }, - client: thirdwebClient, -}); -``` - -To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option. - -```ts -const quote = await Bridge.Sell.prepare({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps - client: thirdwebClient, -}); -``` - -```ts -function prepare(options: Options): Promise; -``` - -### Parameters - -The options for the quote. - -#### Type - -```ts -let options: Options; -``` - -### Returns - -```ts -let returnType: Promise; -``` - -A promise that resolves to a finalized quote and transactions for the requested sell. ---- - -## Sell.quote - -Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option. - -### Example - -```typescript -import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb"; - -const quote = await Bridge.Sell.quote({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - client: thirdwebClient, -}); -``` - -This will return a quote that might look like: - -```typescript -{ - originAmount: 1000000000000000000n, - destinationAmount: 9999979011973735n, - blockNumber: 22026509n, - timestamp: 1741730936680, - estimatedExecutionTimeMs: 1000 - steps: [ - { - originToken: { - chainId: 1, - address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - symbol: "ETH", - name: "Ethereum", - decimals: 18, - priceUsd: 2000, - iconUri: "https://..." - }, - destinationToken: { - chainId: 10, - address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - symbol: "ETH", - name: "Ethereum", - decimals: 18, - priceUsd: 2000, - iconUri: "https://..." - }, - originAmount: 1000000000000000000n, - destinationAmount: 99999979011973735n, - estimatedExecutionTimeMs: 1000 - } - ], - intent: { - originChainId: 1, - originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - destinationChainId: 10, - destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - amount: 1000000000000000000n - } -} -``` - -The quote is an _estimate_ for how much you would expect to receive for a specific sell. This quote is not guaranteed and you should use `Sell.prepare` to get a finalized quote with transaction data ready for execution. So why use `quote`? The quote function is sometimes slightly faster than `prepare`, and can be used before the user connects their wallet. - -You can access this functions input and output types with `Sell.quote.Options` and `Sell.quote.Result`, respectively. - -To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option. - -```ts -const quote = await Bridge.Sell.quote({ - originChainId: 1, - originTokenAddress: NATIVE_TOKEN_ADDRESS, - destinationChainId: 10, - destinationTokenAddress: NATIVE_TOKEN_ADDRESS, - amount: toWei("0.01"), - maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps - client: thirdwebClient, -}); -``` - -```ts -function quote(options: Options): Promise; -``` - -### Parameters - -The options for the quote. - -#### Type - -```ts -let options: Options; -``` - -### Returns - -```ts -let returnType: Promise; -``` - -A promise that resolves to a non-finalized quote for the requested sell. ---- # Client --- @@ -44127,7 +42713,7 @@ function AccountAvatar( #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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 : "lazy" | "eager",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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -44226,7 +42812,7 @@ function AccountBalance( #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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" | "CAD" | "GBP" | "EUR" | "JPY" | "AUD" | "NZD",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} +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 @@ -44300,7 +42886,7 @@ function AccountName(props: AccountNameProps): null | Element; #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -44369,7 +42955,7 @@ function WalletIcon( #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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 : "lazy" | "eager",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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -44383,7 +42969,7 @@ an `` with the src of the wallet icon ## deploySmartAccount -Deployes a smart account via a dummy transaction. If the account is already deployed, this will do nothing. +Deployes a smart account via a dummy transaction. ### Example @@ -44400,2048 +42986,93 @@ const account = await deploySmartAccount({ ```ts function deploySmartAccount(args: { - accountContract: Readonly; - chain: Readonly; + 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; + 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; - smartAccountAddress?: string; - 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: Promise; -``` - -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 partner 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<`ecosystem.${string}`>; -``` - -### Parameters - -#### Type - -```ts -let id: `ecosystem.${string}`; -``` - -#### Type - -```ts -let options: { - auth?: { - allowedSmsCountryCodes?: Array; - defaultSmsCountryCode?: SupportedSmsCountry; - mode?: "popup" | "redirect" | "window"; - redirectUrl?: string; - }; - partnerId?: string; - storage?: AsyncStorage; -}; -``` - -### Returns - -```ts -let returnType: Wallet<`ecosystem.${string}`>; -``` - -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", // or "apple", "facebook","discord", "github", "twitch", "x", "telegram", "line", "coinbase", etc -}); -``` - -[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: - -With the `executionMode` option, you can enable smart accounts and sponsor gas for your users. - -_Using EIP-7702_ (recommended): - -On chains with EIP-7702 enabled, you can upgrade the inapp wallet to a smart account, keeping the same address and performance as the regular EOA. - -```ts -import { inAppWallet } from "thirdweb/wallets"; -import { sepolia } from "thirdweb/chains"; - -const wallet = inAppWallet({ - executionMode: { - mode: "EIP7702", - sponsorGas: true, - }, -}); - -// account will be a smart account with sponsored gas enabled -const account = await wallet.connect({ - client, - strategy: "google", -}); -``` - -_Using EIP-4337_: - -On chains without EIP-7702 enabled, you can still use smart accounts using EIP-4337, this will return a different address (the smart contract address) than the regular EOA. - -```ts -import { inAppWallet } from "thirdweb/wallets/in-app"; - -const wallet = inAppWallet({ - executionMode: { - mode: "EIP4337", - smartAccount: { - chain: sepolia, // chain required for EIP-4337 - sponsorGas: true, - }, - }, -}); -``` - -#### Login with email - -To login with email, you can use the `preAuthenticate` function to first send a verification code to the user's email, then login with the verification code. - -```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 phone number - -Similar to email, you can login with a phone number by first sending a verification code to the user's phone number, then login with the verification code. - -```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 another wallet (SIWE) - -You can also login to the in-app wallet with another existing wallet by signing a standard Sign in with Ethereum (SIWE) message. - -```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 passkey - -You can also login with a passkey. This mode requires specifying whether it should create a new passkey, or sign in with an existing passkey. We recommend checking if the user has a passkey stored in their browser to automatically login with it. - -```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 - -You can also connect to a guest account, this will create a new account for the user instantly and store it in the browser's local storage. - -You can later "upgrade" this account by linking another auth method, like email or phone for example. This will preserve the account's address and history. - -```ts -import { inAppWallet } from "thirdweb/wallets"; - -const wallet = inAppWallet(); - -const account = await wallet.connect({ - client, - strategy: "guest", -}); -``` - -#### Connect to a backend account - -For usage in backends, you can create wallets with the `backend` strategy and a stable walletSecret. - -Make sure to keep that walletSecret safe as it is the key to access that wallet, never expose it to the client. - -```ts -import { inAppWallet } from "thirdweb/wallets"; - -const wallet = inAppWallet(); - -const account = await wallet.connect({ - client, - strategy: "backend", - walletSecret: "...", // Your own secret, keep it safe -}); -``` - -#### 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, icon and name for your login page (Connect UI) - -You can specify a logo, icon and name for your login page to customize how in-app wallets are displayed in the Connect UI components (ConnectButton and ConnectEmbed). - -```ts -import { inAppWallet } from "thirdweb/wallets"; -const wallet = inAppWallet({ - metadata: { - name: "My App", - icon: "https://example.com/icon.png", - 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 - -By default, the Connect Modal will show a button to export the private key of the wallet. You can hide this button by setting the `hidePrivateKeyExport` option to `true`. - -```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", - }, -}); -``` - -#### Override storage for the wallet state - -By default, wallet state is stored in the browser's local storage if in the browser, or in-memory storage if not in the browser. You can override this behavior by providing a custom storage object, useful for server side and CLI integrations. - -```ts -import { inAppWallet } from "thirdweb/wallets"; -import { AsyncStorage } from "thirdweb/storage"; - -const myStorage: AsyncStorage = { - getItem: async (key) => { - return customGet(`CUSTOM_STORAGE_KEY${key}`); - }, - setItem: async (key, value) => { - return customSet(`CUSTOM_STORAGE_KEY${key}`, value); - }, - removeItem: async (key) => { - return customRemove(`CUSTOM_STORAGE_KEY${key}`); - }, -}; - -const wallet = inAppWallet({ - storage: myStorage, -}); -``` - -```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?: { - allowedSmsCountryCodes?: Array; - defaultSmsCountryCode?: SupportedSmsCountry; - mode?: "popup" | "redirect" | "window"; - options: Array; - passkeyDomain?: string; - redirectUrl?: string; - }; - executionMode?: ExecutionModeOptions; - hidePrivateKeyExport?: boolean; - metadata?: { - icon?: string; - image?: { - alt?: string; - height?: number; - src: string; - width?: number; - }; - name?: string; - }; - partnerId?: string; - smartAccount?: SmartWalletOptions; - storage?: AsyncStorage; - } - | 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, - originalMessage, - chainId, - }: { - chainId?: number; - message: SignableMessage; - originalMessage?: string; - }) => 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; - }; - sessionKey?: { address: string; permissions: AccountPermissions }; - } & ({ 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 - -Deprecated - -This for v2 dedicated engine instances, for v3 and engine cloud use Engine.serverWallet() - -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; - overrides?: { - accountAddress?: string; - accountFactoryAddress?: string; - accountSalt?: 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, - originalMessage, - chainId, - }: { - chainId?: number; - message: SignableMessage; - originalMessage?: string; - }) => Promise; - signTransaction?: (tx: SerializableTransaction) => Promise; - signTypedData: ( - _typedData: ox__TypedData.Definition, - ) => Promise; - watchAsset?: (asset: WatchAssetParams) => Promise; -}; -``` - -An account that uses your engine backend wallet. ---- - -## ERC7579.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; - }; - sessionKey?: { address: string; permissions: AccountPermissions }; - } & ({ gasless: boolean } | { sponsorGas: boolean }) ->; -``` - -The smart wallet options. ---- -# Wallet Connection ---- - -## 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; - siweAuth?: { - doLogin: () => Promise; - isLoggedIn: boolean | undefined; - isLoggingIn: boolean | undefined; - requiresAuth: boolean; - }; - timeout?: number; - wallets?: Array; -}; -``` - -### Returns - -```ts -let returnType: Element; -``` ---- -# 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, - originalMessage, - chainId, - }: { - chainId?: number; - message: SignableMessage; - originalMessage?: string; - }) => Promise; - signTransaction?: (tx: SerializableTransaction) => Promise; - signTypedData: ( - _typedData: ox__TypedData.Definition, - ) => Promise; - watchAsset?: (asset: WatchAssetParams) => Promise; +``` + +### Parameters + +Arguments for the deployment. + +#### Type + +```ts +let args: { + accountContract: Readonly>; + chain: Readonly; + client: ThirdwebClient; + smartAccount: Account; }; ``` -A Thirdweb account. +### Returns + +```ts +let returnType: Promise< + | undefined + | { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; + } +>; +``` --- -## getWalletBalance +## getUser -Retrieves the balance of a token or native currency for a given wallet. +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 { getWalletBalance } from "thirdweb/wallets"; -const balance = await getWalletBalance({ - address, +import { getUser } from "thirdweb/wallets"; + +const user = await getUser({ client, - chain, - tokenAddress, + walletAddress: "0x123...", }); ``` ```ts -function getWalletBalance( - options: GetWalletBalanceOptions, -): Promise; +function getUser(options: { + client: ThirdwebClient; + ecosystem?: Ecosystem; + email?: string; + externalWalletAddress?: string; + id?: string; + phone?: string; + walletAddress?: string; +}): Promise; ``` ### Parameters -The options for retrieving the token balance. +The options for the get user function. #### Type ```ts let options: { - address: string; - chain: Chain; client: ThirdwebClient; - tokenAddress?: string; + ecosystem?: Ecosystem; + email?: string; + externalWalletAddress?: string; + id?: string; + phone?: string; + walletAddress?: string; }; ``` @@ -46449,976 +43080,1098 @@ let options: { ```ts let returnType: { - chainId: number; - decimals: number; - displayValue: string; - name: string; - symbol: string; - tokenAddress: string; - value: bigint; + createdAt: string; + email?: string; + phone?: string; + profiles: Array; + userId: string; + walletAddress: string; }; ``` -A promise that resolves to the token balance result. +A user object or null if not found. --- -## injectedProvider +## authenticate -Get Injected Provider for given wallet by passing a wallet ID (rdns) using [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) Provider Discovery. +Authenticates the user based on the provided authentication arguments. ### Example ```ts -import { injectedProvider } from "thirdweb/wallets"; +import { authenticate } from "thirdweb/wallets/in-app"; -const metamaskProvider = injectedProvider("io.metamask"); +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"; -if (metamaskProvider) { - console.log("Metamask is installed"); -} +const result = await authenticate({ + client, + strategy: "backend", + walletSecret: "...", // Provided by your app +}); ``` ```ts -function injectedProvider(walletId: WalletId): undefined | Ethereum; +function authenticate( + args: AuthArgsType, +): Promise; ``` ### Parameters -The Wallet Id (rdns) to check. +The authentication arguments. #### Type ```ts -let walletId: - | "walletConnect" - | "inApp" - | "embedded" - | "smart" - | "adapter" - | EcosystemWalletId - | WCSupportedWalletIds - | InjectedSupportedWalletIds; +let args: AuthArgsType; ``` ### Returns ```ts -let returnType: undefined | Ethereum; +let returnType: Promise; ``` -The details of the Injected Provider if it exists. `undefined` otherwise. +A promise that resolves to the authentication result. --- -## getSocialIcon +## authenticateWithRedirect -Gets the icon URI for a given social authentication provider +Authenticates the user based on the provided authentication arguments using a redirect. ### Example -```tsx -const googleIcon = getSocialIcon("google"); -const appleIcon = getSocialIcon("apple"); +```ts +import { authenticateWithRedirect } from "thirdweb/wallets/in-app"; + +const result = await authenticateWithRedirect({ + client, + strategy: "google", + mode: "redirect", + redirectUrl: "https://example.org", +}); ``` ```ts -function getSocialIcon( - provider: - | ({} & string) - | "google" - | "apple" - | "facebook" - | "discord" - | "line" - | "x" - | "coinbase" - | "farcaster" - | "telegram" - | "github" - | "twitch" - | "steam" - | "guest" - | "backend" - | "email" - | "phone" - | "passkey" - | "wallet", -): string; +function authenticateWithRedirect( + args: SocialAuthArgsType & { + client: ThirdwebClient; + ecosystem?: Ecosystem; + }, +): Promise; ``` ### Parameters -The authentication provider to get the icon for +The authentication arguments. #### Type ```ts -let provider: - | ({} & string) - | "google" - | "apple" - | "facebook" - | "discord" - | "line" - | "x" - | "coinbase" - | "farcaster" - | "telegram" - | "github" - | "twitch" - | "steam" - | "guest" - | "backend" - | "email" - | "phone" - | "passkey" - | "wallet"; +let args: SocialAuthArgsType & { + client: ThirdwebClient; + ecosystem?: Ecosystem; +}; ``` ### Returns ```ts -let returnType: string; +let returnType: Promise; ``` -A data URI containing the SVG icon for the provider, or a generic wallet icon if the provider is not recognized +A promise that resolves to the authentication result. --- -## hasStoredPasskey +## createWallet -Returns whether this device has a stored passkey ready to be used for sign-in +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 -function hasStoredPasskey( - client: ThirdwebClient, - ecosystemId?: `ecosystem.${string}`, - storage?: AsyncStorage, -): Promise; +import { createWallet } from "thirdweb/wallets"; + +const metamaskWallet = createWallet("io.metamask"); + +const account = await metamaskWallet.connect({ + client, +}); ``` -### Parameters +You can check if a wallet is installed by calling the [injectedProvider](https://portal.thirdweb.com/references/typescript/v5/injectedProvider) method. -the thirdweb client +### Connecting via WalletConnect modal -#### Type +```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 -let client: { - readonly clientId: string; - readonly secretKey: string | undefined; -} & Readonly; +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, +}); ``` -#### Type +[View Coinbase wallet creation options](https://portal.thirdweb.com/references/typescript/v5/CoinbaseWalletCreationOptions) + +### Connecting with a smart wallet ```ts -let ecosystemId: `ecosystem.${string}`; +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 storage: { - getItem: (key: string) => Promise; - removeItem: (key: string) => Promise; - setItem: (key: string, value: string) => Promise; -}; +let args: CreateWalletArgs; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Wallet; ``` -whether the device has a stored passkey +* The created wallet. --- -## bundleUserOp +## createWalletAdapter -Bundle a user operation. +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 { bundleUserOp } from "thirdweb/wallets/smart"; +import { createWalletAdapter } from "thirdweb"; -const userOpHash = await bundleUserOp({ - userOp, - options, +const wallet = createWalletAdapter({ + client, + adaptedAccount, + chain, + onDisconnect: () => { + // disconnect logic + }, + switchChain: async (chain) => { + // switch chain logic + }, }); ``` ```ts -function bundleUserOp(args: { - options: BundlerOptions; - userOp: UserOperationV06 | UserOperationV07; -}): Promise<`0x${string}`>; +function createWalletAdapter( + options: AdapterWalletOptions, +): Wallet<"adapter">; ``` ### Parameters -The options for bundling a user operation. +The options for the adapter wallet. #### Type ```ts -let args: { - options: BundlerOptions; - userOp: UserOperationV06 | UserOperationV07; +let options: { + adaptedAccount: Account; + chain: Chain; + client: ThirdwebClient; + onDisconnect: () => Promise | void; + switchChain: (chain: Chain) => Promise | void; }; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Wallet<"adapter">; ``` -The bundle hash of the user operation. +a wallet instance. --- -## createAndSignUserOp +## createWalletConnectClient -Create and sign a user operation. +Creates a new WalletConnect client for interacting with another application. ### Example ```ts -import { createAndSignUserOp } from "thirdweb/wallets/smart"; +import { createWalletConnectClient } from "thirdweb/wallets"; -const userOp = await createAndSignUserOp({ - client, - adminAccount, - smartWalletOptions, - transactions, +const client = await createWalletConnectClient({ + wallet: wallet, + client: client, }); ``` +Pass custom handlers: + ```ts -function createAndSignUserOp(options: { - adminAccount: Account; +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; - isDeployedOverride?: boolean; - smartWalletOptions: SmartWalletOptions; - transactions: Array; - waitForDeployment?: boolean; -}): Promise; + 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 for creating and signing the user operation +The options to use to create the WalletConnect client. #### Type ```ts let options: { - adminAccount: Account; + appMetadata?: AppMetadata; + chains?: Array>; client: ThirdwebClient; - isDeployedOverride?: boolean; - smartWalletOptions: SmartWalletOptions; - transactions: Array; - waitForDeployment?: boolean; + 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: Promise; +let returnType: Awaited>; ``` -* The signed user operation +The WalletConnect client. Use this client to connect to a WalletConnect URI with createWalletConnectSession. --- -## createUnsignedUserOp +## createWalletConnectSession -Creates an unsigned user operation from a prepared transaction. +Initiates a new WalletConnect session for interacting with another application. ### Example ```ts -import { createUnsignedUserOp } from "thirdweb/wallets/smart"; +import { + createWalletConnectClient, + createWalletConnectSession, +} from "thirdweb/wallets"; -const transaction = prepareContractCall(...); +const client = await createWalletConnectClient({ + wallet: wallet, + client: client, +}); -const userOp = await createUnsignedUserOp({ - transaction, - factoryContract, - accountContract, - adminAddress, - sponsorGas, - overrides, +const session = createWalletConnectSession({ + walletConnectClient: client, + uri: "wc:...", }); ``` ```ts -function createUnsignedUserOp(args: { - accountContract: Readonly; - adminAddress: string; - factoryContract: Readonly; - isDeployedOverride?: boolean; - 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; - }) => Promise<`0x${string}`>; - tokenPaymaster?: TokenPaymasterConfig; - }; - sponsorGas: boolean; - transaction: PreparedTransaction; - waitForDeployment?: boolean; -}): Promise; +function createWalletConnectSession( + options: CreateWalletConnectSessionOptions, +): void; ``` ### Parameters -The prepared transaction and options +The options to use to create the WalletConnect session. #### Type ```ts -let args: { - accountContract: Readonly; - adminAddress: string; - factoryContract: Readonly; - isDeployedOverride?: boolean; - 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; - }) => Promise<`0x${string}`>; - tokenPaymaster?: TokenPaymasterConfig; - }; - sponsorGas: boolean; - transaction: PreparedTransaction; - waitForDeployment?: boolean; -}; +let options: CreateWalletConnectSessionOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: void; ``` - -* The unsigned user operation --- -## estimateUserOpGas +## disconnectWalletConnectSession -Estimate the gas cost of a user operation. +Disconnects a WalletConnect session. ### Example ```ts -import { estimateUserOpGas } from "thirdweb/wallets/smart"; +import { disconnectWalletConnectSession } from "thirdweb/wallets"; -const gasCost = await estimateUserOpGas({ - userOp, - options, +await disconnectWalletConnectSession({ + session: mySession, + walletConnectClient: wcClient, }); ``` ```ts -function estimateUserOpGas( - args: { - options: BundlerOptions; - userOp: UserOperationV06 | UserOperationV07; - }, - stateOverrides?: {}, -): Promise; +function disconnectWalletConnectSession(options: { + session: WalletConnectSession; + walletConnectClient: SignClient; +}): Promise; ``` ### Parameters -The options for estimating the gas cost of a user operation. +The options to use to disconnect the WalletConnect session. #### Type ```ts -let args: { - options: BundlerOptions; - userOp: UserOperationV06 | UserOperationV07; +let options: { + session: WalletConnectSession; + walletConnectClient: SignClient; }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` - -The estimated gas cost of the user operation. --- -## estimateUserOpGasCost +## ecosystemWallet -Estimate the gas cost of a user operation. +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 { estimateUserOpGasCost } from "thirdweb/wallets/smart"; +import { ecosystemWallet } from "thirdweb/wallets"; -const gasCost = await estimateUserOpGasCost({ - transactions, - adminAccount, +const wallet = ecosystemWallet("ecosystem.hooli"); + +const account = await wallet.connect({ client, - smartWalletOptions, + 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 estimateUserOpGasCost(args: { - adminAccount: Account; - client: ThirdwebClient; - smartWalletOptions: SmartWalletOptions; - transactions: Array; -}): Promise<{ ether: string; wei: bigint }>; +function ecosystemWallet( + id: `ecosystem.${string}`, + options: EcosystemWalletCreationOptions, +): Wallet; ``` ### Parameters -The options for estimating the gas cost of a user operation. +#### Type + +```ts +let id: `ecosystem.${string}`; +``` #### Type ```ts -let args: { - adminAccount: Account; - client: ThirdwebClient; - smartWalletOptions: SmartWalletOptions; - transactions: Array; +let options: { + auth?: { + defaultSmsCountryCode?: SupportedSmsCountry; + mode?: "popup" | "redirect" | "window"; + redirectUrl?: string; + }; + partnerId?: string; }; ``` ### Returns ```ts -let returnType: Promise<{ ether: string; wei: bigint }>; +let returnType: Wallet; ``` -The estimated gas cost of the user operation. +The created ecosystem wallet. --- -## getPaymasterAndData +## getActiveWalletConnectSessions -Get paymaster and data details for a user operation. +Retrieves all active WalletConnect sessions. ### Example ```ts -import { getPaymasterAndData } from "thirdweb/wallets/smart"; - -const userOp = createUnsignedUserOp(...); +import { getActiveWalletConnectSessions } from "thirdweb/wallets"; -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; +const sessions = await getActiveWalletConnectSessions(); ``` -### Parameters - -The userOp and options - -#### Type - ```ts -let args: { - chain: Readonly; - client: ThirdwebClient; - entrypointAddress?: string; - paymasterOverride?: ( - userOp: UserOperationV06 | UserOperationV07, - ) => Promise; - userOp: UserOperationV06 | UserOperationV07; -}; +function getActiveWalletConnectSessions(): Promise< + Array +>; ``` ### Returns ```ts -let returnType: { - callGasLimit?: bigint; - preVerificationGas?: bigint; - verificationGasLimit?: bigint; -} & ( - | { paymasterAndData: string } - | { - paymaster: string; - paymasterData: string; - paymasterPostOpGasLimit?: bigint; - paymasterVerificationGasLimit?: bigint; - } -); +let returnType: { origin?: string; topic: string }; ``` -* The paymaster and data details for the user operation. +All active WalletConnect sessions. --- -## getUserOpGasFees +## getProfiles -Get the gas fees of a user operation. +Gets the linked profiles for the connected in-app or ecosystem wallet. ### Example ```ts -import { getUserOpGasPrice } from "thirdweb/wallets/smart"; +import { getProfiles } from "thirdweb/wallets"; -const fees = await getUserOpGasPrice({ - options, +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 -function getUserOpGasFees(args: { - options: BundlerOptions; -}): Promise; +import { getProfiles } from "thirdweb/wallets/in-app"; + +const profiles = await getProfiles({ + client, + ecosystem: { + id: "ecosystem.your-ecosystem-id", + }, +}); ``` -### Parameters +```ts +function getProfiles( + args: GetAuthenticatedUserParams, +): Promise>; +``` -The options for getting the gas price of a user operation. +### Parameters #### Type ```ts -let args: { options: BundlerOptions }; +let args: { client: ThirdwebClient; ecosystem?: Ecosystem }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: { + details: { + address?: Address; + email?: string; + id?: string; + phone?: string; + }; + type: AuthOption; +}; ``` -The gas price of the user operation. +An array of accounts user profiles linked to the connected wallet. --- -## getUserOpHash +## getUserEmail -Get the hash of a user operation. +Retrieves the authenticated user email for the active in-app wallet. ### Example ```ts -import { getUserOpHash } from "thirdweb/wallets/smart"; +import { getUserEmail } from "thirdweb/wallets/in-app"; -const userOp = await createUnsignedUserOp(...); -const userOpHash = await getUserOpHash({ - client, - userOp, - chain, -}); +const email = await getUserEmail({ client }); +console.log(email); ``` ```ts -function getUserOpHash(args: { - chain: Readonly; - client: ThirdwebClient; - entrypointAddress?: string; - userOp: UserOperationV06 | UserOperationV07; -}): Promise<`0x${string}`>; +function getUserEmail( + options: GetAuthenticatedUserParams, +): Promise; ``` ### Parameters -The options for getting the user operation hash +The arguments for retrieving the authenticated user. #### Type ```ts -let args: { - chain: Readonly; - client: ThirdwebClient; - entrypointAddress?: string; - userOp: UserOperationV06 | UserOperationV07; -}; +let options: { client: ThirdwebClient; ecosystem?: Ecosystem }; ``` ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: Promise; ``` -* The user operation hash +The authenticated user email if logged in and wallet initialized, otherwise undefined. --- -## getUserOpReceipt +## getUserPhoneNumber -Get the receipt of a user operation. +Retrieves the authenticated user phone number for the active embedded wallet. ### Example ```ts -import { getUserOpReceipt } from "thirdweb/wallets/smart"; +import { getUserPhoneNumber } from "thirdweb/wallets/embedded"; -const receipt = await getUserOpReceipt({ - client, - chain, - userOpHash, -}); +const phoneNumber = await getUserPhoneNumber({ client }); +console.log(phoneNumber); ``` ```ts -function getUserOpReceipt( - args: BundlerOptions & { userOpHash: `0x${string}` }, -): Promise; +function getUserPhoneNumber( + options: GetAuthenticatedUserParams, +): Promise; ``` ### Parameters -The options for getting the receipt of a user operation. +The arguments for retrieving the authenticated user. #### Type ```ts -let args: BundlerOptions & { userOpHash: `0x${string}` }; +let options: { client: ThirdwebClient; ecosystem?: Ecosystem }; ``` ### 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; -}; +let returnType: Promise; ``` -The receipt of the user operation. +The authenticated user phone number if authenticated with phone number, otherwise undefined. --- -## getUserOpReceiptRaw +## inAppWallet -Get the receipt of a user operation. +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 { getUserOpReceiptRaw } from "thirdweb/wallets/smart"; +import { inAppWallet } from "thirdweb/wallets"; -const receipt = await getUserOpReceiptRaw({ +const wallet = inAppWallet(); + +const account = await wallet.connect({ client, chain, - userOpHash, + strategy: "google", }); ``` -```ts -function getUserOpReceiptRaw( - args: BundlerOptions & { userOpHash: `0x${string}` }, -): Promise; -``` - -### Parameters - -The options for getting the receipt of a user operation. +[View all available social auth methods](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure) -#### Type +#### Enable smart accounts and sponsor gas for your users: ```ts -let args: BundlerOptions & { userOpHash: `0x${string}` }; +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", +}); ``` -### Returns +#### Login with email ```ts -let returnType: Promise; +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", +}); ``` -The raw receipt of the user operation. ---- - -## predictAddress - -Deprecated - -Use `predictSmartAccountAddress` instead. +#### Login with SIWE -Predict the address of a smart account. +```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, +}); +``` -### Example +#### Login with phone number ```ts -import { predictAddress } from "thirdweb/wallets/smart"; +import { + inAppWallet, + preAuthenticate, +} from "thirdweb/wallets/in-app"; -const predictedAddress = await predictAddress({ - factoryContract, - adminAddress, - accountSalt, +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 -function predictAddress(args: { - accountAddress?: string; - accountSalt?: string; - adminAddress: string; - factoryContract: Readonly; - predictAddressOverride?: ( - factoryContract: Readonly, - admin: string, - ) => Promise; -}): Promise; +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", +}); ``` -### Parameters - -The options for predicting the address of a smart account. - -#### Type +#### Connect to a guest account ```ts -let args: { - accountAddress?: string; - accountSalt?: string; - adminAddress: string; - factoryContract: Readonly; - predictAddressOverride?: ( - factoryContract: Readonly, - admin: string, - ) => Promise; -}; +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "guest", +}); ``` -### Returns +#### Connect to a backend account ```ts -let returnType: Promise; +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "backend", + walletSecret: "...", // Provided by your app +}); ``` -The predicted address of the smart account. ---- - -## predictSmartAccountAddress - -Predict the address of a smart account. +#### Connect with custom JWT (any OIDC provider) -### Example +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 { predictSmartAccountAddress } from "thirdweb/wallets/smart"; +import { inAppWallet } from "thirdweb/wallets"; -const predictedAddress = await predictSmartAccountAddress({ +const wallet = inAppWallet(); + +const account = await wallet.connect({ client, - chain, - adminAddress, + strategy: "jwt", + jwt: "your_jwt_here", }); ``` -```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. +#### Connect with custom endpoint -#### Type +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 -let args: { - accountSalt?: string; - adminAddress: string; - chain: Readonly; - client: ThirdwebClient; - factoryAddress?: string; -}; +import { inAppWallet } from "thirdweb/wallets"; + +const wallet = inAppWallet(); + +const account = await wallet.connect({ + client, + strategy: "auth_endpoint", + payload: "your_auth_payload_here", +}); ``` -### Returns +#### Specify a logo for your login page (Connect UI) ```ts -let returnType: Promise; +import { inAppWallet } from "thirdweb/wallets"; +const wallet = inAppWallet({ + metadata: { + image: { + src: "https://example.com/logo.png", + alt: "My logo", + width: 100, + height: 100, + }, + }, +}); ``` -The predicted address of the smart account. ---- +#### Hide the ability to export the private key within the Connect Modal UI -## prepareUserOp +```ts +import { inAppWallet } from "thirdweb/wallets"; +const wallet = inAppWallet({ + hidePrivateKeyExport: true, +}); +``` -Prepare a user operation for signing. +#### Open the Oauth window in the same tab -### Example +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 { prepareUserOp } from "thirdweb/wallets/smart"; - -const userOp = await prepareUserOp({ - transactions, - adminAccount, - client, - smartWalletOptions, +import { inAppWallet } from "thirdweb/wallets"; +const wallet = inAppWallet({ + auth: { + mode: "redirect", + }, }); ``` -You can then sign the user operation with signUserOp(). and send it to the bundler with bundlerUserOp(). - ```ts -function prepareUserOp(options: { - adminAccount: Account; - client: ThirdwebClient; - isDeployedOverride?: boolean; - smartWalletOptions: SmartWalletOptions; - transactions: Array; - waitForDeployment?: boolean; -}): Promise; +function inAppWallet( + createOptions?: InAppWalletCreationOptions, +): Wallet<"inApp">; ``` ### Parameters -The options for preparing the user operation +configuration options Refer to [InAppWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/InAppWalletCreationOptions) to see the available options. #### Type ```ts -let options: { - adminAccount: Account; - client: ThirdwebClient; - isDeployedOverride?: boolean; - smartWalletOptions: SmartWalletOptions; - transactions: Array; - waitForDeployment?: boolean; -}; +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: Promise; +let returnType: Wallet<"inApp">; ``` -* The prepared user operation +The created in-app wallet. --- -## signUserOp +## linkProfile -Sign a user operation. +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 { signUserOp } from "thirdweb/wallets/smart"; - -const userOp = await createUnsignedUserOp(...); +import { linkProfile } from "thirdweb/wallets"; -const signedUserOp = await signUserOp({ - client, - userOp, - chain, - adminAccount, -}); +// optionally specify the ecosystem if you're linking an ecosystem wallet +await linkProfile({ client, strategy: "discord" }); ``` ```ts -function signUserOp(args: { - adminAccount: Account; - chain: Readonly; - client: ThirdwebClient; - entrypointAddress?: string; - userOp: UserOperationV06 | UserOperationV07; -}): Promise; +function linkProfile(args: AuthArgsType): Promise>; ``` ### Parameters @@ -47426,4837 +44179,4782 @@ function signUserOp(args: { #### Type ```ts -let args: { - adminAccount: Account; - chain: Readonly; - client: ThirdwebClient; - entrypointAddress?: string; - userOp: UserOperationV06 | UserOperationV07; -}; +let args: AuthArgsType; ``` ### Returns ```ts -let returnType: Promise; +let returnType: { + details: { + address?: Address; + email?: string; + id?: string; + phone?: string; + }; + type: AuthOption; +}; ``` -* The user operation with the signature field populated +A promise that resolves to the currently linked profiles when the connection is successful. --- -## waitForUserOpReceipt +## preAuthenticate -Wait for the user operation to be mined. +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 { waitForUserOpReceipt } from "thirdweb/wallets/smart"; +import { preAuthenticate } from "thirdweb/wallets/in-app"; -const receipt = await waitForUserOpReceipt({ - chain, +const result = await preAuthenticate({ client, - userOpHash, + strategy: "email", + email: "example@example.org", }); ``` ```ts -function waitForUserOpReceipt( - args: BundlerOptions & { - intervalMs?: number; - timeoutMs?: number; - userOpHash: `0x${string}`; - }, -): Promise; +function preAuthenticate(args: PreAuthArgsType): Promise; ``` ### Parameters -The options and user operation hash +The arguments required for pre-authentication. #### Type ```ts -let args: BundlerOptions & { - intervalMs?: number; - timeoutMs?: number; - userOpHash: `0x${string}`; -}; +let args: PreAuthArgsType; ``` ### 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; -}; +let returnType: Promise; ``` -* The transaction receipt ---- -# Chain +A promise that resolves to the pre-authentication result. --- -## defineChain +## privateKeyToAccount -Defines a chain with the given options. +Get an `Account` object from a private key. ### 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, - }, +import { privateKeyToAccount } from "thirdweb/wallets"; + +const wallet = privateKeyToAccount({ + client, + privateKey: "...", }); ``` ```ts -function defineChain( - options: number | Chain | ChainOptions | LegacyChain, -): Readonly; +function privateKeyToAccount( + options: PrivateKeyToAccountOptions, +): Account; ``` ### Parameters -The options for the chain. +The options for `privateKeyToAccount`Refer to the type [PrivateKeyToAccountOptions](https://portal.thirdweb.com/references/typescript/v5/PrivateKeyToAccountOptions) #### Type ```ts -let options: number | Chain | ChainOptions | LegacyChain; +let options: { client: ThirdwebClient; privateKey: string }; ``` ### Returns ```ts -let returnType: Readonly; +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 defined chain. +The `Account` object that represents the private key --- -## getChainMetadata +## smartWallet -Retrieves chain data for a given chain. +Creates a ERC4337 smart wallet based on a admin account. -### Example +Smart wallets are smart contract wallets that enable multiple benefits for users: -```ts -const chain = defineChain({ id: 1 }); -const chainData = await getChainMetadata(chain); -console.log(chainData); -``` +* Sponsor gas fees for transactions +* Multiple owners +* Session keys +* Batch transactions +* Predictable addresses +* Programmable features -```ts -function getChainMetadata(chain: Readonly): Promise; -``` +[Learn more about account abstraction](https://portal.thirdweb.com/connect/account-abstraction/how-it-works) -### Parameters +### Example -The chain object containing the chain ID. +### Connect to a smart wallet -#### Type +To connect to a smart wallet, you need to provide an admin account as the `personalAccount` option. -```ts -let chain: Readonly; -``` +Any wallet can be used as an admin account, including an in-app wallets. -### Returns +The `sponsorGas` option is used to enable sponsored gas for transactions automatically. ```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 } +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, +}); ``` -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 +### Using a custom account factory -```ts -import { getRpcUrlForChain } from "thirdweb/chains"; -const rpcUrl = getRpcUrlForChain({ chain: 1, client }); -console.log(rpcUrl); // "https://1.rpc.thirdweb.com/... -``` +You can pass a custom account factory to the `smartWallet` function to use a your own account factory. ```ts -function getRpcUrlForChain(options: GetRpcUrlForChainOptions): string; +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 +}); ``` -### Parameters +### Using v0.7 Entrypoint -The options object containing the chain and client information. +Both v0.6 (default) and v0.7 ERC4337 Entrypoints are supported. To use the v0.7 Entrypoint, simply pass in a compatible account factory. -#### Type +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 -let options: GetRpcUrlForChainOptions; +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 +}); ``` -### Returns +### Configuring the smart wallet + +You can pass options to the `smartWallet` function to configure the smart wallet. ```ts -let returnType: string; +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 + ... + } +}); ``` -The RPC URL for the specified chain. ---- +Refer to [SmartWalletOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletOptions) for more details. -## ChainIcon +```ts +function smartWallet( + createOptions: SmartWalletOptions, +): Wallet<"smart">; +``` -This component tries to resolve the icon of a given chain, then return an image. +### Parameters -### Example +The options for creating the wallet. Refer to [SmartWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletCreationOptions) for more details. -#### Basic usage +#### Type -```tsx -import { ChainProvider, ChainIcon } from "thirdweb/react"; - - - -; +```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 }) +>; ``` -Result: An `` component with the src of the icon +### Returns -```html - +```ts +let returnType: Wallet<"smart">; ``` -#### Override the icon with the `iconResolver` prop +The created smart wallet. +--- -If you already have the icon url, you can skip the network requests and pass it directly to the ChainIcon +## unlinkProfile -```tsx -; -``` +Disconnects an existing profile (authentication method) from the current user. Once disconnected, that profile can no longer be used to sign into the account. -You can also pass in your own custom (async) function that retrieves the icon url +### Example -```tsx -const getIcon = async () => { - const icon = getIconFromCoinMarketCap(chainId, etc); - return icon; -}; +```ts +import { inAppWallet } from "thirdweb/wallets"; -; -``` - -#### 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 -; +const wallet = inAppWallet(); +wallet.connect({ strategy: "google" }); + +const profiles = await getProfiles({ + client, +}); + +const updatedProfiles = await unlinkProfile({ + client, + profileToUnlink: profiles[0], +}); ``` ```ts -function ChainIcon(__namedParameters: ChainIconProps): null | Element; +function unlinkProfile(args: UnlinkParams): Promise>; ``` ### Parameters +The object containing the profile that we want to unlink. + #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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 : "lazy" | "eager",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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +let args: UnlinkParams; ``` ### Returns ```ts -let returnType: null | Element; +let returnType: { + details: { + address?: Address; + email?: string; + id?: string; + phone?: string; + }; + type: AuthOption; +}; ``` -an `` with the src of the chain icon +A promise that resolves to the updated linked profiles. --- -## ChainName +## walletConnect -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 `` +Creates a wallet that allows connecting to any wallet that supports the WalletConnect protocol. ### Example -#### Basic usage - -```tsx -import { ChainProvider, ChainName } from "thirdweb/react"; -import { ethereum } from "thirdweb/chains"; +```ts +import { walletConnect } from "thirdweb/wallets"; - - -; +const wallet = walletConnect(); + +const account = await wallet.connect({ + client, +}); ``` -Result: - -```html -Ethereum Mainnet +```ts +function walletConnect(): Wallet<"walletConnect">; ``` -#### 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. +### Returns -```tsx -async function fetchNameMethod() { - // your own fetching logic - return "the chain name"; -} - -; +```ts +let returnType: Wallet<"walletConnect">; ``` -Alternatively you can also pass in a string directly: +The created smart wallet. +--- -```tsx -; -``` +## engineAccount -#### Format the name (capitalize, truncate, etc.) +Creates an account that uses your engine backend wallet for sending transactions and signing messages. -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 +### Example -```tsx -const concatStr = (str: string):string => str + "Network" +```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); ``` -Result: - -```html -Ethereum Mainnet Network +```ts +function engineAccount(options: EngineAccountOptions): Account; ``` -#### Show a loading sign when the name is being fetched +### Parameters -```tsx -import { ChainProvider, ChainName } from "thirdweb/react"; - - - } /> -; +The options for the engine account. + +#### Type + +```ts +let options: { + authToken: string; + chain?: Chain; + engineUrl: string; + walletAddress: string; +}; ``` -#### Fallback to something when the name fails to resolve +### Returns -```tsx - - -; +```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; +}; ``` -#### Custom query options for useQuery +An account that uses your engine backend wallet. +--- -This component uses `@tanstack-query`'s useQuery internally. You can use the `queryOptions` prop for more fine-grained control +## ERC7579.erc7579 -```tsx -; +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 ChainName(__namedParameters: ChainNameProps): null | Element; +function erc7579(options: ERC7579Config): SmartWalletOptions; ``` ### Parameters +Optional overrides for the smart wallet. + #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +let options: SmartWalletOptions & { + factoryAddress: string; + validatorAddress: string; +}; ``` ### Returns ```ts -let returnType: null | Element; +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 --- -## isZkSyncChain +## generateAccount -Checks whether the given chain is part of the zksync stack +Generates a new account with a random private key. + +### Example + +```ts +import { generateAccount } from "thirdweb/wallets"; +const account = await generateAccount({ client }); +``` ```ts -function isZkSyncChain(chain: Readonly): Promise; +function generateAccount( + options: GenerateAccountOptions, +): Promise; ``` ### Parameters +The options for generating the account. + #### Type ```ts -let chain: Readonly; +let options: { client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: Promise; +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; +}; ``` ---- -# Contract + +A Thirdweb account. --- -## checkVerificationStatus +## getWalletBalance -Checks the verification status of a contract. +Retrieves the balance of a token or native currency for a given wallet. ### Example ```ts -import { checkVerificationStatus } from "thirdweb/contract"; -const verificationStatus = await checkVerificationStatus({ - explorerApiUrl: "https://api.polygonscan.com/api", - explorerApiKey: "YOUR_API_KEY", - guid: "YOUR_GUID", +import { getWalletBalance } from "thirdweb/wallets"; +const balance = await getWalletBalance({ + address, + client, + chain, + tokenAddress, }); -console.log(verificationStatus); ``` ```ts -function checkVerificationStatus( - options: CheckVerificationStatusOptions, -): Promise; +function getWalletBalance( + options: GetWalletBalanceOptions, +): Promise; ``` ### Parameters -The options for checking the verification status. +The options for retrieving the token balance. #### Type ```ts -let options: CheckVerificationStatusOptions; +let options: { + address: string; + chain: Chain; + client: ThirdwebClient; + tokenAddress?: string; +}; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves with the verification status data. +A promise that resolves to the token balance result. --- -## fetchPublishedContract +## injectedProvider -Fetches the published contract based on the provided options. +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 -const publishedContract = await fetchPublishedContract({ - publisherAddress: "0x1234", - contractName: "MyContract", - version: "1.0.0", - client: client, -}); +import { injectedProvider } from "thirdweb/wallets"; + +const metamaskProvider = injectedProvider("io.metamask"); + +if (metamaskProvider) { + console.log("Metamask is installed"); +} ``` ```ts -function fetchPublishedContract( - options: FetchPublishedContractOptions, -): Promise<{ - bytecodeHash: `0x${string}`; - contractId: string; - implementation: string; - publishMetadataUri: string; - publishTimestamp: bigint; -}>; +function injectedProvider(walletId: WalletId): Ethereum | undefined; ``` ### Parameters -The options for fetching the published contract. +The Wallet Id (rdns) to check. #### Type ```ts -let options: FetchPublishedContractOptions; +let walletId: + | "walletConnect" + | "inApp" + | "embedded" + | "smart" + | "adapter" + | EcosystemWalletId + | WCSupportedWalletIds + | InjectedSupportedWalletIds; ``` ### Returns ```ts -let returnType: Promise<{ - bytecodeHash: `0x${string}`; - contractId: string; - implementation: string; - publishMetadataUri: string; - publishTimestamp: bigint; -}>; +let returnType: Ethereum | undefined; ``` -The published contract. +The details of the Injected Provider if it exists. `undefined` otherwise. --- -## getBytecode +## getSocialIcon -Retrieves the bytecode of a contract. +Gets the icon URI for a given social authentication provider ### Example -```ts -import { getBytecode } from "thirdweb/contract"; -const bytecode = await getBytecode(contract); +```tsx +const googleIcon = getSocialIcon("google"); +const appleIcon = getSocialIcon("apple"); ``` ```ts -function getBytecode(contract: Readonly): Promise<`0x${string}`>; +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 ThirdwebContract instance. +The authentication provider to get the icon for #### Type ```ts -let contract: Readonly; +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: Promise<`0x${string}`>; +let returnType: string; ``` -A Promise that resolves to the bytecode of the contract. +A data URI containing the SVG icon for the provider, or a generic wallet icon if the provider is not recognized --- -## getCompilerMetadata - -Down the compiled metadata from thirdweb contract api and format it +## hasStoredPasskey -### Example +Returns whether this device has a stored passkey ready to be used for sign-in ```ts -import { getCompilerMetadata, getContract } from "thirdweb/contracts"; - -const contract = getContract({ - address: "0x...", - chain: ethereum, - client: "", -}); -const metadata = await getCompilerMetadata(contract); +function hasStoredPasskey( + client: ThirdwebClient, + ecosystemId?: `ecosystem.${string}`, +): Promise; ``` +### Parameters + +the thirdweb client + +#### Type + ```ts -function getCompilerMetadata( - contract: Readonly, -): Promise; +let client: { + readonly clientId: string; + readonly secretKey: string | undefined; +} & Readonly; ``` -### Parameters - #### Type ```ts -let contract: Readonly; +let ecosystemId: `ecosystem.${string}`; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -The compiler metadata for the contract +whether the device has a stored passkey --- -## getContract +## bundleUserOp -Creates a Thirdweb contract by combining the Thirdweb client and contract options. +Bundle a user operation. ### Example ```ts -import { createThirdwebClient, getContract } from "thirdweb"; -import { sepolia } from "thirdweb/chains"; +import { bundleUserOp } from "thirdweb/wallets/smart"; -const client = createThirdwebClient({ clientId: "..." }); -const contract = getContract({ - client, - chain: sepolia, - address: "0x123...", - // optional ABI - abi: [...], +const userOpHash = await bundleUserOp({ + userOp, + options, }); ``` ```ts -function getContract( - options: ContractOptions, -): Readonly>; +function bundleUserOp(args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; +}): Promise; ``` ### Parameters -The options for creating the contract. +The options for bundling a user operation. #### Type ```ts -let options: ContractOptions; +let args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; +}; ``` ### Returns ```ts -let returnType: Readonly>; +let returnType: ox__Hex.Hex; ``` -The Thirdweb contract. +The bundle hash of the user operation. --- -## prepareMethod +## createAndSignUserOp -Prepares a method for usage by converting it into a prepared method object. +Create and sign a user operation. ### Example ```ts -import { prepareMethod } from "thirdweb/utils"; -const method = "function transfer(address to, uint256 value)"; -const preparedMethod = prepareMethod(method); +import { createAndSignUserOp } from "thirdweb/wallets/smart"; + +const userOp = await createAndSignUserOp({ + client, + adminAccount, + smartWalletOptions, + transactions, +}); ``` ```ts -function prepareMethod(method: TMethod): PreparedMethod; +function createAndSignUserOp(options: { + adminAccount: Account; + client: ThirdwebClient; + smartWalletOptions: SmartWalletOptions; + transactions: Array; + waitForDeployment?: boolean; +}): Promise; ``` ### Parameters -The method to prepare. +The options for creating and signing the user operation #### Type ```ts -let method: TMethod; +let options: { + adminAccount: Account; + client: ThirdwebClient; + smartWalletOptions: SmartWalletOptions; + transactions: Array; + waitForDeployment?: boolean; +}; ``` ### Returns ```ts -let returnType: PreparedMethod; +let returnType: Promise; ``` -The prepared method object. +* The signed user operation --- -## resolveAbiFromBytecode +## createUnsignedUserOp -Resolves the ABI (Application Binary Interface) from the bytecode of a contract. +Creates an unsigned user operation from a prepared transaction. ### 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, +import { createUnsignedUserOp } from "thirdweb/wallets/smart"; + +const transaction = prepareContractCall(...); + +const userOp = await createUnsignedUserOp({ + transaction, + factoryContract, + accountContract, + adminAddress, + sponsorGas, + overrides, }); -const abi = await resolveAbiFromBytecode(myContract); ``` ```ts -function resolveAbiFromBytecode( - contract: Readonly>, -): Promise; +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 ThirdwebContract instance. +The prepared transaction and options #### Type ```ts -let contract: Readonly>; +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: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +let returnType: Promise; ``` -The resolved ABI as a generic type. +* The unsigned user operation --- -## resolveAbiFromContractApi +## estimateUserOpGas -Resolves the ABI (Application Binary Interface) for a contract from the contract API. +Estimate the gas cost of a user operation. ### 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, +import { estimateUserOpGas } from "thirdweb/wallets/smart"; + +const gasCost = await estimateUserOpGas({ + userOp, + options, }); -const abi = await resolveAbiFromContractApi(myContract); ``` ```ts -function resolveAbiFromContractApi( - contract: Readonly>, - contractApiBaseUrl: string, -): Promise; +function estimateUserOpGas( + args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; + }, + stateOverrides?: {}, +): 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". +The options for estimating the gas cost of a user operation. #### Type ```ts -let contractApiBaseUrl: string; +let args: { + options: BundlerOptions; + userOp: UserOperationV06 | UserOperationV07; +}; ``` ### Returns ```ts -let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +let returnType: Promise; ``` -A promise that resolves to the ABI of the contract. +The estimated gas cost of the user operation. --- -## resolveCompositeAbi +## getPaymasterAndData -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. +Get paymaster and data details for a user operation. ### 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, +import { getPaymasterAndData } from "thirdweb/wallets/smart"; + +const userOp = createUnsignedUserOp(...); + +const paymasterAndData = await getPaymasterAndData({ + userOp, + client, + chain, }); -const abi = await resolveCompositeAbiFromBytecode(myContract); ``` ```ts -function resolveCompositeAbi( - contract: Readonly, - rootAbi?: Abi, - resolveSubAbi?: (contract: Readonly) => Promise, -): Promise; +function getPaymasterAndData(args: { + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + paymasterOverride?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + userOp: UserOperationV06 | UserOperationV07; +}): 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. +The userOp and options #### Type ```ts -let resolveSubAbi: (contract: Readonly) => Promise; +let args: { + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + paymasterOverride?: ( + userOp: UserOperationV06 | UserOperationV07, + ) => Promise; + userOp: UserOperationV06 | UserOperationV07; +}; ``` ### Returns ```ts -let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> +let returnType: { + callGasLimit?: bigint; + preVerificationGas?: bigint; + verificationGasLimit?: bigint; +} & ( + | { paymasterAndData: string } + | { + paymaster: string; + paymasterData: string; + paymasterPostOpGasLimit?: bigint; + paymasterVerificationGasLimit?: bigint; + } +); ``` -The resolved ABI for the contract. +* The paymaster and data details for the user operation. --- -## resolveContractAbi +## getUserOpGasFees -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. +Get the gas fees of a user operation. ### 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, +import { getUserOpGasPrice } from "thirdweb/wallets/smart"; + +const fees = await getUserOpGasPrice({ + options, }); -const abi = await resolveContractAbi(myContract); ``` ```ts -function resolveContractAbi( - contract: Readonly>, - contractApiBaseUrl: string, -): Promise; +function getUserOpGasFees(args: { + options: BundlerOptions; +}): 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". +The options for getting the gas price of a user operation. #### Type ```ts -let contractApiBaseUrl: string; +let args: { options: BundlerOptions }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to the ABI of the contract. +The gas price of the user operation. --- -## verifyContract - -Verifies a contract by performing the following steps: +## getUserOpReceipt -* 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. +Get the receipt of a user operation. ### Example ```ts -import { getContract } from "thirdweb/contract"; -import { verifyContract } from "thirdweb/contract"; +import { getUserOpReceipt } from "thirdweb/wallets/smart"; -const contract = getContract({ ... }); -const verificationResult = await verifyContract({ - contract, - explorerApiUrl: "https://api.polygonscan.com/api", - explorerApiKey: "YOUR_API_KEY", +const receipt = await getUserOpReceipt({ + client, + chain, + userOpHash, }); -console.log(verificationResult); ``` ```ts -function verifyContract( - options: VerifyContractOptions, -): Promise>; +function getUserOpReceipt( + args: BundlerOptions & { userOpHash: `0x${string}` }, +): Promise; ``` ### Parameters -The options for contract verification. +The options for getting the receipt of a user operation. #### Type ```ts -let options: VerifyContractOptions; +let args: BundlerOptions & { userOpHash: `0x${string}` }; ``` ### Returns ```ts -let returnType: Promise>; +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 verification result. +The receipt of the user operation. --- -## getInitializeTransaction +## getUserOpReceiptRaw -Prepares the initialization transaction for a contract deployment +Get the receipt of a user operation. + +### Example ```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> ->; +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 generating the initialize transaction +The options for getting the receipt of a user operation. #### Type ```ts -let options: { - account: Account; - chain: Readonly; - client: ThirdwebClient; - deployMetadata: FetchDeployMetadataResult; - implementationContract: Readonly; - initializeParams?: Record; - modules?: Array<{ - deployMetadata: FetchDeployMetadataResult; - initializeParams?: Record; - }>; -}; +let args: BundlerOptions & { userOpHash: `0x${string}` }; ``` ### Returns ```ts -let returnType: Readonly & { - __contract?: ThirdwebContract; - __preparedMethod?: () => Promise>; -}; +let returnType: Promise; ``` -The prepared transaction for contract initialization +The raw receipt of the user operation. --- -## getOrDeployInfraForPublishedContract +## predictAddress -Gets or deploys the infrastructure contracts needed for a published contract deployment +Deprecated + +Use `predictSmartAccountAddress` instead. + +Predict the address of a smart account. + +### Example ```ts -function getOrDeployInfraForPublishedContract( - args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; - } & { - constructorParams?: Record; - contractId: string; - publisher?: string; - version?: string; - }, -): Promise<{ - cloneFactoryContract: Readonly; - implementationContract: Readonly; -}>; +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 arguments object +The options for predicting the address of a smart account. #### Type ```ts let args: { - account: Account; - chain: Readonly; - client: ThirdwebClient; -} & { - constructorParams?: Record; - contractId: string; - publisher?: string; - version?: string; + accountAddress?: string; + accountSalt?: string; + adminAddress: string; + factoryContract: Readonly>; + predictAddressOverride?: ( + factoryContract: Readonly>, + admin: string, + ) => Promise; }; ``` ### Returns ```ts -let returnType: Promise<{ - cloneFactoryContract: Readonly; - implementationContract: Readonly; -}>; +let returnType: Promise; ``` -An object containing: - -* cloneFactoryContract: The factory contract used for creating clones -* implementationContract: The deployed implementation contract +The predicted address of the smart account. --- -## getContractEvents +## predictSmartAccountAddress -Get contract events +Predict the address of a smart account. ### Example ```ts -import { Insight } from "thirdweb"; +import { predictSmartAccountAddress } from "thirdweb/wallets/smart"; -const events = await Insight.getContractEvents({ +const predictedAddress = await predictSmartAccountAddress({ client, - chains: [sepolia], - contractAddress: "0x1234567890123456789012345678901234567890", - event: transferEvent(), - decodeLogs: true, + chain, + adminAddress, }); ``` ```ts -function getContractEvents(options: { - chains: Array>; +function predictSmartAccountAddress(args: { + accountSalt?: string; + adminAddress: string; + chain: Readonly; client: ThirdwebClient; - contractAddress: string; - decodeLogs?: boolean; - event?: PreparedEvent; - queryOptions?: Omit< - | undefined - | { - aggregate?: unknown; - chain?: unknown; - decode?: null | boolean; - filter_block_hash?: string; - filter_block_number?: null | number; - filter_block_number_gt?: null | number; - filter_block_number_gte?: null | number; - filter_block_number_lt?: null | number; - filter_block_number_lte?: null | number; - filter_block_timestamp?: null | number; - filter_block_timestamp_gt?: null | number; - filter_block_timestamp_gte?: null | number; - filter_block_timestamp_lt?: null | number; - filter_block_timestamp_lte?: null | number; - filter_log_index?: null | number; - filter_log_index_gt?: null | number; - filter_log_index_gte?: null | number; - filter_log_index_lt?: null | number; - filter_log_index_lte?: null | number; - filter_topic_0?: string; - filter_topic_1?: string; - filter_topic_2?: string; - filter_topic_3?: string; - filter_transaction_hash?: string; - filter_transaction_index?: null | number; - filter_transaction_index_gt?: null | number; - filter_transaction_index_gte?: null | number; - filter_transaction_index_lt?: null | number; - filter_transaction_index_lte?: null | number; - group_by?: unknown; - limit?: number; - page?: null | number; - sort_by?: string; - sort_order?: "asc" | "desc"; - }, - "chain" | "decode" - >; -}): Promise< - Array<{ - address: string; - block_hash: string; - block_number: string; - block_timestamp: string; - chain_id: number; - data: string; - decoded?: { - indexed_params: {}; - name: string; - non_indexed_params: {}; - signature: string; - }; - log_index: number; - topics: Array; - transaction_hash: string; - transaction_index: number; - }> ->; + factoryAddress?: string; +}): Promise; ``` ### Parameters +The options for predicting the address of a smart account. + #### Type ```ts -let options: { - chains: Array>; +let args: { + accountSalt?: string; + adminAddress: string; + chain: Readonly; client: ThirdwebClient; - contractAddress: string; - decodeLogs?: boolean; - event?: PreparedEvent; - queryOptions?: Omit< - | undefined - | { - aggregate?: unknown; - chain?: unknown; - decode?: null | boolean; - filter_block_hash?: string; - filter_block_number?: null | number; - filter_block_number_gt?: null | number; - filter_block_number_gte?: null | number; - filter_block_number_lt?: null | number; - filter_block_number_lte?: null | number; - filter_block_timestamp?: null | number; - filter_block_timestamp_gt?: null | number; - filter_block_timestamp_gte?: null | number; - filter_block_timestamp_lt?: null | number; - filter_block_timestamp_lte?: null | number; - filter_log_index?: null | number; - filter_log_index_gt?: null | number; - filter_log_index_gte?: null | number; - filter_log_index_lt?: null | number; - filter_log_index_lte?: null | number; - filter_topic_0?: string; - filter_topic_1?: string; - filter_topic_2?: string; - filter_topic_3?: string; - filter_transaction_hash?: string; - filter_transaction_index?: null | number; - filter_transaction_index_gt?: null | number; - filter_transaction_index_gte?: null | number; - filter_transaction_index_lt?: null | number; - filter_transaction_index_lte?: null | number; - group_by?: unknown; - limit?: number; - page?: null | number; - sort_by?: string; - sort_order?: "asc" | "desc"; - }, - "chain" | "decode" - >; + factoryAddress?: string; }; ``` ### Returns ```ts -let returnType: Promise< - Array<{ - address: string; - block_hash: string; - block_number: string; - block_timestamp: string; - chain_id: number; - data: string; - decoded?: { - indexed_params: {}; - name: string; - non_indexed_params: {}; - signature: string; - }; - log_index: number; - topics: Array; - transaction_hash: string; - transaction_index: number; - }> ->; +let returnType: Promise; ``` + +The predicted address of the smart account. --- -## parseEventLogs +## signUserOp -Parses logs and returns the corresponding events. +Sign a user operation. ### Example ```ts -import { parseEventLogs } from "thirdweb"; -const events = parseEventLogs({ - logs, - events: [preparedEvent, preparedEvent2], +import { signUserOp } from "thirdweb/wallets/smart"; + +const userOp = await createUnsignedUserOp(...); + +const signedUserOp = await signUserOp({ + client, + userOp, + chain, + adminAccount, }); ``` ```ts -function parseEventLogs( - options: ParseEventLogsOptions, -): ParseEventLogsResult; +function signUserOp(args: { + adminAccount: Account; + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + userOp: UserOperationV06 | UserOperationV07; +}): Promise; ``` ### Parameters -The options for parsing logs. - #### Type ```ts -let options: ParseEventLogsOptions; +let args: { + adminAccount: Account; + chain: Readonly; + client: ThirdwebClient; + entrypointAddress?: string; + userOp: UserOperationV06 | UserOperationV07; +}; ``` ### Returns ```ts -let returnType: ParseEventLogsResult; +let returnType: Promise; ``` -The parsed events. +* The user operation with the signature field populated --- -## prepareEvent +## waitForUserOpReceipt -Prepares an event by parsing the signature, generating the event hash, and encoding the event topics. +Wait for the user operation to be mined. ### Example ```ts -import { prepareEvent } from "thirdweb"; -const myEvent = prepareEvent({ - signature: "event MyEvent(uint256 myArg)", +import { waitForUserOpReceipt } from "thirdweb/wallets/smart"; + +const receipt = await waitForUserOpReceipt({ + chain, + client, + userOpHash, }); ``` ```ts -function prepareEvent( - options: PrepareEventOptions, -): PreparedEvent>; +function waitForUserOpReceipt( + args: BundlerOptions & { + intervalMs?: number; + timeoutMs?: number; + userOpHash: `0x${string}`; + }, +): Promise; ``` ### Parameters -The options for preparing the event. +The options and user operation hash #### Type ```ts -let options: PrepareEventOptions; +let args: BundlerOptions & { + intervalMs?: number; + timeoutMs?: number; + userOpHash: `0x${string}`; +}; ``` ### Returns ```ts -let returnType: PreparedEvent>; +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 prepared event object. +* The transaction receipt +--- +# Chain --- -## watchContractEvents +## defineChain -Listens for contract events from the blockchain. +Defines a chain with the given options. ### Example -#### Listen to all events for a contract +Just pass the chain ID to connect to: ```ts -import { watchContractEvents } from "thirdweb"; -const unwatch = watchContractEvents({ - contract: myContract, - onEvents: (events) => { - // do something with the events - }, -}); +const chain = defineChain(1); ``` -#### Listen to specific events for a contract +Or pass your own RPC or custom values: ```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 +const chain = defineChain({ + id: 1, + rpc: "https://my-rpc.com", + nativeCurrency: { + name: "Ether", + symbol: "ETH", + decimals: 18, }, }); ``` ```ts -function watchContractEvents(options: { - contract: Readonly>; - events?: abiEvents; - latestBlockNumber?: bigint; - onEvents: ( - events: ParseEventLogsResult, - ) => void; - strict?: TStrict; - useIndexer?: boolean; -}): () => void; +function defineChain( + options: number | ChainOptions | LegacyChain | Chain, +): Chain; ``` ### Parameters -The options for retrieving contract events. +The options for the chain. #### Type ```ts -let options: { - contract: Readonly>; - events?: abiEvents; - latestBlockNumber?: bigint; - onEvents: ( - events: ParseEventLogsResult, - ) => void; - strict?: TStrict; - useIndexer?: boolean; -}; +let options: number | ChainOptions | LegacyChain | Chain; ``` ### Returns ```ts -let returnType: () => void; +let returnType: Readonly; ``` -The unwatch function. +The defined chain. --- -## resolveMethod +## getChainMetadata -Resolves and returns the ABI function with the specified method name. Throws an error if the function is not found in the ABI. +Retrieves chain data for a given chain. ### 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], -}); +const chain = defineChain({ id: 1 }); +const chainData = await getChainMetadata(chain); +console.log(chainData); ``` ```ts -function resolveMethod( - method: string, -): ( - contract: Readonly>, -) => Promise; +function getChainMetadata( + chain: Readonly, +): Promise; ``` ### Parameters -The name of the method to resolve. +The chain object containing the chain ID. #### Type ```ts -let method: string; +let chain: Readonly; ``` ### Returns ```ts -let returnType: ( - contract: Readonly>, -) => Promise; +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 } ``` -The resolved ABI function. +A Promise that resolves to the chain data. --- -## detectMethod +## getRpcUrlForChain -Detects if the specified method is present in the contract bytecode. +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 { detectMethod } from "thirdweb/utils/extensions/detect.js"; -const hasDecimals = await detectMethod({ - method: "function decimals() view returns (uint8)", - availableSelectors: ["0x313ce567"], -}); +import { getRpcUrlForChain } from "thirdweb/chains"; +const rpcUrl = getRpcUrlForChain({ chain: 1, client }); +console.log(rpcUrl); // "https://1.rpc.thirdweb.com/... ``` ```ts -function detectMethod(options: DetectExtensionOptions): boolean; +function getRpcUrlForChain(options: GetRpcUrlForChainOptions): string; ``` ### Parameters -The options for detecting the extension. +The options object containing the chain and client information. #### Type ```ts -let options: DetectExtensionOptions; +let options: GetRpcUrlForChainOptions; ``` ### Returns ```ts -let returnType: boolean; +let returnType: string; ``` -A promise that resolves to a boolean indicating if the extension is detected. +The RPC URL for the specified chain. --- -## isContractDeployed +## ChainIcon -Checks if a contract is deployed by verifying its bytecode. +This component tries to resolve the icon of a given chain, then return an image. ### Example -```ts -import { getContract } from "thirdweb/contract"; -import { isContractDeployed } from "thirdweb/contract/utils"; +#### Basic usage + +```tsx +import { ChainProvider, ChainIcon } from "thirdweb/react"; -const contract = getContract({ ... }); -const isDeployed = await isContractDeployed(contract); -console.log(isDeployed); + + +; ``` -```ts -function isContractDeployed(contract: Readonly): Promise; +Result: An `` component with the src of the icon + +```html + ``` -### Parameters +#### Override the icon with the `iconResolver` prop -The contract to check. +If you already have the icon url, you can skip the network requests and pass it directly to the ChainIcon -#### Type +```tsx +; +``` -```ts -let contract: Readonly; +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; +}; + +; ``` -### Returns +#### Show a loading sign while the icon is being loaded -```ts -let returnType: Promise; +```tsx +} />; ``` -A promise that resolves to a boolean indicating whether the contract is deployed or not. ---- +#### Fallback to a dummy image if the chain icon fails to resolve -## resolveImplementation +```tsx +} />; +``` -Resolves the implementation address and bytecode for a given proxy contract. +#### Usage with queryOptions -### Example +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 -```ts -import { resolveImplementation } from "thirdweb/utils"; -const implementation = await resolveImplementation(contract); +```tsx +; ``` ```ts -function resolveImplementation( - contract: Readonly>, -): Promise<{ address: string; bytecode: `0x${string}` }>; +function ChainIcon(__namedParameters: ChainIconProps): null | Element; ``` ### Parameters -The contract to resolve the implementation for. - #### Type ```ts -let contract: Readonly>; +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: Promise<{ address: string; bytecode: `0x${string}` }>; +let returnType: null | Element; ``` -A promise that resolves to an object containing the implementation address and bytecode. ---- -# Transactions +an `` with the src of the chain icon --- -## 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. +## ChainName -This extension is a handy method that checks for the allowance and requests to approve for more if current allowance is insufficient +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 -```ts -import { getApprovalForTransaction } from "thirdweb/extensions/erc20"; -import { sendAndConfirmTransaction } from "thirdweb"; - -async function buyNFT() { - const buyTransaction = ... // could be a marketplacev3's buyFromListing +#### Basic usage + +```tsx +import { ChainProvider, ChainName } from "thirdweb/react"; +import { ethereum } from "thirdweb/chains"; - // 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; -``` +Result: -### Parameters +```html +Ethereum Mainnet +``` -GetApprovalForTransactionParams +#### Custom name resolver -#### Type +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. -```ts -let options: { account: Account; transaction: PreparedTransaction }; +```tsx +async function fetchNameMethod() { + // your own fetching logic + return "the chain name"; +} + +; ``` -### Returns +Alternatively you can also pass in a string directly: -```ts -let returnType: Readonly & { - __contract?: ThirdwebContract; - __preparedMethod?: () => Promise>; -}; +```tsx +; ``` -a PreparedTransaction ---- - -## createContractQuery - -Creates a `useQuery` hook for a contract call. - -### Example +#### Format the name (capitalize, truncate, etc.) -```jsx -import { createContractQuery } from "thirdweb/react"; -import { totalSupply } from "thirdweb/extensions/erc20"; -const useTotalSupply = createContractQuery(totalSupply); -const { data, isLoading } = useTotalSupply({ contract }); -``` +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 -```ts -function createContractQuery( - readCall: ( - options: BaseTransactionOptions, - ) => Promise, -): ( - options: { - contract: Readonly>; - } & opts & { queryOptions?: Partial<{ enabled: boolean }> }, -) => UseQueryResult; +```tsx +const concatStr = (str: string):string => str + "Network" + + + + ``` -### Parameters - -A function that performs the contract function call and returns the result. - -#### Type +Result: -```ts -let readCall: ( - options: BaseTransactionOptions, -) => Promise; +```html +Ethereum Mainnet Network ``` -### Returns +#### Show a loading sign when the name is being fetched -```ts -let returnType: ( - options: { - contract: Readonly>; - } & opts & { queryOptions?: Partial<{ enabled: boolean }> }, -) => UseQueryResult; +```tsx +import { ChainProvider, ChainName } from "thirdweb/react"; + + + } /> +; ``` -An object containing the created `useRead` hook. ---- +#### Fallback to something when the name fails to resolve -## encode +```tsx + + +; +``` -Encodes a transaction object into a hexadecimal string representation of the encoded data. +#### Custom query options for useQuery -### Example +This component uses `@tanstack-query`'s useQuery internally. You can use the `queryOptions` prop for more fine-grained control -```ts -import { encode } from "thirdweb"; -const encodedData = await encode(transaction); +```tsx +; ``` ```ts -function encode( - transaction: PreparedTransaction, -): Promise<`0x${string}`>; +function ChainName(__namedParameters: ChainNameProps): null | Element; ``` ### Parameters -The transaction object to encode. - #### Type ```ts -let transaction: PreparedTransaction; +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: Promise<`0x${string}`>; +let returnType: null | Element; ``` - -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 +## isZkSyncChain -```ts -import { estimateGas } from "thirdweb"; -const gas = await estimateGas({ - transaction, - from: "0x...", -}); -``` +Checks whether the given chain is part of the zksync stack ```ts -function estimateGas(options: EstimateGasOptions): Promise; +function isZkSyncChain( + chain: Readonly, +): Promise; ``` ### Parameters -The options for estimating gas. - #### Type ```ts -let options: Prettify< - { transaction: PreparedTransaction } & ( - | { account: Account; from?: never } - | { account?: never; from?: string | Account } - ) ->; +let chain: Readonly; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` - -A promise that resolves to the estimated gas as a bigint. +--- +# Contract --- -## estimateGasCost +## checkVerificationStatus -Estimate the gas cost of a transaction in ether and wei. +Checks the verification status of a contract. ### Example ```ts -import { estimateGasCost } from "thirdweb"; - -const gasCost = await estimateGasCost({ transaction }); +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 estimateGasCost( - options: EstimateGasOptions, -): Promise; +function checkVerificationStatus( + options: CheckVerificationStatusOptions, +): Promise; ``` ### Parameters +The options for checking the verification status. + #### Type ```ts -let options: Prettify< - { transaction: PreparedTransaction } & ( - | { account: Account; from?: never } - | { account?: never; from?: string | Account } - ) ->; +let options: CheckVerificationStatusOptions; ``` ### Returns ```ts -let returnType: { ether: string; wei: bigint }; +let returnType: Promise; ``` + +A promise that resolves with the verification status data. --- -## prepareContractCall +## fetchPublishedContract -Prepares a contract call by resolving the ABI function, parameters and encoded data. Optionally specify other properties such as value or gas price. +Fetches the published contract based on the provided options. ### 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], +const publishedContract = await fetchPublishedContract({ + publisherAddress: "0x1234", + contractName: "MyContract", + version: "1.0.0", + client: client, }); ``` -#### 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"), -}); +function fetchPublishedContract( + options: FetchPublishedContractOptions, +): Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; ``` -#### Usage with ERC20 value: - -For transactions that transfer ERC20 tokens, you can specify the value as the amount of tokens to transfer. +### Parameters -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. +The options for fetching the published contract. -This value will also be read by the react hooks and UI components to present to total cost to the user. +#### Type ```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 - }, -}); +let options: FetchPublishedContractOptions; ``` -#### Usage with a JSON ABI function object: +### Returns ```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], -}); +let returnType: Promise<{ + bytecodeHash: `0x${string}`; + contractId: string; + implementation: string; + publishMetadataUri: string; + publishTimestamp: bigint; +}>; ``` -#### Usage with the ABI defined on the contract: +The published 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], -}); -``` +## getBytecode -#### Passing extra call data to the transaction +Retrieves the bytecode of a contract. + +### Example ```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......." -}); +import { getBytecode } from "thirdweb/contract"; +const bytecode = await getBytecode(contract); ``` ```ts -function prepareContractCall( - options: PrepareContractCallOptions, -): PreparedTransaction< - TAbi, - ParseMethod, - PrepareTransactionOptions ->; +function getBytecode( + contract: Readonly>, +): Promise; ``` ### Parameters -The options for preparing the contract call. +The ThirdwebContract instance. #### Type ```ts -let options: PrepareContractCallOptions< - TAbi, - TMethod, - TPreparedMethod ->; +let contract: Readonly>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - TAbi, - ParseMethod, - PrepareTransactionOptions ->; +let returnType: ox__Hex.Hex; ``` -A promise that resolves to the prepared transaction. +A Promise that resolves to the bytecode of the contract. --- -## prepareTransaction +## getCompilerMetadata -Prepares a transaction with the given options. +Down the compiled metadata from thirdweb contract api and format it ### Example ```ts -import { prepareTransaction, toWei } from "thirdweb"; -import { ethereum } from "thirdweb/chains"; -const transaction = prepareTransaction({ - to: "0x1234567890123456789012345678901234567890", +import { getCompilerMetadata, getContract } from "thirdweb/contracts"; + +const contract = getContract({ + address: "0x...", chain: ethereum, - client: thirdwebClient, - value: toWei("1.0"), - gasPrice: 30n, + client: "", }); +const metadata = await getCompilerMetadata(contract); ``` ```ts -function prepareTransaction( - options: PrepareTransactionOptions, - info?: Additional, -): PreparedTransaction; +function getCompilerMetadata( + contract: Readonly>, +): Promise; ``` ### 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; +let contract: Readonly>; ``` ### Returns ```ts -let returnType: PreparedTransaction< - abi, - abiFn, - PrepareTransactionOptions ->; +let returnType: Promise; ``` -The prepared transaction. +The compiler metadata for the contract --- -## readContract - -#### Reads state from a deployed smart contract. +## getContract -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. +Creates a Thirdweb contract by combining the Thirdweb client and contract options. ### 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 { createThirdwebClient, getContract } from "thirdweb"; import { sepolia } from "thirdweb/chains"; -import { useReadContract } from "thirdweb/react"; +const client = createThirdwebClient({ clientId: "..." }); const contract = getContract({ - client, - address: "0x...", - chain: sepolia, -}); - -const { data, isLoading } = useReadContract({ - contract, - method: resolveMethod("tokenURI"), - params: [1n], + client, + chain: sepolia, + address: "0x123...", + // optional ABI + abi: [...], }); ``` ```ts -function readContract( - options: ReadContractOptions, -): Promise>; +function getContract( + options: ContractOptions, +): ThirdwebContract; ``` ### Parameters -The transaction options. +The options for creating the contract. #### Type ```ts -let options: ReadContractOptions; +let options: ContractOptions; ``` ### Returns ```ts -let returnType: outputs extends { length: 0 } - ? never - : outputs extends { length: 1 } - ? AbiParametersToPrimitiveTypes[0] - : AbiParametersToPrimitiveTypes; +let returnType: ThirdwebContract; ``` -A promise that resolves with the result of the read call. +The Thirdweb contract. --- -## sendAndConfirmTransaction +## prepareMethod -Sends a transaction using the provided wallet. +Prepares a method for usage by converting it into a prepared method object. ### Example -#### Basic usage +```ts +import { prepareMethod } from "thirdweb/utils"; +const method = "function transfer(address to, uint256 value)"; +const preparedMethod = prepareMethod(method); +``` ```ts -import { sendAndConfirmTransaction } from "thirdweb"; - -const transactionReceipt = await sendAndConfirmTransaction({ - account, - transaction, -}); +function prepareMethod(method: TMethod): PreparedMethod; ``` -#### Gasless usage with [thirdweb Engine](https://portal.thirdweb.com/engine) +### Parameters + +The method to prepare. + +#### Type ```ts -const transactionReceipt = await sendAndConfirmTransaction({ - account, - transaction, - gasless: { - provider: "engine", - relayerUrl: - "https://thirdweb.engine-***.thirdweb.com/relayer/***", - relayerForwarderAddress: "0x...", - }, -}); +let method: TMethod; ``` -#### Gasless usage with OpenZeppelin +### Returns ```ts -const transactionReceipt = await sendAndConfirmTransaction({ - account, - transaction, - gasless: { - provider: "openzeppelin", - relayerUrl: "https://...", - relayerForwarderAddress: "0x...", - }, +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 sendAndConfirmTransaction( - options: SendTransactionOptions, -): Promise; +function resolveAbiFromBytecode( + contract: Readonly>, +): Promise; ``` ### Parameters -The options for sending the transaction. +The ThirdwebContract instance. #### Type ```ts -let options: { - account: Account; - gasless: GaslessOptions; - transaction: PreparedTransaction; -}; +let contract: Readonly>; ``` ### 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; -}; +let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> ``` -A promise that resolves to the confirmed transaction receipt. +The resolved ABI as a generic type. --- -## sendBatchTransaction +## resolveAbiFromContractApi -Sends a batch transaction using the provided options. +Resolves the ABI (Application Binary Interface) for a contract from the contract API. ### Example ```ts -import { sendBatchTransaction } from "thirdweb"; - -const waitForReceiptOptions = await sendBatchTransaction({ - account, - transactions, +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 sendBatchTransaction( - options: SendBatchTransactionOptions, -): Promise<{ - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}>; +function resolveAbiFromContractApi( + contract: Readonly>, + contractApiBaseUrl: string, +): Promise; ``` ### Parameters -The options for sending the batch transaction. +The ThirdwebContract instance representing the contract. #### Type ```ts -let options: { - account: Account; - transactions: Array; -}; +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<{ - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}>; +let returnType: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> ``` -A promise that resolves to the options for waiting for the receipt of the first transaction in the batch. +A promise that resolves to the ABI of the contract. --- -## sendTransaction - -Sends a transaction using the provided account. +## resolveCompositeAbi -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). +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 -#### Using a prepared contract call - ```ts -import { - sendTransaction, - getContract, - prepareContractCall, -} from "thirdweb"; -import { sepolia } from "thirdweb/chains"; - -const contract = getContract({ - address: "0x...", - chain: sepolia, +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 transaction = prepareContractCall({ - contract, - method: "function transfer(address to, uint256 value)", - params: [to, value], -}); - -const { transactionHash } = await sendTransaction({ - account, - transaction, -}); +const abi = await resolveCompositeAbiFromBytecode(myContract); ``` -#### 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, -}); +function resolveCompositeAbi( + contract: Readonly>, + rootAbi?: Abi, + resolveSubAbi?: ( + contract: Readonly>, + ) => Promise, +): Promise; ``` -#### Using a prepared transaction +### Parameters -```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, -}); +The contract for which to resolve the ABI. + +#### Type + +```ts +let contract: Readonly>; ``` -#### Send an EIP-7702 Transaction +The root ABI to use for the contract. If not provided, it resolves the ABI from the contract's bytecode. -_Note: This feature is in beta and is subject to breaking changes_ +#### Type ```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, -}); +let rootAbi: readonly Array<(AbiConstructor) | (AbiError) | (AbiEvent) | (AbiFallback) | (AbiFunction) | (AbiReceive)> ``` -#### Gasless usage with [thirdweb Engine](https://portal.thirdweb.com/engine) +A function to resolve the ABI for a sub-contract. If not provided, it uses the default ABI resolution logic. + +#### Type ```ts -const { transactionHash } = await sendTransaction({ - account, - transaction, - gasless: { - provider: "engine", - relayerUrl: - "https://thirdweb.engine-***.thirdweb.com/relayer/***", - relayerForwarderAddress: "0x...", - }, -}); +let resolveSubAbi: ( + contract: Readonly>, +) => Promise; ``` -#### Gasless usage with OpenZeppelin +### Returns ```ts -const { transactionHash } = await sendTransaction({ - account, - transaction, - gasless: { - provider: "openzeppelin", - relayerUrl: "https://...", - relayerForwarderAddress: "0x...", - }, +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 sendTransaction( - options: SendTransactionOptions, -): Promise<{ - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}>; +function resolveContractAbi( + contract: Readonly>, + contractApiBaseUrl: string, +): Promise; ``` ### Parameters -The options for sending the transaction. +The contract for which to resolve the ABI. #### Type ```ts -let options: { - account: Account; - gasless: GaslessOptions; - transaction: PreparedTransaction; -}; +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<{ - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}>; +let returnType: Promise; ``` -A promise that resolves to the transaction result. +A promise that resolves to the ABI of the contract. --- -## serializeTransaction +## verifyContract -Serializes a legacy, EIP-1559, EIP-2930, EIP-4844, or EIP-7702 transaction object. +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 { serializeTransaction } from "thirdweb"; +import { getContract } from "thirdweb/contract"; +import { verifyContract } from "thirdweb/contract"; -const serializedTransaction = serializeTransaction({ - transaction: { - to: "0x", - value: 0n, - }, +const contract = getContract({ ... }); +const verificationResult = await verifyContract({ + contract, + explorerApiUrl: "https://api.polygonscan.com/api", + explorerApiKey: "YOUR_API_KEY", }); +console.log(verificationResult); ``` ```ts -function serializeTransaction( - options: SerializeTransactionOptions, -): `0x${string}`; +function verifyContract( + options: VerifyContractOptions, +): Promise>; ``` ### Parameters -The serialization options. +The options for contract verification. #### Type ```ts -let options: { - signature?: - | ox__Signature.Signature - | ox__Signature.Legacy; - transaction: SerializableTransaction; -}; +let options: VerifyContractOptions; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: Promise>; ``` -The serialized transaction. +A promise that resolves to the verification result. --- -## signAuthorization +## getInitializeTransaction -Sign the given EIP-7702 authorization object. +Prepares the initialization transaction for a contract deployment ```ts -function signAuthorization(options: { +function getInitializeTransaction(options: { account: Account; - request: AuthorizationRequest; -}): Promise<{ - address: string; - chainId: number; - nonce: bigint; - r: bigint; - s: bigint; - yParity: number; -}>; + chain: Readonly; + client: ThirdwebClient; + deployMetadata: FetchDeployMetadataResult; + implementationContract: Readonly>; + initializeParams?: Record; + modules?: Array<{ + deployMetadata: FetchDeployMetadataResult; + initializeParams?: Record; + }>; +}): Promise< + PreparedTransaction<[], AbiFunction, PrepareTransactionOptions> +>; ``` ### Parameters -The options for `signAuthorization`Refer to the type [SignAuthorizationOptions](https://portal.thirdweb.com/references/typescript/v5/SignAuthorizationOptions) +The options for generating the initialize transaction #### Type ```ts -let options: { account: Account; request: AuthorizationRequest }; +let options: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + deployMetadata: FetchDeployMetadataResult; + implementationContract: Readonly>; + initializeParams?: Record; + modules?: Array<{ + deployMetadata: FetchDeployMetadataResult; + initializeParams?: Record; + }>; +}; ``` ### Returns ```ts -let returnType: Promise<{ - address: string; - chainId: number; - nonce: bigint; - r: bigint; - s: bigint; - yParity: number; -}>; +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; +}; ``` -The signed authorization object - -```ts -import { signAuthorization } from "thirdweb"; - -const authorization = await signAuthorization({ - request: { - address: "0x...", - chainId: 911867, - nonce: 100n, - }, - account: myAccount, -}); -``` +The prepared transaction for contract initialization --- -## signTransaction - -Signs a transaction to be sent to a node. +## getOrDeployInfraForPublishedContract -### Example +Gets or deploys the infrastructure contracts needed for a published contract deployment ```ts -import { signTransaction } from "thirdweb"; -signTransaction({ - transaction: { - ... +function getOrDeployInfraForPublishedContract( + args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; + } & { + constructorParams?: Record; + contractId: string; + publisher?: string; + version?: string; }, - privateKey: "0x...", -}); -``` - -```ts -function signTransaction( - options: SignTransactionOptions, -): `0x${string}`; +): Promise<{ + cloneFactoryContract: ThirdwebContract; + implementationContract: ThirdwebContract; +}>; ``` ### Parameters -The options for signing. +The arguments object #### Type ```ts -let options: { - privateKey: Hex; - transaction: SerializableTransaction; +let args: { + account: Account; + chain: Readonly; + client: ThirdwebClient; +} & { + constructorParams?: Record; + contractId: string; + publisher?: string; + version?: string; }; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: Readonly>; ``` -The signed transaction as a hex string +An object containing: + +* cloneFactoryContract: The factory contract used for creating clones +* implementationContract: The deployed implementation contract --- -## simulateTransaction +## getContractEvents -Simulates the execution of a transaction. +Retrieves events from a contract based on the provided options. ### Example ```ts -import { simulateTransaction } from "thirdweb"; -const result = await simulateTransaction({ - transaction, +import { getContractEvents } from "thirdweb"; +const events = await getContractEvents({ + contract: myContract, + fromBlock: 123456n, + toBlock: 123456n, + events: [preparedEvent, preparedEvent2], }); ``` ```ts -function simulateTransaction( - options: SimulateOptions, -): Promise; +function getContractEvents( + options: GetContractEventsOptions, +): Promise>; ``` ### Parameters -The options for simulating the transaction. +The options for retrieving events. #### Type ```ts -let options: SimulateOptions; +let options: GetContractEventsOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: ParseEventLogsResult; ``` -A promise that resolves to the result of the simulation. +A promise that resolves to an array of parsed event logs. Note: toBlock and fromBlock are both inclusive. --- -## toSerializableTransaction +## parseEventLogs -Converts a prepared transaction to a transaction with populated options. +Parses logs and returns the corresponding events. ### Example ```ts -import { - prepareTransaction, - toSerializableTransaction, -} from "thirdweb"; - -const transaction = await prepareTransaction({ - transaction: { - to: "0x...", - value: 100, - }, -}); -const finalTx = await toSerializableTransaction({ - transaction, +import { parseEventLogs } from "thirdweb"; +const events = parseEventLogs({ + logs, + events: [preparedEvent, preparedEvent2], }); - -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; - type: undefined | TransactionType; - 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; - type: undefined | TransactionType; - value: undefined | bigint; - } ->; +function parseEventLogs( + options: ParseEventLogsOptions, +): ParseEventLogsResult; ``` ### Parameters -The transaction and additional options for conversion +The options for parsing logs. #### Type ```ts -let options: { - from?: string | Account; - transaction: PreparedTransaction; -}; +let options: ParseEventLogsOptions; ``` ### 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; - type: undefined | TransactionType; - 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; - type: undefined | TransactionType; - value: undefined | bigint; - } ->; +let returnType: ParseEventLogsResult; ``` -A serializable transaction for inspection or submission to an account. - -For easier transaction sending, sendTransaction +The parsed events. --- -## waitForReceipt +## prepareEvent -Waits for the transaction receipt of a given transaction hash on a specific contract. +Prepares an event by parsing the signature, generating the event hash, and encoding the event topics. ### Example ```ts -import { waitForReceipt } from "thirdweb"; -const receipt = await waitForReceipt({ - client, - chain, - transactionHash: "0x123...", +import { prepareEvent } from "thirdweb"; +const myEvent = prepareEvent({ + signature: "event MyEvent(uint256 myArg)", }); ``` ```ts -function waitForReceipt(options: { - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}): Promise; +function prepareEvent( + options: PrepareEventOptions, +): PreparedEvent>; ``` ### Parameters -The options for waiting for the receipt. By default, it's 100 blocks. +The options for preparing the event. #### Type ```ts -let options: { - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}; +let options: PrepareEventOptions; ``` ### 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; -}; +let returnType: PreparedEvent>; ``` -A promise that resolves with the transaction receipt. +The prepared event object. --- -## getTransactionStore +## watchContractEvents -Retrieve the transaction store for a given address. +Listens for contract events from the blockchain. ### Example +#### Listen to all events for a contract + ```ts -import { getTransactionStore } from "thirdweb/transaction"; - -const store = getTransactionStore("0x..."); -store.subscribe((transactions) => { - console.log(transactions); +import { watchContractEvents } from "thirdweb"; +const unwatch = watchContractEvents({ + contract: myContract, + onEvents: (events) => { + // do something with the events + }, }); ``` +#### Listen to specific events for a contract + ```ts -function getTransactionStore( - address: string, -): Store>; +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 address to retrieve the transaction store for. +The options for retrieving contract events. #### Type ```ts -let address: string; +let options: { + contract: Readonly>; + events?: abiEvents; + latestBlockNumber?: bigint; + onEvents: ( + events: ParseEventLogsResult, + ) => void; + strict?: TStrict; +}; ``` ### Returns ```ts -let returnType: Store>; +let returnType: () => void; ``` -A store of transactions for the given account to subscribe to. ---- -# Insight +The unwatch function. --- -## getContractEvents +## resolveMethod -Get contract events +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 { Insight } from "thirdweb"; - -const events = await Insight.getContractEvents({ - client, - chains: [sepolia], - contractAddress: "0x1234567890123456789012345678901234567890", - event: transferEvent(), - decodeLogs: true, +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 getContractEvents(options: { - chains: Array>; - client: ThirdwebClient; - contractAddress: string; - decodeLogs?: boolean; - event?: PreparedEvent; - queryOptions?: Omit< - | undefined - | { - aggregate?: unknown; - chain?: unknown; - decode?: null | boolean; - filter_block_hash?: string; - filter_block_number?: null | number; - filter_block_number_gt?: null | number; - filter_block_number_gte?: null | number; - filter_block_number_lt?: null | number; - filter_block_number_lte?: null | number; - filter_block_timestamp?: null | number; - filter_block_timestamp_gt?: null | number; - filter_block_timestamp_gte?: null | number; - filter_block_timestamp_lt?: null | number; - filter_block_timestamp_lte?: null | number; - filter_log_index?: null | number; - filter_log_index_gt?: null | number; - filter_log_index_gte?: null | number; - filter_log_index_lt?: null | number; - filter_log_index_lte?: null | number; - filter_topic_0?: string; - filter_topic_1?: string; - filter_topic_2?: string; - filter_topic_3?: string; - filter_transaction_hash?: string; - filter_transaction_index?: null | number; - filter_transaction_index_gt?: null | number; - filter_transaction_index_gte?: null | number; - filter_transaction_index_lt?: null | number; - filter_transaction_index_lte?: null | number; - group_by?: unknown; - limit?: number; - page?: null | number; - sort_by?: string; - sort_order?: "asc" | "desc"; - }, - "chain" | "decode" - >; -}): Promise< - Array<{ - address: string; - block_hash: string; - block_number: string; - block_timestamp: string; - chain_id: number; - data: string; - decoded?: { - indexed_params: {}; - name: string; - non_indexed_params: {}; - signature: string; - }; - log_index: number; - topics: Array; - transaction_hash: string; - transaction_index: number; - }> ->; +function resolveMethod( + method: string, +): ( + contract: Readonly>, +) => Promise; ``` ### Parameters +The name of the method to resolve. + #### Type ```ts -let options: { - chains: Array>; - client: ThirdwebClient; - contractAddress: string; - decodeLogs?: boolean; - event?: PreparedEvent; - queryOptions?: Omit< - | undefined - | { - aggregate?: unknown; - chain?: unknown; - decode?: null | boolean; - filter_block_hash?: string; - filter_block_number?: null | number; - filter_block_number_gt?: null | number; - filter_block_number_gte?: null | number; - filter_block_number_lt?: null | number; - filter_block_number_lte?: null | number; - filter_block_timestamp?: null | number; - filter_block_timestamp_gt?: null | number; - filter_block_timestamp_gte?: null | number; - filter_block_timestamp_lt?: null | number; - filter_block_timestamp_lte?: null | number; - filter_log_index?: null | number; - filter_log_index_gt?: null | number; - filter_log_index_gte?: null | number; - filter_log_index_lt?: null | number; - filter_log_index_lte?: null | number; - filter_topic_0?: string; - filter_topic_1?: string; - filter_topic_2?: string; - filter_topic_3?: string; - filter_transaction_hash?: string; - filter_transaction_index?: null | number; - filter_transaction_index_gt?: null | number; - filter_transaction_index_gte?: null | number; - filter_transaction_index_lt?: null | number; - filter_transaction_index_lte?: null | number; - group_by?: unknown; - limit?: number; - page?: null | number; - sort_by?: string; - sort_order?: "asc" | "desc"; - }, - "chain" | "decode" - >; -}; +let method: string; ``` ### Returns ```ts -let returnType: Promise< - Array<{ - address: string; - block_hash: string; - block_number: string; - block_timestamp: string; - chain_id: number; - data: string; - decoded?: { - indexed_params: {}; - name: string; - non_indexed_params: {}; - signature: string; - }; - log_index: number; - topics: Array; - transaction_hash: string; - transaction_index: number; - }> ->; +let returnType: ( + contract: Readonly>, +) => Promise; ``` + +The resolved ABI function. --- -## getContractNFTs +## detectMethod -Get all NFTs from a contract +Detects if the specified method is present in the contract bytecode. ### Example ```ts -import { Insight } from "thirdweb"; - -const nfts = await Insight.getContractNFTs({ - client, - chains: [sepolia], - contractAddress: "0x1234567890123456789012345678901234567890", +import { detectMethod } from "thirdweb/utils/extensions/detect.js"; +const hasDecimals = await detectMethod({ + method: "function decimals() view returns (uint8)", + availableSelectors: ["0x313ce567"], }); ``` ```ts -function getContractNFTs(args: { - chains: Array>; - client: ThirdwebClient; - contractAddress: string; - includeMetadata?: boolean; - includeOwners?: boolean; - queryOptions?: Omit< - | undefined - | { - chain?: unknown; - include_owners?: "false" | "true"; - limit?: number; - page?: null | number; - }, - "chain" - >; -}): Promise>; +function detectMethod(options: DetectExtensionOptions): boolean; ``` ### Parameters +The options for detecting the extension. + #### Type ```ts -let args: { - chains: Array>; - client: ThirdwebClient; - contractAddress: string; - includeMetadata?: boolean; - includeOwners?: boolean; - queryOptions?: Omit< - | undefined - | { - chain?: unknown; - include_owners?: "false" | "true"; - limit?: number; - page?: null | number; - }, - "chain" - >; -}; +let options: DetectExtensionOptions; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: boolean; ``` + +A promise that resolves to a boolean indicating if the extension is detected. --- -## getNFT +## isContractDeployed -Get NFT metadata by contract address and token id +Checks if a contract is deployed by verifying its bytecode. ### Example ```ts -import { Insight } from "thirdweb"; +import { getContract } from "thirdweb/contract"; +import { isContractDeployed } from "thirdweb/contract/utils"; -const nft = await Insight.getNFT({ - client, - chain: sepolia, - contractAddress: "0x1234567890123456789012345678901234567890", - tokenId: 1n, -}); +const contract = getContract({ ... }); +const isDeployed = await isContractDeployed(contract); +console.log(isDeployed); ``` ```ts -function getNFT(args: { - chain: Readonly; - client: ThirdwebClient; - contractAddress: string; - includeOwners?: boolean; - queryOptions?: { - chain?: unknown; - include_owners?: "false" | "true"; - }; - tokenId: string | number | bigint; -}): Promise; +function isContractDeployed( + contract: Readonly>, +): Promise; ``` ### Parameters +The contract to check. + #### Type ```ts -let args: { - chain: Readonly; - client: ThirdwebClient; - contractAddress: string; - includeOwners?: boolean; - queryOptions?: { - chain?: unknown; - include_owners?: "false" | "true"; - }; - tokenId: string | number | bigint; -}; +let contract: Readonly>; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: Promise; ``` + +A promise that resolves to a boolean indicating whether the contract is deployed or not. --- -## getOwnedNFTs +## resolveImplementation -Get NFTs owned by an address +Resolves the implementation address and bytecode for a given proxy contract. ### Example ```ts -import { Insight } from "thirdweb"; - -const nfts = await Insight.getOwnedNFTs({ - client, - chains: [sepolia], - ownerAddress: "0x1234567890123456789012345678901234567890", -}); +import { resolveImplementation } from "thirdweb"; +const implementation = await resolveImplementation(contract); ``` ```ts -function getOwnedNFTs(args: { - chains: Array>; - client: ThirdwebClient; - includeMetadata?: boolean; - ownerAddress: string; - queryOptions?: Omit< - { - chain?: unknown; - limit?: number; - owner_address: string; - page?: null | number; - }, - "chain" | "owner_address" - >; -}): Promise>; +function resolveImplementation( + contract: Readonly>, +): Promise<{ address: string; bytecode: Hex }>; ``` ### Parameters +The contract to resolve the implementation for. + #### Type ```ts -let args: { - chains: Array>; - client: ThirdwebClient; - includeMetadata?: boolean; - ownerAddress: string; - queryOptions?: Omit< - { - chain?: unknown; - limit?: number; - owner_address: string; - page?: null | number; - }, - "chain" | "owner_address" - >; -}; +let contract: Readonly>; ``` ### Returns ```ts -let returnType: - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - tokenAddress: string; - tokenURI: string; - type: "ERC721"; - } - | { - chainId: number; - id: bigint; - metadata: NFTMetadata; - owner: string | null; - supply: bigint; - tokenAddress: string; - tokenURI: string; - type: "ERC1155"; - }; +let returnType: ox__Hex.Hex; ``` + +A promise that resolves to an object containing the implementation address and bytecode. +--- +# Transactions --- -## getOwnedTokens +## 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. -Get ERC20 tokens owned by an address +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 { Insight } from "thirdweb"; +import { getApprovalForTransaction } from "thirdweb/extensions/erc20"; +import { sendAndConfirmTransaction } from "thirdweb"; -const tokens = await Insight.getOwnedTokens({ - client, - chains: [sepolia], - ownerAddress: "0x1234567890123456789012345678901234567890", -}); +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 getOwnedTokens(args: { - chains: Array>; - client: ThirdwebClient; - ownerAddress: string; - queryOptions?: { - chain?: unknown; - include_spam?: "false" | "true"; - limit?: number; - metadata?: "false" | "true"; - page?: null | number; - }; -}): Promise>; +function getApprovalForTransaction( + options: GetApprovalForTransactionParams, +): Promise; ``` ### Parameters +GetApprovalForTransactionParams + #### Type ```ts -let args: { - chains: Array>; - client: ThirdwebClient; - ownerAddress: string; - queryOptions?: { - chain?: unknown; - include_spam?: "false" | "true"; - limit?: number; - metadata?: "false" | "true"; - page?: null | number; - }; -}; +let options: { account: Account; transaction: PreparedTransaction }; ``` ### Returns ```ts -let returnType: { - chainId: number; - decimals: number; - displayValue: string; - name: string; - symbol: string; - tokenAddress: string; - value: bigint; +let returnType: Readonly & { + __contract?: ThirdwebContract; + __preparedMethod?: () => Promise>; }; ``` + +a PreparedTransaction --- -## getTransactions +## createContractQuery -Get transactions for a wallet +Creates a `useQuery` hook for a contract call. ### Example -```ts -import { Insight } from "thirdweb"; - -const transactions = await Insight.getTransactions({ - client, - walletAddress: "0x1234567890123456789012345678901234567890", - chains: [sepolia], -}); +```jsx +import { createContractQuery } from "thirdweb/react"; +import { totalSupply } from "thirdweb/extensions/erc20"; +const useTotalSupply = createContractQuery(totalSupply); +const { data, isLoading } = useTotalSupply({ contract }); ``` ```ts -function getTransactions(args: { - chains: Array>; - client: ThirdwebClient; - queryOptions?: { - aggregate?: unknown; - chain?: unknown; - decode?: null | boolean; - filter_block_hash?: string; - filter_block_number?: null | number; - filter_block_number_gt?: null | number; - filter_block_number_gte?: null | number; - filter_block_number_lt?: null | number; - filter_block_number_lte?: null | number; - filter_block_timestamp?: null | number; - filter_block_timestamp_gt?: null | number; - filter_block_timestamp_gte?: null | number; - filter_block_timestamp_lt?: null | number; - filter_block_timestamp_lte?: null | number; - filter_function_selector?: string; - filter_gas?: null | number; - filter_gas_gt?: null | number; - filter_gas_gte?: null | number; - filter_gas_lt?: null | number; - filter_gas_lte?: null | number; - filter_gas_price?: null | number; - filter_gas_price_gt?: null | number; - filter_gas_price_gte?: null | number; - filter_gas_price_lt?: null | number; - filter_gas_price_lte?: null | number; - filter_hash?: string; - filter_transaction_index?: null | number; - filter_transaction_index_gt?: null | number; - filter_transaction_index_gte?: null | number; - filter_transaction_index_lt?: null | number; - filter_transaction_index_lte?: null | number; - filter_value?: null | number; - filter_value_gt?: null | number; - filter_value_gte?: null | number; - filter_value_lt?: null | number; - filter_value_lte?: null | number; - group_by?: unknown; - limit?: number; - page?: null | number; - sort_by?: string; - sort_order?: "asc" | "desc"; - }; - walletAddress: string; -}): Promise< - Array<{ - access_list_json?: string; - blob_gas_price?: number; - blob_gas_used?: number; - block_hash: string; - block_number: string; - block_timestamp: string; - chain_id: number; - contract_address?: string; - cumulative_gas_used?: number; - data: string; - decoded?: { inputs?: {}; name: string; signature: string }; - decodedData?: { inputs?: {}; name: string; signature: string }; - effective_gas_price?: number; - from_address: string; - function_selector: string; - gas: number; - gas_price: number; - gas_used?: number; - hash: string; - logs_bloom?: string; - max_fee_per_gas: number; - max_priority_fee_per_gas: number; - nonce: number; - r: number; - s: number; - status?: number; - to_address: string; - transaction_index: number; - transaction_type: number; - v: number; - value: number; - }> ->; +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 args: { - chains: Array>; - client: ThirdwebClient; - queryOptions?: { - aggregate?: unknown; - chain?: unknown; - decode?: null | boolean; - filter_block_hash?: string; - filter_block_number?: null | number; - filter_block_number_gt?: null | number; - filter_block_number_gte?: null | number; - filter_block_number_lt?: null | number; - filter_block_number_lte?: null | number; - filter_block_timestamp?: null | number; - filter_block_timestamp_gt?: null | number; - filter_block_timestamp_gte?: null | number; - filter_block_timestamp_lt?: null | number; - filter_block_timestamp_lte?: null | number; - filter_function_selector?: string; - filter_gas?: null | number; - filter_gas_gt?: null | number; - filter_gas_gte?: null | number; - filter_gas_lt?: null | number; - filter_gas_lte?: null | number; - filter_gas_price?: null | number; - filter_gas_price_gt?: null | number; - filter_gas_price_gte?: null | number; - filter_gas_price_lt?: null | number; - filter_gas_price_lte?: null | number; - filter_hash?: string; - filter_transaction_index?: null | number; - filter_transaction_index_gt?: null | number; - filter_transaction_index_gte?: null | number; - filter_transaction_index_lt?: null | number; - filter_transaction_index_lte?: null | number; - filter_value?: null | number; - filter_value_gt?: null | number; - filter_value_gte?: null | number; - filter_value_lt?: null | number; - filter_value_lte?: null | number; - group_by?: unknown; - limit?: number; - page?: null | number; - sort_by?: string; - sort_order?: "asc" | "desc"; - }; - walletAddress: string; -}; +let readCall: ( + options: BaseTransactionOptions, +) => Promise; ``` ### Returns ```ts -let returnType: Promise< - Array<{ - access_list_json?: string; - blob_gas_price?: number; - blob_gas_used?: number; - block_hash: string; - block_number: string; - block_timestamp: string; - chain_id: number; - contract_address?: string; - cumulative_gas_used?: number; - data: string; - decoded?: { inputs?: {}; name: string; signature: string }; - decodedData?: { inputs?: {}; name: string; signature: string }; - effective_gas_price?: number; - from_address: string; - function_selector: string; - gas: number; - gas_price: number; - gas_used?: number; - hash: string; - logs_bloom?: string; - max_fee_per_gas: number; - max_priority_fee_per_gas: number; - nonce: number; - r: number; - s: number; - status?: number; - to_address: string; - transaction_index: number; - transaction_type: number; - v: number; - value: number; - }> ->; -``` ---- -# Engine ---- - -## getTransactionStatus - -Get the execution status of a transaction. - -### Example - -```ts -import { Engine } from "thirdweb"; - -const executionResult = await Engine.getTransactionStatus({ - client, - transactionId, -}); -console.log(executionResult.status); +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 getTransactionStatus(args: { - client: ThirdwebClient; - transactionId: string; -}): Promise; +function encode( + transaction: PreparedTransaction, +): Promise; ``` ### Parameters -The arguments for the transaction. +The transaction object to encode. #### Type ```ts -let args: { client: ThirdwebClient; transactionId: string }; +let transaction: PreparedTransaction; ``` ### Returns ```ts -let returnType: Prettify< - ExecutionResult4337Serialized & { - cancelledAt: string | null; - chain: Chain; - confirmedAt: string | null; - createdAt: string; - from: string | undefined; - id: string; - } ->; +let returnType: ox__Hex.Hex; ``` ---- -## ServerWallet - -```ts -type ServerWallet = Account & { - enqueueTransaction: (args: { - simulate?: boolean; - transaction: PreparedTransaction; - }) => Promise<{ transactionId: string }>; -}; -``` +A promise that resolves to the encoded data as a hexadecimal string. --- -## waitForTransactionHash +## estimateGas -Wait for a transaction to be submitted onchain and return the transaction hash. +Estimates the gas required to execute a transaction. The gas is returned as a `bigint` and in gwei units. ### Example ```ts -import { Engine } from "thirdweb"; - -const { transactionHash } = await Engine.waitForTransactionHash({ - client, - transactionId, // the transaction id returned from enqueueTransaction +import { estimateGas } from "thirdweb"; +const gas = await estimateGas({ + transaction, + from: "0x...", }); ``` ```ts -function waitForTransactionHash(args: { - client: ThirdwebClient; - timeoutInSeconds?: number; - transactionId: string; -}): Promise<{ - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}>; +function estimateGas( + options: EstimateGasOptions, +): Promise; ``` ### Parameters -The arguments for the transaction. +The options for estimating gas. #### Type ```ts -let args: { - client: ThirdwebClient; - timeoutInSeconds?: number; - transactionId: string; -}; +let options: Prettify< + { transaction: PreparedTransaction } & ( + | { account: Account; from?: never } + | { account?: never; from?: string | Account } + ) +>; ``` ### Returns ```ts -let returnType: Promise<{ - chain: Readonly; - client: ThirdwebClient; - maxBlocksWaitTime?: number; - readonly transactionHash: `0x${string}`; -}>; +let returnType: bigint; ``` ---- -# Nebula + +A promise that resolves to the estimated gas as a bigint. --- -## chat +## estimateGasCost -Chat with Nebula. +Estimate the gas cost of a transaction in ether and wei. ### Example ```ts -import { Nebula } from "thirdweb/ai"; +import { estimateGasCost } from "thirdweb"; -const response = await Nebula.chat({ - client: TEST_CLIENT, - message: - "What's the symbol of this contract: 0xe2cb0eb5147b42095c2FfA6F7ec953bb0bE347D8", - contextFilter: { - chains: [sepolia], - }, -}); +const gasCost = await estimateGasCost({ transaction }); ``` -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], - }, -}); +function estimateGasCost( + options: EstimateGasOptions, +): Promise; ``` -Extracting and sending transactions from a chat response: +### Parameters + +#### Type ```ts -const response = await Nebula.chat({ ... }); -const transactions = response.transactions; -for (const transaction of transactions) { - await sendTransaction({ transaction, account }); -} +let options: Prettify< + { transaction: PreparedTransaction } & ( + | { account: Account; from?: never } + | { account?: never; from?: string | Account } + ) +>; ``` +### Returns + ```ts -function chat(input: Input): Promise; +let returnType: { ether: string; wei: bigint }; ``` +--- -### Parameters +## prepareContractCall -The input for the chat. +Prepares a contract call by resolving the ABI function, parameters and encoded data. Optionally specify other properties such as value or gas price. -#### Type +### Example + +#### Usage with a human-readable method signature: ```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 } -); +import { prepareContractCall } from "thirdweb"; + +const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [to, value], +}); ``` -### Returns +#### Usage with explicit gas price and/or value: ```ts -let returnType: { - message: string; - sessionId: string; - transactions: Array; -}; +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"), +}); ``` -The chat response. This API is in early access and might change in the future. ---- +#### Usage with ERC20 value: -## execute +For transactions that transfer ERC20 tokens, you can specify the value as the amount of tokens to transfer. -Execute a transaction based on a prompt. +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. -### Example +This value will also be read by the react hooks and UI components to present to total cost to the user. ```ts -import { Nebula } from "thirdweb/ai"; +import { prepareContractCall } from "thirdweb"; +import { toWei } from "thirdweb/utils"; -const wallet = createWallet("io.metamask"); -const account = wallet.connect({ client }); +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 result = await Nebula.execute({ - client, - account, // transactions will be sent from this account - message: "send 0.0001 ETH to vitalik.eth", - contextFilter: { - chains: [sepolia], +const transaction = prepareContractCall({ + contract, + method: { + name: "transfer", + type: "function", + inputs: [ + { name: "to", type: "address" }, + { name: "value", type: "uint256" }, + ], + outputs: [], + stateMutability: "payable", }, + params: [to, value], }); ``` -Multi message prompt: +#### Usage with the ABI defined on the contract: ```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], - }, +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 -function execute( - input: Input & { account: Account }, -): Promise; +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 input for the transaction. +The options for preparing the contract call. #### Type ```ts -let input: Input & { account: Account }; +let options: PrepareContractCallOptions< + TAbi, + TMethod, + TPreparedMethod +>; ``` ### Returns ```ts -let returnType: Promise; +let returnType: PreparedTransaction< + TAbi, + ParseMethod, + PrepareTransactionOptions +>; ``` -The transaction hash. This API is in early access and might change in the future. ---- -# Social API +A promise that resolves to the prepared transaction. --- -## getSocialProfiles +## prepareTransaction -Fetches the wallet's available social profiles. +Prepares a transaction with the given options. ### Example ```ts -import { getSocialProfiles } from "thirdweb/social"; -const profiles = await getSocialProfiles({ - address: "0x...", - client, +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 getSocialProfiles(args: { - address: string; - client: ThirdwebClient; -}): Promise>; +function prepareTransaction( + options: PrepareTransactionOptions, + info?: Additional, +): PreparedTransaction; ``` ### Parameters -The arguments to use when fetching the social profiles. +The options for preparing the transaction. #### Type ```ts -let args: { address: string; client: ThirdwebClient }; +let options: { + chain: Chain; + client: ThirdwebClient; +} & PromisedObject< + Omit +>; +``` + +Additional information about the ABI function. + +#### Type + +```ts +let info: Additional; ``` ### Returns ```ts -let returnType: { - avatar?: string; - bio?: string; - metadata?: FarcasterProfile | LensProfile | EnsProfile; - name?: string; - type: "farcaster" | "lens" | "ens"; -}; +let returnType: PreparedTransaction< + abi, + abiFn, + PrepareTransactionOptions +>; ``` -A promise resolving to the array of social profiles for the given address. ---- -# Auth +The prepared transaction. --- -## createAuth +## readContract -Creates an authentication object with the given options. +#### 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 { 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 +import { getContract } from "thirdweb"; +import { sepolia } from "thirdweb/chains"; +import { useReadContract } from "thirdweb/react"; -// 3. verify the login payload that the client sends back later -const verifiedPayload = await auth.verifyPayload({ payload: loginPayload, signature: '0x123...' }); +const contract = getContract({ + client, + address: "0x...", + chain: sepolia, +}); -// 4. generate a JWT for the client -const jwt = await auth.generateJWT({ payload: verifiedPayload }); +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"; -// 5. set the JWT as a cookie or otherwise provide it to the client +const contract = getContract({ + client, + address: "0x...", + chain: sepolia, +}); -// 6. authenticate the client based on the JWT on subsequent calls - const { valid, parsedJWT } = await auth.verifyJWT({ jwt }); +const { data, isLoading } = useReadContract({ + contract, + method: resolveMethod("tokenURI"), + params: [1n], +}); ``` ```ts -function createAuth(options: AuthOptions): { - generateJWT: (params: GenerateJWTParams) => Promise; - generatePayload: ( - __namedParameters: GenerateLoginPayloadParams, - ) => Promise; - verifyJWT: (params: VerifyJWTParams) => Promise; - verifyPayload: ( - __namedParameters: VerifyLoginPayloadParams, - ) => Promise; -}; +function readContract( + options: ReadContractOptions, +): Promise>; ``` ### Parameters -The options for creating the authentication object. +The transaction options. #### 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; - }; -}; +let options: ReadContractOptions; ``` ### Returns ```ts -let returnType: { - generateJWT: (params: GenerateJWTParams) => Promise; - generatePayload: ( - __namedParameters: GenerateLoginPayloadParams, - ) => Promise; - verifyJWT: (params: VerifyJWTParams) => Promise; - verifyPayload: ( - __namedParameters: VerifyLoginPayloadParams, - ) => Promise; -}; +let returnType: outputs extends { length: 0 } + ? never + : outputs extends { length: 1 } + ? AbiParametersToPrimitiveTypes[0] + : AbiParametersToPrimitiveTypes; ``` -The created authentication object. +A promise that resolves with the result of the read call. --- -## isErc6492Signature +## sendAndConfirmTransaction -Determines if a signature is compatible with [ERC6492](https://eips.ethereum.org/EIPS/eip-6492) +Sends a transaction using the provided wallet. ### Example +#### Basic usage + ```ts -import { isErc6492Signature } from "thirdweb/auth"; +import { sendAndConfirmTransaction } from "thirdweb"; -const isErc6492 = isErc6492Signature( - "0x1234567890123456789012345678901234567890", -); +const transactionReceipt = await sendAndConfirmTransaction({ + account, + transaction, +}); ``` +#### Gasless usage with [thirdweb Engine](https://portal.thirdweb.com/engine) + ```ts -function isErc6492Signature(signature: `0x${string}`): boolean; +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 signature to check for ERC6492 compatibility +The options for sending the transaction. #### Type ```ts -let signature: `0x${string}`; +let options: { + account: Account; + gasless: GaslessOptions; + transaction: PreparedTransaction; +}; ``` ### Returns ```ts -let returnType: boolean; +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; +}; ``` -True if the signature is compatible with ERC6492, false otherwise +A promise that resolves to the confirmed transaction receipt. --- -## parseErc6492Signature +## sendBatchTransaction -Parses a serialized (Hex) [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492) signature. If the signature is not in ERC-6492 format, the original signature is returned. +Sends a batch transaction using the provided options. ### Example ```ts -import { parseErc6492Signature } from "thirdweb/auth"; +import { sendBatchTransaction } from "thirdweb"; -const parsedSignature = parseErc6492Signature( - "0x1234567890123456789012345678901234567890", -); +const waitForReceiptOptions = await sendBatchTransaction({ + account, + transactions, +}); ``` ```ts -function parseErc6492Signature( - signature: `0x${string}`, -): ParseErc6492SignatureReturnType; +function sendBatchTransaction( + options: SendBatchTransactionOptions, +): Promise; ``` ### Parameters -The signature to parse +The options for sending the batch transaction. #### Type ```ts -let signature: `0x${string}`; +let options: { + account: Account; + transactions: Array; +}; ``` ### Returns ```ts -let returnType: OneOf; +let returnType: Prettify< + SendTransactionResult & { + chain: Chain; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + } +>; ``` -ParseErc6492SignatureReturnType The parsed (or original) signature +A promise that resolves to the options for waiting for the receipt of the first transaction in the batch. --- -## serializeErc6492Signature +## sendTransaction -Serializes a signature for use with [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492). The signature must be generated by a signer for an [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) Account Factory account with counterfactual deployment addresses. +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 { serializeErc6492Signature } from "thirdweb/auth"; +import { + sendTransaction, + getContract, + prepareContractCall, +} from "thirdweb"; +import { sepolia } from "thirdweb/chains"; -const serializedSignature = serializeErc6492Signature({ +const contract = getContract({ address: "0x...", - data: "0x...", - signature: "0x...", + chain: sepolia, + client, +}); + +const transaction = prepareContractCall({ + contract, + method: "function transfer(address to, uint256 value)", + params: [to, value], +}); + +const { transactionHash } = await sendTransaction({ + account, + transaction, }); -// 0x000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492 ``` +#### Using a write extension + ```ts -function serializeErc6492Signature( - __namedParameters: Erc6492Signature, -): `0x${string}`; +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, +}); ``` -### Parameters - -#### Type +#### Using a prepared transaction ```ts -let __namedParameters: { address: string; data: Hex; signature: Hex }; +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, +}); ``` -### Returns +#### Send an EIP-7702 Transaction + +_Note: This feature is in beta and is subject to breaking changes_ ```ts -let returnType: `0x${string}`; +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, +}); ``` -The serialized signature ---- - -## signLoginPayload +#### Gasless usage with [thirdweb Engine](https://portal.thirdweb.com/engine) -Signs the login payload using the provided account. +```ts +const { transactionHash } = await sendTransaction({ + account, + transaction, + gasless: { + provider: "engine", + relayerUrl: + "https://thirdweb.engine-***.thirdweb.com/relayer/***", + relayerForwarderAddress: "0x...", + }, +}); +``` -### Example +#### Gasless usage with OpenZeppelin ```ts -import { signLoginPayload } from "thirdweb/auth"; - -const { signature, payload } = await signLoginPayload({ - payload: loginPayload, - account: account, +const { transactionHash } = await sendTransaction({ + account, + transaction, + gasless: { + provider: "openzeppelin", + relayerUrl: "https://...", + relayerForwarderAddress: "0x...", + }, }); ``` ```ts -function signLoginPayload( - options: SignLoginPayloadParams, -): Promise<{ payload: LoginPayload; signature: `0x${string}` }>; +function sendTransaction( + options: SendTransactionOptions, +): Promise; ``` ### Parameters -The options for signing the login payload. +The options for sending the transaction. #### Type ```ts -let options: { account: Account; payload: LoginPayload }; +let options: { + account: Account; + gasless: GaslessOptions; + transaction: PreparedTransaction; +}; ``` ### 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; -}; +let returnType: Prettify< + SendTransactionResult & { + chain: Chain; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + } +>; ``` -An object containing the signature and the payload. +A promise that resolves to the transaction result. --- -## verifyContractWalletSignature +## serializeTransaction -Verifies a contract wallet signature using [ERC-6942](https://eips.ethereum.org/EIPS/eip-6942) Signature Validation for Predeploy Contracts. This function will validate signatures for both deployed and undeployed smart accounts of all signature types. +Serializes a legacy, EIP-1559, EIP-2930, EIP-4844, or EIP-7702 transaction object. ### Example ```ts -import { verifyContractWalletSignature } from 'thirdweb/auth'; +import { serializeTransaction } from "thirdweb"; -const isValid = await verifyContractWalletSignature({ - message: '0x..', - signature: '0x..', - address: '0x...', - chain: ..., - client: ..., +const serializedTransaction = serializeTransaction({ + transaction: { + to: "0x", + value: 0n, + }, }); ``` ```ts -function verifyContractWalletSignature(__namedParameters: { - accountFactory?: { - address: string; - verificationCalldata: `0x${string}`; - }; - address: string; - chain: Readonly; - client: ThirdwebClient; - message: Message; - signature: string | Uint8Array; -}): Promise; +function serializeTransaction( + options: SerializeTransactionOptions, +): Hex; ``` ### Parameters +The serialization options. + #### Type ```ts -let __namedParameters: { - accountFactory?: { - address: string; - verificationCalldata: `0x${string}`; - }; - address: string; - chain: Readonly; - client: ThirdwebClient; - message: Message; - signature: string | Uint8Array; +let options: { + signature?: + | ox__Signature.Signature + | ox__Signature.Legacy; + transaction: SerializableTransaction; }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: ox__Hex.Hex; ``` -A boolean indicating whether the signature is valid. +The serialized transaction. --- -## verifyEOASignature - -Verifies the signature of a message using an Ethereum account's EOA (Externally Owned Account). - -### Example +## signAuthorization -```ts -import { verifyEOASignature } from "thirdweb/auth"; - -const isValid = await verifyEOASignature({ - message: "0x1234567890123456789012345678901234567890", - signature: "0x1234567890123456789012345678901234567890", - address: "0x1234567890123456789012345678901234567890", -}); -``` +Sign the given EIP-7702 authorization object. ```ts -function verifyEOASignature( - options: VerifyEOASignatureParams, -): Promise; +function signAuthorization(options: { + account: Account; + request: AuthorizationRequest; +}): Promise; ``` ### Parameters -The options for verifying the signature. +The options for `signAuthorization`Refer to the type [SignAuthorizationOptions](https://portal.thirdweb.com/references/typescript/v5/SignAuthorizationOptions) #### Type ```ts -let options: { - address: string; - message: string | Message; - signature: string | Uint8Array; -}; +let options: { account: Account; request: AuthorizationRequest }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: ox__Authorization.ListSigned[number]; ``` -A boolean indicating whether the signature is valid. ---- +The signed authorization object -## verifySignature +```ts +import { signAuthorization } from "thirdweb"; + +const authorization = await signAuthorization({ + request: { + address: "0x...", + chainId: 911867, + nonce: 100n, + }, + account: myAccount, +}); +``` +--- -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._ +## signTransaction -verifyContractWalletSignature +Signs a transaction to be sent to a node. ### Example ```ts -import { verifySignature } from "thirdweb/auth"; - -const isValid = await verifySignature({ - message: "Your message to sign", - signature: - "0x91db0222ec371a8c18d3b187a6d2e77789bffca1b96826ef6b8708e0d4a66c80312fc3ae95b8fbc147265abf539bb6f360152be61a0e1411d7f5771a599e769a1c", - address: "0xda9C7A86AeE76701FC1c23ae548e8E93Ba3e42A5", - client: thirdwebClient, - chain: chain, +import { signTransaction } from "thirdweb"; +signTransaction({ + transaction: { + ... + }, + privateKey: "0x...", }); ``` ```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; +function signTransaction(options: SignTransactionOptions): Hex; ``` ### Parameters -The options for signature verification. +The options for signing. #### 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); + privateKey: Hex; + transaction: SerializableTransaction; }; ``` ### Returns ```ts -let returnType: Promise; +let returnType: ox__Hex.Hex; ``` -A boolean indicating whether the signature is valid or not. +The signed transaction as a hex string --- -## verifyTypedData +## simulateTransaction -Verify am [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data signature. This function is interoperable with all wallet types (smart accounts or EOAs). +Simulates the execution of a transaction. ### 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!", - }, +import { simulateTransaction } from "thirdweb"; +const result = await simulateTransaction({ + transaction, }); ``` ```ts -function verifyTypedData( - __namedParameters: VerifyTypedDataParams, -): Promise; +function simulateTransaction( + options: SimulateOptions, +): Promise; ``` ### Parameters +The options for simulating the transaction. + #### Type ```ts -let __namedParameters: VerifyTypedDataParams; +let options: SimulateOptions; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Promise; ``` -A promise that resolves to `true` if the signature is valid, or `false` otherwise. +A promise that resolves to the result of the simulation. --- -## decodeJWT +## toSerializableTransaction -Decodes a JSON Web Token (JWT) and returns the decoded payload and signature. +Converts a prepared transaction to a transaction with populated options. ### Example ```ts -import { decodeJWT } from "thirdweb/utils"; +import { + prepareTransaction, + toSerializableTransaction, +} from "thirdweb"; -const { payload, signature } = decodeJWT(jwt); +const transaction = await prepareTransaction({ + transaction: { + to: "0x...", + value: 100, + }, +}); +const finalTx = await toSerializableTransaction({ + transaction, +}); + +account.sendTransaction(finalTx); ``` ```ts -function decodeJWT(jwt: string): { - payload: JWTPayload; - signature: `0x${string}`; -}; +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 JWT string to decode. +The transaction and additional options for conversion #### Type ```ts -let jwt: string; +let options: { + from?: string | Account; + transaction: PreparedTransaction; +}; ``` ### Returns ```ts -let returnType: { payload: JWTPayload; signature: `0x${string}` }; +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; + } +>; ``` -An object containing the decoded payload and signature. +A serializable transaction for inspection or submission to an account. + +For easier transaction sending, sendTransaction --- -## encodeJWT +## waitForReceipt -Builds a JSON Web Token (JWT) using the provided options. +Waits for the transaction receipt of a given transaction hash on a specific contract. ### 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, +import { waitForReceipt } from "thirdweb"; +const receipt = await waitForReceipt({ + client, + chain, + transactionHash: "0x123...", }); ``` ```ts -function encodeJWT(options: EncodeJWTParams): Promise; +function waitForReceipt(options: { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; +}): Promise; ``` ### Parameters -The options for building the JWT. +The options for waiting for the receipt. By default, it's 100 blocks. #### Type ```ts -let options: EncodeJWTParams; +let options: { + chain: Readonly; + client: ThirdwebClient; + maxBlocksWaitTime?: number; + readonly transactionHash: `0x${string}`; +}; ``` ### Returns ```ts -let returnType: Promise; +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 generated JWT. +A promise that resolves with the transaction receipt. --- -## refreshJWT +## getTransactionStore -Refreshes a JSON Web Token (JWT) by encoding a new payload with updated expiration time. +Retrieve the transaction store for a given address. ### Example ```ts -import { refreshJWT } from "thirdweb/utils"; +import { getTransactionStore } from "thirdweb/transaction"; -const jwt = await refreshJWT({ - account, - jwt, - expirationTime: 1000 * 60 * 60, +const store = getTransactionStore("0x..."); +store.subscribe((transactions) => { + console.log(transactions); }); ``` ```ts -function refreshJWT(options: RefreshJWTParams): Promise; +function getTransactionStore( + address: string, +): Store>; ``` ### Parameters -The options for refreshing the JWT. +The address to retrieve the transaction store for. #### Type ```ts -let options: { - account: Account; - expirationTime?: number; - jwt: string; -}; +let address: string; ``` ### Returns ```ts -let returnType: Promise; +let returnType: Store>; ``` -A Promise that resolves to the refreshed JWT. +A store of transactions for the given account to subscribe to. --- -# NFT +# Nebula --- -## NFTDescription +## chat -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. +Chat with Nebula. ### 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"; +```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], + }, +}); ``` -#### 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 -; +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], + }, +}); ``` -You can also pass in your own custom (async) function that retrieves the description +Extracting and sending transactions from a chat response: -```tsx -const getDescription = async () => { - // ... - return description; -}; - -; +```ts +const response = await Nebula.chat({ ... }); +const transactions = response.transactions; +for (const transaction of transactions) { + await sendTransaction({ transaction, account }); +} ``` ```ts -function NFTDescription( - __namedParameters: NFTDescriptionProps, -): null | Element; +function chat(input: Input): Promise; ``` ### Parameters +The input for the chat. + #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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: null | Element; +let returnType: { + message: string; + sessionId: string; + transactions: Array; +}; ``` -A `` element containing the description of the NFT +The chat response. This API is in early access and might change in the future. --- -## NFTMedia +## execute -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. +Execute a transaction based on a prompt. ### Example -#### Basic usage - -```tsx -import { NFTProvider, NFTMedia } from "thirdweb/react"; +```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], + }, +}); ``` -#### Show a loading sign while the media is being fetched +Multi message prompt: -```tsx -import { NFTProvider, NFTMedia } from "thirdweb/react"; - - - } /> -; +```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], + }, +}); ``` -#### Show something in case the media failed to resolve - -```tsx -import { NFTProvider, NFTMedia } from "thirdweb/react"; - - - Failed to load media} /> -; +```ts +function execute( + input: Input & { account: Account }, +): Promise; ``` -#### Custom query options for useQuery (tanstack-query) +### Parameters -```tsx -import { NFTProvider, NFTMedia } from "thirdweb/react"; - - - -; -``` +The input for the transaction. -#### Basic stylings +#### Type -You can style NFTMedia with the `style` and `className` props. +```ts +let input: Input & { account: Account }; +``` -```tsx -; +### Returns + +```ts +let returnType: Promise; ``` -#### Override the media with the `mediaResolver` prop +The transaction hash. This API is in early access and might change in the future. +--- +# Social API +--- -If you already have the url, you can skip the network requests and pass it directly to the NFTMedia +## getSocialProfiles -```tsx -; -``` +Fetches the wallet's available social profiles. -You can also pass in your own custom (async) function that retrieves the media url +### Example -```tsx -const getMedia = async () => { - const url = getNFTMedia(props); - return url; -}; - -; +```ts +import { getSocialProfiles } from "thirdweb/social"; +const profiles = await getSocialProfiles({ + address: "0x...", + client, +}); ``` ```ts -function NFTMedia(__namedParameters: NFTMediaProps): null | Element; +function getSocialProfiles(args: { + address: string; + client: ThirdwebClient; +}): Promise>; ``` ### Parameters +The arguments to use when fetching the social profiles. + #### Type ```ts -let __namedParameters: Omit< - MediaRendererProps, - "src" | "poster" | "client" -> & { - fallbackComponent?: JSX.Element; - loadingComponent?: JSX.Element; - mediaResolver?: - | NFTMediaInfo - | (() => NFTMediaInfo) - | (() => Promise); - queryOptions?: Omit< - UseQueryOptions, - "queryFn" | "queryKey" - >; -}; +let args: { address: string; client: ThirdwebClient }; ``` ### Returns ```ts -let returnType: null | Element; +let returnType: { + avatar?: string; + bio?: string; + metadata?: FarcasterProfile | LensProfile | EnsProfile; + name?: string; + type: "farcaster" | "lens" | "ens"; +}; ``` -A MediaRenderer component +A promise resolving to the array of social profiles for the given address. +--- +# Auth --- -## NFTName +## createAuth -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. +Creates an authentication object with the given options. ### Example -#### Basic usage - -```tsx -import { NFTProvider, NFTName } from "thirdweb/react"; +```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 }); ``` -#### Show a loading sign while the name is being fetched - -```tsx -import { NFTProvider, NFTName } from "thirdweb/react"; - - - } /> -; +```ts +function createAuth(options: AuthOptions): { + generateJWT: ( + params: GenerateJWTParams, + ) => Promise; + generatePayload: ( + __namedParameters: GenerateLoginPayloadParams, + ) => Promise; + verifyJWT: (params: VerifyJWTParams) => Promise; + verifyPayload: ( + __namedParameters: VerifyLoginPayloadParams, + ) => Promise; +}; ``` -#### Show something in case the name failed to resolve +### Parameters -```tsx -import { NFTProvider, NFTName } from "thirdweb/react"; - - - Failed to load name} /> -; -``` +The options for creating the authentication object. -#### Custom query options for useQuery (tanstack-query) +#### Type -```tsx -import { NFTProvider, NFTName } from "thirdweb/react"; - - - -; +```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; + }; +}; ``` -#### 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 +### Returns -```tsx -; +```ts +let returnType: { + generateJWT: ( + params: GenerateJWTParams, + ) => Promise; + generatePayload: ( + __namedParameters: GenerateLoginPayloadParams, + ) => Promise; + verifyJWT: (params: VerifyJWTParams) => Promise; + verifyPayload: ( + __namedParameters: VerifyLoginPayloadParams, + ) => Promise; +}; ``` -You can also pass in your own custom (async) function that retrieves the name +The created authentication object. +--- -```tsx -const getName = async () => { - // ... - return name; -}; +## isErc6492Signature + +### Example + +```ts +import { isErc6492Signature } from "thirdweb/auth"; -; +const isErc6492 = isErc6492Signature( + "0x1234567890123456789012345678901234567890", +); ``` ```ts -function NFTName(__namedParameters: NFTNameProps): null | Element; +function isErc6492Signature(signature: `0x${string}`): boolean; ``` ### Parameters +The signature to check for ERC6492 compatibility + #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +let signature: `0x${string}`; ``` ### Returns ```ts -let returnType: null | Element; +let returnType: boolean; ``` -A `` element containing the name of the NFT ---- -# Buy Crypto +True if the signature is compatible with ERC6492, false otherwise --- -## convertCryptoToFiat - -Get a price of a token (using tokenAddress + chainId) in fiat. Only USD is supported at the moment. +## parseErc6492Signature ### 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, -}); +import { parseErc6492Signature } from "thirdweb/auth"; -// Result: `{ result: 3404.11 }` +const parsedSignature = parseErc6492Signature( + "0x1234567890123456789012345678901234567890", +); ``` ```ts -function convertCryptoToFiat( - options: ConvertCryptoToFiatParams, -): Promise<{ result: number }>; +function parseErc6492Signature( + signature: `0x${string}`, +): ParseErc6492SignatureReturnType; ``` ### Parameters +The signature to parse + #### Type ```ts -let options: { - chain: Chain; - client: ThirdwebClient; - fromAmount: number; - fromTokenAddress: Address; - to: SupportedFiatCurrency; -}; +let signature: `0x${string}`; ``` ### Returns ```ts -let returnType: Promise<{ result: number }>; +let returnType: OneOf; ``` -a number representing the price (in selected fiat) of "x" token, with "x" being the `fromAmount`. +ParseErc6492SignatureReturnType The parsed (or original) signature --- -## convertFiatToCrypto - -Convert a fiat value to a token. Currently only USD is supported. +## serializeErc6492Signature ### Example -#### Basic usage - ```ts -import { convertFiatToCrypto } from "thirdweb/pay"; +import { serializeErc6492Signature } from "thirdweb/auth"; -// 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, +const serializedSignature = serializeErc6492Signature({ + address: "0x...", + data: "0x...", + signature: "0x...", }); +// 0x000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492 ``` -Result: `{ result: 0.0000057 }` - ```ts -function convertFiatToCrypto( - options: ConvertFiatToCryptoParams, -): Promise<{ result: number }>; +function serializeErc6492Signature( + __namedParameters: Erc6492Signature, +): Hex; ``` ### Parameters @@ -52264,802 +48962,724 @@ function convertFiatToCrypto( #### Type ```ts -let options: { - chain: Chain; - client: ThirdwebClient; - from: SupportedFiatCurrency; - fromAmount: number; - to: Address; -}; +let __namedParameters: { address: string; data: Hex; signature: Hex }; ``` ### Returns ```ts -let returnType: Promise<{ result: number }>; +let returnType: ox__Hex.Hex; ``` ---- -## getBuyHistory +The serialized signature +--- -Get Buy transaction history for a given wallet address. +## signLoginPayload -This includes both "Buy with Cryto" and "Buy with Fiat" transactions +Signs the login payload using the provided account. ### Example ```ts -import { createThirdwebClient } from "thirdweb"; -import { getBuyHistory } from "thirdweb/pay"; - -const client = createThirdwebClient({ clientId: "..." }); +import { signLoginPayload } from "thirdweb/auth"; -const history = await getBuyHistory({ - client, - walletAddress: "0x...", +const { signature, payload } = await signLoginPayload({ + payload: loginPayload, + account: account, }); ``` ```ts -function getBuyHistory( - params: BuyHistoryParams, -): Promise; +function signLoginPayload( + options: SignLoginPayloadParams, +): Promise<{ payload: LoginPayload; signature: `0x${string}` }>; ``` ### Parameters -Object of type [BuyHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyHistoryParams) +The options for signing the login payload. #### Type ```ts -let params: { - client: ThirdwebClient; - count: number; - start: number; - walletAddress: string; -}; +let options: { account: Account; payload: LoginPayload }; ``` ### Returns ```ts let returnType: { - hasNextPage: boolean; - page: Array< - | { buyWithFiatStatus: BuyWithFiatStatus } - | { buyWithCryptoStatus: BuyWithCryptoStatus } - >; + 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; }; ``` ---- - -## getBuyWithCryptoHistory -Deprecated +An object containing the signature and the payload. +--- -Gets the History of purchases for a given wallet address +## verifyContractWalletSignature ### Example ```ts -import { createThirdwebClient } from "thirdweb"; -import { BuyWithCryptoHistoryData } from "thirdweb/pay"; - -const client = createThirdwebClient({ clientId: "..." }); -const walletAddress = "0x..."; -const params = { - client, - walletAddress, -}; +import { verifyContractWalletSignature } from 'thirdweb/auth'; -// grabs the history of purchase transactions for the wallet address -const status = await getBuyWithCryptoHistory(params); +const isValid = await verifyContractWalletSignature({ + message: '0x..', + signature: '0x..', + address: '0x...', + chain: ..., + client: ..., +}); ``` ```ts -function getBuyWithCryptoHistory( - params: BuyWithCryptoHistoryParams, -): Promise; +function verifyContractWalletSignature(__namedParameters: { + accountFactory?: { + address: string; + verificationCalldata: `0x${string}`; + }; + address: string; + chain: Readonly; + client: ThirdwebClient; + message: Message; + signature: string | Uint8Array; +}): Promise; ``` ### Parameters -Object of type [BuyWithCryptoHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryParams) - #### Type ```ts -let params: { +let __namedParameters: { + accountFactory?: { + address: string; + verificationCalldata: `0x${string}`; + }; + address: string; + chain: Readonly; client: ThirdwebClient; - count: number; - start: number; - walletAddress: string; + message: Message; + signature: string | Uint8Array; }; ``` ### Returns ```ts -let returnType: { - hasNextPage: boolean; - page: Array; -}; +let returnType: Promise; ``` -Object of type [BuyWithCryptoHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryData) +A boolean indicating whether the signature is valid. --- -## getBuyWithCryptoQuote - -Deprecated - -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. +## verifyEOASignature -Once you have the quote, you can use `prepareTransaction` and prepare the transaction for submission. +Verifies the signature of a message using an Ethereum account's EOA (Externally Owned Account). ### Example ```ts -import { getBuyWithCryptoQuote } from "thirdweb/pay"; +import { verifyEOASignature } from "thirdweb/auth"; -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 +const isValid = await verifyEOASignature({ + message: "0x1234567890123456789012345678901234567890", + signature: "0x1234567890123456789012345678901234567890", + address: "0x1234567890123456789012345678901234567890", }); ``` ```ts -function getBuyWithCryptoQuote( - params: GetBuyWithCryptoQuoteParams, -): Promise; +function verifyEOASignature( + options: VerifyEOASignatureParams, +): Promise; ``` ### Parameters -object of type [GetBuyWithCryptoQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoQuoteParams) +The options for verifying the signature. #### Type ```ts -let params: { - client: ThirdwebClient; - fromAddress: string; - fromChainId: number; - fromTokenAddress: string; - intentId?: string; - maxSlippageBPS?: number; - paymentLinkId?: string; - purchaseData?: object; - toAddress: string; - toChainId: number; - toTokenAddress: string; -} & ( - | { fromAmount: string; toAmount?: never } - | { fromAmount?: never; toAmount: string } -); +let options: { + address: string; + message: string | Message; + signature: string | Uint8Array; +}; ``` ### Returns ```ts -let returnType: { - approvalData?: QuoteApprovalInfo; - 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; -}; +let returnType: Promise; ``` -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. +A boolean indicating whether the signature is valid. --- -## getBuyWithCryptoStatus - -Deprecated +## verifySignature -use Bridge.status instead +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._ -Gets the status of a buy with crypto transaction +verifyContractWalletSignature ### 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); +import { verifySignature } from "thirdweb/auth"; -// keep polling the status of the quoted transaction until it returns a success or failure status -const status = await getBuyWithCryptoStatus({ - client, - transactionHash: swapTxResult.transactionHash, -}}); +const isValid = await verifySignature({ + message: "Your message to sign", + signature: + "0x91db0222ec371a8c18d3b187a6d2e77789bffca1b96826ef6b8708e0d4a66c80312fc3ae95b8fbc147265abf539bb6f360152be61a0e1411d7f5771a599e769a1c", + address: "0xda9C7A86AeE76701FC1c23ae548e8E93Ba3e42A5", + client: thirdwebClient, + chain: chain, +}); ``` ```ts -function getBuyWithCryptoStatus( - buyWithCryptoTransaction: BuyWithCryptoTransaction, -): Promise; +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 -Object of type [BuyWithCryptoTransaction](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransaction) +The options for signature verification. #### Type ```ts -let buyWithCryptoTransaction: { - chainId: number; - client: ThirdwebClient; - transactionHash: string; +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: - | { 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; - }; +let returnType: Promise; ``` -Object of type [BuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoStatus) +A boolean indicating whether the signature is valid or not. --- -## getBuyWithCryptoTransfer - -Deprecated - -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. +## verifyTypedData ### Example ```ts -import { getBuyWithCryptoTransfer } from "thirdweb/pay"; - -const transfer = await getBuyWithCryptoTransfer({ +import { verifyTypedData } from "thirdweb/utils"; +const isValid = await verifyTypedData({ + address: "0x...", + signature: "0x...", 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", + 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 getBuyWithCryptoTransfer( - params: GetBuyWithCryptoTransferParams, -): Promise; +function verifyTypedData( + __namedParameters: VerifyTypedDataParams, +): Promise; ``` ### Parameters -object of type [GetBuyWithCryptoTransferParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoTransferParams) - #### Type ```ts -let params: { - amount: string; - chainId: number; - client: ThirdwebClient; - feePayer?: "sender" | "receiver"; - fromAddress: string; - paymentLinkId?: string; - purchaseData?: object; - toAddress: string; - tokenAddress: string; -}; +let __namedParameters: VerifyTypedDataParams; ``` ### Returns ```ts -let returnType: { - approvalData?: QuoteApprovalInfo; - client: ThirdwebClient; - estimatedGasCostUSDCents: number; - fromAddress: string; - paymentToken: QuotePaymentToken; - processingFee: QuotePaymentToken; - toAddress: string; - transactionRequest: PrepareTransactionOptions; -}; +let returnType: Promise; ``` -Object of type [BuyWithCryptoTransfer](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) which contains the information about the transfer +A promise that resolves to `true` if the signature is valid, or `false` otherwise. --- -## getBuyWithFiatHistory - -Deprecated +## decodeJWT -Get the "Buy with fiat" transaction history for a given wallet address +Decodes a JSON Web Token (JWT) and returns the decoded payload and signature. ### Example ```ts -import { createThirdwebClient } from "thirdweb"; -import { getBuyWithFiatHistory } from "thirdweb/pay"; - -const client = createThirdwebClient({ clientId: "..." }); +import { decodeJWT } from "thirdweb/utils"; -// get the 10 latest "Buy with fiat" transactions dony by the wallet -const history = await getBuyWithFiatHistory({ - client: client, - walletAddress: "0x...", - start: 0, - count: 10, -}); +const { payload, signature } = decodeJWT(jwt); ``` ```ts -function getBuyWithFiatHistory( - params: BuyWithFiatHistoryParams, -): Promise; +function decodeJWT(jwt: string): { + payload: JWTPayload; + signature: `0x${string}`; +}; ``` ### Parameters -Object of type [BuyWithFiatHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryParams) +The JWT string to decode. #### Type ```ts -let params: { - client: ThirdwebClient; - count: number; - start: number; - walletAddress: string; -}; +let jwt: string; ``` ### Returns ```ts -let returnType: { - hasNextPage: boolean; - page: Array; -}; +let returnType: { payload: JWTPayload; signature: `0x${string}` }; ``` -Object of type [BuyWithFiatHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryData) +An object containing the decoded payload and signature. --- -## getBuyWithFiatQuote +## encodeJWT -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. +Builds a JSON Web Token (JWT) using the provided options. -#### Rendering the On-Ramp provider UI +### Example -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 +```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, +}); +``` -#### Determining the steps required +```ts +function encodeJWT(options: EncodeJWTParams): Promise; +``` -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. +### Parameters -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. +The options for building the JWT. -#### Polling for the status +#### Type -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. +```ts +let options: EncodeJWTParams; +``` -`getBuyWithFiatStatus` returns a status object of type [BuyWithFiatStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatStatus). +### Returns -* 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. +```ts +let returnType: Promise; +``` -#### Swap Process +The generated JWT. +--- -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). +## refreshJWT -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. +Refreshes a JSON Web Token (JWT) by encoding a new payload with updated expiration time. ### Example -Get a quote for buying 10 USDC on polygon chain (chainId: 137) with USD fiat currency: - ```ts -import { getBuyWithFiatQuote } from "thirdweb/pay"; +import { refreshJWT } from "thirdweb/utils"; -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) +const jwt = await refreshJWT({ + account, + jwt, + expirationTime: 1000 * 60 * 60, }); - -window.open(quote.onRampLink, "_blank"); ``` ```ts -function getBuyWithFiatQuote( - params: GetBuyWithFiatQuoteParams, -): Promise; +function refreshJWT(options: RefreshJWTParams): Promise; ``` ### Parameters -object of type [GetBuyWithFiatQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatQuoteParams) +The options for refreshing the JWT. #### Type ```ts -let params: { - client: ThirdwebClient; - fromAddress: string; - fromAmount?: string; - fromCurrencySymbol: CurrencyMeta["shorthand"]; - isTestMode?: boolean; - maxSlippageBPS?: number; - paymentLinkId?: string; - preferredProvider?: FiatProvider; - purchaseData?: object; - toAddress: string; - toAmount?: string; - toChainId: number; - toGasAmountWei?: string; - toTokenAddress: string; +let options: { + account: Account; + expirationTime?: number; + jwt: 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; - }; - intentId: string; - maxSlippageBPS: number; - onRampLink: string; - onRampToken: { - amount: string; - amountUSDCents: number; - amountWei: string; - token: PayTokenInfo; - }; - processingFees: Array<{ - amount: string; - amountUnits: string; - currencySymbol: string; - decimals: number; - feeType: "ON_RAMP" | "NETWORK"; - }>; - provider: FiatProvider; - routingToken?: { - amount: string; - amountUSDCents: number; - amountWei: string; - token: PayTokenInfo; - }; - toAddress: string; - toAmountMin: string; - toAmountMinWei: string; - toToken: PayTokenInfo; -}; +let returnType: Promise; ``` -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. +A Promise that resolves to the refreshed JWT. +--- +# NFT --- -## getBuyWithFiatStatus +## NFTDescription -Deprecated +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. -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` +### Example -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.. +#### Basic usage -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. +```tsx +import { NFTProvider, NFTDescription } from "thirdweb/react"; + + + +; +``` -##### When no swap is required +#### Show a loading sign while the description is being fetched -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. +```tsx +import { NFTProvider, NFTDescription } from "thirdweb/react"; + + + } /> +; +``` -#### When a swap is required +#### 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"; + + + +; +``` -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. +#### Override the description with the `descriptionResolver` prop -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). +If you already have the url, you can skip the network requests and pass it directly to the NFTDescription -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. +```tsx +; +``` -### Example +You can also pass in your own custom (async) function that retrieves the description -```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, -}); +```tsx +const getDescription = async () => { + // ... + return description; +}; -// when the fiatStatus.status is "ON_RAMP_TRANSFER_COMPLETED" - the process is complete +; ``` ```ts -function getBuyWithFiatStatus( - params: GetBuyWithFiatStatusParams, -): Promise; +function NFTDescription( + __namedParameters: NFTDescriptionProps, +): null | Element; ``` ### Parameters -Object of type [GetBuyWithFiatStatusParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatStatusParams) - #### Type ```ts -let params: { client: ThirdwebClient; intentId: string }; +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: - | { 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" - | "ON_RAMP_TRANSFER_COMPLETED"; - toAddress: string; - }; +let returnType: null | Element; ``` + +A `` element containing the description of the NFT --- -## getPostOnRampQuote +## NFTMedia -Deprecated +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. -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. +### Example -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. +#### Basic usage -`getPostOnRampQuote` function is used to get the quote for swapping the on-ramp token to destination token. +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; + + + +; +``` -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 +#### Show a loading sign while the media is being fetched -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. +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; + + + } /> +; +``` -### Example +#### Show something in case the media failed to resolve -```ts -import { - getPostOnRampQuote, - getBuyWithFiatStatus, -} from "thirdweb/pay"; +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; -// 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 + + Failed to load media} /> +; +``` + +#### Custom query options for useQuery (tanstack-query) + +```tsx +import { NFTProvider, NFTMedia } from "thirdweb/react"; -// when a swap is required after onramp -if (buyWithFiatStatus.status === "CRYPTO_SWAP_REQUIRED") { - const buyWithCryptoQuote = await getPostOnRampQuote({ - client, - buyWithFiatStatus, - }); -} + + +; +``` + +#### 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 getPostOnRampQuote( - params: GetPostOnRampQuoteParams, -): Promise; +function NFTMedia(__namedParameters: NFTMediaProps): null | Element; ``` ### Parameters -object of type [GetPostOnRampQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetPostOnRampQuoteParams) - #### Type ```ts -let params: { - buyWithFiatStatus: BuyWithFiatStatus; - client: ThirdwebClient; - paymentLinkId?: string; +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: { - approvalData?: QuoteApprovalInfo; - 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; -}; +let returnType: null | Element; ``` -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. +A MediaRenderer component --- -## isSwapRequiredPostOnramp +## NFTName -Deprecated +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. -Check if a Swap is required after on-ramp when buying a token with fiat currency. +### Example -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. +#### Basic usage -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. +```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 isSwapRequiredPostOnramp( - buyWithFiatQuote: Pick, -): boolean; +function NFTName(__namedParameters: NFTNameProps): null | Element; ``` ### 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" ->; +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: boolean; +let returnType: null | Element; ``` + +A `` element containing the name of the NFT --- # Tokens --- @@ -53138,7 +49758,7 @@ function TokenIcon(__namedParameters: TokenIconProps): null | Element; #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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 : "lazy" | "eager",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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -53248,7 +49868,7 @@ function TokenName(__namedParameters: TokenNameProps): null | Element; #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -53358,7 +49978,7 @@ function TokenSymbol( #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -53372,17 +49992,13 @@ let returnType: null | Element; ## download -Downloads a file from the specified IPFS, Arweave, or HTTP URI. - -`download` will parse the provided URI based on its scheme (ipfs://, ar://, https://) and convert it to a URL to fetch the file from thirdweb's storage service. - ### Example Download a file from IPFS: ```ts import { download } from "thirdweb/storage"; -import { createThirdwebClient } from "thirdweb"; +import { createThirdwebClient } from "@thirdweb-dev/sdk"; const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); @@ -53396,7 +50012,7 @@ Download a file from Arweave: ```ts import { download } from "thirdweb/storage"; -import { createThirdwebClient } from "thirdweb"; +import { createThirdwebClient } from "@thirdweb-dev/sdk"; const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); @@ -53410,7 +50026,7 @@ Download a file from HTTP: ```ts import { download } from "thirdweb/storage"; -import { createThirdwebClient } from "thirdweb"; +import { createThirdwebClient } from "@thirdweb-dev/sdk"; const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" }); @@ -53819,7 +50435,7 @@ function eth_call( blockTag?: BlockTag | undefined; stateOverrides?: StateOverride; }, -): Promise<`0x${string}`>; +): Promise; ``` ### Parameters @@ -53875,7 +50491,7 @@ let params: Partial & { ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: ox__Hex.Hex; ``` A promise that resolves to the result of the call or transaction. @@ -53969,12 +50585,209 @@ let request: EIP1193RequestFn< >; ``` -The transaction request object. +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 transactionRequest: RpcTransactionRequest; +let params: { address: string }; ``` ### Returns @@ -53983,23 +50796,26 @@ let transactionRequest: RpcTransactionRequest; let returnType: Promise; ``` -A promise that resolves to the estimated gas as a bigint. +A promise that resolves to the balance of the address in wei as bigint. --- -## eth\_gasPrice +## eth\_getBlockByHash -Retrieves the current gas price from the Ethereum network. +Retrieves a block by its hash. ### Example ```ts -import { getRpcClient, eth_gasPrice } from "thirdweb/rpc"; +import { getRpcClient, eth_getBlockByHash } from "thirdweb/rpc"; const rpcRequest = getRpcClient({ client, chain }); -const gasPrice = await eth_gasPrice(rpcRequest); +const block = await eth_getBlockByHash(rpcRequest, { + blockHash: "0x...", + includeTransactions: true, +}); ``` ```ts -function eth_gasPrice( +function eth_getBlockByHash( request: EIP1193RequestFn< [ { @@ -54029,7 +50845,8 @@ function eth_gasPrice( }, ] >, -): Promise; + params: GetBlockByHashParams, +): Promise>; ``` ### Parameters @@ -54070,31 +50887,42 @@ let request: EIP1193RequestFn< >; ``` +The parameters for the block retrieval. + +#### Type + +```ts +let params: GetBlockByHashParams; +``` + ### Returns ```ts -let returnType: Promise; +let returnType: Promise< + GetBlockReturnType +>; ``` -A promise that resolves to the gas price as a bigint. +A promise that resolves to the retrieved block. --- -## eth\_getBalance +## eth\_getBlockByNumber -Retrieves the balance of the specified Ethereum address. +Retrieves a block by its number or tag from the Ethereum blockchain. ### Example ```ts -import { getRpcClient, eth_getBalance } from "thirdweb/rpc"; +import { getRpcClient, eth_getBlockByNumber } from "thirdweb/rpc"; const rpcRequest = getRpcClient({ client, chain }); -const balance = await eth_getBalance(rpcRequest, { - address: "0x...", +const block = await eth_getBlockByNumber(rpcRequest, { + blockNumber: 123456, + includeTransactions: true, }); ``` ```ts -function eth_getBalance( +function eth_getBlockByNumber( request: EIP1193RequestFn< [ { @@ -54124,158 +50952,12 @@ function eth_getBalance( }, ] >, - 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<{ baseFeePerGas: null | bigint; blobGasUsed: bigint; difficulty: bigint; excessBlobGas: bigint; extraData: `0x${string}`; gasLimit: bigint; gasUsed: bigint; hash: `0x${string}`; logsBloom: `0x${string}`; miner: string; mixHash: `0x${string}`; nonce: `0x${string}`; number: bigint; parentBeaconBlockRoot?: `0x${string}`; parentHash: `0x${string}`; receiptsRoot: `0x${string}`; sealFields: Array<`0x${string}`>; sha3Uncles: `0x${string}`; size: bigint; stateRoot: `0x${string}`; timestamp: bigint; totalDifficulty: null | bigint; transactions: TIncludeTransactions extends true ? Array<({ accessList?: undefined; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId?: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "legacy"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity?: undefined }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip2930"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip1559"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes: readonly Array<`0x${string}`>; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip4844"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList: SignedAuthorizationList; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip7702"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number })> : Array<`0x${string}`>; transactionsRoot: `0x${string}`; uncles: Array<`0x${string}`>; withdrawals?: Array; withdrawalsRoot?: `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}`; - }, - ] + params: GetBlockParameters, +): Promise< + GetBlockReturnType >; ``` -The parameters for the block retrieval. - -#### Type - -```ts -let params: GetBlockByHashParams; -``` - -### Returns - -```ts -let returnType: Promise<{ baseFeePerGas: null | bigint; blobGasUsed: bigint; difficulty: bigint; excessBlobGas: bigint; extraData: `0x${string}`; gasLimit: bigint; gasUsed: bigint; hash: `0x${string}`; logsBloom: `0x${string}`; miner: string; mixHash: `0x${string}`; nonce: `0x${string}`; number: bigint; parentBeaconBlockRoot?: `0x${string}`; parentHash: `0x${string}`; receiptsRoot: `0x${string}`; sealFields: Array<`0x${string}`>; sha3Uncles: `0x${string}`; size: bigint; stateRoot: `0x${string}`; timestamp: bigint; totalDifficulty: null | bigint; transactions: TIncludeTransactions extends true ? Array<({ accessList?: undefined; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId?: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "legacy"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity?: undefined }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip2930"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip1559"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes: readonly Array<`0x${string}`>; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip4844"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList: SignedAuthorizationList; blobVersionedHashes?: undefined; blockHash: `0x${string}`; blockNumber: bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: number; type: "eip7702"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number })> : Array<`0x${string}`>; transactionsRoot: `0x${string}`; uncles: Array<`0x${string}`>; withdrawals?: Array; withdrawalsRoot?: `0x${string}` }> -``` - -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<{ baseFeePerGas: null | bigint; blobGasUsed: bigint; difficulty: bigint; excessBlobGas: bigint; extraData: `0x${string}`; gasLimit: bigint; gasUsed: bigint; hash: TBlockTag extends "pending" ? null : `0x${string}`; logsBloom: TBlockTag extends "pending" ? null : `0x${string}`; miner: string; mixHash: `0x${string}`; nonce: TBlockTag extends "pending" ? null : `0x${string}`; number: TBlockTag extends "pending" ? null : bigint; parentBeaconBlockRoot?: `0x${string}`; parentHash: `0x${string}`; receiptsRoot: `0x${string}`; sealFields: Array<`0x${string}`>; sha3Uncles: `0x${string}`; size: bigint; stateRoot: `0x${string}`; timestamp: bigint; totalDifficulty: null | bigint; transactions: TIncludeTransactions extends true ? Array<({ accessList?: undefined; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId?: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "legacy"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity?: undefined }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip2930"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip1559"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes: readonly Array<`0x${string}`>; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip4844"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList: SignedAuthorizationList; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip7702"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number })> : Array<`0x${string}`>; transactionsRoot: `0x${string}`; uncles: Array<`0x${string}`>; withdrawals?: Array; withdrawalsRoot?: `0x${string}` }> -``` - ### Parameters The EIP1193 request function. @@ -54325,7 +51007,9 @@ let params: GetBlockParameters; ### Returns ```ts -let returnType: Promise<{ baseFeePerGas: null | bigint; blobGasUsed: bigint; difficulty: bigint; excessBlobGas: bigint; extraData: `0x${string}`; gasLimit: bigint; gasUsed: bigint; hash: TBlockTag extends "pending" ? null : `0x${string}`; logsBloom: TBlockTag extends "pending" ? null : `0x${string}`; miner: string; mixHash: `0x${string}`; nonce: TBlockTag extends "pending" ? null : `0x${string}`; number: TBlockTag extends "pending" ? null : bigint; parentBeaconBlockRoot?: `0x${string}`; parentHash: `0x${string}`; receiptsRoot: `0x${string}`; sealFields: Array<`0x${string}`>; sha3Uncles: `0x${string}`; size: bigint; stateRoot: `0x${string}`; timestamp: bigint; totalDifficulty: null | bigint; transactions: TIncludeTransactions extends true ? Array<({ accessList?: undefined; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId?: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "legacy"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity?: undefined }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip2930"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip1559"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList?: undefined; blobVersionedHashes: readonly Array<`0x${string}`>; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip4844"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number }) | ({ accessList: AccessList; authorizationList: SignedAuthorizationList; blobVersionedHashes?: undefined; blockHash: TBlockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: TBlockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: string; gas: bigint; gasPrice?: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: null | string; transactionIndex: TBlockTag extends "pending" ? true : false extends true ? null : number; type: "eip7702"; typeHex: null | (`0x${string}`); v: bigint; value: bigint; yParity: number })> : Array<`0x${string}`>; transactionsRoot: `0x${string}`; uncles: Array<`0x${string}`>; withdrawals?: Array; withdrawalsRoot?: `0x${string}` }> +let returnType: Promise< + GetBlockReturnType +>; ``` A promise that resolves to the requested block. @@ -54377,7 +51061,7 @@ function eth_getCode( ] >, params: GetCodeParams, -): Promise<`0x${string}`>; +): Promise; ``` ### Parameters @@ -54429,7 +51113,7 @@ let params: GetCodeParams; ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: ox__Hex.Hex; ``` A promise that resolves to the bytecode of the smart contract. @@ -54588,7 +51272,7 @@ function eth_getStorageAt( ] >, params: GetStorageAtParams, -): Promise<`0x${string}`>; +): Promise; ``` ### Parameters @@ -54640,7 +51324,7 @@ let params: GetStorageAtParams; ### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: ox__Hex.Hex; ``` A promise that resolves to the value stored at the specified position. @@ -54744,9 +51428,7 @@ let params: GetTransactionByHashParameters; ### Returns ```ts -let returnType: NonNullable< - GetV1WalletsByWalletAddressTransactionsResponse["data"] ->[number]; +let returnType: Promise; ``` A promise that resolves to the transaction. @@ -55202,36 +51884,16 @@ const blockNumber = await rpcRequest({ ```ts function getRpcClient( - options: Readonly, -): 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}`; - }, - ] ->; + options: Readonly<{ + chain: Readonly; + client: ThirdwebClient; + config?: { + batchTimeoutMs?: number; + maxBatchSize?: number; + requestTimeoutMs?: number; + }; + }>, +): EIP1193RequestFn; ``` ### Parameters @@ -55241,41 +51903,21 @@ The RPC options. #### Type ```ts -let options: Readonly; +let options: Readonly<{ + chain: Readonly; + client: ThirdwebClient; + config?: { + batchTimeoutMs?: number; + maxBatchSize?: number; + requestTimeoutMs?: number; + }; +}>; ``` ### Returns ```ts -let returnType: 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}`; - }, - ] ->; +let returnType: EIP1193RequestFn; ``` The RPC request function. @@ -55543,7 +52185,7 @@ const token = getDefaultToken(ethereum, "USDC"); ```ts function getDefaultToken( - chain: Readonly, + chain: Readonly, symbol: | "WETH" | "USDT" @@ -55564,7 +52206,7 @@ The chain to get the token for #### Type ```ts -let chain: Readonly; +let chain: Readonly; ``` The symbol of the token to get @@ -55703,7 +52345,7 @@ console.log(hex); // "0x01" ``` ```ts -function boolToHex(value: boolean, opts: Options): `0x${string}`; +function boolToHex(value: boolean, opts: Options): Hex; ``` ### Parameters @@ -55727,7 +52369,7 @@ let opts: Options; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The hexadecimal string representation of the boolean value. @@ -55748,7 +52390,7 @@ console.log(bigInt); // 420n ```ts function bytesToBigInt( - bytes: Uint8Array, + bytes: Uint8Array, opts: BytesToBigIntOpts, ): bigint; ``` @@ -55760,7 +52402,7 @@ The Uint8Array of bytes to convert. #### Type ```ts -let bytes: Uint8Array; +let bytes: Uint8Array; ``` Optional parameters for the conversion. @@ -55794,7 +52436,10 @@ console.log(bool); // true ``` ```ts -function bytesToBool(bytes_: Uint8Array, opts: Options): boolean; +function bytesToBool( + bytes_: Uint8Array, + opts: Options, +): boolean; ``` ### Parameters @@ -55804,7 +52449,7 @@ The byte array to convert. #### Type ```ts -let bytes_: Uint8Array; +let bytes_: Uint8Array; ``` Optional parameters for the conversion. @@ -55839,7 +52484,7 @@ console.log(number); // 420 ```ts function bytesToNumber( - bytes: Uint8Array, + bytes: Uint8Array, opts: BytesToBigIntOpts, ): number; ``` @@ -55851,7 +52496,7 @@ The Uint8Array of bytes to convert. #### Type ```ts -let bytes: Uint8Array; +let bytes: Uint8Array; ``` Optional configuration options. @@ -55885,7 +52530,10 @@ console.log(string); // "Hello" ``` ```ts -function bytesToString(bytes_: Uint8Array, opts: Options): string; +function bytesToString( + bytes_: Uint8Array, + opts: Options, +): string; ``` ### Parameters @@ -55895,7 +52543,7 @@ The array of bytes to convert. #### Type ```ts -let bytes_: Uint8Array; +let bytes_: Uint8Array; ``` Optional parameters for the conversion. @@ -55920,7 +52568,7 @@ The resulting string. Concatenates an array of hexadecimal values into a single hexadecimal value. ```ts -function concatHex(values: readonly Array<`0x${string}`>) : `0x${string}` +function concatHex(values: readonly Array<`0x${string}`>) : Hex ``` ### Parameters @@ -55936,7 +52584,7 @@ let values: readonly Array<`0x${string}`> ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The concatenated hexadecimal value. @@ -55957,7 +52605,7 @@ console.log(number); // 420 ```ts function fromBytes( - bytes: Uint8Array, + bytes: Uint8Array, toOrOpts: FromBytesParameters, ): FromBytesReturnType; ``` @@ -55969,7 +52617,7 @@ The Uint8Array to convert. #### Type ```ts -let bytes: Uint8Array; +let bytes: Uint8Array; ``` The target type or conversion options. @@ -56084,7 +52732,7 @@ getAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"); ``` ```ts -function getAddress(address: string): `0x${string}`; +function getAddress(address: string): Address; ``` ### Parameters @@ -56590,10 +53238,7 @@ console.log(hex); // "0x1a4" ``` ```ts -function numberToHex( - value_: number | bigint, - opts: Options, -): `0x${string}`; +function numberToHex(value_: number | bigint, opts: Options): Hex; ``` ### Parameters @@ -56617,7 +53262,7 @@ let opts: Options; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The hexadecimal representation of the input value. @@ -56773,7 +53418,7 @@ console.log(hex); // "0x48656c6c6f2c20776f726c6421" ``` ```ts -function stringToHex(value_: string, opts: Options): `0x${string}`; +function stringToHex(value_: string, opts: Options): Hex; ``` ### Parameters @@ -56797,7 +53442,7 @@ let opts: Options; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The hexadecimal representation of the input string. @@ -56905,7 +53550,7 @@ function toHex( | boolean | Uint8Array, opts: ToHexParameters, -): `0x${string}`; +): Hex; ``` ### Parameters @@ -56934,7 +53579,7 @@ let opts: { size?: number }; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The hexadecimal representation of the value. @@ -57079,9 +53724,9 @@ console.log(hex); // "0x48656c6c6f2c20776f726c64" ```ts function uint8ArrayToHex( - value: Uint8Array, + value: Uint8Array, opts: Options, -): `0x${string}`; +): Hex; ``` ### Parameters @@ -57091,7 +53736,7 @@ The array of bytes to convert. #### Type ```ts -let value: Uint8Array; +let value: Uint8Array; ``` Optional parameters for the conversion. @@ -57105,7 +53750,7 @@ let opts: Options; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The hexadecimal string representation of the bytes. @@ -57125,7 +53770,7 @@ checksumAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"); ``` ```ts -function checksumAddress(address: string): `0x${string}`; +function checksumAddress(address: string): Address; ``` ### Parameters @@ -57203,7 +53848,7 @@ const error = await decodeError({ contract, data }); ```ts function decodeError(options: { - contract: Readonly>; + contract: Readonly>; data: `0x${string}`; }): Promise; ``` @@ -57216,7 +53861,7 @@ The options object. ```ts let options: { - contract: Readonly>; + contract: Readonly>; data: `0x${string}`; }; ``` @@ -57245,7 +53890,7 @@ const decodedData = await decodeFunctionData({ contract, data }); ```ts function decodeFunctionData(options: { - contract: Readonly>; + contract: Readonly>; data: `0x${string}`; }): Promise< ReturnType, undefined, AbiFunction>> @@ -57260,7 +53905,7 @@ The options object. ```ts let options: { - contract: Readonly>; + contract: Readonly>; data: `0x${string}`; }; ``` @@ -57291,7 +53936,7 @@ const result = await decodeFunctionResult({ contract, data }); ```ts function decodeFunctionResult(options: { - contract: Readonly>; + contract: Readonly>; data: `0x${string}`; }): Promise< ReturnType< @@ -57309,7 +53954,7 @@ The options object. ```ts let options: { - contract: Readonly>; + contract: Readonly>; data: `0x${string}`; }; ``` @@ -57348,7 +53993,7 @@ 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) : `0x${string}` +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 @@ -57372,7 +54017,7 @@ let values: TParams extends readonly Array ? {[key in string | num ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` * The encoded ABI parameters as a hexadecimal string. @@ -57393,7 +54038,7 @@ console.log(prefixedBytecode); ``` ```ts -function ensureBytecodePrefix(bytecode: string): `0x${string}`; +function ensureBytecodePrefix(bytecode: string): Hex; ``` ### Parameters @@ -57409,7 +54054,7 @@ let bytecode: string; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The bytecode with the correct prefix. @@ -57430,7 +54075,7 @@ console.log(ipfsHash); ``` ```ts -function extractIPFSUri(bytecode: string): undefined | string; +function extractIPFSUri(bytecode: string): string | undefined; ``` ### Parameters @@ -57446,7 +54091,7 @@ let bytecode: string; ### Returns ```ts -let returnType: undefined | string; +let returnType: string | undefined; ``` The IPFS URI if found, otherwise undefined. @@ -57468,7 +54113,7 @@ const implementationAddress = ```ts function extractMinimalProxyImplementationAddress( bytecode: string, -): undefined | string; +): string | undefined; ``` ### Parameters @@ -57484,7 +54129,7 @@ let bytecode: string; ### Returns ```ts -let returnType: undefined | string; +let returnType: string | undefined; ``` The implementation address as a string if a match is found, otherwise undefined. @@ -57625,7 +54270,7 @@ const initBytecodeWithSalt = getInitBytecodeWithSalt({ ```ts function getInitBytecodeWithSalt( options: GetInitiBytecodeWithSaltOptions, -): `0x${string}`; +): Hex; ``` ### Parameters @@ -57641,7 +54286,7 @@ let options: GetInitiBytecodeWithSaltOptions; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The initialization bytecode with salt. @@ -57659,7 +54304,7 @@ const saltHash = getSaltHash(bytecode); ``` ```ts -function getSaltHash(bytecode: string): `0x${string}`; +function getSaltHash(bytecode: string): Hex; ``` ### Parameters @@ -57675,7 +54320,7 @@ let bytecode: string; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The salt hash of the bytecode. @@ -57774,7 +54419,7 @@ const keccakId = keccackId(input); ``` ```ts -function keccakId(input: string): `0x${string}`; +function keccakId(input: string): Hex; ``` ### Parameters @@ -57790,7 +54435,7 @@ let input: string; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` The keccak ID as a Hex string. @@ -57919,142 +54564,488 @@ An array of type strings indicating the expected types of the values, following let constructorParamTypes: Array; ``` -An array of values to be converted according to the types. +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 +##### Type ```ts -let constructorParamValues: Array; +let options: { message: Message; privateKey: Hex }; ``` -### Returns +#### Returns ```ts -let returnType: Array; +let returnType: ox__Hex.Hex; ``` -* An array of values converted to their respective types. ---- +The signature as a hex string -## resolveSignature +### Signature#2 -Resolves a signature by converting a hexadecimal string into a function or event signature. +Signs a string message with a given account. -### Example +#### Example ```ts -import { resolveSignature } from "thirdweb/utils"; -const res = await resolveSignature("0x1f931c1c"); -console.log(res); +import { signMessage } from "thirdweb/utils"; +await signMessage({ + message: "Hello, world!", + account, +}); ``` ```ts -function resolveSignature( - hexSig: string, -): Promise<{ - event: null | `event ${string}`; - function: null | `function ${string}`; -}>; +function signMessage(options: { + account: Account; + message: Message; +}): Promise; ``` -### Parameters +#### Parameters -The hexadecimal signature to resolve. +The options for signing. -#### Type +##### Type ```ts -let hexSig: string; +let options: { account: Account; message: Message }; ``` -### Returns +#### Returns ```ts -let returnType: Promise<{ - event: null | `event ${string}`; - function: null | `function ${string}`; -}>; +let returnType: ox__Hex.Hex; ``` -A promise that resolves to an object containing the function and event signatures. +The signature as a hex string --- -## resolveSignatures +## signTypedData -Resolves the signatures of the given hexadecimal signatures. +Signs a typed data object with a given private key according to EIP712. ### Example ```ts -import { resolveSignatures } from "thirdweb/utils"; -const res = await resolveSignatures(["0x1f931c1c", "0x1f931c1c"]); -console.log(res); +import { signTypedData } from "thirdweb/utils"; +signTypedData({ + privateKey: "0x...", + ...typedData, +}); ``` ```ts -function resolveSignatures( - hexSigs: Array, -): Promise<{ - events: Array<`event ${string}`>; - functions: Array<`function ${string}`>; -}>; +function signTypedData( + options: SignTypedDataOptions, +): Hex; ``` ### Parameters -An array of hexadecimal signatures. +The typed data is passed within options alongside the private key #### Type ```ts -let hexSigs: Array; +let options: SignTypedDataOptions; ``` ### Returns ```ts -let returnType: Promise<{ - events: Array<`event ${string}`>; - functions: Array<`function ${string}`>; -}>; +let returnType: ox__Hex.Hex; ``` -A promise that resolves to an object containing the resolved functions and events. +The signature as a hex string --- -## shortenAddress +## stringify -Checksums and formats an address if valid. Note this function does not check if the provided address is an ENS. +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 { shortenAddress } from "thirdweb/utils"; - -shortenAddress("0xa0cf798816d4b9b9866b5330eea46a18382f251e"); -//=> '0xA0Cf...251e' +import { stringify } from "thirdweb/utils"; +const obj = { tokenId: 0n }; +const str = stringify(obj); // "{"tokenId":"0"}" ``` ```ts -function shortenAddress(address: string, length: number): string; +function stringify( + value: any, + replacer?: null | ((this: any, key: string, value: any) => any), + space?: string | number, +): string; ``` ### Parameters -The address to shorten. - #### Type ```ts -let address: string; +let value: any; ``` -The number of characters to keep from the start and end of the address. +#### Type + +```ts +let replacer: null | ((this: any, key: string, value: any) => any); +``` #### Type ```ts -let length: number; +let space: string | number; ``` ### Returns @@ -58063,511 +55054,901 @@ let length: number; let returnType: string; ``` -The shortened address. +An object with all bigint values converted to string +--- +# Miscellaneous --- -## shortenHex +## convertCryptoToFiat -Shortens a hexadecimal string without performing any validation or checksumming. +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 { shortenHex } from "thirdweb/utils"; +import { convertCryptoToFiat } from "thirdweb/pay"; -shortenHex("0xa0cf798816d4b9b9866b5330eea46a18382f251e"); -//=> '0xa0cf...251e' +// Get Ethereum price +const result = convertCryptoToFiat({ + fromTokenAddress: NATIVE_TOKEN_ADDRESS, + to: "USD", + chain: ethereum, + fromAmount: 1, +}); + +// Result: `{ result: 3404.11 }` ``` ```ts -function shortenHex(hex: string, length: number): string; +function convertCryptoToFiat( + options: ConvertCryptoToFiatParams, +): Promise<{ result: number }>; ``` ### Parameters -The hexadecimal string to shorten. - #### Type ```ts -let hex: string; +let options: { + chain: Chain; + client: ThirdwebClient; + fromAmount: number; + fromTokenAddress: Address; + to: SupportedFiatCurrency; +}; ``` -The number of characters to keep from the start and end of the string. +### 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 length: number; +let options: { + chain: Chain; + client: ThirdwebClient; + from: SupportedFiatCurrency; + fromAmount: number; + to: Address; +}; ``` ### Returns ```ts -let returnType: string; +let returnType: Promise<{ result: number }>; ``` - -The shortened hexadecimal string. --- -## shortenLargeNumber +## getBuyHistory -Shorten the string for large value Mainly used for Examples: 10\_000 -> 10k 1\_000\_000 -> 1M 1\_000\_000\_000 -> 1B +Get Buy transaction history for a given wallet address. + +This includes both "Buy with Cryto" and "Buy with Fiat" transactions ### Example ```ts -import { shortenLargeNumber } from "thirdweb/utils"; -const numStr = shortenLargeNumber(1_000_000_000); +import { createThirdwebClient } from "thirdweb"; +import { getBuyHistory } from "thirdweb/pay"; + +const client = createThirdwebClient({ clientId: "..." }); + +const history = await getBuyHistory({ + client, + walletAddress: "0x...", +}); ``` ```ts -function shortenLargeNumber(value: number): string; +function getBuyHistory( + params: BuyHistoryParams, +): Promise; ``` ### Parameters +Object of type [BuyHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyHistoryParams) + #### Type ```ts -let value: number; +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; ``` ### Returns ```ts -let returnType: string; +let returnType: { + hasNextPage: boolean; + page: Array< + | { buyWithFiatStatus: BuyWithFiatStatus } + | { buyWithCryptoStatus: BuyWithCryptoStatus } + >; +}; ``` --- -## sign +## getBuyWithCryptoHistory -Generates the signature for the provided transaction hash. +Gets the History of purchases for a given wallet address ### Example ```ts -import { sign } from "thirdweb/utils"; +import { createThirdwebClient } from "thirdweb"; +import { BuyWithCryptoHistoryData } from "thirdweb/pay"; -const signature = sign({ - hash: "0x", - privateKey: "0x", -}); +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 sign(options: SignOptions): { - r: `0x${string}`; - s: `0x${string}`; - v: bigint; - yParity: number; -}; +function getBuyWithCryptoHistory( + params: BuyWithCryptoHistoryParams, +): Promise; ``` ### Parameters -The options for signing. +Object of type [BuyWithCryptoHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryParams) #### Type ```ts -let options: { hash: Hex; privateKey: Hex }; +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; ``` ### Returns ```ts let returnType: { - r: `0x${string}`; - s: `0x${string}`; - v: bigint; - yParity: number; + hasNextPage: boolean; + page: Array; }; ``` -The transaction signature. +Object of type [BuyWithCryptoHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryData) --- -## signatureToHex +## getBuyWithCryptoQuote -Converts a signature to a hex string. +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 { signatureToHex } from "thirdweb/utils"; +import { getBuyWithCryptoQuote } from "thirdweb/pay"; -const hex = signatureToHex({ - r: toHex( - 49782753348462494199823712700004552394425719014458918871452329774910450607807n, - ), - s: toHex( - 33726695977844476214676913201140481102225469284307016937915595756355928419768n, - ), - v: 28n, +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 }); - -console.log(hex); -// "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c" ``` ```ts -function signatureToHex(signature: { - r: `0x${string}`; - s: `0x${string}`; - v?: number | bigint | `0x${string}`; - yParity?: number | bigint | `0x${string}`; -}): `0x${string}`; +function getBuyWithCryptoQuote( + params: GetBuyWithCryptoQuoteParams, +): Promise; ``` ### Parameters -The signature to convert. +object of type [GetBuyWithCryptoQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoQuoteParams) #### Type ```ts -let signature: { - r: `0x${string}`; - s: `0x${string}`; - v?: number | bigint | `0x${string}`; - yParity?: number | bigint | `0x${string}`; -}; +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: `0x${string}`; +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; +}; ``` -The hex string representation of the signature. +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. --- -## signMessage - -### Signature#1 +## getBuyWithCryptoStatus -Signs a string message with a given private key. +Gets the status of a buy with crypto transaction -#### Example +### Example ```ts -import { signMessage } from "thirdweb/utils"; -signMessage({ - message: "Hello, world!", - privateKey: "0x...", -}); +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 signMessage(options: SignMessageOptions): `0x${string}`; +function getBuyWithCryptoStatus( + buyWithCryptoTransaction: BuyWithCryptoTransaction, +): Promise; ``` -#### Parameters +### Parameters -The options for signing. +Object of type [BuyWithCryptoTransaction](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransaction) -##### Type +#### Type ```ts -let options: { message: Message; privateKey: Hex }; +let buyWithCryptoTransaction: { + client: ThirdwebClient; + transactionHash: string; +}; ``` -#### Returns +### Returns ```ts -let returnType: `0x${string}`; +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; + }; ``` -The signature as a hex string +Object of type [BuyWithCryptoStatus](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoStatus) +--- -### Signature#2 +## getBuyWithCryptoTransfer -Signs a string message with a given account. +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. -#### Example +Once you have the quote, you can use `prepareTransaction` and prepare the transaction for submission. + +### Example ```ts -import { signMessage } from "thirdweb/utils"; -await signMessage({ - message: "Hello, world!", - account, +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 signMessage(options: { - account: Account; - message: Message; -}): Promise<`0x${string}`>; +function getBuyWithCryptoTransfer( + params: GetBuyWithCryptoTransferParams, +): Promise; ``` -#### Parameters +### Parameters -The options for signing. +object of type [GetBuyWithCryptoTransferParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoTransferParams) -##### Type +#### Type ```ts -let options: { account: Account; message: Message }; +let params: { + amount: string; + chainId: number; + client: ThirdwebClient; + fromAddress: string; + purchaseData?: object; + toAddress: string; + tokenAddress: string; +}; ``` -#### Returns +### Returns ```ts -let returnType: Promise<`0x${string}`>; +let returnType: { + approval?: PrepareTransactionOptions; + client: ThirdwebClient; + estimatedGasCostUSDCents: number; + fromAddress: string; + paymentToken: QuotePaymentToken; + processingFee: QuotePaymentToken; + toAddress: string; + transactionRequest: PrepareTransactionOptions; +}; ``` -The signature as a hex string +Object of type [BuyWithCryptoTransfer](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) which contains the information about the transfer --- -## signTypedData +## getBuyWithFiatHistory -Signs a typed data object with a given private key according to EIP712. +Get the "Buy with fiat" transaction history for a given wallet address ### Example ```ts -import { signTypedData } from "thirdweb/utils"; -signTypedData({ - privateKey: "0x...", - ...typedData, +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 signTypedData( - options: SignTypedDataOptions, -): `0x${string}`; +function getBuyWithFiatHistory( + params: BuyWithFiatHistoryParams, +): Promise; ``` ### Parameters -The typed data is passed within options alongside the private key +Object of type [BuyWithFiatHistoryParams](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryParams) #### Type ```ts -let options: SignTypedDataOptions; +let params: { + client: ThirdwebClient; + count: number; + start: number; + walletAddress: string; +}; ``` ### Returns ```ts -let returnType: `0x${string}`; +let returnType: { + hasNextPage: boolean; + page: Array; +}; ``` -The signature as a hex string +Object of type [BuyWithFiatHistoryData](https://portal.thirdweb.com/references/typescript/v5/BuyWithFiatHistoryData) --- -## stringify +## getBuyWithFiatQuote -Stringify a JSON object and convert all bigint values to string +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. -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. +#### 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 { stringify } from "thirdweb/utils"; -const obj = { tokenId: 0n }; -const str = stringify(obj); // "{"tokenId":"0"}" +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 stringify( - value: any, - replacer?: null | ((this: any, key: string, value: any) => any), - space?: string | number, -): string; +function getBuyWithFiatQuote( + params: GetBuyWithFiatQuoteParams, +): Promise; ``` ### Parameters +object of type [GetBuyWithFiatQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatQuoteParams) + #### Type ```ts -let value: any; +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 +### Returns ```ts -let replacer: null | ((this: any, key: string, value: any) => any); +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; + }; +}; ``` -#### Type +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. +--- -```ts -let space: string | number; -``` +## getBuyWithFiatStatus -### Returns +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` -```ts -let returnType: string; -``` +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.. -An object with all bigint values converted to string ---- -# Miscellaneous ---- +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. -## installPublishedExtension +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). -Install a published extension on a dynamic contract +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 -import { installPublishedExtension } from "thirdweb/dynamic-contracts"; -const transaction = installPublishedExtension({ +// 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, - chain, - account, - contract, - extensionName: "MyExtension", - publisherAddress: "0x...", + intentId: fiatQuote.intentId, }); -await sendTransaction({ transaction, account }); + +// 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 installPublishedExtension( - options: InstallPublishedExtensionOptions, -): PreparedTransaction; +function getBuyWithFiatStatus( + params: GetBuyWithFiatStatusParams, +): Promise; ``` ### Parameters -The options for installing a published extension +Object of type [GetBuyWithFiatStatusParams](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithFiatStatusParams) #### Type ```ts -let options: { - account: Account; - constructorParams?: Record; - contract: ThirdwebContract; - extensionName: string; - publisher?: string; - version?: string; -}; +let params: { client: ThirdwebClient; intentId: string }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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; + }; ``` - -A prepared transaction to send --- -## uninstallExtension +## 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 -Uninstall an extension on a dynamic contract +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 { uninstallExtension } from "thirdweb/dynamic-contracts"; -const transaction = uninstallExtension({ +import { + getPostOnRampQuote, + getBuyWithFiatStatus, +} from "thirdweb/pay"; + +// previous steps +const fiatQuote = await getBuyWithFiatQuote(fiatQuoteParams); +window.open(fiatQuote.onRampLink, "_blank"); +const buyWithFiatStatus = await getBuyWithFiatStatus({ client, - chain, - account, - contract, - extensionName: "MyExtension", -}); -await sendTransaction({ transaction, account }); + 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 uninstallExtension( - options: UninstallExtensionOptions, -): PreparedTransaction; +function getPostOnRampQuote( + params: GetPostOnRampQuoteParams, +): Promise; ``` ### Parameters -The options for uninstalling an extension +object of type [GetPostOnRampQuoteParams](https://portal.thirdweb.com/references/typescript/v5/GetPostOnRampQuoteParams) #### Type ```ts -let options: { - account: Account; - contract: ThirdwebContract; - extensionName: string; +let params: { + buyWithFiatStatus: BuyWithFiatStatus; + client: ThirdwebClient; }; ``` ### Returns ```ts -let returnType: PreparedTransaction< - any, - AbiFunction, - PrepareTransactionOptions ->; +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; +}; ``` -A prepared transaction to send +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. --- -## activateStylusContract +## isSwapRequiredPostOnramp -Activate a stylus contract by calling ArbWasm Precompile +Check if a Swap is required after on-ramp when buying a token with fiat currency. -### Example +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. -```ts -import { activateStylusContract } from "thirdweb/stylus"; -const transaction = activateStylusContract({ - client, - chain, - contractAddress, -}); -await sendTransaction({ transaction, account }); -``` +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 activateStylusContract( - options: ActivateStylusContractOptions, -): Promise< - PreparedTransaction ->; +function isSwapRequiredPostOnramp( + buyWithFiatQuote: Pick, +): boolean; ``` ### Parameters -The options for activating the contract +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 options: { - chain: Chain; - client: ThirdwebClient; - contractAddress: string; -}; +let buyWithFiatQuote: Pick< + BuyWithFiatQuote, + "toToken" | "onRampToken" +>; ``` ### Returns ```ts -let returnType: Readonly & { - __contract?: ThirdwebContract; - __preparedMethod?: () => Promise>; -}; +let returnType: boolean; ``` - -A prepared transaction to send --- ## WalletName @@ -58637,7 +56018,7 @@ function WalletName( #### 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" | "date" | "page" | "step" | "location",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" | "listbox" | "tree",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",exportparts : string,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,onScroll : UIEventHandler,onScrollCapture : UIEventHandler,onScrollEnd : UIEventHandler,onScrollEndCapture : 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,part : string,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} +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 @@ -58650,7 +56031,10 @@ let returnType: null | Element; ## decodeAbiParameters ```ts -function decodeAbiParameters(params: params, data: (`0x${string}`) | (ByteArray)) : {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType ? params : Array[key], AbiParameterKind>}[key]} +function decodeAbiParameters( + params: params, + data: `0x${string}` | ByteArray, +): DecodeAbiParametersReturnType; ``` ### Parameters @@ -58670,7 +56054,7 @@ let data: `0x${string}` | ByteArray; ### Returns ```ts -let returnType: {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType ? params : Array[key], AbiParameterKind>}[key]} +let returnType: DecodeAbiParametersReturnType; ``` --- @@ -58680,7 +56064,7 @@ let returnType: {[key in string | number | symbol] : {[key in string | number | function encodePacked( types: packedAbiTypes, values: EncodePackedValues, -): `0x${string}`; +): Hex; ``` ### Parameters @@ -58700,7 +56084,7 @@ let values: EncodePackedValues; ### Returns ```ts -let returnType: `0x${string}`; +let returnType: ox__Hex.Hex; ``` --- @@ -58758,48 +56142,6 @@ let returnType: boolean; ``` --- -## setServiceKey - -```ts -function setServiceKey(key: null | string): void; -``` - -### Parameters - -#### Type - -```ts -let key: null | string; -``` - -### Returns - -```ts -let returnType: void; -``` ---- - -## setThirdwebDomains - -```ts -function setThirdwebDomains(DomainOverrides: DomainOverrides): void; -``` - -### Parameters - -#### Type - -```ts -let DomainOverrides: DomainOverrides; -``` - -### Returns - -```ts -let returnType: void; -``` ---- - ## toEventSelector Returns the hash (of the function/event signature) for a given event or function definition. @@ -58846,114 +56188,65 @@ let returnType: `0x${string}`; ``` --- -## getInstalledWallets - -Get All currently installed wallets. Uses EIP-6963 to discover installed browser extension wallets. - -```ts -function getInstalledWallets(): Array; -``` - -### Returns +## AutoConnect -```ts -let returnType: Array; -``` +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. -a list of installed wallets ---- +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. -## randomPrivateKey +You can also use the [useAutoConnect](https://portal.thirdweb.com/references/typescript/v5/useAutoConnect) hook to achieve the same result. -Generates a random ECDSA private key on the secp256k1 curve. +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 -```ts -import { Secp256k1 } from "ox"; +```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"), +]; -const privateKey = Secp256k1.randomPrivateKey(); +function Example() { + return ( + + ); +} ``` ```ts -function randomPrivateKey(options?: Options): ReturnType; +function AutoConnect(props: AutoConnectProps): Element; ``` ### Parameters -The options to generate the private key. - -#### Type - -```ts -let options: Options; -``` - -### Returns - -```ts -let returnType: ReturnType; -``` - -The generated private key. ---- - -## create7702MinimalAccount - -```ts -function create7702MinimalAccount(args: { - adminAccount: Account; - client: ThirdwebClient; - sponsorGas?: boolean; -}): Account; -``` - -### Parameters +Object of type `AutoConnectProps`. Refer to [AutoConnectProps](https://portal.thirdweb.com/references/typescript/v5/AutoConnectProps) #### Type ```ts -let args: { - adminAccount: Account; +let props: { + accountAbstraction?: SmartWalletOptions; + appMetadata?: AppMetadata; + chain?: Chain; client: ThirdwebClient; - sponsorGas?: boolean; + onConnect?: (wallet: Wallet) => void; + onTimeout?: () => void; + timeout?: number; + wallets?: Array; }; ``` ### 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, - originalMessage, - chainId, - }: { - chainId?: number; - message: SignableMessage; - originalMessage?: string; - }) => Promise; - signTransaction?: (tx: SerializableTransaction) => Promise; - signTypedData: ( - _typedData: ox__TypedData.Definition, - ) => Promise; - watchAsset?: (asset: WatchAssetParams) => Promise; -}; +let returnType: Element; ``` diff --git a/apps/portal/public/llms.txt b/apps/portal/public/llms.txt index d143a72e8f4..6b6c7160110 100644 --- a/apps/portal/public/llms.txt +++ b/apps/portal/public/llms.txt @@ -10,8 +10,7 @@ * [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. -* [SocialIcon](https://portal.thirdweb.com/references/typescript/v5/SocialIcon): Social auth provider icon -* [WalletProvider](https://portal.thirdweb.com/references/typescript/v5/WalletProvider): A React context provider component that supplies Wallet-related data to its child components. +* [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. @@ -33,31 +32,27 @@ # NFT * [NFTProvider](https://portal.thirdweb.com/references/typescript/v5/NFTProvider): A React context provider component that supplies NFT-related data to its child components. --- -# Buy Crypto -* [PayEmbed](https://portal.thirdweb.com/references/typescript/v5/PayEmbed): Embed a prebuilt UI for funding wallets, purchases or transactions with crypto or fiat. ---- # 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 +* [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). * [EIP5792.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). -* [EIP5792.useSendAndConfirmCalls](https://portal.thirdweb.com/references/typescript/v5/eip5792/useSendAndConfirmCalls): 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 batched and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions. * [EIP5792.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. -* [EIP5792.useWaitForCallsReceipt](https://portal.thirdweb.com/references/typescript/v5/eip5792/useWaitForCallsReceipt): A hook to wait for the receipt of eip5792 calls. --- ## ENS * [ENS.useEnsAvatar](https://portal.thirdweb.com/references/typescript/v5/ens/useEnsAvatar): Get the ENS avatar for an ENS name * [ENS.useEnsName](https://portal.thirdweb.com/references/typescript/v5/ens/useEnsName): Get the ENS name and avatar for an address --- # Wallets -* [useAuthToken](https://portal.thirdweb.com/references/typescript/v5/useAuthToken): A hook that returns the authentication token (JWT) for the currently active wallet. This token can be used to authorize API calls to your backend server. * [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. @@ -101,7 +96,10 @@ # Social API * [useSocialProfiles](https://portal.thirdweb.com/references/typescript/v5/useSocialProfiles): Fetches the wallet's available social profiles. --- -# Buy Crypto +# Utils +* [useBlockNumber](https://portal.thirdweb.com/references/typescript/v5/useBlockNumber): Hook that watches for changes in the block number on a given chain. +--- +# Miscellaneous * [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. @@ -111,9 +109,6 @@ * [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 @@ -129,69 +124,11 @@ * [DEPLOY.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. * [DEPLOY.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. * [DEPLOY.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. -* [DEPLOY.deployPackContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployPackContract): \[Pack contract is incompatible with Pectra update. Support for this contract is being removed in next release.\] +* [DEPLOY.deployPackContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployPackContract): Deploy a thirdweb Pack contract * [DEPLOY.deployPublishedContract](https://portal.thirdweb.com/references/typescript/v5/deploy/deployPublishedContract): Deploy an instance of a published contract on a given chain * [DEPLOY.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. * [DEPLOY.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. --- -## MARKETPLACE -* [MARKETPLACE.deployMarketplaceContract](https://portal.thirdweb.com/references/typescript/v5/marketplace/deployMarketplaceContract): Deploys a marketplace contract. -* [MARKETPLACE.acceptedOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/acceptedOfferEvent): Creates an event object for the AcceptedOffer event. -* [MARKETPLACE.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. -* [MARKETPLACE.approveBuyerForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/approveBuyerForListing): Prepares a transaction to call the "approveBuyerForListing" function on the contract. -* [MARKETPLACE.approveCurrencyForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/approveCurrencyForListing): Prepares a transaction to call the "approveCurrencyForListing" function on the contract. -* [MARKETPLACE.auctionClosedEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/auctionClosedEvent): Creates an event object for the AuctionClosed event. -* [MARKETPLACE.bidInAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/bidInAuction): Places a bid in an English auction. -* [MARKETPLACE.buyerApprovedForListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyerApprovedForListingEvent): Creates an event object for the BuyerApprovedForListing event. -* [MARKETPLACE.buyFromListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyFromListing): Buys a listing from the marketplace. -* [MARKETPLACE.buyoutAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyoutAuction): Buys out an English auction. -* [MARKETPLACE.cancelAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelAuction): Cancels an auction by providing the necessary options. -* [MARKETPLACE.cancelledAuctionEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledAuctionEvent): Creates an event object for the CancelledAuction event. -* [MARKETPLACE.cancelledListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledListingEvent): Creates an event object for the CancelledListing event. -* [MARKETPLACE.cancelledOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledOfferEvent): Creates an event object for the CancelledOffer event. -* [MARKETPLACE.cancelListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelListing): Prepares a transaction to call the "cancelListing" function on the contract. -* [MARKETPLACE.cancelOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelOffer): Prepares a transaction to call the "cancelOffer" function on the contract. -* [MARKETPLACE.collectAuctionPayout](https://portal.thirdweb.com/references/typescript/v5/marketplace/collectAuctionPayout): Prepares a transaction to call the "collectAuctionPayout" function on the contract. -* [MARKETPLACE.collectAuctionTokens](https://portal.thirdweb.com/references/typescript/v5/marketplace/collectAuctionTokens): Prepares a transaction to call the "collectAuctionTokens" function on the contract. -* [MARKETPLACE.createAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/createAuction): Creates an auction. -* [MARKETPLACE.createListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/createListing): Creates a direct listing. -* [MARKETPLACE.currencyApprovedForListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/currencyApprovedForListingEvent): Creates an event object for the CurrencyApprovedForListing event. -* [MARKETPLACE.currencyPriceForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/currencyPriceForListing): Retrieves the currency price for a listing. -* [MARKETPLACE.executeSale](https://portal.thirdweb.com/references/typescript/v5/marketplace/executeSale): Executes a sale for an English auction. -* [MARKETPLACE.getAllAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllAuctions): Retrieves all auctions based on the provided options. -* [MARKETPLACE.getAllListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllListings): Retrieves all direct listings based on the provided options. -* [MARKETPLACE.getAllOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllOffers): Retrieves all offers based on the provided options. -* [MARKETPLACE.getAllValidAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidAuctions): Retrieves all valid auctions based on the provided options. -* [MARKETPLACE.getAllValidListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidListings): Retrieves all valid direct listings based on the provided options. -* [MARKETPLACE.getAllValidOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidOffers): Retrieves all valid offers based on the provided options. -* [MARKETPLACE.getAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAuction): Retrieves an auction listing based on the provided options. -* [MARKETPLACE.getListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/getListing): Retrieves a direct listing based on the provided options. -* [MARKETPLACE.getOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/getOffer): Retrieves an offer based on the provided options. -* [MARKETPLACE.getWinningBid](https://portal.thirdweb.com/references/typescript/v5/marketplace/getWinningBid): Retrieves the winning bid information for a given auction. -* [MARKETPLACE.isBidInAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBidInAuctionSupported): Checks if the `bidInAuction` method is supported by the given contract. -* [MARKETPLACE.isBuyerApprovedForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBuyerApprovedForListing): Checks if the buyer is approved for a listing. -* [MARKETPLACE.isBuyFromListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBuyFromListingSupported): Checks if the `buyFromListing` method is supported by the given contract. -* [MARKETPLACE.isCancelAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCancelAuctionSupported): Checks if the `cancelAuction` method is supported by the given contract. -* [MARKETPLACE.isCancelListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCancelListingSupported): Checks if the `cancelListing` method is supported by the given contract. -* [MARKETPLACE.isCreateAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCreateAuctionSupported): Checks if the `createAuction` method is supported by the given contract. -* [MARKETPLACE.isCreateListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCreateListingSupported): Checks if the `createListing` method is supported by the given contract. -* [MARKETPLACE.isCurrencyApprovedForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCurrencyApprovedForListing): Calls the "isCurrencyApprovedForListing" function on the contract. -* [MARKETPLACE.isGetAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetAuctionSupported): Checks if the `getAuction` method is supported by the given contract. -* [MARKETPLACE.isGetListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetListingSupported): Checks if the `isGetListingSupported` method is supported by the given contract. -* [MARKETPLACE.isGetWinningBidSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetWinningBidSupported): Checks if the `getWinningBid` method is supported by the given contract. -* [MARKETPLACE.isNewWinningBid](https://portal.thirdweb.com/references/typescript/v5/marketplace/isNewWinningBid): Calls the "isNewWinningBid" function on the contract. -* [MARKETPLACE.makeOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/makeOffer): Makes an offer for any asset (ERC721 or ERC1155). -* [MARKETPLACE.newAuctionEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newAuctionEvent): Creates an event object for the NewAuction event. -* [MARKETPLACE.newBidEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newBidEvent): Creates an event object for the NewBid event. -* [MARKETPLACE.newListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newListingEvent): Creates an event object for the NewListing event. -* [MARKETPLACE.newOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newOfferEvent): Creates an event object for the NewOffer event. -* [MARKETPLACE.newSaleEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newSaleEvent): Creates an event object for the NewSale event. -* [MARKETPLACE.totalAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalAuctions): Calls the "totalAuctions" function on the contract. -* [MARKETPLACE.totalListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalListings): Calls the "totalListings" function on the contract. -* [MARKETPLACE.totalOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalOffers): Calls the "totalOffers" function on the contract. -* [MARKETPLACE.updatedListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/updatedListingEvent): Creates an event object for the UpdatedListing event. -* [MARKETPLACE.updateListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/updateListing): Updates an existing direct listing. ---- ## AIRDROP * [AIRDROP.airdropERC1155](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC1155): Prepares a transaction to call the "airdropERC1155" function on the contract. * [AIRDROP.airdropERC1155WithSignature](https://portal.thirdweb.com/references/typescript/v5/airdrop/airdropERC1155WithSignature): Prepares a transaction to call the "airdropERC1155WithSignature" function on the contract. @@ -268,16 +205,14 @@ * [ERC1155.batchMetadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/batchMetadataUpdateEvent): Creates an event object for the BatchMetadataUpdate event. * [ERC1155.burn](https://portal.thirdweb.com/references/typescript/v5/erc1155/burn): Prepares a transaction to call the "burn" function on the contract. * [ERC1155.burnBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/burnBatch): Prepares a transaction to call the "burnBatch" function on the contract. -* [ERC1155.canClaim](https://portal.thirdweb.com/references/typescript/v5/erc1155/canClaim): Check if a user can claim a drop. This method is only available on the `DropERC1155` contract. -* [ERC1155.claimCondition](https://portal.thirdweb.com/references/typescript/v5/erc1155/claimCondition): Calls the "claimCondition" function on the contract. -* [ERC1155.claimTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/claimTo): Claim ERC1155 NFTs to a specified address This method is only available on the `DropERC1155` contract. +* [ERC1155.claimTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/claimTo): Claim ERC1155 NFTs to a specified address * [ERC1155.createPack](https://portal.thirdweb.com/references/typescript/v5/erc1155/createPack): Prepares a transaction to call the "createPack" function on the contract. * [ERC1155.encodeSafeTransferFrom](https://portal.thirdweb.com/references/typescript/v5/erc1155/encodeSafeTransferFrom): Encodes the "safeTransferFrom" function into a Hex string with its parameters. * [ERC1155.freezeMetadata](https://portal.thirdweb.com/references/typescript/v5/erc1155/freezeMetadata): Prepares a transaction to call the "freezeMetadata" function on the contract. * [ERC1155.generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/erc1155/generateMintSignature): Generates the payload and signature for minting an ERC1155 token. -* [ERC1155.getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc1155/getActiveClaimCondition): Retrieves the active claim condition. This method is only available on the `DropERC1155` contract. +* [ERC1155.getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc1155/getActiveClaimCondition): Retrieves the active claim condition. * [ERC1155.getClaimConditionById](https://portal.thirdweb.com/references/typescript/v5/erc1155/getClaimConditionById): Calls the "getClaimConditionById" function on the contract. -* [ERC1155.getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc1155/getClaimConditions): Retrieves all claim conditions. This method is only available on the `DropERC1155` contract. +* [ERC1155.getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc1155/getClaimConditions): Retrieves all claim conditions. * [ERC1155.getNFT](https://portal.thirdweb.com/references/typescript/v5/erc1155/getNFT): Retrieves information about a specific ERC1155 non-fungible token (NFT). * [ERC1155.getNFTs](https://portal.thirdweb.com/references/typescript/v5/erc1155/getNFTs): Retrieves an array of NFTs ("ERC1155") based on the provided options. * [ERC1155.getOwnedNFTs](https://portal.thirdweb.com/references/typescript/v5/erc1155/getOwnedNFTs): Retrieves the owned ERC1155 NFTs for a given wallet address. @@ -299,25 +234,25 @@ * [ERC1155.isSetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isSetClaimConditionsSupported): Checks if the `setClaimConditions` method is supported by the given contract. * [ERC1155.isTotalSupplySupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isTotalSupplySupported): Checks if the `totalSupply` method is supported by the given contract. * [ERC1155.isUpdateTokenURISupported](https://portal.thirdweb.com/references/typescript/v5/erc1155/isUpdateTokenURISupported): Checks if the `setTokenURI` method is supported by the given contract. -* [ERC1155.lazyMint](https://portal.thirdweb.com/references/typescript/v5/erc1155/lazyMint): Lazily mints ERC1155 tokens. This method is only available on the `DropERC1155` contract. +* [ERC1155.lazyMint](https://portal.thirdweb.com/references/typescript/v5/erc1155/lazyMint): Lazily mints ERC1155 tokens. * [ERC1155.metadataFrozenEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/metadataFrozenEvent): Creates an event object for the MetadataFrozen event. * [ERC1155.metadataUpdateEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/metadataUpdateEvent): Creates an event object for the MetadataUpdate event. -* [ERC1155.mintAdditionalSupplyTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintAdditionalSupplyTo): Mints a "supply" number of additional ERC1155 tokens to the specified "to" address. This method is only available on the `TokenERC1155` contract. -* [ERC1155.mintAdditionalSupplyToBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintAdditionalSupplyToBatch): This extension batches multiple `mintAdditionalSupplyToBatch` extensions into one single multicall. This method is only available on the `TokenERC1155` contract. 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. -* [ERC1155.mintTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintTo): Mints a "supply" number of new ERC1155 tokens to the specified "to" address. This method is only available on the `TokenERC1155` contract. 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. -* [ERC1155.mintToBatch](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintToBatch): This extension batches multiple `mintTo` extensions into one single multicall. This method is only available on the `TokenERC1155` contract. 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. -* [ERC1155.mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintWithSignature): Mints a new ERC1155 token with the given minter signature This method is only available on the `TokenERC1155` contract. +* [ERC1155.mintAdditionalSupplyTo](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintAdditionalSupplyTo): Mints a "supply" number of additional ERC1155 tokens to the specified "to" address. +* [ERC1155.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. +* [ERC1155.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. +* [ERC1155.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. +* [ERC1155.mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc1155/mintWithSignature): Mints a new ERC1155 token with the given minter signature * [ERC1155.nextTokenId](https://portal.thirdweb.com/references/typescript/v5/erc1155/nextTokenId): Calls the "nextTokenId" function on the contract. * [ERC1155.nextTokenIdToMint](https://portal.thirdweb.com/references/typescript/v5/erc1155/nextTokenIdToMint): Calls the "nextTokenIdToMint" function on the contract. * [ERC1155.openPack](https://portal.thirdweb.com/references/typescript/v5/erc1155/openPack): Prepares a transaction to call the "openPack" function on the contract. * [ERC1155.packCreatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/packCreatedEvent): Creates an event object for the PackCreated event. * [ERC1155.packOpenedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/packOpenedEvent): Creates an event object for the PackOpened event. * [ERC1155.packUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/packUpdatedEvent): Creates an event object for the PackUpdated event. -* [ERC1155.resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc1155/resetClaimEligibility): Reset the claim eligibility for all users. This method is only available on the `DropERC1155` contract. +* [ERC1155.resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc1155/resetClaimEligibility): Reset the claim eligibility for all users. * [ERC1155.safeBatchTransferFrom](https://portal.thirdweb.com/references/typescript/v5/erc1155/safeBatchTransferFrom): Prepares a transaction to call the "safeBatchTransferFrom" function on the contract. * [ERC1155.safeTransferFrom](https://portal.thirdweb.com/references/typescript/v5/erc1155/safeTransferFrom): Prepares a transaction to call the "safeTransferFrom" function on the contract. * [ERC1155.setApprovalForAll](https://portal.thirdweb.com/references/typescript/v5/erc1155/setApprovalForAll): Prepares a transaction to call the "setApprovalForAll" function on the contract. -* [ERC1155.setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc1155/setClaimConditions): Set the claim conditions for a ERC1155 drop This method is only available on the `DropERC1155` contract. +* [ERC1155.setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc1155/setClaimConditions): Set the claim conditions for a ERC1155 drop * [ERC1155.setTokenURI](https://portal.thirdweb.com/references/typescript/v5/erc1155/setTokenURI): Prepares a transaction to call the "setTokenURI" function on the contract. * [ERC1155.tokensClaimedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/tokensClaimedEvent): Creates an event object for the TokensClaimed event. * [ERC1155.tokensLazyMintedEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/tokensLazyMintedEvent): Creates an event object for the TokensLazyMinted event. @@ -326,7 +261,7 @@ * [ERC1155.transferBatchEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/transferBatchEvent): Creates an event object for the TransferBatch event. * [ERC1155.transferSingleEvent](https://portal.thirdweb.com/references/typescript/v5/erc1155/transferSingleEvent): Creates an event object for the TransferSingle event. * [ERC1155.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` -* [ERC1155.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. This method is only available on the `TokenERC1155` contract. +* [ERC1155.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. * [ERC1155.uri](https://portal.thirdweb.com/references/typescript/v5/erc1155/uri): Calls the "uri" function on the contract. --- ## ERC721 @@ -337,16 +272,14 @@ * [ERC721.approve](https://portal.thirdweb.com/references/typescript/v5/erc721/approve): Prepares a transaction to call the "approve" function on the contract. * [ERC721.balanceOf](https://portal.thirdweb.com/references/typescript/v5/erc721/balanceOf): Calls the "balanceOf" function on the contract. * [ERC721.burn](https://portal.thirdweb.com/references/typescript/v5/erc721/burn): Prepares a transaction to call the "burn" function on the contract. -* [ERC721.canClaim](https://portal.thirdweb.com/references/typescript/v5/erc721/canClaim): Check if a user can claim a drop. * [ERC721.claimConditionsUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc721/claimConditionsUpdatedEvent): Creates an event object for the ClaimConditionsUpdated event. -* [ERC721.claimTo](https://portal.thirdweb.com/references/typescript/v5/erc721/claimTo): Claim ERC721 NFTs to a specified address This method is only available on the `DropERC721` contract. -* [ERC721.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. This method is only available on the `DropERC721` contract. -* [ERC721.createDelayedRevealBatch](https://portal.thirdweb.com/references/typescript/v5/erc721/createDelayedRevealBatch): Creates a batch of encrypted NFTs that can be revealed at a later time. This method is only available on the `DropERC721` contract. +* [ERC721.claimTo](https://portal.thirdweb.com/references/typescript/v5/erc721/claimTo): Claim ERC721 NFTs to a specified address +* [ERC721.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. +* [ERC721.createDelayedRevealBatch](https://portal.thirdweb.com/references/typescript/v5/erc721/createDelayedRevealBatch): Creates a batch of encrypted NFTs that can be revealed at a later time. * [ERC721.generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/erc721/generateMintSignature): Generates the payload and signature for minting an ERC721 token. -* [ERC721.getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc721/getActiveClaimCondition): Retrieves the active claim condition. This method is only available on the `DropERC721` contract. +* [ERC721.getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc721/getActiveClaimCondition): Retrieves the active claim condition. * [ERC721.getActiveClaimConditionId](https://portal.thirdweb.com/references/typescript/v5/erc721/getActiveClaimConditionId): Calls the "getActiveClaimConditionId" function on the contract. * [ERC721.getAllOwners](https://portal.thirdweb.com/references/typescript/v5/erc721/getAllOwners): Retrieves the owners of all ERC721 tokens within a specified range. -* [ERC721.getApproved](https://portal.thirdweb.com/references/typescript/v5/erc721/getApproved): Calls the "getApproved" function on the contract. * [ERC721.getBatchesToReveal](https://portal.thirdweb.com/references/typescript/v5/erc721/getBatchesToReveal): Retrieves the batches available to reveal in an NFT contract. * [ERC721.getClaimConditionById](https://portal.thirdweb.com/references/typescript/v5/erc721/getClaimConditionById): Calls the "getClaimConditionById" function on the contract. * [ERC721.getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc721/getClaimConditions): Retrieves all claim conditions. @@ -362,8 +295,7 @@ * [ERC721.isCreateDelayedRevealBatchSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isCreateDelayedRevealBatchSupported): Checks if the `createDelayedRevealBatch` method is supported by the given contract. * [ERC721.isERC721](https://portal.thirdweb.com/references/typescript/v5/erc721/isERC721): Check if a contract supports the ERC721 interface. * [ERC721.isGetActiveClaimConditionIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetActiveClaimConditionIdSupported): Checks if the `getActiveClaimConditionId` method is supported by the given contract. -* [ERC721.isGetActiveClaimConditionSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetActiveClaimConditionSupported): Checks if the `getActiveClaimCondition` method is supported by the given contract. This method is only available on the `DropERC721` contract. -* [ERC721.isGetApprovedSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetApprovedSupported): Checks if the `getApproved` method is supported by the given contract. +* [ERC721.isGetActiveClaimConditionSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetActiveClaimConditionSupported): Checks if the `getActiveClaimCondition` method is supported by the given contract. * [ERC721.isGetBatchesToRevealSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetBatchesToRevealSupported): Checks if the `getBatchesToReveal` method is supported by the given contract. * [ERC721.isGetClaimConditionByIdSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetClaimConditionByIdSupported): Checks if the `getClaimConditionById` method is supported by the given contract. * [ERC721.isGetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isGetClaimConditionsSupported-2): Checks if the `getClaimConditions` method is supported by the given contract. @@ -377,19 +309,18 @@ * [ERC721.isSetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isSetClaimConditionsSupported): Checks if the `setClaimConditions` method is supported by the given contract. * [ERC721.isSetSharedMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isSetSharedMetadataSupported): Checks if the `setSharedMetadata` method is supported by the given contract. * [ERC721.isSharedMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isSharedMetadataSupported): Checks if the `sharedMetadata` method is supported by the given contract. -* [ERC721.isTokenByIndexSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isTokenByIndexSupported): Checks if the `tokenByIndex` method is supported by the given contract. * [ERC721.isTotalSupplySupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isTotalSupplySupported): Checks if the `totalSupply` method is supported by the given contract. * [ERC721.isUpdateMetadataSupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isUpdateMetadataSupported-2): Checks if the `updateMetadata` method is supported by the given contract. * [ERC721.isUpdateTokenURISupported](https://portal.thirdweb.com/references/typescript/v5/erc721/isUpdateTokenURISupported): Checks if the `setTokenURI` method is supported by the given contract. -* [ERC721.lazyMint](https://portal.thirdweb.com/references/typescript/v5/erc721/lazyMint): Lazily mints ERC721 tokens. This method is only available on the `DropERC721` contract. -* [ERC721.mintTo](https://portal.thirdweb.com/references/typescript/v5/erc721/mintTo): Mints a new ERC721 token and assigns it to the specified address. This method is only available on the `TokenERC721` contract. -* [ERC721.mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc721/mintWithSignature): Mints a new ERC721 token with the given minter signature This method is only available on the `TokenERC721` contract. +* [ERC721.lazyMint](https://portal.thirdweb.com/references/typescript/v5/erc721/lazyMint): Lazily mints ERC721 tokens. +* [ERC721.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. +* [ERC721.mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc721/mintWithSignature): Mints a new ERC721 token with the given minter signature * [ERC721.nextTokenIdToMint](https://portal.thirdweb.com/references/typescript/v5/erc721/nextTokenIdToMint): Calls the "nextTokenIdToMint" function on the contract. * [ERC721.ownerOf](https://portal.thirdweb.com/references/typescript/v5/erc721/ownerOf): Calls the "ownerOf" function on the contract. -* [ERC721.resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc721/resetClaimEligibility): Reset the claim eligibility for all users. This method is only available on the `DropERC721` contract. -* [ERC721.reveal](https://portal.thirdweb.com/references/typescript/v5/erc721/reveal): Reveals a previously lazy minted batch of NFTs. This method is only available on the `DropERC721` contract. +* [ERC721.resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc721/resetClaimEligibility): Reset the claim eligibility for all users. +* [ERC721.reveal](https://portal.thirdweb.com/references/typescript/v5/erc721/reveal): Reveals a previously lazy minted batch of NFTs. * [ERC721.setApprovalForAll](https://portal.thirdweb.com/references/typescript/v5/erc721/setApprovalForAll): Prepares a transaction to call the "setApprovalForAll" function on the contract. -* [ERC721.setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc721/setClaimConditions): Set the claim conditions for a ERC721 drop This method is only available on the `DropERC721` contract. +* [ERC721.setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc721/setClaimConditions): Set the claim conditions for a ERC721 drop * [ERC721.setSharedMetadata](https://portal.thirdweb.com/references/typescript/v5/erc721/setSharedMetadata): Sets the shared metadata for a OpenEdition contract. * [ERC721.setTokenURI](https://portal.thirdweb.com/references/typescript/v5/erc721/setTokenURI): Prepares a transaction to call the "setTokenURI" function on the contract. * [ERC721.sharedMetadata](https://portal.thirdweb.com/references/typescript/v5/erc721/sharedMetadata): Calls the "sharedMetadata" function on the contract. @@ -419,19 +350,18 @@ * [ERC20.balanceOf](https://portal.thirdweb.com/references/typescript/v5/erc20/balanceOf): Calls the "balanceOf" function on the contract. * [ERC20.burn](https://portal.thirdweb.com/references/typescript/v5/erc20/burn): Prepares a transaction to call the "burn" function on the contract. * [ERC20.burnFrom](https://portal.thirdweb.com/references/typescript/v5/erc20/burnFrom): Prepares a transaction to call the "burnFrom" function on the contract. -* [ERC20.canClaim](https://portal.thirdweb.com/references/typescript/v5/erc20/canClaim): Check if a user can claim a drop. This method is only available on the `DropERC20` contract. * [ERC20.claimConditionsUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/claimConditionsUpdatedEvent): Creates an event object for the ClaimConditionsUpdated event. -* [ERC20.claimTo](https://portal.thirdweb.com/references/typescript/v5/erc20/claimTo): Claim ERC20 NFTs to a specified address This method is only available on the `DropERC20` contract. +* [ERC20.claimTo](https://portal.thirdweb.com/references/typescript/v5/erc20/claimTo): Claim ERC20 NFTs to a specified address * [ERC20.decimals](https://portal.thirdweb.com/references/typescript/v5/erc20/decimals): Retrieves the number of decimal places for a given ERC20 contract. * [ERC20.delegate](https://portal.thirdweb.com/references/typescript/v5/erc20/delegate): Prepares a transaction to call the "delegate" function on the contract. * [ERC20.delegates](https://portal.thirdweb.com/references/typescript/v5/erc20/delegates): Calls the "delegates" function on the contract. * [ERC20.deposit](https://portal.thirdweb.com/references/typescript/v5/erc20/deposit): Calls the "deposit" function on the contract (useful to wrap ETH). * [ERC20.generateMintSignature](https://portal.thirdweb.com/references/typescript/v5/erc20/generateMintSignature): Generates the payload and signature for minting an ERC20 token. -* [ERC20.getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc20/getActiveClaimCondition): Retrieves the active claim condition. This method is only available on the `DropERC20` contract. +* [ERC20.getActiveClaimCondition](https://portal.thirdweb.com/references/typescript/v5/erc20/getActiveClaimCondition): Retrieves the active claim condition. * [ERC20.getActiveClaimConditionId](https://portal.thirdweb.com/references/typescript/v5/erc20/getActiveClaimConditionId): Calls the "getActiveClaimConditionId" function on the contract. * [ERC20.getBalance](https://portal.thirdweb.com/references/typescript/v5/erc20/getBalance): Retrieves the balance of an ERC20 token for a specific address. * [ERC20.getClaimConditionById](https://portal.thirdweb.com/references/typescript/v5/erc20/getClaimConditionById): Calls the "getClaimConditionById" function on the contract. -* [ERC20.getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc20/getClaimConditions): Retrieves all claim conditions. This method is only available on the `DropERC20` contract. +* [ERC20.getClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc20/getClaimConditions): Retrieves all claim conditions. * [ERC20.getCurrencyMetadata](https://portal.thirdweb.com/references/typescript/v5/erc20/getCurrencyMetadata): Retrieves the metadata of a currency. * [ERC20.isClaimToSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isClaimToSupported): Checks if the `claimTo` method is supported by the given contract. * [ERC20.isERC20](https://portal.thirdweb.com/references/typescript/v5/erc20/isERC20): Check if a contract is an ERC20 token. @@ -441,10 +371,10 @@ * [ERC20.isMintToSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isMintToSupported): Checks if the `mintTo` method is supported by the given contract. * [ERC20.isResetClaimEligibilitySupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isResetClaimEligibilitySupported): Checks if the `resetClaimEligibility` method is supported by the given contract. * [ERC20.isSetClaimConditionsSupported](https://portal.thirdweb.com/references/typescript/v5/erc20/isSetClaimConditionsSupported): Checks if the `setClaimConditions` method is supported by the given contract. -* [ERC20.mintTo](https://portal.thirdweb.com/references/typescript/v5/erc20/mintTo): Mints a specified amount of tokens to a given address. This method is only available on the `TokenERC20` contract. -* [ERC20.mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc20/mintWithSignature): Mints a new ERC20 token with the given minter signature This method is only available on the `TokenERC20` contract. -* [ERC20.resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc20/resetClaimEligibility): Reset the claim eligibility for all users. This method is only available on the `DropERC20` contract. -* [ERC20.setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc20/setClaimConditions): Set the claim conditions for a ERC20 drop This method is only available on the `DropERC20` contract. +* [ERC20.mintTo](https://portal.thirdweb.com/references/typescript/v5/erc20/mintTo): Mints a specified amount of tokens to a given address. +* [ERC20.mintWithSignature](https://portal.thirdweb.com/references/typescript/v5/erc20/mintWithSignature): Mints a new ERC20 token with the given minter signature +* [ERC20.resetClaimEligibility](https://portal.thirdweb.com/references/typescript/v5/erc20/resetClaimEligibility): Reset the claim eligibility for all users. +* [ERC20.setClaimConditions](https://portal.thirdweb.com/references/typescript/v5/erc20/setClaimConditions): Set the claim conditions for a ERC20 drop * [ERC20.tokensClaimedEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/tokensClaimedEvent): Creates an event object for the TokensClaimed event. * [ERC20.tokensMintedEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/tokensMintedEvent): Creates an event object for the TokensMinted event. * [ERC20.tokensMintedWithSignatureEvent](https://portal.thirdweb.com/references/typescript/v5/erc20/tokensMintedWithSignatureEvent): Creates an event object for the TokensMintedWithSignature event. @@ -492,7 +422,6 @@ * [ERC4337.predictAccountAddress](https://portal.thirdweb.com/references/typescript/v5/erc4337/predictAccountAddress): Calls the "getAddress" function on the contract. * [ERC4337.removeAdmin](https://portal.thirdweb.com/references/typescript/v5/erc4337/removeAdmin): Removes admin permissions for a specified address. * [ERC4337.removeSessionKey](https://portal.thirdweb.com/references/typescript/v5/erc4337/removeSessionKey): Removes session key permissions for a specified address. -* [ERC4337.shouldUpdateSessionKey](https://portal.thirdweb.com/references/typescript/v5/erc4337/shouldUpdateSessionKey): Checks if the session key should be updated. * [ERC4337.signerPermissionsUpdatedEvent](https://portal.thirdweb.com/references/typescript/v5/erc4337/signerPermissionsUpdatedEvent): Creates an event object for the SignerPermissionsUpdated event. * [ERC4337.simulateHandleOp](https://portal.thirdweb.com/references/typescript/v5/erc4337/simulateHandleOp): Prepares a transaction to call the "simulateHandleOp" function on the contract. * [ERC4337.totalAccounts](https://portal.thirdweb.com/references/typescript/v5/erc4337/totalAccounts): Calls the "totalAccounts" function on the contract. @@ -645,6 +574,63 @@ * [LENS.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 * [LENS.tokenDataOf](https://portal.thirdweb.com/references/typescript/v5/lens/tokenDataOf): Calls the "tokenDataOf" function on the contract. --- +## MARKETPLACE +* [MARKETPLACE.acceptedOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/acceptedOfferEvent): Creates an event object for the AcceptedOffer event. +* [MARKETPLACE.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. +* [MARKETPLACE.approveBuyerForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/approveBuyerForListing): Prepares a transaction to call the "approveBuyerForListing" function on the contract. +* [MARKETPLACE.approveCurrencyForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/approveCurrencyForListing): Prepares a transaction to call the "approveCurrencyForListing" function on the contract. +* [MARKETPLACE.auctionClosedEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/auctionClosedEvent): Creates an event object for the AuctionClosed event. +* [MARKETPLACE.bidInAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/bidInAuction): Places a bid in an English auction. +* [MARKETPLACE.buyerApprovedForListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyerApprovedForListingEvent): Creates an event object for the BuyerApprovedForListing event. +* [MARKETPLACE.buyFromListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyFromListing): Buys a listing from the marketplace. +* [MARKETPLACE.buyoutAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyoutAuction): Buys out an English auction. +* [MARKETPLACE.cancelAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelAuction): Cancels an auction by providing the necessary options. +* [MARKETPLACE.cancelledAuctionEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledAuctionEvent): Creates an event object for the CancelledAuction event. +* [MARKETPLACE.cancelledListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledListingEvent): Creates an event object for the CancelledListing event. +* [MARKETPLACE.cancelledOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelledOfferEvent): Creates an event object for the CancelledOffer event. +* [MARKETPLACE.cancelListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelListing): Prepares a transaction to call the "cancelListing" function on the contract. +* [MARKETPLACE.cancelOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/cancelOffer): Prepares a transaction to call the "cancelOffer" function on the contract. +* [MARKETPLACE.collectAuctionPayout](https://portal.thirdweb.com/references/typescript/v5/marketplace/collectAuctionPayout): Prepares a transaction to call the "collectAuctionPayout" function on the contract. +* [MARKETPLACE.collectAuctionTokens](https://portal.thirdweb.com/references/typescript/v5/marketplace/collectAuctionTokens): Prepares a transaction to call the "collectAuctionTokens" function on the contract. +* [MARKETPLACE.createAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/createAuction): Creates an auction. +* [MARKETPLACE.createListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/createListing): Creates a direct listing. +* [MARKETPLACE.currencyApprovedForListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/currencyApprovedForListingEvent): Creates an event object for the CurrencyApprovedForListing event. +* [MARKETPLACE.currencyPriceForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/currencyPriceForListing): Retrieves the currency price for a listing. +* [MARKETPLACE.executeSale](https://portal.thirdweb.com/references/typescript/v5/marketplace/executeSale): Executes a sale for an English auction. +* [MARKETPLACE.getAllAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllAuctions): Retrieves all auctions based on the provided options. +* [MARKETPLACE.getAllListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllListings): Retrieves all direct listings based on the provided options. +* [MARKETPLACE.getAllOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllOffers): Retrieves all offers based on the provided options. +* [MARKETPLACE.getAllValidAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidAuctions): Retrieves all valid auctions based on the provided options. +* [MARKETPLACE.getAllValidListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidListings): Retrieves all valid direct listings based on the provided options. +* [MARKETPLACE.getAllValidOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAllValidOffers): Retrieves all valid offers based on the provided options. +* [MARKETPLACE.getAuction](https://portal.thirdweb.com/references/typescript/v5/marketplace/getAuction): Retrieves an auction listing based on the provided options. +* [MARKETPLACE.getListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/getListing): Retrieves a direct listing based on the provided options. +* [MARKETPLACE.getOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/getOffer): Retrieves an offer based on the provided options. +* [MARKETPLACE.getWinningBid](https://portal.thirdweb.com/references/typescript/v5/marketplace/getWinningBid): Retrieves the winning bid information for a given auction. +* [MARKETPLACE.isBidInAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBidInAuctionSupported): Checks if the `bidInAuction` method is supported by the given contract. +* [MARKETPLACE.isBuyerApprovedForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBuyerApprovedForListing): Checks if the buyer is approved for a listing. +* [MARKETPLACE.isBuyFromListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isBuyFromListingSupported): Checks if the `buyFromListing` method is supported by the given contract. +* [MARKETPLACE.isCancelAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCancelAuctionSupported): Checks if the `cancelAuction` method is supported by the given contract. +* [MARKETPLACE.isCancelListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCancelListingSupported): Checks if the `cancelListing` method is supported by the given contract. +* [MARKETPLACE.isCreateAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCreateAuctionSupported): Checks if the `createAuction` method is supported by the given contract. +* [MARKETPLACE.isCreateListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCreateListingSupported): Checks if the `createListing` method is supported by the given contract. +* [MARKETPLACE.isCurrencyApprovedForListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/isCurrencyApprovedForListing): Calls the "isCurrencyApprovedForListing" function on the contract. +* [MARKETPLACE.isGetAuctionSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetAuctionSupported): Checks if the `getAuction` method is supported by the given contract. +* [MARKETPLACE.isGetListingSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetListingSupported): Checks if the `isGetListingSupported` method is supported by the given contract. +* [MARKETPLACE.isGetWinningBidSupported](https://portal.thirdweb.com/references/typescript/v5/marketplace/isGetWinningBidSupported): Checks if the `getWinningBid` method is supported by the given contract. +* [MARKETPLACE.isNewWinningBid](https://portal.thirdweb.com/references/typescript/v5/marketplace/isNewWinningBid): Calls the "isNewWinningBid" function on the contract. +* [MARKETPLACE.makeOffer](https://portal.thirdweb.com/references/typescript/v5/marketplace/makeOffer): Makes an offer for any asset (ERC721 or ERC1155). +* [MARKETPLACE.newAuctionEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newAuctionEvent): Creates an event object for the NewAuction event. +* [MARKETPLACE.newBidEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newBidEvent): Creates an event object for the NewBid event. +* [MARKETPLACE.newListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newListingEvent): Creates an event object for the NewListing event. +* [MARKETPLACE.newOfferEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newOfferEvent): Creates an event object for the NewOffer event. +* [MARKETPLACE.newSaleEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/newSaleEvent): Creates an event object for the NewSale event. +* [MARKETPLACE.totalAuctions](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalAuctions): Calls the "totalAuctions" function on the contract. +* [MARKETPLACE.totalListings](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalListings): Calls the "totalListings" function on the contract. +* [MARKETPLACE.totalOffers](https://portal.thirdweb.com/references/typescript/v5/marketplace/totalOffers): Calls the "totalOffers" function on the contract. +* [MARKETPLACE.updatedListingEvent](https://portal.thirdweb.com/references/typescript/v5/marketplace/updatedListingEvent): Creates an event object for the UpdatedListing event. +* [MARKETPLACE.updateListing](https://portal.thirdweb.com/references/typescript/v5/marketplace/updateListing): Updates an existing direct listing. +--- ## MULTICALL3 * [MULTICALL3.aggregate](https://portal.thirdweb.com/references/typescript/v5/multicall3/aggregate): Prepares a transaction to call the "aggregate" function on the contract. * [MULTICALL3.aggregate3](https://portal.thirdweb.com/references/typescript/v5/multicall3/aggregate3): Prepares a transaction to call the "aggregate3" function on the contract. @@ -664,7 +650,7 @@ * [MULTICALL3.tryBlockAndAggregate](https://portal.thirdweb.com/references/typescript/v5/multicall3/tryBlockAndAggregate): Prepares a transaction to call the "tryBlockAndAggregate" function on the contract. --- ## PACK -* [PACK.createNewPack](https://portal.thirdweb.com/references/typescript/v5/pack/createNewPack): \[Pack contract is incompatible with Pectra update. Support for this contract is being removed in next release.\] +* [PACK.createNewPack](https://portal.thirdweb.com/references/typescript/v5/pack/createNewPack): Reference for PACK.createNewPack * [PACK.createPack](https://portal.thirdweb.com/references/typescript/v5/pack/createPack): Prepares a transaction to call the "createPack" function on the contract. * [PACK.getPackContents](https://portal.thirdweb.com/references/typescript/v5/pack/getPackContents): Calls the "getPackContents" function on the contract. * [PACK.getTokenCountOfBundle](https://portal.thirdweb.com/references/typescript/v5/pack/getTokenCountOfBundle): Calls the "getTokenCountOfBundle" function on the contract. @@ -726,11 +712,13 @@ * [THIRDWEB.getPublishedUriFromCompilerUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getPublishedUriFromCompilerUri): Calls the "getPublishedUriFromCompilerUri" function on the contract. * [THIRDWEB.getPublisherProfileUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/getPublisherProfileUri): Calls the "getPublisherProfileUri" function on the contract. * [THIRDWEB.isContractTypeSupported](https://portal.thirdweb.com/references/typescript/v5/thirdweb/isContractTypeSupported): Checks if the `contractType` method is supported by the given contract. -* [THIRDWEB.publishContract](https://portal.thirdweb.com/references/typescript/v5/thirdweb/publishContract): Publish a contract to the contract publisher. * [THIRDWEB.remove](https://portal.thirdweb.com/references/typescript/v5/thirdweb/remove): Prepares a transaction to call the "remove" function on the contract. * [THIRDWEB.setPublisherProfileUri](https://portal.thirdweb.com/references/typescript/v5/thirdweb/setPublisherProfileUri): Prepares a transaction to call the "setPublisherProfileUri" function on the contract. * [THIRDWEB.unpublishContract](https://portal.thirdweb.com/references/typescript/v5/thirdweb/unpublishContract): Prepares a transaction to call the "unpublishContract" function on the contract. --- +## thirdweb +* [thirdweb.publishContract](https://portal.thirdweb.com/references/typescript/v5/thirdweb/publishContract): Publish a contract to the contract publisher. +--- ## UNISWAP * [UNISWAP.createPool](https://portal.thirdweb.com/references/typescript/v5/uniswap/createPool): Prepares a transaction to call the "createPool" function on the contract. * [UNISWAP.enableFeeAmount](https://portal.thirdweb.com/references/typescript/v5/uniswap/enableFeeAmount): Prepares a transaction to call the "enableFeeAmount" function on the contract. @@ -809,7 +797,6 @@ * [MODULES.isGetSupportedCallbackFunctionsSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isGetSupportedCallbackFunctionsSupported): Checks if the `getSupportedCallbackFunctions` method is supported by the given contract. * [MODULES.isInstallModuleSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isInstallModuleSupported): Checks if the `installModule` method is supported by the given contract. * [MODULES.isUninstallModuleSupported](https://portal.thirdweb.com/references/typescript/v5/modules/isUninstallModuleSupported): Checks if the `uninstallModule` method is supported by the given contract. -* [MODULES.moduleInstalledEvent](https://portal.thirdweb.com/references/typescript/v5/modules/moduleInstalledEvent): Creates an event object for the ModuleInstalled event. * [MODULES.owner](https://portal.thirdweb.com/references/typescript/v5/modules/owner): Calls the "owner" function on the contract. * [MODULES.ownershipHandoverExpiresAt](https://portal.thirdweb.com/references/typescript/v5/modules/ownershipHandoverExpiresAt): Calls the "ownershipHandoverExpiresAt" function on the contract. * [MODULES.renounceOwnership](https://portal.thirdweb.com/references/typescript/v5/modules/renounceOwnership): Prepares a transaction to call the "renounceOwnership" function on the contract. @@ -826,9 +813,8 @@ ## EIP5792 * [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. * [EIP5792.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. -* [EIP5792.sendAndConfirmCalls](https://portal.thirdweb.com/references/typescript/v5/eip5792/sendAndConfirmCalls): Send and confirm calls in a single transaction. * [EIP5792.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. -* [EIP5792.waitForCallsReceipt](https://portal.thirdweb.com/references/typescript/v5/eip5792/waitForCallsReceipt): Waits for the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle to be confirmed. +* [EIP5792.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 --- @@ -972,16 +958,6 @@ * [TransferableERC721.setTransferable](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/setTransferable): Prepares a transaction to call the "setTransferable" function on the contract. * [TransferableERC721.setTransferableFor](https://portal.thirdweb.com/references/typescript/v5/transferableerc721/setTransferableFor): Prepares a transaction to call the "setTransferableFor" function on the contract. --- -# Universal Bridge ---- -## Buy -* [Buy.prepare](https://portal.thirdweb.com/references/typescript/v5/buy/prepare): Prepares a _finalized_ Universal Bridge quote for the provided buy request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp. -* [Buy.quote](https://portal.thirdweb.com/references/typescript/v5/buy/quote): Retrieves a Universal Bridge quote for the provided buy intent. The quote will specify the necessary `originAmount` to receive the desired `destinationAmount`, which is specified with the `buyAmountWei` option. ---- -## Sell -* [Sell.prepare](https://portal.thirdweb.com/references/typescript/v5/sell/prepare): Prepares a _finalized_ Universal Bridge quote for the provided sell request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp. -* [Sell.quote](https://portal.thirdweb.com/references/typescript/v5/sell/quote): Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option. ---- # 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). --- @@ -990,7 +966,7 @@ * [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. If the account is already deployed, this will do nothing. +* [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. @@ -1011,12 +987,9 @@ * [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): This for v2 dedicated engine instances, for v3 and engine cloud use Engine.serverWallet() +* [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.erc7579](https://portal.thirdweb.com/references/typescript/v5/erc7579): Config for a ERC7579 modular smart wallet. --- -# Wallet Connection -* [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. ---- # 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. @@ -1027,15 +1000,12 @@ * [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. -* [estimateUserOpGasCost](https://portal.thirdweb.com/references/typescript/v5/estimateUserOpGasCost): 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. -* [getUserOpHash](https://portal.thirdweb.com/references/typescript/v5/getUserOpHash): Get the hash 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. -* [prepareUserOp](https://portal.thirdweb.com/references/typescript/v5/prepareUserOp): Prepare a user operation for signing. * [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. --- @@ -1061,7 +1031,7 @@ * [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): Get contract events +* [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. @@ -1090,19 +1060,6 @@ * [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. --- -# Insight -* [getContractEvents](https://portal.thirdweb.com/references/typescript/v5/getContractEvents-2): Get contract events -* [getContractNFTs](https://portal.thirdweb.com/references/typescript/v5/getContractNFTs): Get all NFTs from a contract -* [getNFT](https://portal.thirdweb.com/references/typescript/v5/getNFT): Get NFT metadata by contract address and token id -* [getOwnedNFTs](https://portal.thirdweb.com/references/typescript/v5/getOwnedNFTs): Get NFTs owned by an address -* [getOwnedTokens](https://portal.thirdweb.com/references/typescript/v5/getOwnedTokens): Get ERC20 tokens owned by an address -* [getTransactions](https://portal.thirdweb.com/references/typescript/v5/getTransactions): Get transactions for a wallet ---- -# Engine -* [getTransactionStatus](https://portal.thirdweb.com/references/typescript/v5/getTransactionStatus): Get the execution status of a transaction. -* [ServerWallet](https://portal.thirdweb.com/references/typescript/v5/serverWallet): Reference for ServerWallet -* [waitForTransactionHash](https://portal.thirdweb.com/references/typescript/v5/waitForTransactionHash): Wait for a transaction to be submitted onchain and return the transaction hash. ---- # 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. @@ -1112,14 +1069,14 @@ --- # 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): Determines if a signature is compatible with [ERC6492](https://eips.ethereum.org/EIPS/eip-6492) -* [parseErc6492Signature](https://portal.thirdweb.com/references/typescript/v5/parseErc6492Signature): Parses a serialized (Hex) [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492) signature. If the signature is not in ERC-6492 format, the original signature is returned. -* [serializeErc6492Signature](https://portal.thirdweb.com/references/typescript/v5/serializeErc6492Signature): Serializes a signature for use with [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492). The signature must be generated by a signer for an [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) Account Factory account with counterfactual deployment addresses. +* [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): Verifies a contract wallet signature using [ERC-6942](https://eips.ethereum.org/EIPS/eip-6942) Signature Validation for Predeploy Contracts. This function will validate signatures for both deployed and undeployed smart accounts of all signature types. +* [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): Verify am [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data signature. This function is interoperable with all wallet types (smart accounts or EOAs). +* [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. @@ -1129,27 +1086,13 @@ * [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): use Bridge.status instead -* [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): Downloads a file from the specified IPFS, Arweave, or HTTP URI. +* [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. @@ -1248,18 +1191,23 @@ * [stringify](https://portal.thirdweb.com/references/typescript/v5/stringify): Stringify a JSON object and convert all bigint values to string --- # Miscellaneous -* [installPublishedExtension](https://portal.thirdweb.com/references/typescript/v5/installPublishedExtension): Install a published extension on a dynamic contract -* [uninstallExtension](https://portal.thirdweb.com/references/typescript/v5/uninstallExtension): Uninstall an extension on a dynamic contract -* [activateStylusContract](https://portal.thirdweb.com/references/typescript/v5/activateStylusContract): Activate a stylus contract by calling ArbWasm Precompile +* [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. * [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. -* [setServiceKey](https://portal.thirdweb.com/references/typescript/v5/setServiceKey): Reference for setServiceKey -* [setThirdwebDomains](https://portal.thirdweb.com/references/typescript/v5/setThirdwebDomains): Reference for setThirdwebDomains * [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 -* [getInstalledWallets](https://portal.thirdweb.com/references/typescript/v5/getInstalledWallets): Get All currently installed wallets. Uses EIP-6963 to discover installed browser extension wallets. -* [randomPrivateKey](https://portal.thirdweb.com/references/typescript/v5/randomPrivateKey): Generates a random ECDSA private key on the secp256k1 curve. -* [create7702MinimalAccount](https://portal.thirdweb.com/references/typescript/v5/create7702MinimalAccount): Reference for create7702MinimalAccount +* [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.