NEAR Intents
  • Overview
  • Integration
    • Distribution Channels
      • 1Click API
  • Market Makers
    • Message Bus
      • API
      • Usage
    • PoA bridge API
    • Verifier
      • Introduction
      • Deposits and withdrawals
        • NEAR Token treatment
        • Deposits
        • Balances, and identifying your token
        • Withdrawals
      • Account Abstraction
      • Intent types and execution
      • Signing Intents
      • Events
      • Example Transactions
      • Simulating intents
    • Examples
  • FAQs
  • Security
  • Chain and Address Type Support
Powered by GitBook
On this page
  • How to use
  • JSON-RPC Endpoint
  • Requests
  1. Market Makers

PoA bridge API

PreviousUsageNextVerifier

Last updated 27 days ago

The PoA Bridge is a solution for transferring asset tokens between blockchain network and NEAR Intents. This service is designed as an alternative to the OmniBridge. It will help users take full advantage of the NEAR Intents protocol's capabilities for interacting with multi-chain financial products.


How to use

  1. Get supported assets. The bridge only works with a specific list of tokens that are available for transfer to NEAR Intents. The list of supported tokens and networks can be obtained using this request.

  2. Get deposit address. Once you have verified that your token is supported by the bridge, you can use the request to obtain a deposit address. After receiving the address, transfer the tokens to it, and they will soon be available in NEAR Intents.

  3. Get recent deposit. The API service allows you to get the status of the most recent deposits. Simply send a request to retrieve this information.

  4. Get withdrawal status. The bridge supports token withdrawals from NEAR Intents to the supported network. To do this, call the 'withdrawal' contract method or use the frontend. The status of the withdrawal can be obtained upon request.


JSON-RPC Endpoint

POST: https://bridge.chaindefuser.com/rpc


Requests

1. Get supported assets

Returns a list of tokens that are supported by the PoA bridge in each network.

Parameters
  • []chains - chain filter.

Response
  • [].tokens.defuse_asset_identifier — unique id of trading asset

  • [].tokens.near_token_id — unique id of the token in the NEAR blockchain

  • [].tokens.decimals — trading asset precision. should be used for amount setup during intent creation

  • [].tokens.asset_name — trading asset name

  • [].tokens.min_deposit_amount — minimum amount of tokens to trigger transfer process

  • [].tokens.min_withdrawal_amount — minimum amount of tokens to initiate a withdrawal

  • [].tokens.withdrawal_fee — the fee charged for withdrawing the specified token

Example
// Request
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "supported_tokens",
  "params": [
    {
      "chains": ["CHAIN_TYPE:CHAIN_ID", "..."], //optional
    }
  ]
}

// Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
   "tokens": [
     {
       "defuse_asset_identifier" : "eth:8453:0x123", //CHAIN_TYPE:CHAIN_ID:ADDRESS
       "near_token_id": "...",
       "decimals" : 18,
       "asset_name" : "PEPE",
       "min_deposit_amount": "100000"
       "min_withdrawal_amount": "10000"
       "withdrawal_fee": "1000"
     },
     // ...
     ]
   }
}

2. Get deposit address

Returns the address for depositing supported tokens or native currency.

Parameters
  • account_id - Defuse user account

  • chain - network type and chain id. E.g. eth:42161 for Arbitrum or btc:mainnetfor Bitcoin.

Response
  • address - deposit address

  • chain - network type and chain id.

Example
//Request
{
  "jsonrpc": "2.0", 
  "id": 1, 
  "method": "deposit_address", 
  "params": [ 
    {
      "account_id": "user.near",
      "chain": "CHAIN_TYPE:CHAIN_ID"
    }
  ]
}

//Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "address": "0x....",
    "chain": "CHAIN_TYPE:CHAIN_ID"
  }
}

3. Get recent deposits

Returns information on recent deposits

Parameters
  • account_id - Defuse user account

  • chain - network type and chain id.

