πŸ”§ Native Meta Transaction

Enable meta transactions or gasless transactions in your Dapp with our native meta transaction API. No extra signature and no Contract Wallets involved here.

Note:

Before using this API, make sure you have native meta transaction support in your smart contracts i.e., you have removed the dependency on msg.sender property from your smart contracts.

If your contracts do not support native meta transactions yet, check out How to enable native meta transactions in your smart contracts.

post
/api/v2/meta-tx/native

https://api.biconomy.io/api/v2/meta-tx/native
This API lets you relay the transaction directly to your smart contract without the end-user having to pay transaction fees. Just register your DApp on the developer dashboard, upload your smart contracts and select your methods in which you want to enable native meta transaction support
Request
Response
Request
Headers
x-api-key
required
string
API key present on the dashboard for your DApp after DApp registration. This is specific to DApp registered.
Body Parameters
to
required
string
Target Contract Address. In case of SCW, It represents user's proxy wallet address.
apiId
required
string
API id corresponding to the method you want to call in your smart contract. It can be found on the dashboard under 'Manage APIs' section.
params
required
array
Array of all the parameters required to call the method in the same order they appear in your Smart Contract.
from
required
string
User client wallet public address who is supposed to be sending the transaction eg. metamask wallet address or portis wallet address.
gasLimit
optional
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.
Response
200: OK
Transaction successfully sent.
{
"txHash": "0x84bc6f25b964f794f90c59b4f97a16aadc878ce53187703124b5e0ee52e15af9",
"log": "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.
404: Not Found
Required Data not found
{
"log": "Api does not exist",
"flag": 404
}
409: Conflict
When Limits set on dashboard are reached and also when ERC20 token/ETH price has fallen below a certain threshold. Check the code field to see which limit is reached. See "Check Limit" under API section to see all possible values of code field. code = 150, when DApp limits are reached code = 151, when User limits are reached code = 152, when API per user limits are reached code = 153, when pre flight checks are not passed for token gas price
{
"code": 150,
"message": "DApp limit reached",
"responseCode": 409,
"limit": {
"allowed": false,
"type": 1,
"limitLeft": -6,
"resetTime": 1608940800000
},
"allowed": false
}
417: Expectation Failed
When gas estimation is failed due to any revert on your contracts due to any business logic. Usually you'll see the revert error message in response but to debug the issue, try sending the same transaction without Biconomy to see the actual error on explorer.
{
"log": "Error while executing Blockchain Transactions",
"error": "Error: Invalid number of parameters for \"methodName\". Got 1 expected 0!",
"message":"Error while gas estimation with message Returned error: The execution failed due to an exception.",
"code":417
}
500: Internal Server Error
Method call is invalid
{
"log": "Error while executing Blockchain Transactions",
"error": "Error: Invalid number of parameters for \"methodName\". Got 1 expected 0!",
"flag": 500
}

Example Curl Request

curl --request POST 'https://api.biconomy.io/api/v2/meta-tx/native' --header 'x-api-key: <api_key_from_dashboard>' --header 'Content-Type: application/json' --data-raw '{ "userAddress": "<user_public_address>", "apiId": "<api_id_from_dashboard>", "params": [<param1>,<param2>,...... ], "gasLimit":"0xF4240" }'