Usage
Simple transaction
Batch transaction
Values for title and description
Parameters
The address of the smart contract to interact with.
The name of the smart contract function to call.
The parameters to pass to the smart contract function. Should be an empty
array if no parameters are needed.
The amount of native currency (ETH, POL, etc.) to send with the transaction.
Specify ‘0’ if no native token is transferred.
The contract standard if any (e.g., ‘ERC20’).
If your Mini App supports multiple chains, you can specify the chain id to
use.
Optional array of Permit2 permits for token approvals. Each permit must
include: -
owner: The address of the user wallet that owns the tokens. -
token: The address of the ERC20 token to be approved. - spender: The
address of the contract authorized to spend the tokens (must match the
contractAddress). - amount: The maximum amount that can be spent, in the
token’s smallest unit (e.g., wei). - deadline: UNIX timestamp (in seconds)
after which the permit expires. - nonce: Unique nonce (number) to prevent
replay attacks.Optional values to interpolate into the method title. Use
{{key}} placeholders in the method title, and provide the corresponding values here.Note: Any unreplaced placeholders (those without a corresponding value) will be automatically removed from the final text.Example: If the title is “Swap {{amount}} {{token}}”, pass { amount: "100", token: "USDC" } to display “Swap 100 USDC”. If you only pass { amount: "100" }, it will display “Swap 100” (the {{token}} placeholder is removed).Optional values to interpolate into the method description. Use
{{key}} placeholders in the method description configuration, and provide the corresponding values here.Note: Any unreplaced placeholders (those without a corresponding value) will be automatically removed from the final text.Example: If the description is “Exchange {{fromToken}} for {{toToken}}”, pass { fromToken: "USDC", toToken: "ETH" } to display “Exchange USDC for ETH”.Returns
The result of the smart contract call attempt. -
SUCCESS: The smart contract
call was successful. - FAILED: The smart contract call failed. -
CANCELLED: The smart contract call was cancelled by the user.Contains the transaction hash of the smart contract call transaction. Only
present when the result is
SUCCESS. - txHash: The transaction hash.Contains the error information when the smart contract call fails. Only
present when the result is
FAILED. - message: The error message. - code:
The error code.Demo
Example using Permit2
Instead of requiring a user to submit a separateapprove transaction before a contract can interact with their tokens, you can provide a signed permit. The service will automatically handle the one-time approval to the Permit2 contract if it hasn’t been done already.
Permit Type
Using Permits
The SDK automatically handles all Permit2 complexity for you. You simply provide the permit data, and the SDK will:- Generate the EIP-712 signature
- Handle the one-time ERC-20 approval to Permit2 if needed
- Execute the transaction with the permit signature