Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

NameTypeDescription
Content-Type*Stringuse application/json

Request Body

NameTypeDescription
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

Response Parameters

NameTypeDescription
statusTransferHistoryStatustransfer status
wd_onchainStringSerialized on-chain withdraw request(only for refund)
sorted_sigsArray<String>Celer SGN validators’ sign for wd_onchain (only for refund)
signersArray<String>Celer SGN validators which has signed for wd_onchain (only for refund)
powersArray<String>Powers for each signed validators (only for refund)
refund_reasonXferStatusUsed when status is TRANSFER_TO_BE_REFUNDED
block_delayNumberWaiting block for this transfer on src chain
src_block_tx_linkStringsource chain transaction link
dst_block_tx_linkStringdestination chain transaction link

TransferHistoryStatus

TypeDescriptionCode
TRANSFER_UNKNOWNPlaceholder status0
TRANSFER_SUBMITTINGcBridge gateway monitoring on-chain transaction1
TRANSFER_FAILEDtransfer failed, no need to refund2
TRANSFER_WAITING_FOR_SGN_CONFIRMATIONcBridge gateway waiting for Celer SGN confirmation3
TRANSFER_WAITING_FOR_FUND_RELEASEwaiting for user's fund release on destination chain4
TRANSFER_COMPLETEDTransfer completed5
TRANSFER_TO_BE_REFUNDEDTransfer failed, should trigger refund flow, whether it is Pool-Based or Mint/Burn refund​6
TRANSFER_REQUESTING_REFUNDcBridge gateway is preparing information for user's transfer refund7
TRANSFER_REFUND_TO_BE_CONFIRMEDThe user should submit on-chain refund transaction based on information provided by this api8
TRANSFER_CONFIRMING_YOUR_REFUNDcBridge monitoring transfer refund status on source chain9
TRANSFER_REFUNDEDTransfer refund completed10
TRANSFER_DELAYEDTransfer is put into a delayed execution queue11

XferStatus

TypeDescriptionCode
UNKNOWNPlaceholder0
OK_TO_RELAY ​ ​ ​ ​ ​ ​ ​ ​ TRANSFER_WAITING_FOR_SGN_CONFIRMATION1
SUCCESSTransfer success2
BAD_LIQUIDITYNot enough liquidity3
BAD_SLIPPAGESlippage is too low4
BAD_TOKENnot supported token or token amount not available5
REFUND_REQUESTEDrefund started6
REFUND_DONErefund finished7
BAD_XFER_DISABLEDtransfer for this token is disabled8
BAD_DEST_CHAINnot supported destination chain9

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 }