✋Claim assets on destination chain

As we mentioned in section.5, users need to claim the assets that rolled out from Cycle to be acquired on the destination chain. The procedures of claiming are composed of two parts, getting rollout transactions and claiming assets corresponding to a specific rollout. First, we need to have all unclaimed rollout transactions listed. Thanks to SDK, we just have to call a single function instead of going through all transactions recorded on a Cycle to get them.

interface ListBridgeTransactionsResult {
    deposits: Deposit[];
    total_cnt: number;
}

interface NetworkService {
    listBridgeTransactions)
        version: string,
        owner: string,
        page: number = 0,
        pageSize: number = 10
    ): Promise<ListBridgeTransactionsResult>
}

service.zkEvmNetwork.listBridgeTransactionsBySender(
    'starfish',
    '0x1234...',
)

Then we need to find out which rollout asset we want to acquire, and then claim it by calling SDK method.

async function claimRollout(
    transactionHash: string,
    tokenId: number
) {
    const client = await getZkEvmClient()
    const erc20Token = client.customERC20(tokenId)
    const result = await erc20Token.depositClaim(transactionHash)
    const txHash = await result.getTransactionHash()
    const receipt = await result.getReceipt()
}

Last updated