0.1.2 • Published 3 years ago

slpswap-node v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Simple SLP Swap

The project started as a repackaging of Vin Armani's slpswap-client project.

This is the CLI version of the project. It depends from the non-broswer version of BCH gRPC library.

Changes from the original:

  • Original monolithic exchange code split
  • Some common functions moved to separate module (Utils etc.)
  • Command line arguments removed from the main code

Usage

  • Installation
git clone https://github.com/zh/slpswap-node
cd slpswap-node
npm install
npm link slpswap-node

npm package for easy include is also available.

  • Using in projects
const SLPSwap = require('slpswap-node');

const swapConfig = {
  to: 'tokens receiver SLP address',
  wif: 'tokens sender private key',
  amount: 'send tokens amount',
  send: 'send tokens token ID',
  receive: 'receive tokens token ID',
  postage: 'use PostOffice protocol (true/false)',
};

const slpSwap = new SLPSwap();
const result = await slpSwap.exchange(swapConfig);
  • CLI SLP swap exchange

result should be same as the original project

git clone https://github.com/zh/slpswap-node
cd slpswap-node
npm install

node ./examples/exchange_tokens.js -h
Options:
      --version  Show version number                                   [boolean]
  -t, --to       send token to that address                             [string]
  -w, --wif      token sender private key                               [string]
  -s, --send     Send tokens                                            [string]
  -r, --receive  Receive tokens                                         [string]
  -a, --amount   Amount of tokens to send                               [string]
  -p, --postage  Use postage protocol (pay with tokens)
                                                      [boolean] [default: false]
  -h, --help     Show help                                             [boolean]

node ./examples/exchange_tokens.js ...some params...

See examples directory for more code usage examples.

Disclaimer

THIS WALLET IS CONSIDERED ALPHA SOFTWARE. USE AT YOUR OWN RISK! WE ASSUME NO RESPONSIBILITY NOR LIABILITY IF THERE IS A BUG IN THIS IMPLEMENTATION.