Skip to Content
EnDocs
Trading API
Nogas Feature

Nogas Feature

What is Nogas?

When a user does not have native chain tokens (e.g., ETH, BNB, SOL) to pay for gas fees, Bitget Wallet can submit the transaction on behalf of the user and cover the gas fee. A portion of the input trading token is then deducted as compensation.

This allows users to complete swap transactions using only stablecoins — without needing any native token balance for gas.


How Nogas Works

EVM Chains

Nogas on EVM chains leverages the EIP-7702 capability:

  1. Bitget Wallet uses a SetCode transaction to attach contract code to the user’s address, upgrading the user’s EOA (Externally Owned Account) into an address with smart contract functionality.
  2. Bitget Wallet then uses an internal address to initiate a contract call to the user’s upgraded EOA address.
  3. The user only needs to sign an EIP-712 typed data message — no on-chain transaction signing is required.

Solana Chain

On Solana, the implementation is simpler:

  • Bitget Wallet sets an internal address as the feePayer, paying the gas fee on behalf of the user.
  • The returned transaction data is the same format as standard mode — the user signs the transaction normally.

How to Use Nogas

Nogas is currently available only in Order Mode. To enable it:

  1. Call getSwapPrice and verify that the features array in the response contains "no_gas".
  2. When calling makeSwapOrder, set the feature parameter to "no_gas".

Response Differences

Solana chain: The response is identical to standard mode — the txs array is returned as usual.

EVM chains: The response contains a signatures array instead of the txs array used in standard mode. Each signature item includes:

FieldTypeDescription
kindstringAlways "signature"
chainNamestringChain name
chainIdstringChain identifier
hashstringEIP-712 typed data hash — sign this value with eth_sign
dataobjectEIP-712 structured data for display purposes
data.signTypestringAlways "eip712"
data.typesobjectEIP-712 type definitions
data.domainobjectEIP-712 domain separator
data.messageobjectEIP-712 message content

Signing and Submitting (EVM)

  1. Extract the hash field from each item in the signatures array.
  2. Sign the hash using eth_sign (raw hash signing, NOT personal_sign).
  3. Submit the signed data via submitSwapOrder with the signedTxs array.

Usage Restrictions

ConditionRequirement
Supported tokensStablecoins only (USDT, USDC, etc.)
Minimum order value≥ 5 USD (1 USD on Morph chain)
Available modeOrder Mode only

Refer to the Supported Chains table in the Order Mode documentation for the full list of per-chain minimum order values.


EVM Nogas Example (Node.js)

The following example demonstrates the complete Nogas flow on an EVM chain: creating an order, signing the EIP-712 hash, and submitting the signed data.

