API

This API allows you to interact with neuron to build custom integrations using neuron bridges to enable token transfers between different blockchain networks in any app.

The base URL for all API endpoints is: https://brain.goneuron.xyz/

Conventions

Unless otherwise stated the following should be considered conventions of the API:

  • chain IDs should be expressed as strings

  • paramters ending in _dec are expected to be decimal representations, parameters without _dec are expressed in wei

All APIs return the errorparam.

This param should be checked to make sure it is 'none' before using any other data within the response.

Get Bridging Quote

This API endpoint retrieves a bridging quote based on the provided parameters. It returns information about the available liquidity, fee breakdown, bridging time estimation, and any potential errors.

Endpoint: /api/getBridgingQuote

Method: GET

Parameters

  • chainFrom (required string): Chain ID of the source chain.

  • chainTo (required string): Chain ID of the destination chain.

  • tokenFrom (required string): Token address on the source chain.

  • tokenTo (required string): Token address on the destination chain.

  • amount (required string): Amount of tokens to bridge.

Response

The API response is a JSON object with the following fields:

  • destination_tokens_available_dec (float): Available liquidity on the destination chain (in decimal format).

  • destination_tokens_available (integer): Available liquidity on the destination chain (without decimal points).

  • fee_usd_equivalent_total_dec (float): Total fee equivalent in USD (in decimal format).

  • fee_usd_equivalent_volume_dec (float): Fee equivalent based on volume in USD (in decimal format).

  • fee_usd_equivalent_destination_dec (float): Fee equivalent for the destination chain in USD (in decimal format).

  • fee_token_name (string): Token name for the fee being charged.

  • fee_token_total_dec (string): Total fee in tokens (in decimal format).

  • fee_token_total (string): Total fee in tokens (without decimal points).

  • estimated_bridge_time_seconds (integer): Approximate bridging time in seconds.

  • error (string): Indicates if any errors occurred during the process. Possible values: 'none', error messages for specific cases.

In most cases if the call fails the response will be entirely contained within the error message, however if the quote fails due to insufficient liquidity, the parameters destination_tokens_available_dec and destination_tokens_available will also be returned.

Get Bridging Options

Retrieve the available bridging options for source and destination chains.

Endpoint: /api/getBridgingOptions

Method: GET

Response:

  • chains_from: An array of supported source blockchain chain IDs.

  • chains_to: An array of supported destination blockchain chain IDs.

  • tokens_from: An object mapping source chain IDs to an array of supported tokens.

  • tokens_to: An object mapping destination chain IDs to an array of supported tokens.

  • error: An error message if any error occurred during the request, otherwise "none".

Get Bridge Contract

Retrieve the bridge contract address for a specific chain.

Endpoint: /api/getBridgeContract

Method: GET

Query Parameters:

  • chain (required): The ID of the blockchain chain.

Response:

  • chain: The ID of the requested chain.

  • contract: The address of the bridge contract.

  • error: An error message if any error occurred during the request, otherwise "none".

Get Address Balance

Retrieve the token balance of an address on a specific chain.

Endpoint: /api/getAddressBalance

Method: GET

Query Parameters:

  • chain (required): The ID of the blockchain chain.

  • address (required): The address to check the balance for.

  • token (required): The token address.

Response:

  • balance: The token balance of the address.

  • error: An error message if any error occurred during the request, otherwise "none".

Get History

Retrieve the bridging history for a specific address.

Endpoint: /api/getHistory

Method: GET

Query Parameters:

Although all parameters are optional, at least one of address and id must be provided.

  • address (optional): The address to retrieve the history for.

  • id (optional): The source chain transaction hash to retrieve history for.

  • count (optional): Maximum number of records to return, defaults to 20

  • page (optional): Pagination index, defaults to 1

Response:

  • history: An array of bridging events for the address.

  • error: An error message if any error occurred during the request, otherwise "none".

Example:

Response:
{
    "history": [
        {
            "source_chain_tx": "0x1234567890abcdef",
            "source_chain": 1,
            "source_token": "ETH",
            "source_amount_dec": 1.5,
            "fee_service_amount_dec": 0.001,
            "fee_destination_cost_amount_dec": 0.002,
            "destination_chain_tx": "0xfedcba0987654321",
            "destination_chain": 2,
            "destination_token": "BTC",
            "destination_address": "0x9876543210fedcba",
            "destination_amount": 0.5,
            "status": "Complete",
            "timestamp": "22-06-30 12:34:56"
        },
        {
            "source_chain_tx": "0x9876543210fedcba",
            "source_chain": 2,
            "source_token": "BTC",
            "source_amount_dec": 0.5,
            "fee_service_amount_dec": 0.001,
            "fee_destination_cost_amount_dec": 0.002,
            "destination_chain_tx": "0x1234567890abcdef",
            "destination_chain": 1,
            "destination_token": "ETH",
            "destination_address": "0xabcdef123456",
            "destination_amount": 1.5,
            "status": "Pending (10/15)",
            "timestamp": "22-06-29 09:00:00"
        }
    ],
    "error": "none"
}

Get History Count

Retrieve the number of bridging events for a particular address

Endpoint: /api/getHistoryCount

Method: GET

Query Parameters:

  • address (required): The address to retrieve the history number of historical entries for

Response:

  • history_count: An array of bridging events for the address.

  • error: An error message if any error occurred during the request, otherwise "none".

Get Partner Reward

Retrieve the partner referral fees collected by an address participating in the referral scheme.

This API will be extended in the future to allow for querying over a certain period, for now it just returns lifetime rewards

Endpoint: /api/getRefRewards

Method: GET

Query Parameters:

  • address (required): The address to retrieve the history number of historical entries for

Response:

  • txs: Number of eligible bridging transactions that fees have been collected for

  • partner_fees: Map of token addresses and amount collected

    • In the example below a ~0.00089 reward has been collected in ETH

      {"0x0000000000000000000000000000000000000000":0.0008927641760108384}
  • error: An error message if any error occurred during the request, otherwise "none".

Last updated