Checking the Status of a Transaction
Checking if a cross-chain transfer is completed.
The full API documentation for our /status endpoint can be found here.
If you already looked at our Transferring Tokens Guide, you know how to request and submit a transaction.
If the submitted transaction was an on-chain swap, nothing more has to be done. In case the transaction was a cross-chain transfer, the /status endpoint can be used to query the execution status of the transfer:
1
const getStatus = async (bridge, fromChain, toChain, txHash) => {
2
const result = await axios.get('https://li.quest/v1/status', {
3
params: {
4
bridge,
5
fromChain,
6
toChain,
7
txHash,
8
}
9
});
10
return result.data;
11
}
Copied!
The result will look similar to the following:
1
{
2
"sending": {
3
"chainId": 1,
4
"txHash": "0x807e84fcea166e316742f811a47c464c02cc1f2cd176f514308244831cc67182",
5
"txLink": "https://etherscan.io/tx/0x807e84fcea166e316742f811a47c464c02cc1f2cd176f514308244831cc67182",
6
"amount": "2000000000000000000",
7
"token": { ... }, // information about the sent token
8
"gasPrice": "204953572552",
9
"gasUsed": "124062"
10
},
11
"receiving": {
12
"chainId": 42161,
13
"txHash": "0x233114043b0bc383d7d87ab3d8451b24ce17474f26e4c08a9d08ff18f18f639f",
14
"txLink": "https://arbiscan.io/tx/0x233114043b0bc383d7d87ab3d8451b24ce17474f26e4c08a9d08ff18f18f639f",
15
"amount": "2004304477512464378",
16
"token": { ... }, // information about the received tokenpe
17
"gasPrice": "1140752846",
18
"gasUsed": "0"
19
​
20
},
21
"tool": "hop",
22
"status": "DONE"
23
}
Copied!

The different statuses and what they mean

The response from our /status endpoint contains the property status, indicating the current state of the transaction. The possible values are NOT_FOUND, PENDING, DONE, or FAILED.
  • NOT_FOUND: This means that the transaction doesn't exist. This can happen if the passed transaction hash is incorrect or (and that's important) if the transaction wasn't mined yet. This status can change to PENDING in the future.
  • PENDING: The initial transaction was mined, but the bridging process is not completed yet.
  • DONE: The final transaction was received on the destination chain and the user has received their funds.
  • FAILED: The bridging transaction was marked as failed. Look into the transactions to learn what exactly went wrong.

Querying the status endpoint

If your dApp wants to wait for the completion of the cross-chain transfer, it can query the /status endpoint until a final state is reached:
1
const getStatus = async (bridge, fromChain, toChain, txHash) => {
2
const result = await axios.get('https://li.quest/v1/status', {
3
params: {
4
bridge,
5
fromChain,
6
toChain,
7
txHash,
8
}
9
});
10
return result.data;
11
}
12
​
13
let result;
14
do {
15
result = await getStatus(quote.tool, fromChain, toChain, tx.hash);
16
} while (result.status !== 'DONE' && result.status !== 'FAILED')
17
​
18
console.log(`Transfer completed with state ${result.status}`);
Copied!