1.1.0 • Published 3 years ago

btu-sender v1.1.0

Weekly downloads
10
License
SEE LICENCE IN LI...
Repository
github
Last release
3 years ago

BTU Sender

Node.js client for BTU request API

Getting started

Installation

npm install btu-sender --save

Instantiation

const BTUSender = require('btu-sender');

const myBtuSender = new BTUSender(privateKey, publicKey, url);

privateKey and publicKey are private and public keys; please contact us to generate them.

url is the url of the distribution server.

Methods

sendRequest()

The method sendRequest creates a new send request.

Parameters

parametertypemandatorydescription
amountnumberyesAmount to send
currencystringyesCurrency code ('BTU', 'EUR', 'USD', etc.)
recipientstringyesWallet address of the recipient. 42 characters: "0x" followed by 40 hexadecimal characters
networkstringnoNetwork on which to perform the request ("mainnet", "ropsten", "mumbai", etc.). Default "mainnet".
fromstringnoMinimal date when the request must be performed. (Format YYYY-MM-DDTHH:MM:SS)
pushnumberno1 if a push notification must be sent to the recipient when the transaction is performed, 0 otherwise. (default is 1)
prioritynumberno0 if normal priority, 1 otherwise. (default is 0)
commission_payernumberno0 if the commission is paid by the recipient, 1 if paid by the sender. (if omitted, default settings are applied)
testnumbernoWhen set to 1, the request will not result into a BTU distribution. (default is 0)

Examples

This example creates a send request for 1 BTU to the address 0x0123456789012345678901234567890123456789 on the Mainnet network.

const res = myBtuSender.sendRequest({
  amount: 1,
  currency: 'BTU',
  recipient: '0x0123456789012345678901234567890123456789',
  network: 'mainnet'
})
.then(res => {
  console.log('BTU Sender Response:', res);
});

This example creates a test send request for 2 EUR to the address 0x0123456789012345678901234567890123456789 on Ropsten, to be performed after september 1st, 2020, with a higher priority. The commission is to be paid by the recipient. No push notification is required.

const res = myBtuSender.sendRequest({
  amount: 2,
  currency: 'EUR',
  recipient: '0x0123456789012345678901234567890123456789',
  network: 'ropsten',
  from: '2020-09-01T00:00:00',
  push: 0,
  priority: 0,
  commission_payer: 0,
  test: 0
})
.then(res => {
  console.log('BTU Sender Response:', res);
});

License

This project is licensed under a proprietary License- see the LICENSE file for details