New Bridge API Endpoints: Chains & Fiat-to-Crypto

New Bridge utilities now available as part of the thirdweb API.

New Bridge API Endpoints: Chains & Fiat-to-Crypto

✨ New Features

Bridge API - Chain Discovery Endpoint

  • Endpoint: GET /v1/bridge/chains
  • Description: Retrieves a list of blockchain networks supported for bridging.
  • Details:
    • Returns chain ID, name, icon, and native currency details

Example Response:

{
  "result": [
    {
      "chainId": 1,
      "name": "Ethereum Mainnet",
      "icon": "https://...",
      "nativeCurrency": {
        "name": "Ether",
        "symbol": "ETH",
        "decimals": 18
      }
    }
  ]
}

Bridge API - Fiat-to-Crypto Conversion Endpoint

  • Endpoint: GET /v1/bridge/convert
  • Description: Calculates the equivalent crypto token amount for a given fiat currency amount based on current market prices. This endpoint provides conversion rate estimates and does not execute any transactions.
  • Parameters:
    • from (required) - Source fiat currency (broad list supported)
    • fromAmount (required) - Fiat amount (positive number)
    • chainId (required) - Target blockchain chain ID
    • to (required) - Ethereum address of the target token
  • Response: Returns JSON with converted crypto amount.
  • Performance:
    • Smart caching (30s fresh, 5m stale)
    • Rate-limited, requires client authentication

Example Usage:

GET /v1/bridge/convert?from=USD&fromAmount=100&chainId=42161&to=0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9

🔄 Changes

  • Migration: Legacy endpoint pay.thirdweb.com/convert/fiatToCrypto replaced by /v1/bridge/convert.

Visit the full reference here.