Skip to main content
Amounts in Gnosis Ramp are strings with currency-specific decimal precision. Using incorrect precision will result in validation errors.

Key Rules

  1. Amounts are strings, not numbers
  2. Decimal precision must match the currency type
  3. No trailing zeros beyond the required precision

Decimal Precision by Currency

Currency TypeDecimalsExample
Fiat (USD, EUR)2"100.00"
USDC6"100.000000"
ETH18"1.000000000000000000"
BTC8"0.00100000"

Valid Examples

// USD - 2 decimals
{ "srcAmount": "100.00" }
{ "srcAmount": "50.25" }

// USDC - 6 decimals
{ "srcAmount": "100.000000" }
{ "srcAmount": "50.123456" }

// ETH - 18 decimals
{ "srcAmount": "1.000000000000000000" }
{ "srcAmount": "0.500000000000000000" }

Invalid Examples

// Number instead of string
{ "srcAmount": 100 }

// Wrong precision for USD (3 decimals)
{ "srcAmount": "100.000" }

// Missing decimals for USD
{ "srcAmount": "100" }

// Wrong precision for USDC (2 decimals)
{ "srcAmount": "100.00" }

Error Response

If you send an incorrectly formatted amount:
{
  "error": "VALIDATION_ERROR",
  "message": "srcAmount has invalid precision for currency USD. Expected 2 decimals."
}

Helper Function

function formatAmount(amount, currency) {
  const decimals = {
    'USD': 2,
    'EUR': 2,
    'GBP': 2,
    'USDC_GNO': 6,
    'USDC_ETH': 6,
    'USDC_BASE': 6,
    'ETH': 18,
    'BTC': 8,
  };

  const precision = decimals[currency];
  if (!precision) throw new Error(`Unknown currency: ${currency}`);

  return Number(amount).toFixed(precision);
}

// Usage
formatAmount(100, 'USD');        // "100.00"
formatAmount(100, 'USDC_GNO');   // "100.000000"
formatAmount(0.5, 'ETH');        // "0.500000000000000000"

ONRAMP vs OFFRAMP

For ONRAMP (fiat → crypto):
  • srcAmount uses fiat precision (2 decimals for USD)
For OFFRAMP (crypto → fiat):
  • srcAmount uses crypto precision (6 decimals for USDC)
// ONRAMP: $100 USD → USDC
{ "srcAmount": "100.00" }

// OFFRAMP: 100 USDC → USD
{ "srcAmount": "100.000000" }

Next Steps

Create an Intent

Use proper amount formatting in your intents.

Requirements

See full field requirements.