Gas Station

The Gas Station enables you to pay gas fees for your users. This takes out the process of users needing to fund their wallet with the native blockchain token to pay for gas. To start using the Gas Station an integrator should create a gas station account with wallet addresses for the networks you want to support, configure the gas station for each network, and top up the wallet with the network's native token.

Create Gas Station Account

First you need to create the Gas Station account. Specify what network(s) you are adding. You can add more networks to the account at anytime with a separate endpoint.

POST /api/gas-station/v1/account?networks=polygonMainnet

//Sample Response
{
  "id": "3ba8h64-5017-4562-b3fc-2c963766afa6",
  "wallets": [
    {
      "network": "polygonMainnet",
      "asset": "matic",
      "totalBalance": 0,
      "address": "0xD57297C5e504D7c6A70Ba860ba24264b83fd358"
    }
  ]
}

Add network to gas station

POST /api/gas-station/v1/account/assets

//Sample Request
[
  {
    "network": "Mainnet",
    "asset": "Eth"
  }
]

You will receive the address to the wallet created on the added network in the response. Send the native tokens to the address to top up your gas station.

Retrieve all addresses and balances

You can get all address and balances for each network.

GET /api/gas-station/v1/account

//Sample Response 
{
    "id": "0517cb2b-fr32-4e12-a8cc-9e22d907bb",
    "wallets": [
        {
            "network": "solanaDevnet",
            "asset": "sol",
            "totalBalance": 0,
            "address": "HxXLjRnhmYj348eguf2g8RJ2uQBa41LGoix9sZjYXn"
        },
        {
            "network": "goerli",
            "asset": "eth",
            "totalBalance": 0.356333560056672171,
            "address": "0xdE37Dd5356t175k73766326Cc377150B8c3408D"
        }
    ]
}

Configure Gas Station

After creation you can configure your Gas Station to have an "overpriceMultiplier" for each network. This is a value that will be multiplied with the estimated gas fee. The calculated value will be used for fueling transactions. You can add 1 configuration at a time.

POST /api/gas-station/v1/gas-configuration

// Sample Request
{
  "network": "polygonMumbai",
  "asset": "matic",
  "overpriceMultiplier": 1.35
}

Retrieve Gas Station Configuration

GET /api/gas-station/v1/gas-configuration?Assets=matic&Networks=polygonMumbai

//Sample Response 
{
    "meta": {
        "pageCount": 1,
        "resourceCount": 1
    },
    "data": [
        {
            "id": "77d4dba-3ao8-46ed-b3e7-7705482e7sad1",
            "network": "polygonMumbai",
            "asset": "matic",
            "overpriceMultiplier": 1.35000000
        }
    ]
}

Update Gas Configuration

To update a configuration grab the id for the specific network and use the PATCH call below.

PATCH /api/gas-station/v1/gas-configuration/{gasConfigId} 

//Sample Request
{
  "network": "polygonMumbai",
  "asset": "matic",
  "overpriceMultiplier": 1.50
}

Using the Gas Station

To use the Gas Station for your user's transactions the "autofuel" field must be set to true.

POST /api/wallet/v1/wallets/{walletId}/withdraw-crypto
//Sample Request
{
  "network": "mainnet",
  "assetType": "eth",
  "destinationWalletId": "3385f64-5717-45r2-b3fc-2c9v3f66afa6",//For Fortress Wallets
  "destinationAddress": "0xc57227C5e504D7ceA40Ba8a05a74264b35fd358",// Non Fortress Wallets or Fortress Wallets
  "amount": 10,
  "autofuel": true, //autofuel can be toggled on and off
  "note": "wagmi"
}