Stellar Batch Payment Library
Batch payment library for Stellar
Installation
Install the package with:
npm install stellar-batch-payment --save
Usage
The library needs to be configured with fee payer accounts (max 50).
const BatchPayment = ;const batchPayment =defaultMemo: 'thx from batch payment lib'fee: 101feePayersSecrets: 'SDL...A2J' 'SFK...ABJ' ...;
Configuration
- batchSize
Number of payments per transaction.
Default value:100
Required: false - defaultMemo
Default value for payments without memo.
Required: false - fee
The max fee willing to pay per operation (in stroops) .
Default value: 100
Required: false - feePayersSecrets
Array of fee payers secret keys .
Required: true - publicNetUri
Public horizon uri.
Default value:"https://horizon.stellar.org"
Required: false - testNetUri
Testnet horizon uri.
Default value:"https://horizon-testnet.stellar.org"
Required: false - useTestnet
if true then the testnet will be used.
Default value:true
Required: false
Batch payments from csv
The csv file must have the next headers:
amount, destination, asset.code, asset.issuer, memo.value, memo.type
- destination can be Ed25519 public key or federated addresses
- if the payment is XLM then the issuer can be empty
- memo fields are optional
const stream = batchPayment;const outputStream = fs;outputStreamstream;
Batch payments from array
const payments = ;for var i = 0; i < 10; i++payments;batchPayment;
Batch payments from stream (object mode)
const payments = objectMode: true;const stream = batchPayment;stream;for var i = 0; i < 1000; i++payments;// end the streampayments
Development
Run all tests:
$ npm install$ npm test
Run a single test suite:
$ npm run mocha -- test/helpers/utils.spec.js
Run a single test (case sensitive):
$ npm run mocha -- test/helpers/utils.spec.js --grep 'resolveAddress'