- Send lock tx on Wanchain
- Wait for storeman response on Ethereum
- Send redeem tx on Ethereum
- Wait for storeman response on Wanchain
Lock fields (- check the ethOutboundInput lockinput field in the input.js )
to
- the receiving Ethereum accountfrom
- the sending Wanchain accountamount
- the value to be transferred
lockTxHash
- the lock tx id for locking process
lockTxHash
- the lock tx id for locking process
Simple Usage: if the specified Wanchain and Ethereum accounts are open, just simply invoke a lock action and then invoke a redeem action.
//define the source chain and destination chain
srcChain = global.crossInvoker.getSrcChainNameByContractAddr('WAN', 'WAN');
dstChain = global.crossInvoker.getSrcChainNameByContractAddr('ETH', 'ETH');
// do lock
global.crossInvoker.invoke(srcChain, dstChain, 'LOCK', ethOutboundInput.lockInput);
...
// later, and even maybe else where, do redeem
txHashList = global.wanDb.getItem(walletCore.config.crossCollection, {lockTxHash: lockTxHash});
...
redeemInputCopy = Object.assign({}, ethOutboundInput.redeemInput);
redeemInputCopy.x = txHashList.x;
redeemInputCopy.hashX = txHashList.hashX;
console.log('Starting eth inbound redeem', redeemInputCopy);
retReddem = await global.crossInvoker.invoke(srcChain, dstChain, 'REDEEM', redeemInputCopy)