jcc-call-utils
Version:
Toolkit of crossing chain from Call chain to SWTC chain
60 lines (42 loc) • 2.3 kB
Markdown
from [Call](http://www.callchain.live/) to [SWTC chain](http://www.swtc.top/#/)

[](https://travis-ci.com/JCCDex/jcc-call-utils)
[](https://coveralls.io/github/JCCDex/jcc-call-utils?branch=master)
[](https://david-dm.org/JCCDex/jcc-call-utils)
[](https://david-dm.org/JCCDex/jcc-call-utils?type=dev)
[](http://npm-stat.com/charts.html?package=jcc-call-utils)
[](http://makeapullrequest.com)
Transfer token automatically from [Call](http://www.callchain.live/) to [SWTC](http://www.swtc.top/#/) chain. Support CALL token.
e.g. you transfer 1 `CALL` to [Call Fingate](http://block.callchain.live/#/account/cs9AWskwRmJrcMsszqC4hWeedCL5vSpexv) from your call address if success, the contract will automatically transfer 1 `JCALL` to your swtc address from [Jingtum Fingate](https://explorec9d536e.jccdex.cn/#/wallet/?wallet=jMCJrXRmycsT5tsVuge7Y65v9MrQi9r11E) in a few minutes.
```shell
npm install jcc-call-utils
```
```javascript
// demo
import CallFingate from "jcc-call-utils";
// websocket server
const server = "";
const instance = new CallFingate(server);
const testSecret = "shaXxkbcS8NoHrL1TzTfWBRCbsD2K";
const testAddress = "c3oPNfL3k3EUTBQMFQ2LTZM5W5TUM7Qq5N";
// Don't change it. The fingate address is it for now.
const destination = "cs9AWskwRmJrcMsszqC4hWeedCL5vSpexv";
const testMemo = {
jtaddress: "jpgWGpfHz8GxqUjz5nb6ej8eZJQtiF6KhH"
}
const amount = "1";
try {
// transfer 1 CALL
await instance.connect();
const hash = await inst.transfer(testSecret, destination, amount, testMemo);
console.log(hash);
} catch (error) {
console.log(error);
} finally {
instance.disconnect();
}
```
Toolkit of crossing chain