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

Contract: Mint Canonical Token Transfer Refund

Implementation

Here is the abi for OriginalTokenVault: https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/pegged/OriginalTokenVault.sol

originalTokenVault.withdraw(wdmsg, sigs, signers, powers)

Request Parameters

All information is given by cBridge gateway in getTransferStatus response

wdmsgBytesLikewd_onchain
sigsArray<BytesLike>sorted_sigs
signersArray<String>signers
powersArray<BigNumber>powers

Note: Notice: Since the types of parameters are different between getTransferStatus response and withdraw request, please convert them accordingly. See details in the below code sample

import { base64, getAddress, hexlify } from "ethers/lib/utils";

const wdmsg = base64.decode(wd_onchain);

const signers = _signers.map(item => {
    const decodeSigners = base64.decode(item);
    const hexlifyObj = hexlify(decodeSigners);
    return getAddress(hexlifyObj);
});

const sigs = sorted_sigs.map(item => {
    return base64.decode(item);
});

const powers = _powers.map(item => {
    return base64.decode(item);
});

Response

Since this function is an on-chain transaction, the response is the corresponding transaction response.