const { ethers } = require("ethers"); const API_HOST = "https://bopenapi.bgwapi.io"; const PARTNER_CODE = "your_partner_code"; const PRIVATE_KEY = "0xYourPrivateKeyHere"; const wallet = new ethers.Wallet(PRIVATE_KEY); async function apiPost(path, body) { const res = await fetch(`${API_HOST}${path}`, { method: "POST", headers: { "Content-Type": "application/json", "Partner-Code": PARTNER_CODE, }, body: JSON.stringify(body), }); return res.json(); } // Step 1: Get quote and check nogas availability async function getQuote() { const res = await apiPost("/bgw-pro/swapx/order/getSwapPrice", { fromChain: "bnb", fromContract: "0x55d398326f99059ff775485246999027b3197955", // USDT fromAmount: "10", toChain: "bnb", toContract: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", // USDC fromAddress: wallet.address, }); if (res.status !== 0) throw new Error(`Quote failed: ${res.msg}`); const supportsNogas = res.data.features?.includes("no_gas"); console.log("Supports nogas:", supportsNogas); console.log("Market:", res.data.market); return res.data; } // Step 2: Create order with nogas feature async function createOrder(market) { const res = await apiPost("/bgw-pro/swapx/order/makeSwapOrder", { fromChain: "bnb", fromContract: "0x55d398326f99059ff775485246999027b3197955", fromAmount: "10", toChain: "bnb", toContract: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", fromAddress: wallet.address, toAddress: wallet.address, market, slippage: "3", feature: "no_gas", }); if (res.status !== 0) throw new Error(`Create order failed: ${res.msg}`); console.log("Order ID:", res.data.orderId); console.log("Response contains 'signatures':", !!res.data.signatures); return res.data; } // Step 3: Sign the EIP-712 hash async function signHash(orderData) { const signedTxs = []; for (const item of orderData.signatures) { const hash = item.hash; // Sign the raw hash bytes directly (not personal_sign) const signature = wallet.signingKey.sign(hash).serialized; signedTxs.push(signature); } console.log("Signed transactions:", signedTxs); return signedTxs; } // Step 4: Submit the signed order async function submitOrder(orderId, signedTxs) { const res = await apiPost("/bgw-pro/swapx/order/submitSwapOrder", { orderId, signedTxs, }); if (res.status !== 0) throw new Error(`Submit failed: ${res.msg}`); console.log("Order submitted successfully:", res.data.orderId); return res.data; } // Step 5: Poll order status async function pollOrderStatus(orderId) { while (true) { const res = await apiPost("/bgw-pro/swapx/order/getSwapOrder", { orderId }); if (res.status !== 0) throw new Error(`Query failed: ${res.msg}`); const status = res.data.status; console.log(`Order ${orderId} status: ${status}`); if (["success", "failed", "refunded"].includes(status)) { return res.data; } await new Promise((r) => setTimeout(r, 3000)); } } // Main flow async function main() { const quote = await getQuote(); const orderData = await createOrder(quote.market); const signedTxs = await signHash(orderData); await submitOrder(orderData.orderId, signedTxs); await pollOrderStatus(orderData.orderId); } main().catch(console.error);

makeSwapOrder Response Example (EVM Nogas)

{ "status": 0, "error_code": 0, "data": { "orderId": "316de20899804b75a4e88f9bfd8468f3", "signatures": [ { "kind": "signature", "chainName": "bnb", "chainId": "56", "hash": "0xa8c2faaf03806e3172cad40bed94e60d16a0e598747474f52ab7e0856f963f6f", "data": { "signType": "eip712", "types": { "Aggregator": [ { "name": "chainId", "type": "uint256" }, { "name": "msgSender", "type": "address" }, { "name": "deadline", "type": "uint256" }, { "name": "nonce", "type": "uint256" }, { "name": "adminContract", "type": "address" }, { "name": "calls", "type": "Call[]" } ], "Call": [ { "name": "target", "type": "address" }, { "name": "value", "type": "uint256" }, { "name": "callData", "type": "bytes" } ], "EIP712Domain": [ { "name": "name", "type": "string" }, { "name": "version", "type": "string" }, { "name": "chainId", "type": "uint256" }, { "name": "verifyingContract", "type": "address" } ] }, "primaryType": "Aggregator", "domain": { "chainId": "56", "name": "BW7702Admin", "verifyingContract": "0x8C80e4d123e1A9E787B74a150D3220Dabf327707", "version": "1" }, "message": { "adminContract": "0x8C80e4d123e1A9E787B74a150D3220Dabf327707", "calls": [ { "callData": "0xd984396a...", "target": "0xBc1D9760bd6ca468CA9fB5Ff2CFbEAC35d86c973", "value": "0" } ], "chainId": "56", "deadline": "1775121855", "msgSender": "0xe51346fbf6D8c3833cD28b3e49611B3f972b9276", "nonce": "5775121735994317608" } } } ], "toMinAmount": "9.416319243764614284" }, "msg": "success" }

submitSwapOrder Request Example

{ "orderId": "316de20899804b75a4e88f9bfd8468f3", "signedTxs": [ "0x8f68bad504ca45f299b1843f736c069ee1e636fe50f5bef764ead661deddd4647dcf0ff2d83d69533ffe88568c514a47c59989e0c794138473a27da5feb9a7f41c" ] }
Last updated on