APIs

Hyphen can also be integrated using APIs too.

In some scenarios, where SDK integration is not possible due to any circumstances, Hyphen APIs can be used directly to integrate the same on any Platform.

These are the same APIs that are being used in the SDK internally.

Supported Token & Chain List

GET https://hyphen-v2-api.biconomy.io/api/v1/admin/supported-token/list

This API will give supported tokens as well as destination chain ids

Query Parameters

NameTypeDescription

networkId*

number

Source chain id 1 for Ethereum

137 for Polygon

43114 for Avalanche

{
  "code": 200,
  "message": "SupportedPair data fetched successfully",
  "supportedPairList": [
    {
      "tokenSymbol": "USDC",
      "decimal": 6,
      "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "chainId": 1,
      "toChainId": 137
    },
    {
      "tokenSymbol": "USDC",
      "decimal": 6,
      "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "chainId": 1,
      "toChainId": 43114
    },
    ...
  ]
}

Pool-Info

Get Min & Max transfer amount allowed in Hyphen for the Token. Also, you get the Available liquidity on the destination chain.

GET https://hyphen-v2-api.biconomy.io/api/v1/insta-exit/get-pool-info

Query Parameters

NameTypeDescription

tokenAddress*

String

Token Address from above api

fromChainId*

Nmber

Source chain id

toChainId*

Number

Destination chain id

{
  "code": 200,
  "message": "Got pool info successfuly",
  "minDepositAmount": "100",
  "maxDepositAmount": "200000",
  "availableLiquidity": "1206361",
  "fromLPManagerAddress": "<source Hyphen contract address>",
  "toLPManagerAddress": "<destination Hyphen contract address>"
}

Transfer Fee

Get transfer fee components for given deposit amount, token, source and destination chain. Fee component includes dynamic LP fee, gas fee for destination chain transaction, reward amount for filling up deficit pool on source chain. All these components constitutes netTransferFee and amountToGet on destination chain.

Get Transfer Fee for given token and amount

GET https://hyphen-v2-api.biconomy.io/api/v1/data/transferFee

Query Parameters

NameTypeDescription

fromChainId*

number

Chain id of source chain eg. 137 for Polygon

toChainId*

number

Chain id of destination chain eg. 1 for ethereum

tokenAddress*

String

Token address on source chain which is being deposited

amount

String

Amount of token being transferred in lowest unit like wei.

For eg., if user is depositing 6 USDC then value should be "6000000"

// If user deposits 100 USDC on source chain then this will be the response
{
	"code": 200,
	"message": "Successfully fetched transfer fee",
	"gasFee": "0.966", // Gas fee in USDC on destination chain
	"transferFee": "0.10009509", // LP Fee in UDSC on destination chain
	"transferFeePercentage": "0.10009509", // Percentage LP fee eg. 0.1%
	"reward": "0", // Reward in USDC if available on source chain
	"netTransferFee": "1.06609509", // Final Net Transfer Fee (transferFee + gasFee - reward)
	"amountToGet": "98.93390491" // Approximate amount to get on destination chain (Amount deposited - netTransferFee)
}

System- status

Check if the cross-transfer requirement can be fulfilled or not, before initiating the deposit.

POST https://hyphen-v2-api.biconomy.io/api/v1/insta-exit/system-status

Request Body

NameTypeDescription

tokenAddress*

String

Source chain token Address

amount*

String

in wei

fromChainId*

String

Source chain id

toChainId*

String

Destination chain Id

userAddress*

String

Sender address

{
  "code": 144,
  "message": "All Checks Passed",
  "responseCode": 200,
  "depositContract": "0x65d8bF5a792aD32ee884f77301E8D6b11FBb21b3",
  "allowanceGiven": true
}

Time to initiate the cross-chain transfer

Once All the above checks are passed, now you can initiate the Transfer functionality.

  1. For Native currency on source chain, call depositNative() method. No Approval Required.

  2. For Erc20, call depositErc20() method. Approval is required before the deposit

Hyphen contract ABI: https://etherscan.io/address/0xd0ee149a4ceec165c456c1e2d4372318e4df82bd#contracts

Hyphen pools address are same on all supported networks.

Check Status API

Once a deposit is initiated, keep calling this API at certain interval to get the status of the deposit request. If processed, it will return the exit hash along with status "PROCESSED"

GET https://hyphen-v2-api.biconomy.io/api/v1/insta-exit/check-status

Query Parameters

NameTypeDescription

fromChainId*

Number

Source chain id

depositHash*

String

Deposit hash from source chain

{
  "code": 200,
  "message": "Fund Transfer Status PROCESSED",
  "statusCode": 2,
  "fromChainId": 137,
  "toChainId": 43114,
  "amount": "100000000",
  "tokenAddress": "0x2791bca1f2de4661ed88a30c9Xxxxxxxxxxxx",
  "depositHash": "0x5b4adfe231af8f059cc24e4a1273adfd59da74e9b86683xxxxxxxxxxx2c",
  "exitHash": "0x4fb307fe63887ee2c4dd2efc58789593d3xxxxxxxx8cdf2a682a182b041ee7c"
}

Manual exit API

In some scenarios, somehow the deposit hash is not received by our watch-towers. To mitigate this, we have this manual exit API, which can be triggered after some time, if the Exit transfer transaction is not received. This API should be used in very extreme situation as Hyphen also runs reconciliations scripts that picks up any transactions that were ignored by watch towers for any reason.

POST https://hyphen-v2-api.biconomy.io/api/v1/insta-exit/execute

Request Body

NameTypeDescription

depositHash*

String

fromChainId*

number

{
  "code": 200,
  "message": "Exit hash 0xeb8b43b51aa1dbfa083b5abf171689f1b5d6f203890979e7b85fa1XXXXXXXXXX found for Deposit hash 0x9eb126be57612bd9215615d8d1b1b45dd1cf92f1bce7cadc1a85a3347afcd793",
  "responseCode": 200,
  "depositHash": "0x9eb126be57612bd9215xxxxxxxxx45dd1cf92f1bce7cadc1a85a3347afcd793",
  "exitHash": "0xeb8b43b51aa1dbfa083b5abf171689f1b5d6f203890979e7b85fa1XXXXXXXXXX"
}

Last updated