Usage

"use client";
import { useCreateTokenIntent } from "@tx-kit/hooks";

const MyComponent = () => {
    const { 
        createTokenIntent,
        signedIntent,
        status, 
        txHash,
        error 
    } = useCreateTokenIntent()

    const onClick = () => {
        createTokenIntent({ ... })
    }

    return <button onClick={onClick}>Create Token Intent</button>
}

Returns

createTokenIntent

Function to create a new token intent. See createToken args.

  • type: ({ channelAddress: string; uri: string; maxSupply: bigint; )} => Promise<DeferredTokenIntentWithSignature | undefined>

status

  • type: ContractExecutionStatus
type ContractExecutionStatus =
  | 'pendingApproval'
  | 'txInProgress'
  | 'complete'
  | 'error'

the status of the signature request

signedIntent

  • type: DeferredTokenIntentWithSignature

the signed token intent. this is passed in the sponsoredToken parameter during sponsorship.

error

  • type: any

the revert message if the transaction fails