-
Notifications
You must be signed in to change notification settings - Fork 10
/
erc20tk2werc20tk-revoke.js
43 lines (30 loc) · 1.34 KB
/
erc20tk2werc20tk-revoke.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
global.wanchain_js_testnet = true;// define testnet or mainnet
let ccUtil = require("wanchain-js-sdk").ccUtil;
let WalletCore = require("wanchain-js-sdk").walletCore;
const {config, SLEEPTIME} = require('./conf/config');
const { e20InboundInput } = require('./conf/input');
/**
* Requirements:
* - Ethereum account has enough to cover the value defined in `ethInboundInput` plus gas
*/
// define lock hash para from the lock
lockTxHash = '0x869a40ac626c0f4720e9de1457c70b7daac711daef175143ea41091bca8accd8';
async function main(){
walletCore = new WalletCore(config);
await walletCore.init();
console.log('Starting init walletCore');
srcChain = global.crossInvoker.getSrcChainNameByContractAddr(e20InboundInput.tokenAddr, 'ETH');
dstChain = global.crossInvoker.getSrcChainNameByContractAddr('WAN', 'WAN');
txHashList = global.wanDb.getItem(walletCore.config.crossCollection, {lockTxHash: lockTxHash});
console.log('checking txHashList for revoke', txHashList);
const tmp = {
x: txHashList.x,
hashX: txHashList.hashX
}
input = Object.assign({}, ETH_PARA, tmp);
console.log('The Revoke input is', input);
ret = await global.crossInvoker.invoke(srcChain, dstChain, 'REVOKE', input);
console.log(`The Revoke Hash is ${ret.result}`);
process.exit(0);
}
main();