Developers

Deposits and withdrawals

Deposit from other chains through your deposit addresses, and withdraw USDT to other chains through the bridge: quote, sign a transfer, track the payout.

On this page

URLs on this page: Testnet (chain ID 326). Other code on this page doesn't change: it stays on testnet until you switch it in your code. Tutorials, signing cases and live tools always use testnet.

Use this page to move funds between Grvt and wallets on other chains from code:

  • Deposits: each main account has a deposit address on every supported chain. Tokens sent there are bridged to Grvt and credited to your main account.
  • Withdrawals to other chains go through Grvt's bridge partner: get a quote, sign a transfer, then track the payout.
  • Withdrawals to Ethereum use the withdrawal call instead, which the SDKs have.

The deposit address and bridge calls are on the edge host and have no SDK methods yet. Send them over HTTP as shown here.

Authenticate edge calls

  • Deposit addresses: send your API key in an X-API-Key header. A session cookie from a login works too.
  • Bridge withdrawals: send the session cookie, Cookie: gravity=..., from a login (Authentication). The API key header alone gets HTTP 401 (err_auth_user_not_logged_in).

Errors come back with an HTTP status and a body like {"code": "err_withdrawal_quote_expired", "message": "withdrawal quote has expired", "params": {}}. Match on code.

Get your deposit addresses

export GRVT_DOMAIN=testnet.grvt.io
curl -sS "https://edge.testnet.grvt.io/api/v1/deposit/addresses" \
  -H "X-API-Key: $GRVT_API_KEY"

The response lists one entry per chain:

{
  "chains": [
    {
      "chain": "BASE_SEPOLIA",
      "chain_id": "84532",
      "deposit_address": "0x...",
      "supported_tokens": [{"name": "USDT", "contract_address": "0x..."}]
    },
    {
      "chain": "SOLANA_TEST",
      "chain_id": "solana_test",
      "deposit_address": "",
      "supported_tokens": [{"name": "USDT", "contract_address": "..."}]
    }
  ]
}
FieldMeaning
chainThe chain's name. Pass it back exactly as returned.
chain_idThe EVM chain ID, or a name for chains without one, such as "solana" and "tron" ("solana_test" and "tron_test" on testnet).
deposit_addressSend tokens here. Empty when the address doesn't exist yet (Create an address).
supported_tokensThe tokens you can deposit on this chain, with their contract addresses.
token_outPresent only when deposits are credited as a different token, which it names.

Watch out:

  • The chains and tokens differ by environment and change over time. Read them from this call; don't hard-code them.
  • A contract_address can be empty when Grvt couldn't look it up. Call again before you send that token.
  • A new account fails with err_chain_account_not_setup ("funding account is not set up") until its main account is set up.

Create an address on another chain

When: a chain is listed with an empty deposit_address.

curl -sS "https://edge.testnet.grvt.io/api/v1/deposit/generate-address" \
  -H "X-API-Key: $GRVT_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"chain": "SOLANA_TEST"}'

It returns one entry in the same shape, with the new deposit_address. The chain name is not case-sensitive. An unknown chain fails with err_deposit_chain_not_supported, and a chain that isn't open to your account with err_deposit_chain_not_available.

Track deposits

A bridged deposit arrives in your main account as a transfer with transfer_type NON_NATIVE_BRIDGE_DEPOSIT. Find it with transfer_history.

Withdraw to another chain

When: you send USDT from your main account to a wallet on another chain.

