https://github.com/bitfinexcom/dazaar-scatter-pay
https://github.com/bitfinexcom/dazaar-scatter-pay
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bitfinexcom/dazaar-scatter-pay
- Owner: bitfinexcom
- License: mit
- Created: 2019-10-18T08:36:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T20:31:46.000Z (almost 6 years ago)
- Last Synced: 2025-02-03T09:18:37.475Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dazaar-scatter-pay
Pay for Dazaar feeds using Scatter
```js
const DazaarPay = require('dazaar-scatter-pay')
// pass in an array of dazaard card entries
const payments = [{ currency: 'EOS', payTo: 'dazaartest22' }]
const sellerKey = Buffer.from('dazaar-seller-key', 'hex')
const pay = new DazaarPay(payments, sellerKey)
for (const provider of pay.supported) {
console.log('Supports', provider.name)
}
// Will call out to Scatter to request the purchase
pay.supported[0].buy(buyerKey, '1.0000 EOS', function (err) {
console.log('bought for 1 EOS?', err)
})
```
## API
#### `pay = new DazaarScatterPay(payments, sellerKey)`
Make a new instance.
`payments` should be an array of payment objects, usually retrieved using a Dazaar card.
`sellerKey` should be the Dazaar sellers key as a buffer.
#### `pay.supported`
A list of supported Payment objects corresponding to your payments input.
#### `payment = pay.match(paymentEntry)`
Match a specific entry from your payments input to a provider. If not supported null is returned.
#### `payment.buy(buyerKey, amount, cb)`
Purchase Dazaar time for the given amount. `buyerKey` should be the buyer's key as a buffer.