0.1.2 • Published 5 years ago

jcc-ripple-utils v0.1.2

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

jcc-ripple-utils

Toolkit of crossing chain from Ripple to SWTC chain

Toolkit of crossing chain from Ripple to SWTC chain

npm Build Status Coverage Status Dependencies DevDependencies npm downloads PRs Welcome

Description

Transfer token automatically from Ripple to SWTC chain. Support XRP token.

e.g. you transfer 1 XRP to Ripple Fingate from your ripple address if success, the contract will automatically transfer 1 JXRP to your swtc address from Jingtum Fingate in a few minutes.

Installtion

npm install jcc-ripple-utils

Usage

// demo
import RippleFingate from "jcc-ripple-utils";

// This is a test websocket server. Don't use it in production environment.
const testServer = "wss://t1.ripple.com";

const instance = new RippleFingate(testServer);

const testSecret = "ss8tnkFNue4TZe1MKydL5TYNnz9w4";

const testAddress = "r3sMTxiYm17nDB1nYwGCWd19GJXUrVxuNR";

// Don't change it. The fingate address is it for now.
const destination = "rMUpPikgdhmtCida2zf4CMBLrBREfCeYcy";

const testMemo = {
    jtaddress: "jpgWGpfHz8GxqUjz5nb6ej8eZJQtiF6KhH"
}

const amount = "1";

try {
    // transfer 1 XRP
    await instance.connect();
    const hash = await inst.transfer(testSecret, destination, amount, testMemo);
    console.log(hash);
} catch (error) {
    console.log(error);
} finally {
    instance.disconnect();
}