Before you start:

  • The destination address must be in your main account's withdrawal address book.
  • The signing wallet needs the External Transfer (or Admin) permission on the main account (Permissions). The withdrawal is a transfer to the bridge partner's Grvt account.
  • The funds must be in the main account. Move them from a sub-account with transfer first.
  1. Read the routes and the bridge partner's account:

    curl -sS "https://edge.testnet.grvt.io/api/v1/bridge/withdrawal-info" -H "Cookie: gravity=$GRVT_COOKIE"
    {
      "provider": "RHINO",
      "funding_address": "0x...",
      "route": {
        "USDT": [{"chain": "BASE_SEPOLIA", "chain_id": "84532", "chain_type": "evm", "tokens_out": ["USDT"]}],
        "USDC": []
      }
    }

    route maps each token you can send (token_in) to the chains and tokens it can arrive as. Only USDT can be withdrawn this way today.

  2. Get a quote. Nothing moves yet.

    curl -sS "https://edge.testnet.grvt.io/api/v1/bridge/withdrawal-quote" \
      -H "Cookie: gravity=$GRVT_COOKIE" \
      -H "Content-Type: application/json" \
      --data '{"to_address": "0x...", "chain": "BASE_SEPOLIA", "token_in": "USDT", "token_out": "USDT", "amount": "100"}'

    The reply has quote_id, pay_amount (what leaves your main account), receive_amount (what arrives), fee (in token_in), fee_usd, speed and expires_at. All amounts are decimal strings.

  3. Sign a Transfer from your main account to the bridge partner, with the quote's amount:

    FieldValue
    fromAccountyour main account ID
    fromSubAccount0
    toAccountfunding_address from step 1
    toSubAccount0
    tokenCurrencythe id of USDT from get_currency
    numTokenspay_amount × 10^balance_decimals of USDT
    nonce, expirationa random uint32; unix nanoseconds, at most 30 days ahead

    Signing explains the domain and the hashing.

  4. Send the quote ID and the signature before expires_at:

    curl -sS "https://edge.testnet.grvt.io/api/v1/bridge/withdraw" \
      -H "Cookie: gravity=$GRVT_COOKIE" \
      -H "Content-Type: application/json" \
      --data @- <<'EOF'
    {
      "quote_id": "...",
      "signature": {"signer": "0x...", "r": "0x...", "s": "0x...", "v": 28,
                    "expiration": "1767225600000000000", "nonce": 1002, "chain_id": 326}
    }
    EOF

    Here chain_id is a number, not a string as in other signed requests. You can leave it out: Grvt then uses its own chain ID.

    HTTP 202 means the transfer was sent: {"quote_id", "tx_id", "state": "SUBMITTED", "receive_amount", "fee", "fee_usd"}.

  5. Check progress until the state is final:

    curl -sS "https://edge.testnet.grvt.io/api/v1/bridge/withdrawal-status?quote_id=$QUOTE_ID" \
      -H "Cookie: gravity=$GRVT_COOKIE"

    The reply has state, chain, token_out, receive_amount and, once paid, withdraw_tx_hash on the destination chain.

StateMeaning
CREATEDQuoted, not sent.
SUBMITTEDSent to the bridge partner; payout not started.
SENDINGThe bridge partner is paying out.
COMPLETEDPaid out. Final.
REFUNDEDNot paid out; the funds were returned. Final.
FAILEDNot paid out. Final.

Watch out:

  • If step 4 times out or returns a 5xx, the withdrawal may still go through. Check the status, or send the same request again with the same signature: if it went through, you get the first reply back. A quote can be sent only once, so retrying it can't withdraw twice.
  • Don't get a new quote and sign again until the status of the first one is final, or you may withdraw twice.
  • A quote past expires_at fails with err_withdrawal_quote_expired (HTTP 410). Get a new one.
Errors
StatusCodeCause
404err_withdrawal_address_not_in_address_bookto_address isn't in the withdrawal address book for this chain type.
422err_withdrawal_token_not_supportedtoken_in isn't USDT.
422err_withdrawal_route_not_supportedThis chain and token_out aren't a route right now.
422err_withdrawal_amount_below_feeThe amount doesn't cover the fee.
422err_withdrawal_limit_exceededA daily limit or the bridge's available funds would be exceeded.
422err_withdrawal_insufficient_balanceThe main account doesn't hold pay_amount.
400err_withdrawal_signature_invalidThe signature doesn't match the quote, or has expired.
403err_withdrawal_address_rejectedThe destination failed screening or can't be used.
403err_user_has_insufficient_permissionsThe signing wallet lacks External Transfer.
409err_withdrawal_already_executedThis quote was already sent.
410err_withdrawal_quote_expiredGet a new quote.
404err_withdrawal_not_foundNo withdrawal with this quote_id for your account.
esc

↑ ↓ move↵ open⇧↵ open .mdTry an error code like 2002

Keyboard shortcuts

⌘ K
Search the docs
/
Search
l
Next code language (Python → TypeScript → Go → Rust → curl → WebSocket)
j / k
Next / previous page
t
Light / dark theme
?
This help
Esc
Close dialogs and drawers