Response
  • [].tx_hash - Transaction hash [EVM networks only]

  • [].chain - network type and chain id.

  • [].defuse_asset_identifier - token identifier

  • [].decimals - token decimals

  • [].amount - asset amount

  • [].account_id - Defuse user account

  • [].address - deposit address

  • [].status - deposit status

Example
//Request
{
  "jsonrpc": "2.0", 
  "id": 1, 
  "method": "recent_deposits", 
  "params": [ 
    {
      "account_id": "user.near",
      "chain": "CHAIN_TYPE:CHAIN_ID"
    }
  ]
}

//Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "deposits": [
      {
        "tx_hash": "",
        "chain": "CHAIN_TYPE:CHAIN_ID",
        "defuse_asset_identifier": "eth:8543:0x123",
        "decimals": 18,
        "amount": 10000000000,
        "account_id": "user.near",
        "address": "0x123",
        "status": "COMPLETED" // PENDING, FAILED
      },
    ]
  }
}

4. Get withdrawal status

Returns withdrawal status.

Parameters
  • withdrawal_hash - hash of the transaction on NEAR where ft_burn event happened on the bridged token contract

Response
  • status - withdrawal status

  • data.tx_hash - NEAR transaction hash

  • data.transfer_tx_hash - Transfer transaction hash

  • data.chain - network type and chain id.

  • data.defuse_asset_identifier - token identifier

  • data.decimals - token decimals

  • data.amount - asset amount

  • data.account_id - Defuse user account

  • data.address - withdrawal address

Example

// Request
{
  "jsonrpc": "2.0", 
  "id": 1, 
  "method": "withdrawal_status", 
  "params": [ 
    {
      "withdrawal_hash": "some_hash",
    }
  ]
}

// Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "status": "COMPLETED" // NOT_FOUND, PENDING, FAILED
    "data": {
      "tx_hash": "some_hash",
      "transfer_tx_hash": "", // if exists
      "chain": "CHAIN_TYPE:CHAIN_ID",
      "defuse_asset_identifier": "eth:8543:0x123",
      "decimals": 18,
      "amount": 10000000000,
      "account_id": "user.near",
      "address": "0x123"
    }
  }
}

5. Notify about deposit transaction hash

Optional method that notifies bridge about your deposit.

Parameters
  • deposit_address - address which you received from bridge api previously and where you transferred tokens

  • tx_hash - hash of your deposit transaction

Response
  • error- optional field in case of wrong input

Example

// Request
{
  "jsonrpc": "2.0", 
  "id": 1, 
  "method": "notify_deposit", 
  "params": [ 
    {
      "deposit_address": "address",
      "tx_hash": "hash"
    }
  ]
}

// Response
{
  "jsonrpc": "2.0",
  "id": 1
}

6. Estimated withdrawal fees

Convenience method that estimate amount of fees for transactions.

Parameters
  • chain - The blockchain network in format {network}:{chainId}

  • token - The token identifier for which to estimate withdrawal fees

  • address - Recepient address

Response
  • tokenAddress- The address of the token contract

  • userAddress - The user's address

  • withdrawalFee - The estimated fee for withdrawal

  • withdrawalFeeDecimals- The decimal precision of the withdrawal fee

  • token- Token information details

  • error- Error message if estimation fails

Example

// Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "withdrawal_estimate",
  "params": [
    {
      "chain": "eth:1",
      "token": "eth.omft.near",
      "address": "0x456def..."
    }
  ]
}

// Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tokenAddress": "0x123abc...",
    "userAddress": "0x456def...",
    "withdrawalFee": "12500000000000000",
    "withdrawalFeeDecimals": 18,
    "token": {
      "defuse_asset_identifier": "0x123abc...",
      "near_token_id": "eth.omft.near",
      "decimals": 18,
      "asset_name": "ETH",
      "min_deposit_amount": 0.001
    }
  }
}