API
This page provides a set of APIs to interact with backend.
This API enable users to do all bridge operations.
For flow freely between Harmony and Ethereum blockchains you need to call these methods in special order and with appropriate parameters.

Operations Example

ETH -> ONE (BUSD)

1) call Create operation API with params (see more params in API section):
  • type= eth_to_one
  • id = operation uniq ID (you need to generate ID on client side)
  • token = busd
  • amount = transfered amount
  • ethAddress = your ethereum address
  • oneAddress = harmony receiver address
2) call approveEthManager smart contract method (see smart contract methods section in the end) for BUSD ethereum contract. You need to save generated transaction hash.
3) call lockToken smart contract method (see smart contract methods section in the end) for BUSD manager ethereum contract. You need to save generated transaction hash.
4) call Confirm action API with params (see more params in API section):
  • operationId - operation ID (generated on step 1)
  • transactionHash - approveEthManager transaction Hash (generated on step 2)
  • actionType = approveEthManager
5) call Confirm action API with params (see more params in API section):
  • operationId - operation ID (generated on step 1)
  • transactionHash - lockToken transaction Hash (generated on step 2)
  • actionType = lockToken
6) call Get Operation Info API with operation ID (generated on step 1) to get actual operation status (see status property).
Also you can monitoring each action status: see operation -> actions
7) Next stepsWait for finality and Mint tokens (on harmony side) - will be done automatically. You need only monitoring operation status (step 6).
For Create operation API and Confirm action API you need to call API for each validator from list.
1
[
2
"https://be1.bridge.hmny.io",
3
"https://be2.bridge.hmny.io",
4
"https://be3.bridge.hmny.io"
5
]
Copied!

ONE -> ETH (BUSD)

1) call Create operation API with params (see more params in API section):
  • type= one_to_eth
  • id = operation uniq ID (you need to generate ID on client side)
  • token = link
  • amount = transfered amount
  • oneAddress = your one address
  • ethAddress = ethereum receiver address
2) call approveHmyManager smart contract method (see smart contract methods section in the end) for BUSD harmony contract. You need to save generated transaction hash.
3) call burnToken smart contract method (see smart contract methods section in the end) for BUSD manager harmony contract. You need to save generated transaction hash.
4) call Confirm action API with params (see more params in API section):
  • operationId - operation ID (generated on step 1)
  • transactionHash - approveHmyManager transaction Hash (generated on step 2)
  • actionType = approveHmyManager
5) call Confirm action API with params (see more params in API section):
  • operationId - operation ID (generated on step 1)
  • transactionHash - burnToken transaction Hash (generated on step 2)
  • actionType = burnToken
6) call Get Operation Info API with operation ID (generated on step 1) to get actual operation status (see status property).
Also you can monitoring each action status: see operation -> actions
7) Next step Unlock tokens (on ethereum side) - will be done automatically. You need only monitoring operation status (step 6).
For Create operation API and Confirm action API you need to call API for each validator from list.

API description

post
https://be1.bridge.hmny.io
/operations
Create operation
post
https://be1.bridge.hmny.io
/operations/:operationId/actions/:actionType/confirm
Confirm action
get
https://be1.bridge.hmny.io
/operations/:id
Get operation info

LINKS

Smart contracts ABI and method call examples - here (https://github.com/harmony-one/ethhmy-bridge/tree/master/scripts)
You can see more examples of API using without UI here: https://github.com/harmony-one/ethhmy-bridge.tests
Last modified 6mo ago