TransactionIntents

Estimate gas cost of creating a transaction

Changed on

Estimate the gas cost of broadcasting a TransactionIntent.

This is a simulation, it does not send the transaction on-chain.

If a Policy ID is used that includes payment of gas in ERC-20 tokens, an extra field estimatedTXGasFeeToken is returned with the estimated amount of tokens that will be used.

post/v1/transaction_intents/estimate_gas_cost

Request

  • Base URL: https://api.openfort.io
  • URL: https://api.openfort.io/v1/transaction_intents/estimate_gas_cost
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer
    • HTTP bearer
    • HTTP bearer

Request body

chainIdinteger required

The chain ID. Must be a supported chain.

playerstring

ID of the Player this TransactionIntent belongs to, if one exists (starts with pla_).

If you omit this parameter a new Player will be created.

accountstring

ID of the Account this TransactionIntent is executed with, if one exists (starts with acc_ or dac_).

When providing a Player and ChainID, you can omit this parameter.

policystring

ID of the Policy that defines the gas sponsorship strategy (starts with pol_). If no Policy is provided, the own Account native token funds will be used to pay for gas.

feeSponsorshipTokenstring

For a fee-sponsorship Policy that accepts several user-pay ERC-20 tokens, the on-chain address of the token the user pays the sponsored fee in. Must be one of the Policy's configured tokens on this chain; omit to use the Policy's first configured token.

externalOwnerAddressstring

Use this parameter to create a new Account for Player with the provided owner address.

If you omit this parameter and no Account exists for the Player, a custodial Account will be created.

optimisticboolean

Set to true to indicate that the transactionIntent request should be resolved as soon as possible, after the transactionIntent is created and simulated and before it arrives on chain.

signedAuthorizationstring

Signed authorization for delegated accounts. This signature is used to authorize the user operation for AccountAbstractionV8. The signature should be in the format "0x..." and will be parsed to extract r, s, and yParity values.

Example request

{
  "chainId": 80002,
  "player": "pla_e0b84653-1741-4a3d-9e91-2b0fd2942f60",
  "account": "acc_e1b24353-1741-4a3d-9e91-2b0fd2942f60",
  "policy": "pol_7e07ae30-2a4d-48fa-803f-361da94905dd",
  "feeSponsorshipToken": "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
  "externalOwnerAddress": "0x1234567890abcdef1234567890abcdef12345678",
  "optimistic": true,
  "signedAuthorization": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1c",
  "interactions": [
    {
      "value": "1000000000000000000",
      "contract": "con_0cddb398-1dc6-4e6f-8726-9ec7cea85f35",
      "functionName": "mint",
      "functionArgs": [
        "0x662D24Bf7Ea2dD6a7D0935F680a6056b94fE934d"
      ]
    }
  ]
}

Response

Successful response.

estimatedTXGasstring required

estimated TX gas cost

estimatedTXGasFeestring required

estimated TX gas cost in the chain native token (WEI)

estimatedTXGasFeeUSDstring required

estimated TX gas cost in USD

estimatedTXGasFeeTokenstring

when using a policy, the estimated TX gas cost in the ERC-20 token defined in the strategy (WEI)

gasPricestring required

gas price used for the estimation

Changes

    • info

      added the new optional request property

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      the endpoint scheme security auth_token was added to the API

    • info

      the endpoint scheme security better_auth was removed from the API

    • info

      the security scope transactions:write was added to the endpoint's security scheme sk