Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 2.33 KB

README.md

File metadata and controls

70 lines (48 loc) · 2.33 KB

jcc-call-utils

Toolkit of crossing chain from Call to SWTC chain

npm Build Status Coverage Status Dependencies 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

CDN

jcc_call_utils as a global variable.

<script src="https://unpkg.com/jcc-call-utils/dist/jcc-call-utils.min.js"></script>

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

API

see API.md