Skip to content

Instantly share code, notes, and snippets.

@emschwartz
Forked from justmoon/01a_sender.js
Created May 19, 2016 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emschwartz/0bfbf08dc21d5d53025ebc8f6cf42366 to your computer and use it in GitHub Desktop.
Save emschwartz/0bfbf08dc21d5d53025ebc8f6cf42366 to your computer and use it in GitHub Desktop.
SPP Example
import { Client } from 'spp-client'
const client = new Client({
username: 'alice@red.ilpdemo.org',
password: 'secret'
})
function pay () {
const payment = client.payment({
destination: 'bob@blue.ilpdemo.org',
destinationAmount: '0.01',
memo: 'Still love you!'
})
return payment.send()
}
setInterval(pay, 1500)
import { Client } from 'spp-client'
const client = new Client({
username: 'bob@blue.ilpdemo.org',
password: 'secret'
})
client.on('incoming', (payment) => {
console.log('Received ' + payment.amount + ' bucks!')
console.log(payment.sender + ' says: ' + payment.memo)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment