项目作者: JCCDex

项目描述 :
Toolkit of crossing chain from Stream chain to SWTC chain
高级语言: JavaScript
项目地址: git://github.com/JCCDex/jcc-stream-utils.git
创建时间: 2019-05-31T03:51:13Z
项目社区:https://github.com/JCCDex/jcc-stream-utils

开源协议:Apache License 2.0

下载


jcc-stream-utils

Toolkit of crossing chain from Stream chain to SWTC chain

npm
Build Status
Coverage Status
Dependencies
npm downloads
PRs Welcome

Description

Transfer token automatically from Stream chain to SWTC chain. Support STM token.

e.g. you transfer 1 STM to Stream Fingate from your stream address if success, the contract will automatically transfer 1 JSTM to your swtc address from Jingtum Fingate in a few minutes.

Installtion

  1. npm install jcc-stream-utils

CDN

jcc_stream_utils as a global variable.

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

Usage

  1. // demo
  2. import StreamFingate from "jcc-stream-utils";
  3. // This is a test websocket server. Don't use it in production environment.
  4. const testServer = "sa.labs.stream";
  5. const instance = new StreamFingate({
  6. host: testServer,
  7. port: 443,
  8. secure: true
  9. });
  10. const testSecret = "vaFtuK2skLZUCcqHvsFk2BMKpzQmJbQsXa";
  11. // Don't change it. The fingate address is it for now.
  12. const destination = "vn4K541zh3vNHHJJaos2Poc4z3RiMHLHcK";
  13. const testMemo = {
  14. jtaddress: "jpgWGpfHz8GxqUjz5nb6ej8eZJQtiF6KhH"
  15. }
  16. const amount = "1";
  17. try {
  18. instance.init()
  19. .connect()
  20. const hash = await instance.transfer(testSecret, destination, amount, testMemo);
  21. console.log(hash);
  22. } catch (error) {
  23. console.log(error);
  24. } finally {
  25. instance.disconnect();
  26. }

API

see API.md