Gateway: WithdrawLiquidity For Transfer Refund

Notice cBridge gateway that user wants to refund previous failed transfer transaction

REST API

post
https://cbridge-prod2.celer.app
/v2/withdrawLiquidity
Submit withdraw liquidity request to cBridge gateway

GRPC-Web API

// import Withdraw liquidity request
import {
WithdrawLiquidityRequest
} from "../ts-proto/sgn/gateway/v1/gateway_pb";
// import WithdrawReq message
import {
WithdrawReq
} from "../ts-proto/sgn/cbridge/v1/tx_pb";
// import grpc-web WebClient
import {
WebClient
} from "../ts-proto/sgn/gateway/v1/GatewayServiceClientPb";
const timestamp = Math.floor(Date.now() / 1000);
const withdrawReq = new WithdrawReq();
withdrawReq.setReqId(timestamp);
withdrawReq.setXferId(transferId);
withdrawReq.setWithdrawType(WithdrawType.WITHDRAW_TYPE_REFUND_TRANSFER);
const request = new WithdrawLiquidityRequest();
request.setWithdrawReq(withdrawReq.serializeBinary());
request.setMethodType(WithdrawMethodType.WD_METHOD_TYPE_ONE_RM)
const client = new WebClient(`https://cbridge-prod2.celer.app`, null, null);
const response = await client.withdrawLiquidity((request, null);

Request Parameters

Name
Type
Description
withdraw_req
Array<UInt8>
serialized WithdrawReq
estimate_received_amt
String
Failed transfer transaction send amount
method_type
WD_METHOD_TYPE_ONE_RM

WithdrawReq

Name
Type
Description
xfer_id
String
req_id
Number
current timestamp
withdraw_type
WITHDRAW_TYPE_REFUND_TRANSFER

WithdrawType

Type
Description
WITHDRAW_TYPE_REMOVE_LIQUIDITY
Not supported yet
WITHDRAW_TYPE_REFUND_TRANSFER
refund transfer
WITHDRAW_TYPE_CLAIM_FEE_SHARE
Not supported yet

WithdrawMethodType

Type
Description
WD_METHOD_TYPE_UNDEFINED
placeholder
WD_METHOD_TYPE_ONE_RM
refund transfer method
WD_METHOD_TYPE_ALL_IN_ONE
Not supported
WD_METHOD_TYPE_STAKING_CLAIM
Not supported

Response

After finishing liquidity withdrawal for transfer refund, there should be a getTransferStatus polling and waiting for TRANSFER_REFUND_TO_BE_CONFIRMED