Skip to main content

actions/getTxAuthDataSignature

Actions

GetTxAuthDataSignatureFn()

GetTxAuthDataSignatureFn: (params) => Promise\<{data: AnyTxAuthDataSignatureResponse;type: "txAuthDataSignatureResponse"; }>(params) => Promise\<{blockExpiration: number;isAuthorized: true;signature: EdSignature; } | {errorMessage: any;isAuthorized: false; } & {namespace: "tezos";userAddress: TezosImplicitAddress; }>

Get the signature of the transaction authorization data

Parameters

params: {args: unknown[];blockExpiration: number;chainId: EvmChainId;contractAbi: Record\<string, unknown>[];contractAddress: AddressSchema;functionName: string;nonce: number;userAddress: AddressSchema; } & {namespace: "eip155";userAddress: AddressSchema; }

Returns

Promise\<{data: AnyTxAuthDataSignatureResponse;type: "txAuthDataSignatureResponse"; }>

data

data: ({ signature: string; blockExpiration: number; isAuthorized: true; payload: string; } | { isAuthorized: false; errorMessage?: any; }) & { namespace: "eip155"; userAddress: `0x${string}`; } | ({ signature: `edsig${string}`; blockExpiration: number; isAuthorized: true; } | { isAuthorized: false; errorMessage?: any; }) & { namespace: "tezos"; userAddress: `tz${string}`; } = AnyTxAuthDataSignatureResponse

type

type: "txAuthDataSignatureResponse"

Parameters

params: {args: string;blockExpiration: number;chainID: TezosChainId;contractAddress: TezosContractAddress;functionName: TezosEntrypointName;nonce: number;userAddress: TezosImplicitAddress; } & {namespace: "tezos";userAddress: TezosImplicitAddress; }

Returns

Promise\<{blockExpiration: number;isAuthorized: true;signature: EdSignature; } | {errorMessage: any;isAuthorized: false; } & {namespace: "tezos";userAddress: TezosImplicitAddress; }>

Param

The parameters required to get the transaction authorization data signature

Example

Eip155:

import { createSdk } from "@compilot/js-sdk";

const compilotSdk = createSdk({ apiKey });

const txAuthDataSignature = await compilotSdk.getTxAuthDataSignature({
namespace: "eip155",
contractAbi: ExampleGatedNFTMinterABI,
contractAddress: "0x123",
functionName: "mintNFTGated",
args: [account.address],
userAddress: account.address,
chainId: EvmChainId.parse(chainId),
});

if (!signatureResponse.isAuthorized) {
throw new Error("User is not authorized");
}

// Mint Gated Nft with signature
const unsignedTx = encodeFunctionData({
abi: contractAbi,
functionName: "mintNFTGated",
args: [account.address],
});

// Build the raw transaction data with the signature
const txData = (unsignedTx + signatureResponse.payload) as `0x${string}`;

// try to mint nft
const tx = await walletClient.data.sendTransaction({
to: contractAddress,
data: txData,
});