Using API

Use native meta transaction APIs to easily implement meta transactions!

Before using this API, make sure your smart contracts inherits from one of the contracts mentioned in Custom Implementation , and you have removed the dependency on msg.sender property from your smart contracts by replacing it with msgSender() method.

/api/v2/meta-tx/native

POST https://api.biconomy.io/api/v2/meta-tx/native

Our API lets you relay transactions directly to your smart contract without having the end user paying the transaction/gas fee. Just register your dApp on the developer dashboard, upload your smart contracts with meta transaction type as Custom and select executeMetaTransaction method under Manage API section.

Headers

Name
Type
Description

x-api-key

string

API key present on your dashboard for your DApp after DApp registration. This is specific to DApp registered.

Request Body

Name
Type
Description

gasLimit

string

Gas limit to be set in the transaction. It can be a decimal number or hexadecimal string. If omitted web3 estimateGas method will be used to calculate the gasLimit for the transaction.

to

string

Target Contract Address. In case of SCW, It represents user's proxy wallet address.

apiId

string

API id corresponding to the method you want to call in your smart contract. Select executeMetaTransaction method on the dashboard under 'Manage APIs' section or other methods that support native meta transaction like DAI permit method.

params

array

Array of all the parameters required to call the method in the same order they appear in your Smart Contract.

from

string

User client wallet public address who is supposed to be sending the transaction eg. metamask wallet address.

{
    "txHash": "0x19847abea387b5086e4ff35a5e27cc18b72e04c29e81a85dd27316b05c27b818",
    "message": "Meta transaction sent to blockchain",
    "retryDuration": 158, 
    "flag": 200
}
//retryDuration : time in seconds after which you 
//can check resubmitted? endpoint for new hash in case of
//potential resubmits.

Example Curl Request

Example Code Snippets

Check the repository here for complete example code.

Congratulations πŸ‘

You're now ready to use the custom approach and enable gasless transactions in your dApp using SDK and/or APIs.

Last updated

Was this helpful?