Check swap status
GET /api/v1/swap/:swapId
Following the prior API, this API will check the status of a submitted cross-chain swap.
If you are not using the prior API, you can also construct the swapId
as follows
const { utils } = require('ethers') // ethers@^5
function getSwapId(encoded, initiator) {
const packed = utils.solidityPack(['bytes32', 'address'], [encoded, initiator])
return utils.keccak256(packed)
}
Path Parameters
- swapId hex_string_32_bytes requiredExamples:
The unique id for a Meson cross-chain swap, returned by the prior API.
- Mainnet
- Testnet
Example:
0x03ae219df61c9a564f9a68a9b8b48539060e869ff8ef9dc457d21e0a924f48be
Example:
0xf1a9f12fe479e80f3e8003a347303ff39652766b34f5aa454cf5aedd8f3c2021
- 200
- 404
Successful operation
A swap typically completes within 1-2 minutes. If there are issues preventing its execution, it will expire after 10 minutes.
An expired swap cannot be executed on the Meson contract thereafter, and funds remain in fromAddress
.
- application/json
- Schema
- Example (from schema)
- For Mainnet
- For Testnet
- Expired
Schema
result object
expired booleanWill be true if the swap has expired and cannot be executed by Meson contract.
POSTED stringThe hash for the transaction taking the incoming fund. On initial chain.
BONDED stringThe hash for the transaction bonding the swap fund. On initial chain.
CANCELLED stringThe hash for the transaction returning fund to the initiator. On initial chain.
LOCKED stringThe hash for the transaction locking fund for the swap. On target chain.
UNLOCKED stringThe hash for the transaction unlocking fund for the swap. On target chain.
EXECUTED stringThe hash for the transaction transfering fund to LP. On initial chain.
RELEASED stringThe hash for the transaction releasing fund to recipient. On target chain.
{
"result": {
"expired": false,
"POSTED": "string",
"BONDED": "string",
"CANCELLED": "string",
"LOCKED": "string",
"UNLOCKED": "string",
"EXECUTED": "string",
"RELEASED": "string"
}
}
An example response on Mainnet for swapId 0x03ae219df61c9a564f9a68a9b8b48539060e869ff8ef9dc457d21e0a924f48be
{
"result": {
"BONDED": "0xa3b9a696f125624ba6a334f3fee00e1ecd739948d469128fcad9a69f10f57291",
"LOCKED": "0x613eb61a248cf292f4cc0c131260a1b6f47cd95349ead1f6caa3d8981caf5f2b",
"EXECUTED": "0x5ae1eec67187cee4cc854f988d403f4e1e29922bef5514f42c79b6511dcc8dfc",
"RELEASED": "0xd596777e37ca06aa10f1eb1178c63ab4290c75c619d9502aa4004de9f664abf8"
}
}
An example response on Testnet for swapId 0xf1a9f12fe479e80f3e8003a347303ff39652766b34f5aa454cf5aedd8f3c2021
{
"result": {
"BONDED": "0x5eb363ae3c43546385d1b7d6f1ed3f81d75cfd814f2cfd651e7cc22a6e0de9c6",
"LOCKED": "0x8fde501dc1fa000426174819239a4274bfb3ac91f7dc9ef933305c44ca33a050",
"EXECUTED": "0x111f420b55e7aac43da9148e2676bc8bf84980d6f1a93d9c62f8eb0245d19deb",
"RELEASED": "0x91cf3d2cdb4e9c090a11aabfd3fbe5a550b2988b2329c81b961c6664e1a235e4"
}
}
The swap expired.
{
"result": {
"expired": true
}
}
Not Found
- application/json
- Schema
- Example (from schema)
Schema
error object
code int32message string
{
"error": {
"code": -1,
"message": "swap-not-found"
}
}