3.1.4-alpha.2 • Published 3 years ago

ilp-packet v3.1.4-alpha.2

Weekly downloads
1,325
License
Apache-2.0
Repository
-
Last release
3 years ago

ILP Packet

npm

A serializer and deserializer for ILP packets and messages

Usage

Install

npm install ilp-packet

Serialize PREPARE, FULFILL, REJECT

const IlpPacket = require('ilp-packet')
const crypto = require('crypto')
function sha256(preimage) {
  return crypto.createHash('sha256').update(preimage).digest()
}

const fulfillment = crypto.randomBytes(32)
const condition = sha256(fulfillment)

const binaryPrepare = IlpPacket.serializeIlpPrepare({
  amount: '10',
  executionCondition: condition,
  destination: 'g.us.nexus.bob',
  data: Buffer.from('hello world'),
  expiresAt: new Date(new Date().getTime() + 10000),
})

const binaryFulfill = IlpPacket.serializeIlpFulfill({
  fulfillment,
  data: Buffer.from('thank you'),
})

const binaryReject = IlpPacket.serializeIlpReject({
  code: 'F00',
  triggeredBy: 'g.us.nexus.gateway',
  message: 'more details, human-readable',
  data: Buffer.from('more details, machine-readable'),
})

Types

IlpPrepare

PropertyType
amountstring
executionConditionBuffer
expiresAtDate
destinationstring
dataBuffer

IlpFulfill

PropertyType
fulfillmentBuffer
dataBuffer

IlpReject

PropertyType
codeIlpErrorCode
triggeredBystring
messagestring
dataBuffer
3.1.4-alpha.2

3 years ago

3.1.4-alpha.0

3 years ago

3.1.4-alpha.1

3 years ago

3.1.3

4 years ago

3.1.2

5 years ago

3.1.0-alpha.0

6 years ago

3.0.9

6 years ago

3.0.8

7 years ago

3.0.7

7 years ago

3.0.6

7 years ago

3.0.5

7 years ago

3.0.4

7 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

8 years ago

1.7.0

8 years ago

1.6.0

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago