0.1.2 • Published 5 years ago

jcc-call-utils v0.1.2

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

jcc-call-utils

Toolkit of crossing chain from Call to SWTC chain

npm Build Status Coverage Status Dependencies DevDependencies npm downloads PRs Welcome

Description

Transfer token automatically from Call to SWTC chain. Support CALL token.

e.g. you transfer 1 CALL to Call Fingate from your call address if success, the contract will automatically transfer 1 JCALL to your swtc address from Jingtum Fingate in a few minutes.

Installtion

npm install jcc-call-utils

Usage

// 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();
}