Envelope
Integration

Sponsored gas

Buy native Arc gas with eUSD, so an eUSD-only wallet can transact.

Arc charges gas in native USDC. The gas station sells a small amount of it for eUSD, so a wallet holding only bridged eUSD can still transact. The user pays in eUSD with a signature that costs no gas, and a relayer submits the transaction and covers its fee.

You cannot call drip() directly

drip() is relayer-gated on-chain. Go through the relayer API below.

Action ids are 0 for a swap and 1 for a launch.

1. Quote

POST https://api.envelope.trade/gas-relayer/api/gas/quote
Content-Type: application/json

{ "action_id": 0 }
{
  "native_out": "7625000000000000",  // wei of native gas you receive
  "eusd_in":    "381250",            // eUSD you pay (6 decimals)
  "gas_price":  "25000000000",
  "eusd":       "0x...",             // eUSD token, for the permit
  "chain_id":   5042
}

The same figures are readable on-chain via quote(uint256 actionId, uint256 gasPrice), which returns (nativeOut, eusdIn). The relayer is the single pricing source, so do not recompute it yourself.

2. Sign an EIP-2612 permit

Sign a Permit on the eUSD token for exactly eusd_in, with the gas station as the spender.

const signature = await signTypedData(config, {
  domain: {
    name: "Envelope USD",
    version: "1",
    chainId: quote.chain_id,
    verifyingContract: quote.eusd,
  },
  types: {
    Permit: [
      { name: "owner",    type: "address" },
      { name: "spender",  type: "address" },
      { name: "value",    type: "uint256" },
      { name: "nonce",    type: "uint256" },
      { name: "deadline", type: "uint256" },
    ],
  },
  primaryType: "Permit",
  message: { owner, spender: gasStation, value: eusdIn, nonce, deadline },
});

Signing costs no gas.

3. Submit

POST https://api.envelope.trade/gas-relayer/api/gas/drip

{ "user": "0x...", "action_id": 0, "native_out": "...",
  "deadline": "...", "v": 27, "r": "0x...", "s": "0x..." }
{ "tx_hash": "0x...", "status": "confirmed" }

status is confirmed once the drip is mined. If the transaction has not been mined within 20 seconds the relayer returns submitted with the same hash rather than holding the request open: the drip is in flight, so watch the balance or the hash instead of signing a new permit. Submitting a permit that is already in flight returns 409.

The station charges the eUSD and sends the native gas in one transaction. Call it before the action you are funding, and skip it entirely when the wallet already holds enough native. Each drip is capped per action and priced off the live gas price, so quote it fresh every time.