Gateway: GetTransferStatus
REST API
POST https://cbridge-prod2.celer.app/v2/getTransferStatus
Here is a curl example.
curl -d '{"transfer_id":"77D7E231B08120217969DED3FF1ED2B40C0028CA1E239B225F535C57808A23F6"}' -H "Content-Type: application/json" -X POST https://cbridge-prod2.celer.app/v2/getTransferStatus
When you get the response, you can get TransferHistoryStatus and XferStatus according to below mapping.
For example, if the “status” is 6 and the “refund_reason” is 4, we know this tx needs to be refunded for user since slippage is too low to finish the cBridge transfer flow.
Headers
| Name | Type | Description |
|---|---|---|
| Content-Type* | String | use application/json |
Request Body
| Name | Type | Description |
|---|---|---|
| transfer_id* | String |
{
"err": null,
"status": 5,
"wd_onchain": null,
"sorted_sigs": [
],
"signers": [
],
"powers": [
],
"refund_reason": 0,
"block_delay": 30,
"src_block_tx_link": "https://ftmscan.com/tx/0x5817041ff87994234a74edbff7f25afb659a5519c1ce0b90b7d886aca67eaccc",
"dst_block_tx_link": "https://arbiscan.io/tx/0xe73db1fff7407a72d4755cd52252d29afd2e5326b755725df56befba4ff7594b"
}
GRPC-Web API
import {
GetTransferStatusRequest
} from "../ts-proto/sgn/gateway/v1/gateway_pb";
// import grpc-web WebClient
import {
WebClient
} from "../ts-proto/sgn/gateway/v1/GatewayServiceClientPb";
/// https://ftmscan.com/tx/0x5817041ff87994234a74edbff7f25afb659a5519c1ce0b90b7d886aca67eaccc"
const request = new GetTransferStatusRequest();
request.setTransferId("77D7E231B08120217969DED3FF1ED2B40C0028CA1E239B225F535C57808A23F6");
const client = new WebClient(`https://cbridge-prod2.celer.app`, null, null);
const response = await client.getTransferStatus((request, null);
Request Parameter
| Name | Type | Description |
|---|---|---|
| transfer_id | String | Ethereum generation hash with cBridge on-chain send transaction parameters |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | TransferHistoryStatus | transfer status |
| wd_onchain | String | Serialized on-chain withdraw request(only for refund) |
| sorted_sigs | Array<String> | Celer SGN validators’ sign for wd_onchain (only for refund) |
| signers | Array<String> | Celer SGN validators which has signed for wd_onchain (only for refund) |
| powers | Array<String> | Powers for each signed validators (only for refund) |
| refund_reason | XferStatus | Used when status is TRANSFER_TO_BE_REFUNDED |
| block_delay | Number | Waiting block for this transfer on src chain |
| src_block_tx_link | String | source chain transaction link |
| dst_block_tx_link | String | destination chain transaction link |
TransferHistoryStatus
| Type | Description | Code | |
|---|---|---|---|
| TRANSFER_UNKNOWN | Placeholder status | 0 | |
| TRANSFER_SUBMITTING | cBridge gateway monitoring on-chain transaction | 1 | |
| TRANSFER_FAILED | transfer failed, no need to refund | 2 | |
| TRANSFER_WAITING_FOR_SGN_CONFIRMATION | cBridge gateway waiting for Celer SGN confirmation | 3 | |
| TRANSFER_WAITING_FOR_FUND_RELEASE | waiting for user's fund release on destination chain | 4 | |
| TRANSFER_COMPLETED | Transfer completed | 5 | |
| TRANSFER_TO_BE_REFUNDED | Transfer failed, should trigger refund flow, whether it is Pool-Based or Mint/Burn refund | 6 | |
| TRANSFER_REQUESTING_REFUND | cBridge gateway is preparing information for user's transfer refund | 7 | |
| TRANSFER_REFUND_TO_BE_CONFIRMED | The user should submit on-chain refund transaction based on information provided by this api | 8 | |
| TRANSFER_CONFIRMING_YOUR_REFUND | cBridge monitoring transfer refund status on source chain | 9 | |
| TRANSFER_REFUNDED | Transfer refund completed | 10 | |
| TRANSFER_DELAYED | Transfer is put into a delayed execution queue | 11 |
XferStatus
| Type | Description | Code | |
|---|---|---|---|
| UNKNOWN | Placeholder | 0 | |
| OK_TO_RELAY | TRANSFER_WAITING_FOR_SGN_CONFIRMATION | 1 | |
| SUCCESS | Transfer success | 2 | |
| BAD_LIQUIDITY | Not enough liquidity | 3 | |
| BAD_SLIPPAGE | Slippage is too low | 4 | |
| BAD_TOKEN | not supported token or token amount not available | 5 | |
| REFUND_REQUESTED | refund started | 6 | |
| REFUND_DONE | refund finished | 7 | |
| BAD_XFER_DISABLED | transfer for this token is disabled | 8 | |
| BAD_DEST_CHAIN | not supported destination chain | 9 |
Note: We should focus on status types with BAD prefix, it shows the error reason for failed transfer transaction. Other status indicates normal transaction flow.
/// Code Sample
const statusRes = await getTransferStatus({ transfer_id: transferId }