init
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
const { loadFixture } = require('./utils')
|
||||
const { coreTypes } = require('../src/types')
|
||||
const { Amount } = coreTypes
|
||||
const fixtures = loadFixture('data-driven-tests.json')
|
||||
|
||||
function amountErrorTests() {
|
||||
fixtures.values_tests
|
||||
.filter((obj) => obj.type === 'Amount')
|
||||
.forEach((f) => {
|
||||
// We only want these with errors
|
||||
if (!f.error) {
|
||||
return
|
||||
}
|
||||
const testName =
|
||||
`${JSON.stringify(f.test_json)}\n\tis invalid ` + `because: ${f.error}`
|
||||
it(testName, () => {
|
||||
expect(() => {
|
||||
Amount.from(f.test_json)
|
||||
JSON.stringify(f.test_json)
|
||||
}).toThrow()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
describe('Amount', function () {
|
||||
it('can be parsed from', function () {
|
||||
expect(Amount.from('1000000') instanceof Amount).toBe(true)
|
||||
expect(Amount.from('1000000').toJSON()).toEqual('1000000')
|
||||
const fixture = {
|
||||
value: '1',
|
||||
issuer: '0000000000000000000000000000000000000000',
|
||||
currency: 'USD',
|
||||
}
|
||||
const amt = Amount.from(fixture)
|
||||
const rewritten = {
|
||||
value: '1',
|
||||
issuer: 'rrrrrrrrrrrrrrrrrrrrrhoLvTp',
|
||||
currency: 'USD',
|
||||
}
|
||||
expect(amt.toJSON()).toEqual(rewritten)
|
||||
})
|
||||
amountErrorTests()
|
||||
})
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
const fixtures = require('./fixtures/codec-fixtures.json')
|
||||
const { decode, encode, decodeLedgerData } = require('../src')
|
||||
|
||||
function json(object) {
|
||||
return JSON.stringify(object)
|
||||
}
|
||||
|
||||
function truncateForDisplay(longStr) {
|
||||
return `${longStr.slice(0, 10)} ... ${longStr.slice(-10)}`
|
||||
}
|
||||
|
||||
describe('ripple-binary-codec', function () {
|
||||
function makeSuite(name, entries) {
|
||||
describe(name, function () {
|
||||
entries.forEach((t, testN) => {
|
||||
test(`${name}[${testN}] can encode ${truncateForDisplay(
|
||||
json(t.json),
|
||||
)} to ${truncateForDisplay(t.binary)}`, () => {
|
||||
expect(encode(t.json)).toEqual(t.binary)
|
||||
})
|
||||
test(`${name}[${testN}] can decode ${truncateForDisplay(
|
||||
t.binary,
|
||||
)} to ${truncateForDisplay(json(t.json))}`, () => {
|
||||
const decoded = decode(t.binary)
|
||||
expect(decoded).toEqual(t.json)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
makeSuite('transactions', fixtures.transactions)
|
||||
makeSuite('accountState', fixtures.accountState)
|
||||
|
||||
describe('ledgerData', function () {
|
||||
if (fixtures.ledgerData) {
|
||||
fixtures.ledgerData.forEach((t, testN) => {
|
||||
test(`ledgerData[${testN}] can decode ${t.binary} to ${json(
|
||||
t.json,
|
||||
)}`, () => {
|
||||
const decoded = decodeLedgerData(t.binary)
|
||||
expect(t.json).toEqual(decoded)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
+396
@@ -0,0 +1,396 @@
|
||||
const { coreTypes } = require('../src/types')
|
||||
const Decimal = require('decimal.js')
|
||||
|
||||
const { encodeAccountID } = require('ripple-address-codec')
|
||||
const { binary } = require('../src/coretypes')
|
||||
const { Amount, Hash160 } = coreTypes
|
||||
const { makeParser, readJSON } = binary
|
||||
const { Field, TransactionType } = require('./../src/enums')
|
||||
const { parseHexOnly, hexOnly, loadFixture } = require('./utils')
|
||||
const fixtures = loadFixture('data-driven-tests.json')
|
||||
const { BytesList } = require('../src/serdes/binary-serializer')
|
||||
const { Buffer } = require('buffer/')
|
||||
|
||||
const __ = hexOnly
|
||||
function toJSON(v) {
|
||||
return v.toJSON ? v.toJSON() : v
|
||||
}
|
||||
|
||||
function assertEqualAmountJSON(actual, expected) {
|
||||
expect(typeof actual === typeof expected).toBe(true)
|
||||
if (typeof actual === 'string') {
|
||||
expect(actual).toEqual(expected)
|
||||
return
|
||||
}
|
||||
expect(actual.currency).toEqual(expected.currency)
|
||||
expect(actual.issuer).toEqual(expected.issuer)
|
||||
expect(
|
||||
actual.value === expected.value ||
|
||||
new Decimal(actual.value).equals(new Decimal(expected.value)),
|
||||
).toBe(true)
|
||||
}
|
||||
|
||||
function basicApiTests() {
|
||||
const bytes = parseHexOnly('00,01020304,0506', Uint8Array)
|
||||
test('can read slices of bytes', () => {
|
||||
const parser = makeParser(bytes)
|
||||
expect(parser.bytes instanceof Buffer).toBe(true)
|
||||
const read1 = parser.read(1)
|
||||
expect(read1 instanceof Buffer).toBe(true)
|
||||
expect(read1).toEqual(Buffer.from([0]))
|
||||
expect(parser.read(4)).toEqual(Buffer.from([1, 2, 3, 4]))
|
||||
expect(parser.read(2)).toEqual(Buffer.from([5, 6]))
|
||||
expect(() => parser.read(1)).toThrow()
|
||||
})
|
||||
test('can read a Uint32 at full', () => {
|
||||
const parser = makeParser('FFFFFFFF')
|
||||
expect(parser.readUInt32()).toEqual(0xffffffff)
|
||||
})
|
||||
}
|
||||
|
||||
function transactionParsingTests() {
|
||||
const transaction = {
|
||||
json: {
|
||||
Account: 'raD5qJMAShLeHZXf9wjUmo6vRK4arj9cF3',
|
||||
Fee: '10',
|
||||
Flags: 0,
|
||||
Sequence: 103929,
|
||||
SigningPubKey:
|
||||
'028472865AF4CB32AA285834B57576B7290AA8C31B459047DB27E16F418D6A7166',
|
||||
TakerGets: {
|
||||
currency: 'ILS',
|
||||
issuer: 'rNPRNzBB92BVpAhhZr4iXDTveCgV5Pofm9',
|
||||
value: '1694.768',
|
||||
},
|
||||
TakerPays: '98957503520',
|
||||
TransactionType: 'OfferCreate',
|
||||
TxnSignature: __(`
|
||||
304502202ABE08D5E78D1E74A4C18F2714F64E87B8BD57444AF
|
||||
A5733109EB3C077077520022100DB335EE97386E4C0591CAC02
|
||||
4D50E9230D8F171EEB901B5E5E4BD6D1E0AEF98C`),
|
||||
},
|
||||
binary: __(`
|
||||
120007220000000024000195F964400000170A53AC2065D5460561E
|
||||
C9DE000000000000000000000000000494C53000000000092D70596
|
||||
8936C419CE614BF264B5EEB1CEA47FF468400000000000000A73210
|
||||
28472865AF4CB32AA285834B57576B7290AA8C31B459047DB27E16F
|
||||
418D6A71667447304502202ABE08D5E78D1E74A4C18F2714F64E87B
|
||||
8BD57444AFA5733109EB3C077077520022100DB335EE97386E4C059
|
||||
1CAC024D50E9230D8F171EEB901B5E5E4BD6D1E0AEF98C811439408
|
||||
A69F0895E62149CFCC006FB89FA7D1E6E5D`),
|
||||
}
|
||||
|
||||
const tx_json = transaction.json
|
||||
// These tests are basically development logs
|
||||
|
||||
test('can be done with low level apis', () => {
|
||||
const parser = makeParser(transaction.binary)
|
||||
|
||||
expect(parser.readField()).toEqual(Field.TransactionType)
|
||||
expect(parser.readUInt16()).toEqual(7)
|
||||
expect(parser.readField()).toEqual(Field.Flags)
|
||||
expect(parser.readUInt32()).toEqual(0)
|
||||
expect(parser.readField()).toEqual(Field.Sequence)
|
||||
expect(parser.readUInt32()).toEqual(103929)
|
||||
expect(parser.readField()).toEqual(Field.TakerPays)
|
||||
parser.read(8)
|
||||
expect(parser.readField()).toEqual(Field.TakerGets)
|
||||
// amount value
|
||||
expect(parser.read(8)).not.toBe([])
|
||||
// amount currency
|
||||
expect(Hash160.fromParser(parser)).not.toBe([])
|
||||
expect(encodeAccountID(parser.read(20))).toEqual(tx_json.TakerGets.issuer)
|
||||
expect(parser.readField()).toEqual(Field.Fee)
|
||||
expect(parser.read(8)).not.toEqual([])
|
||||
expect(parser.readField()).toEqual(Field.SigningPubKey)
|
||||
expect(parser.readVariableLengthLength()).toBe(33)
|
||||
expect(parser.read(33).toString('hex').toUpperCase()).toEqual(
|
||||
tx_json.SigningPubKey,
|
||||
)
|
||||
expect(parser.readField()).toEqual(Field.TxnSignature)
|
||||
expect(parser.readVariableLength().toString('hex').toUpperCase()).toEqual(
|
||||
tx_json.TxnSignature,
|
||||
)
|
||||
expect(parser.readField()).toEqual(Field.Account)
|
||||
expect(encodeAccountID(parser.readVariableLength())).toEqual(
|
||||
tx_json.Account,
|
||||
)
|
||||
expect(parser.end()).toBe(true)
|
||||
})
|
||||
|
||||
test('can be done with high level apis', () => {
|
||||
const parser = makeParser(transaction.binary)
|
||||
function readField() {
|
||||
return parser.readFieldAndValue()
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.TransactionType)
|
||||
expect(value).toEqual(TransactionType.OfferCreate)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.Flags)
|
||||
expect(value.valueOf()).toEqual(0)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.Sequence)
|
||||
expect(value.valueOf()).toEqual(103929)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.TakerPays)
|
||||
expect(value.isNative()).toEqual(true)
|
||||
expect(value.toJSON()).toEqual('98957503520')
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.TakerGets)
|
||||
expect(value.isNative()).toEqual(false)
|
||||
expect(value.toJSON().issuer).toEqual(tx_json.TakerGets.issuer)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.Fee)
|
||||
expect(value.isNative()).toEqual(true)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.SigningPubKey)
|
||||
expect(value.toJSON()).toEqual(tx_json.SigningPubKey)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.TxnSignature)
|
||||
expect(value.toJSON()).toEqual(tx_json.TxnSignature)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.Account)
|
||||
expect(value.toJSON()).toEqual(tx_json.Account)
|
||||
}
|
||||
expect(parser.end()).toBe(true)
|
||||
})
|
||||
|
||||
test('can be done with higher level apis', () => {
|
||||
const parser = makeParser(transaction.binary)
|
||||
const jsonFromBinary = readJSON(parser)
|
||||
expect(jsonFromBinary).toEqual(tx_json)
|
||||
})
|
||||
|
||||
test('readJSON (binary.decode) does not return STObject ', () => {
|
||||
const parser = makeParser(transaction.binary)
|
||||
const jsonFromBinary = readJSON(parser)
|
||||
expect(jsonFromBinary instanceof coreTypes.STObject).toBe(false)
|
||||
expect(jsonFromBinary instanceof Object).toBe(true)
|
||||
expect(jsonFromBinary.prototype).toBe(undefined)
|
||||
})
|
||||
}
|
||||
|
||||
function amountParsingTests() {
|
||||
fixtures.values_tests
|
||||
.filter((obj) => obj.type === 'Amount')
|
||||
.forEach((f, i) => {
|
||||
if (f.error) {
|
||||
return
|
||||
}
|
||||
const parser = makeParser(f.expected_hex)
|
||||
const testName = `values_tests[${i}] parses ${f.expected_hex.slice(
|
||||
0,
|
||||
16,
|
||||
)}...
|
||||
as ${JSON.stringify(f.test_json)}`
|
||||
test(testName, () => {
|
||||
const value = parser.readType(Amount)
|
||||
// May not actually be in canonical form. The fixtures are to be used
|
||||
// also for json -> binary;
|
||||
const json = toJSON(value)
|
||||
assertEqualAmountJSON(json, f.test_json)
|
||||
if (f.exponent) {
|
||||
const exponent = new Decimal(json.value)
|
||||
expect(exponent.e - 15).toEqual(f.exponent)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function fieldParsingTests() {
|
||||
fixtures.fields_tests.forEach((f, i) => {
|
||||
const parser = makeParser(f.expected_hex)
|
||||
test(`fields[${i}]: parses ${f.expected_hex} as ${f.name}`, () => {
|
||||
const field = parser.readField()
|
||||
expect(field.name).toEqual(f.name)
|
||||
expect(field.type.name).toEqual(f.type_name)
|
||||
})
|
||||
})
|
||||
test('Field throws when type code out of range', () => {
|
||||
const parser = makeParser('0101')
|
||||
expect(() => parser.readField()).toThrow(
|
||||
new Error('Cannot read FieldOrdinal, type_code out of range'),
|
||||
)
|
||||
})
|
||||
test('Field throws when field code out of range', () => {
|
||||
const parser = makeParser('1001')
|
||||
expect(() => parser.readFieldOrdinal()).toThrowError(
|
||||
new Error('Cannot read FieldOrdinal, field_code out of range'),
|
||||
)
|
||||
})
|
||||
test('Field throws when both type and field code out of range', () => {
|
||||
const parser = makeParser('000101')
|
||||
expect(() => parser.readFieldOrdinal()).toThrowError(
|
||||
new Error('Cannot read FieldOrdinal, type_code out of range'),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function assertRecyclable(json, forField) {
|
||||
const Type = forField.associatedType
|
||||
const recycled = Type.from(json).toJSON()
|
||||
expect(recycled).toEqual(json)
|
||||
const sink = new BytesList()
|
||||
Type.from(recycled).toBytesSink(sink)
|
||||
const recycledAgain = makeParser(sink.toHex()).readType(Type).toJSON()
|
||||
expect(recycledAgain).toEqual(json)
|
||||
}
|
||||
|
||||
function nestedObjectTests() {
|
||||
fixtures.whole_objects.forEach((f, i) => {
|
||||
test(`whole_objects[${i}]: can parse blob into
|
||||
${JSON.stringify(
|
||||
f.tx_json,
|
||||
)}`, /* */ () => {
|
||||
const parser = makeParser(f.blob_with_no_signing)
|
||||
let ix = 0
|
||||
while (!parser.end()) {
|
||||
const [field, value] = parser.readFieldAndValue()
|
||||
const expected = f.fields[ix]
|
||||
const expectedJSON = expected[1].json
|
||||
const expectedField = expected[0]
|
||||
const actual = toJSON(value)
|
||||
|
||||
try {
|
||||
expect(actual).toEqual(expectedJSON)
|
||||
} catch (e) {
|
||||
throw new Error(`${e} ${field} a: ${actual} e: ${expectedJSON}`)
|
||||
}
|
||||
expect(field.name).toEqual(expectedField)
|
||||
assertRecyclable(actual, field)
|
||||
ix++
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function pathSetBinaryTests() {
|
||||
const bytes = __(
|
||||
`1200002200000000240000002E2E00004BF161D4C71AFD498D00000000000000
|
||||
0000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA0
|
||||
6594D168400000000000000A69D446F8038585E9400000000000000000000000
|
||||
00425443000000000078CA21A6014541AB7B26C3929B9E0CD8C284D61C732103
|
||||
A4665B1F0B7AE2BCA12E2DB80A192125BBEA660F80E9CEE137BA444C1B0769EC
|
||||
7447304502205A964536805E35785C659D1F9670D057749AE39668175D6AA75D
|
||||
25B218FE682E0221009252C0E5DDD5F2712A48F211669DE17B54113918E0D2C2
|
||||
66F818095E9339D7D3811478CA21A6014541AB7B26C3929B9E0CD8C284D61C83
|
||||
140A20B3C85F482532A9578DBB3950B85CA06594D1011231585E1F3BD02A15D6
|
||||
185F8BB9B57CC60DEDDB37C10000000000000000000000004254430000000000
|
||||
585E1F3BD02A15D6185F8BB9B57CC60DEDDB37C131E4FE687C90257D3D2D694C
|
||||
8531CDEECBE84F33670000000000000000000000004254430000000000E4FE68
|
||||
7C90257D3D2D694C8531CDEECBE84F3367310A20B3C85F482532A9578DBB3950
|
||||
B85CA06594D100000000000000000000000042544300000000000A20B3C85F48
|
||||
2532A9578DBB3950B85CA06594D1300000000000000000000000005553440000
|
||||
0000000A20B3C85F482532A9578DBB3950B85CA06594D1FF31585E1F3BD02A15
|
||||
D6185F8BB9B57CC60DEDDB37C100000000000000000000000042544300000000
|
||||
00585E1F3BD02A15D6185F8BB9B57CC60DEDDB37C131E4FE687C90257D3D2D69
|
||||
4C8531CDEECBE84F33670000000000000000000000004254430000000000E4FE
|
||||
687C90257D3D2D694C8531CDEECBE84F33673115036E2D3F5437A83E5AC3CAEE
|
||||
34FF2C21DEB618000000000000000000000000425443000000000015036E2D3F
|
||||
5437A83E5AC3CAEE34FF2C21DEB6183000000000000000000000000055534400
|
||||
000000000A20B3C85F482532A9578DBB3950B85CA06594D1FF31585E1F3BD02A
|
||||
15D6185F8BB9B57CC60DEDDB37C1000000000000000000000000425443000000
|
||||
0000585E1F3BD02A15D6185F8BB9B57CC60DEDDB37C13157180C769B66D942EE
|
||||
69E6DCC940CA48D82337AD000000000000000000000000425443000000000057
|
||||
180C769B66D942EE69E6DCC940CA48D82337AD10000000000000000000000000
|
||||
00000000000000003000000000000000000000000055534400000000000A20B3
|
||||
C85F482532A9578DBB3950B85CA06594D100`,
|
||||
)
|
||||
|
||||
const expectedJSON = [
|
||||
[
|
||||
{
|
||||
account: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
currency: 'BTC',
|
||||
issuer: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
},
|
||||
{
|
||||
account: 'rM1oqKtfh1zgjdAgbFmaRm3btfGBX25xVo',
|
||||
currency: 'BTC',
|
||||
issuer: 'rM1oqKtfh1zgjdAgbFmaRm3btfGBX25xVo',
|
||||
},
|
||||
{
|
||||
account: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
currency: 'BTC',
|
||||
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
},
|
||||
{
|
||||
currency: 'USD',
|
||||
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
account: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
currency: 'BTC',
|
||||
issuer: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
},
|
||||
{
|
||||
account: 'rM1oqKtfh1zgjdAgbFmaRm3btfGBX25xVo',
|
||||
currency: 'BTC',
|
||||
issuer: 'rM1oqKtfh1zgjdAgbFmaRm3btfGBX25xVo',
|
||||
},
|
||||
{
|
||||
account: 'rpvfJ4mR6QQAeogpXEKnuyGBx8mYCSnYZi',
|
||||
currency: 'BTC',
|
||||
issuer: 'rpvfJ4mR6QQAeogpXEKnuyGBx8mYCSnYZi',
|
||||
},
|
||||
{
|
||||
currency: 'USD',
|
||||
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
account: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
currency: 'BTC',
|
||||
issuer: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
},
|
||||
{
|
||||
account: 'r3AWbdp2jQLXLywJypdoNwVSvr81xs3uhn',
|
||||
currency: 'BTC',
|
||||
issuer: 'r3AWbdp2jQLXLywJypdoNwVSvr81xs3uhn',
|
||||
},
|
||||
{ currency: 'XRP' },
|
||||
{
|
||||
currency: 'USD',
|
||||
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
},
|
||||
],
|
||||
]
|
||||
|
||||
test('works with long paths', () => {
|
||||
const parser = makeParser(bytes)
|
||||
const txn = readJSON(parser)
|
||||
expect(txn.Paths).toEqual(expectedJSON)
|
||||
// TODO: this should go elsewhere
|
||||
expect(coreTypes.PathSet.from(txn.Paths).toJSON()).toEqual(expectedJSON)
|
||||
})
|
||||
}
|
||||
|
||||
describe('Binary Parser', function () {
|
||||
describe('pathSetBinaryTests', () => pathSetBinaryTests())
|
||||
describe('nestedObjectTests', () => nestedObjectTests())
|
||||
describe('fieldParsingTests', () => fieldParsingTests())
|
||||
describe('amountParsingTests', () => amountParsingTests())
|
||||
describe('transactionParsingTests', () => transactionParsingTests())
|
||||
describe('basicApiTests', () => basicApiTests())
|
||||
})
|
||||
+289
@@ -0,0 +1,289 @@
|
||||
const { binary } = require('../src/coretypes')
|
||||
const { encode, decode } = require('../src')
|
||||
const { makeParser, BytesList, BinarySerializer } = binary
|
||||
const { coreTypes } = require('../src/types')
|
||||
const { UInt8, UInt16, UInt32, UInt64, STObject } = coreTypes
|
||||
const bigInt = require('big-integer')
|
||||
const { Buffer } = require('buffer/')
|
||||
|
||||
const { loadFixture } = require('./utils')
|
||||
const fixtures = loadFixture('data-driven-tests.json')
|
||||
const deliverMinTx = require('./fixtures/delivermin-tx.json')
|
||||
const deliverMinTxBinary = require('./fixtures/delivermin-tx-binary.json')
|
||||
const SignerListSet = {
|
||||
tx: require('./fixtures/signerlistset-tx.json'),
|
||||
binary: require('./fixtures/signerlistset-tx-binary.json'),
|
||||
meta: require('./fixtures/signerlistset-tx-meta-binary.json'),
|
||||
}
|
||||
const DepositPreauth = {
|
||||
tx: require('./fixtures/deposit-preauth-tx.json'),
|
||||
binary: require('./fixtures/deposit-preauth-tx-binary.json'),
|
||||
meta: require('./fixtures/deposit-preauth-tx-meta-binary.json'),
|
||||
}
|
||||
const Escrow = {
|
||||
create: {
|
||||
tx: require('./fixtures/escrow-create-tx.json'),
|
||||
binary: require('./fixtures/escrow-create-binary.json'),
|
||||
},
|
||||
finish: {
|
||||
tx: require('./fixtures/escrow-finish-tx.json'),
|
||||
binary: require('./fixtures/escrow-finish-binary.json'),
|
||||
meta: require('./fixtures/escrow-finish-meta-binary.json'),
|
||||
},
|
||||
cancel: {
|
||||
tx: require('./fixtures/escrow-cancel-tx.json'),
|
||||
binary: require('./fixtures/escrow-cancel-binary.json'),
|
||||
},
|
||||
}
|
||||
const PaymentChannel = {
|
||||
create: {
|
||||
tx: require('./fixtures/payment-channel-create-tx.json'),
|
||||
binary: require('./fixtures/payment-channel-create-binary.json'),
|
||||
},
|
||||
fund: {
|
||||
tx: require('./fixtures/payment-channel-fund-tx.json'),
|
||||
binary: require('./fixtures/payment-channel-fund-binary.json'),
|
||||
},
|
||||
claim: {
|
||||
tx: require('./fixtures/payment-channel-claim-tx.json'),
|
||||
binary: require('./fixtures/payment-channel-claim-binary.json'),
|
||||
},
|
||||
}
|
||||
|
||||
const Ticket = {
|
||||
create: {
|
||||
tx: require('./fixtures/ticket-create-tx.json'),
|
||||
binary: require('./fixtures/ticket-create-binary.json'),
|
||||
},
|
||||
}
|
||||
|
||||
let json_undefined = {
|
||||
TakerPays: '223174650',
|
||||
Account: 'rPk2dXr27rMw9G5Ej9ad2Tt7RJzGy8ycBp',
|
||||
TransactionType: 'OfferCreate',
|
||||
Memos: [
|
||||
{
|
||||
Memo: {
|
||||
MemoType: '584D4D2076616C7565',
|
||||
MemoData: '322E3230393635',
|
||||
MemoFormat: undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
Fee: '15',
|
||||
OfferSequence: undefined,
|
||||
TakerGets: {
|
||||
currency: 'XMM',
|
||||
value: '100',
|
||||
issuer: 'rExAPEZvbkZqYPuNcZ7XEBLENEshsWDQc8',
|
||||
},
|
||||
Flags: 524288,
|
||||
Sequence: undefined,
|
||||
LastLedgerSequence: 6220135,
|
||||
}
|
||||
|
||||
let json_omitted = {
|
||||
TakerPays: '223174650',
|
||||
Account: 'rPk2dXr27rMw9G5Ej9ad2Tt7RJzGy8ycBp',
|
||||
TransactionType: 'OfferCreate',
|
||||
Memos: [
|
||||
{
|
||||
Memo: {
|
||||
MemoType: '584D4D2076616C7565',
|
||||
MemoData: '322E3230393635',
|
||||
},
|
||||
},
|
||||
],
|
||||
Fee: '15',
|
||||
TakerGets: {
|
||||
currency: 'XMM',
|
||||
value: '100',
|
||||
issuer: 'rExAPEZvbkZqYPuNcZ7XEBLENEshsWDQc8',
|
||||
},
|
||||
Flags: 524288,
|
||||
LastLedgerSequence: 6220135,
|
||||
}
|
||||
|
||||
const NegativeUNL = require('./fixtures/negative-unl.json')
|
||||
|
||||
function bytesListTest() {
|
||||
const list = new BytesList()
|
||||
.put(Buffer.from([0]))
|
||||
.put(Buffer.from([2, 3]))
|
||||
.put(Buffer.from([4, 5]))
|
||||
test('is an Array<Buffer>', function () {
|
||||
expect(Array.isArray(list.bytesArray)).toBe(true)
|
||||
expect(list.bytesArray[0] instanceof Buffer).toBe(true)
|
||||
})
|
||||
test('keeps track of the length itself', function () {
|
||||
expect(list.getLength()).toBe(5)
|
||||
})
|
||||
test('can join all arrays into one via toBytes', function () {
|
||||
const joined = list.toBytes()
|
||||
expect(joined).toHaveLength(5)
|
||||
expect(joined).toEqual(Buffer.from([0, 2, 3, 4, 5]))
|
||||
})
|
||||
}
|
||||
|
||||
function assertRecycles(blob) {
|
||||
const parser = makeParser(blob)
|
||||
const so = parser.readType(STObject)
|
||||
const out = new BytesList()
|
||||
so.toBytesSink(out)
|
||||
const hex = out.toHex()
|
||||
expect(hex).toEqual(blob)
|
||||
expect(hex + ':').not.toEqual(blob)
|
||||
}
|
||||
|
||||
function nestedObjectTests() {
|
||||
fixtures.whole_objects.forEach((f, i) => {
|
||||
test(`whole_objects[${i}]: can parse blob and dump out same blob`, () => {
|
||||
assertRecycles(f.blob_with_no_signing)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function check(type, n, expected) {
|
||||
test(`Uint${type.width * 8} serializes ${n} as ${expected}`, function () {
|
||||
const bl = new BytesList()
|
||||
const serializer = new BinarySerializer(bl)
|
||||
if (expected === 'throws') {
|
||||
expect(() => serializer.writeType(type, n)).toThrow()
|
||||
return
|
||||
}
|
||||
serializer.writeType(type, n)
|
||||
expect(bl.toBytes()).toEqual(Buffer.from(expected))
|
||||
})
|
||||
}
|
||||
|
||||
check(UInt8, 5, [5])
|
||||
check(UInt16, 5, [0, 5])
|
||||
check(UInt32, 5, [0, 0, 0, 5])
|
||||
check(UInt32, 0xffffffff, [255, 255, 255, 255])
|
||||
check(UInt8, 0xfeffffff, 'throws')
|
||||
check(UInt16, 0xfeffffff, 'throws')
|
||||
check(UInt16, 0xfeffffff, 'throws')
|
||||
check(UInt64, 0xfeffffff, [0, 0, 0, 0, 254, 255, 255, 255])
|
||||
check(UInt64, -1, 'throws')
|
||||
check(UInt64, 0, [0, 0, 0, 0, 0, 0, 0, 0])
|
||||
check(UInt64, 1, [0, 0, 0, 0, 0, 0, 0, 1])
|
||||
check(UInt64, bigInt(1), [0, 0, 0, 0, 0, 0, 0, 1])
|
||||
|
||||
function deliverMinTest() {
|
||||
test('can serialize DeliverMin', () => {
|
||||
expect(encode(deliverMinTx)).toEqual(deliverMinTxBinary)
|
||||
})
|
||||
}
|
||||
|
||||
function SignerListSetTest() {
|
||||
test('can serialize SignerListSet', () => {
|
||||
expect(encode(SignerListSet.tx)).toEqual(SignerListSet.binary)
|
||||
})
|
||||
test('can serialize SignerListSet metadata', () => {
|
||||
expect(encode(SignerListSet.tx.meta)).toEqual(SignerListSet.meta)
|
||||
})
|
||||
}
|
||||
|
||||
function DepositPreauthTest() {
|
||||
test('can serialize DepositPreauth', () => {
|
||||
expect(encode(DepositPreauth.tx)).toEqual(DepositPreauth.binary)
|
||||
})
|
||||
test('can serialize DepositPreauth metadata', () => {
|
||||
expect(encode(DepositPreauth.tx.meta)).toEqual(DepositPreauth.meta)
|
||||
})
|
||||
}
|
||||
|
||||
function EscrowTest() {
|
||||
test('can serialize EscrowCreate', () => {
|
||||
expect(encode(Escrow.create.tx)).toEqual(Escrow.create.binary)
|
||||
})
|
||||
test('can serialize EscrowFinish', () => {
|
||||
expect(encode(Escrow.finish.tx)).toEqual(Escrow.finish.binary)
|
||||
expect(encode(Escrow.finish.tx.meta)).toEqual(Escrow.finish.meta)
|
||||
})
|
||||
test('can serialize EscrowCancel', () => {
|
||||
expect(encode(Escrow.cancel.tx)).toEqual(Escrow.cancel.binary)
|
||||
})
|
||||
}
|
||||
|
||||
function PaymentChannelTest() {
|
||||
test('can serialize PaymentChannelCreate', () => {
|
||||
expect(encode(PaymentChannel.create.tx)).toEqual(
|
||||
PaymentChannel.create.binary,
|
||||
)
|
||||
})
|
||||
test('can serialize PaymentChannelFund', () => {
|
||||
expect(encode(PaymentChannel.fund.tx)).toEqual(PaymentChannel.fund.binary)
|
||||
})
|
||||
test('can serialize PaymentChannelClaim', () => {
|
||||
expect(encode(PaymentChannel.claim.tx)).toEqual(PaymentChannel.claim.binary)
|
||||
})
|
||||
}
|
||||
|
||||
function NegativeUNLTest() {
|
||||
test('can serialize NegativeUNL', () => {
|
||||
expect(encode(NegativeUNL.tx)).toEqual(NegativeUNL.binary)
|
||||
})
|
||||
test('can deserialize NegativeUNL', () => {
|
||||
expect(decode(NegativeUNL.binary)).toEqual(NegativeUNL.tx)
|
||||
})
|
||||
}
|
||||
|
||||
function omitUndefinedTest() {
|
||||
test('omits fields with undefined value', () => {
|
||||
let encodedOmitted = encode(json_omitted)
|
||||
let encodedUndefined = encode(json_undefined)
|
||||
expect(encodedOmitted).toEqual(encodedUndefined)
|
||||
expect(decode(encodedOmitted)).toEqual(decode(encodedUndefined))
|
||||
})
|
||||
}
|
||||
|
||||
function ticketTest() {
|
||||
test('can serialize TicketCreate', () => {
|
||||
expect(encode(Ticket.create.tx)).toEqual(Ticket.create.binary)
|
||||
})
|
||||
}
|
||||
|
||||
function nfTokenTest() {
|
||||
const fixtures = require('./fixtures/nf-token.json')
|
||||
|
||||
for (const txName of Object.keys(fixtures)) {
|
||||
test(`can serialize transaction ${txName}`, () => {
|
||||
expect(encode(fixtures[txName].tx.json)).toEqual(
|
||||
fixtures[txName].tx.binary,
|
||||
)
|
||||
})
|
||||
|
||||
test(`can deserialize transaction ${txName}`, () => {
|
||||
expect(decode(fixtures[txName].tx.binary)).toEqual(
|
||||
fixtures[txName].tx.json,
|
||||
)
|
||||
})
|
||||
|
||||
test(`can serialize meta ${txName}`, () => {
|
||||
expect(encode(fixtures[txName].meta.json)).toEqual(
|
||||
fixtures[txName].meta.binary,
|
||||
)
|
||||
})
|
||||
|
||||
test(`can deserialize meta ${txName}`, () => {
|
||||
expect(decode(fixtures[txName].meta.binary)).toEqual(
|
||||
fixtures[txName].meta.json,
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
describe('Binary Serialization', function () {
|
||||
describe('nestedObjectTests', nestedObjectTests)
|
||||
describe('BytesList', bytesListTest)
|
||||
describe('DeliverMin', deliverMinTest)
|
||||
describe('DepositPreauth', DepositPreauthTest)
|
||||
describe('SignerListSet', SignerListSetTest)
|
||||
describe('Escrow', EscrowTest)
|
||||
describe('PaymentChannel', PaymentChannelTest)
|
||||
describe('NegativeUNLTest', NegativeUNLTest)
|
||||
describe('OmitUndefined', omitUndefinedTest)
|
||||
describe('TicketTest', ticketTest)
|
||||
describe('NFToken', nfTokenTest)
|
||||
})
|
||||
BIN
Binary file not shown.
+4466
File diff suppressed because one or more lines are too long
+2919
File diff suppressed because it is too large
Load Diff
+1
@@ -0,0 +1 @@
|
||||
"1200002280020000240000689E201B010BF0E361D4950EA99C657EF800000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D1684000000000002AF8694000000000003A986AD40485B690F28E8000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D173210254D771E2A30552D1F347F5B88EC87513843F8BC1A408E70A4175B2E3C325FD3C7446304402202A4965FCF0571B7308971956864B1949C2BD924B5A41B5E8DAF00C91C64F964502207FD3BEB7C165BD1F10E6E7C443742BD686F8E102A89B502A4A495F4C29EC5C488114EAAA52373B59DCFBFD3476049AA6408AA22EAA898314EAAA52373B59DCFBFD3476049AA6408AA22EAA8901123000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D1FF01FDF050193BEDEAA9074764B961405D31E66AC0E9300000000000000000000000005553440000000000FDF050193BEDEAA9074764B961405D31E66AC0E901FDF050193BEDEAA9074764B961405D31E66AC0E9FF300000000000000000000000005553440000000000DD39C650A96EDA48334E70CC4A85B8B2E8502CD301DD39C650A96EDA48334E70CC4A85B8B2E8502CD3017C44F934D7A5FEEBD1530570CDB83D1D8EF1F37E00"
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"Account": "r4PowrZ7KZw83oWDYxzY82ht2kgDmFUpB7",
|
||||
"Amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "5.927096147083"
|
||||
},
|
||||
"DeliverMin": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "0.012729190692"
|
||||
},
|
||||
"Destination": "r4PowrZ7KZw83oWDYxzY82ht2kgDmFUpB7",
|
||||
"Fee": "11000",
|
||||
"Flags": 2147614720,
|
||||
"LastLedgerSequence": 17559779,
|
||||
"Paths": [
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rQ96qm46YsRX2F7SSCQxToR2ybRuUYsZ4R",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rQ96qm46YsRX2F7SSCQxToR2ybRuUYsZ4R",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rQ96qm46YsRX2F7SSCQxToR2ybRuUYsZ4R",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rULnR9YhAkj9HrcxAcudzBhaXRSqT7zJkq",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"SendMax": "15000",
|
||||
"Sequence": 26782,
|
||||
"SigningPubKey": "0254D771E2A30552D1F347F5B88EC87513843F8BC1A408E70A4175B2E3C325FD3C",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "304402202A4965FCF0571B7308971956864B1949C2BD924B5A41B5E8DAF00C91C64F964502207FD3BEB7C165BD1F10E6E7C443742BD686F8E102A89B502A4A495F4C29EC5C48",
|
||||
"date": 502912010,
|
||||
"hash": "0FB10DF664F33840ABC68A8BBE78178359C55AC1AFC83DB468CE69C4A86E3EAC",
|
||||
"inLedger": 17559773,
|
||||
"ledger_index": 17559773,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "r4PowrZ7KZw83oWDYxzY82ht2kgDmFUpB7",
|
||||
"Balance": "1064773000",
|
||||
"Flags": 65536,
|
||||
"OwnerCount": 9,
|
||||
"Sequence": 26783
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "0D7F8ADAA3269E9C8B2AA9CDE31BC57E2E52133F36516D3DF576DBCE6E405BDC",
|
||||
"PreviousFields": {
|
||||
"Balance": "1064784000",
|
||||
"Sequence": 26782
|
||||
},
|
||||
"PreviousTxnID": "E028797D6C7AE9B84C6930452D427D5E40CE23E199E8DF0534DAAE5277A76CC1",
|
||||
"PreviousTxnLgrSeq": 17537115
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 12,
|
||||
"TransactionResult": "tecPATH_PARTIAL"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"1200132280000000240000004168400000000000000A732103EB1E2603E7571D6144684996C10DA75063D6E2F3B3FDABE38B857C1BE9578A5574473045022100B0A5672E3E09FA3AF8CF1DCC1D8C881F58B39212D6FDC42CCF30E5400D0EFD9F02202DDD9517D9409D1D9A529B8AEA7DE13AE4CDF96BB6D18FA0D9732DBFC887348D81148A928D14A643F388AC0D26BAF9755B07EB0A2B44851486FFE2A17E861BA0FE9A3ED8352F895D80E789E0"
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
"201C00000000F8E51100612500AE5F59558107CEE99D556326ACD4662CA10A24550240D9F933E55435A0C0DB3B06DD343E56146AAAF7A266D8A92DFFEAB1A71B6523534F27820873F4E213014B23398867D2E624000000412D00000007624000000249CB5DD0E1E7220000000024000000422D00000008624000000249CB5DC681148A928D14A643F388AC0D26BAF9755B07EB0A2B44E1E1E311007056C2D0317AD266B93CB3B36AEB0ABB673B0AFFAB134809CCACFD7158F539603C3AE881148A928D14A643F388AC0D26BAF9755B07EB0A2B44851486FFE2A17E861BA0FE9A3ED8352F895D80E789E0E1E1E511006456CD08416851CA53E9649408118A4908E01E43436ED950886D1B1E66F4B68B82ECE7220000000058CD08416851CA53E9649408118A4908E01E43436ED950886D1B1E66F4B68B82EC82148A928D14A643F388AC0D26BAF9755B07EB0A2B44E1E1F1031000"
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"Account": "rDd6FpNbeY2CrQajSmP178BmNGusmQiYMM",
|
||||
"Authorize": "rDJFnv5sEfp42LMFiX3mVQKczpFTdxYDzM",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 65,
|
||||
"SigningPubKey": "03EB1E2603E7571D6144684996C10DA75063D6E2F3B3FDABE38B857C1BE9578A55",
|
||||
"TransactionType": "DepositPreauth",
|
||||
"TxnSignature": "3045022100B0A5672E3E09FA3AF8CF1DCC1D8C881F58B39212D6FDC42CCF30E5400D0EFD9F02202DDD9517D9409D1D9A529B8AEA7DE13AE4CDF96BB6D18FA0D9732DBFC887348D",
|
||||
"hash": "B5D94C027C846171B2F5D4C2D126E88580BF369986A155C1890352F5BC4D7AF9",
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rDd6FpNbeY2CrQajSmP178BmNGusmQiYMM",
|
||||
"Balance": "9827999174",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 8,
|
||||
"Sequence": 66
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "146AAAF7A266D8A92DFFEAB1A71B6523534F27820873F4E213014B23398867D2",
|
||||
"PreviousFields": {
|
||||
"Balance": "9827999184",
|
||||
"OwnerCount": 7,
|
||||
"Sequence": 65
|
||||
},
|
||||
"PreviousTxnID": "8107CEE99D556326ACD4662CA10A24550240D9F933E55435A0C0DB3B06DD343E",
|
||||
"PreviousTxnLgrSeq": 11427673
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "DepositPreauth",
|
||||
"LedgerIndex": "C2D0317AD266B93CB3B36AEB0ABB673B0AFFAB134809CCACFD7158F539603C3A",
|
||||
"NewFields": {
|
||||
"Account": "rDd6FpNbeY2CrQajSmP178BmNGusmQiYMM",
|
||||
"Authorize": "rDJFnv5sEfp42LMFiX3mVQKczpFTdxYDzM"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rDd6FpNbeY2CrQajSmP178BmNGusmQiYMM",
|
||||
"RootIndex": "CD08416851CA53E9649408118A4908E01E43436ED950886D1B1E66F4B68B82EC"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "CD08416851CA53E9649408118A4908E01E43436ED950886D1B1E66F4B68B82EC"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"1200042019000000198114EE5F7CF61504C7CF7E0C22562EB19CC7ACB0FCBA8214EE5F7CF61504C7CF7E0C22562EB19CC7ACB0FCBA"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"Account" : "r4jQDHCUvgcBAa5EzcB1D8BHGcjYP9eBC2",
|
||||
"OfferSequence" : 25,
|
||||
"Owner" : "r4jQDHCUvgcBAa5EzcB1D8BHGcjYP9eBC2",
|
||||
"TransactionType" : "EscrowCancel"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"1200012E00005BB82024258D09812025258D0980614000000000000064701127A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B8558101008114EE5F7CF61504C7CF7E0C22562EB19CC7ACB0FCBA8314B5F762798A53D543A014CAF8B297CFF8F2F937E8"
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Account" : "r4jQDHCUvgcBAa5EzcB1D8BHGcjYP9eBC2",
|
||||
"Amount" : "100",
|
||||
"CancelAfter" : 630000001,
|
||||
"Condition" : "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
|
||||
"Destination" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"DestinationTag" : 23480,
|
||||
"FinishAfter" : 630000000,
|
||||
"TransactionType": "EscrowCreate"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"1200022280000000240000000320190000000268400000000000000A7321028DB04DA8B702272B2A29FAF3DBCF40D01386208E6A9541DB497BE962FEF96A9C74473045022100E3C860D54E88AFA8584FBED99AA38BCB512AB1D69D87F3F71EF38ACB6EA4B7A202204CC1BB34DAA221416DB8946B583D4F33C7E22C130F9FA49353FB6ADB2DF6C69D8114E151CA3207BAB5B91D2F0E4D35ECDFD4551C69A18214E151CA3207BAB5B91D2F0E4D35ECDFD4551C69A1"
|
||||
+1
@@ -0,0 +1 @@
|
||||
"201C0000000BF8E511006125020B814F55F72706F8C7B9C07D83332BE330D77B5CE6A246FE4FA04DD47EBC88719A35B5F95644A462A2806A513D7480CA71059D3D33637B65458017A8828A8F95AF17272501E6624000000010DC67D0E1E7220000000024000000052D00000000624000000013C074F08114DC0BCC71D87BB4E684B35721DC12F2C4E1ABABA4E1E1E4110075569766AE124E5053BCFDE253F6E3DDBAC13858CC0700DDECDCD57FF2FA777BEF7DE7220000000025020B814F202521A0C1B834000000000000000039000000000000000055F72706F8C7B9C07D83332BE330D77B5CE6A246FE4FA04DD47EBC88719A35B5F9614000000002E40D208114E151CA3207BAB5B91D2F0E4D35ECDFD4551C69A18314DC0BCC71D87BB4E684B35721DC12F2C4E1ABABA4E1E1E511006456BA4B47767C25E21CCDA3553BD45BE3699B34B508B459FE0472C70C51660058E0E7220000000058BA4B47767C25E21CCDA3553BD45BE3699B34B508B459FE0472C70C51660058E08214E151CA3207BAB5B91D2F0E4D35ECDFD4551C69A1E1E1E511006125020B814F55F72706F8C7B9C07D83332BE330D77B5CE6A246FE4FA04DD47EBC88719A35B5F956E4DA2A510F0C7FFD0474FAA4C7308A83828E0B3DD09EAA9CFDFFC067E3719D2EE624000000032D00000001624000000002FAF06CE1E7220000000024000000042D00000000624000000002FAF0628114E151CA3207BAB5B91D2F0E4D35ECDFD4551C69A1E1E1E511006456ECE79D27042E87B02DF3A263DB6BB6FCD96E69E20E0955F84D47D164C37546A1E7220000000058ECE79D27042E87B02DF3A263DB6BB6FCD96E69E20E0955F84D47D164C37546A18214DC0BCC71D87BB4E684B35721DC12F2C4E1ABABA4E1E1F1031000"
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"Account": "rMYPppnVNQ7crMizv8D6wF45kYuSupygyr",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"OfferSequence": 2,
|
||||
"Owner": "rMYPppnVNQ7crMizv8D6wF45kYuSupygyr",
|
||||
"Sequence": 3,
|
||||
"SigningPubKey": "028DB04DA8B702272B2A29FAF3DBCF40D01386208E6A9541DB497BE962FEF96A9C",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "3045022100E3C860D54E88AFA8584FBED99AA38BCB512AB1D69D87F3F71EF38ACB6EA4B7A202204CC1BB34DAA221416DB8946B583D4F33C7E22C130F9FA49353FB6ADB2DF6C69D",
|
||||
"hash": "1A76D4BA47A53A66B539D4BD4C30826A5E51C78D0B7344758EACAC77A6753C3C",
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rMhV8zfKJRqEspcayRfqa4FuzQg8kW5LdB",
|
||||
"Balance": "331379952",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 5
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "44A462A2806A513D7480CA71059D3D33637B65458017A8828A8F95AF17272501",
|
||||
"PreviousFields": {
|
||||
"Balance": "282879952"
|
||||
},
|
||||
"PreviousTxnID": "F72706F8C7B9C07D83332BE330D77B5CE6A246FE4FA04DD47EBC88719A35B5F9",
|
||||
"PreviousTxnLgrSeq": 34308431
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rMYPppnVNQ7crMizv8D6wF45kYuSupygyr",
|
||||
"Amount": "48500000",
|
||||
"Destination": "rMhV8zfKJRqEspcayRfqa4FuzQg8kW5LdB",
|
||||
"DestinationNode": "0000000000000000",
|
||||
"FinishAfter": 564183480,
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "F72706F8C7B9C07D83332BE330D77B5CE6A246FE4FA04DD47EBC88719A35B5F9",
|
||||
"PreviousTxnLgrSeq": 34308431
|
||||
},
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "9766AE124E5053BCFDE253F6E3DDBAC13858CC0700DDECDCD57FF2FA777BEF7D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rMYPppnVNQ7crMizv8D6wF45kYuSupygyr",
|
||||
"RootIndex": "BA4B47767C25E21CCDA3553BD45BE3699B34B508B459FE0472C70C51660058E0"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "BA4B47767C25E21CCDA3553BD45BE3699B34B508B459FE0472C70C51660058E0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rMYPppnVNQ7crMizv8D6wF45kYuSupygyr",
|
||||
"Balance": "49999970",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 4
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "E4DA2A510F0C7FFD0474FAA4C7308A83828E0B3DD09EAA9CFDFFC067E3719D2E",
|
||||
"PreviousFields": {
|
||||
"Balance": "49999980",
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 3
|
||||
},
|
||||
"PreviousTxnID": "F72706F8C7B9C07D83332BE330D77B5CE6A246FE4FA04DD47EBC88719A35B5F9",
|
||||
"PreviousTxnLgrSeq": 34308431
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rMhV8zfKJRqEspcayRfqa4FuzQg8kW5LdB",
|
||||
"RootIndex": "ECE79D27042E87B02DF3A263DB6BB6FCD96E69E20E0955F84D47D164C37546A1"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "ECE79D27042E87B02DF3A263DB6BB6FCD96E69E20E0955F84D47D164C37546A1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 11,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
}
|
||||
}
|
||||
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"binary": "120066240000000026040B52006840000000000000007300701321EDB6FC8E803EE8EDC2793F1EC917B2EE41D35255618DEB91D3F9B1FC89B75D4539810000101101",
|
||||
"tx": {
|
||||
"UNLModifyDisabling": 1,
|
||||
"LedgerSequence": 67850752,
|
||||
"UNLModifyValidator": "EDB6FC8E803EE8EDC2793F1EC917B2EE41D35255618DEB91D3F9B1FC89B75D4539",
|
||||
"TransactionType": "UNLModify",
|
||||
"Account": "rrrrrrrrrrrrrrrrrrrrrhoLvTp",
|
||||
"Sequence": 0,
|
||||
"Fee": "0",
|
||||
"SigningPubKey": ""}
|
||||
}
|
||||
+547
@@ -0,0 +1,547 @@
|
||||
{
|
||||
"NFTokenMint": {
|
||||
"tx": {
|
||||
"json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Fee": "12",
|
||||
"Flags": 9,
|
||||
"LastLedgerSequence": 22,
|
||||
"Sequence": 5,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"NFTokenTaxon": 0,
|
||||
"TransactionType": "NFTokenMint",
|
||||
"TransferFee": 50,
|
||||
"TxnSignature": "3045022100DAB7343B26035702FF7E0736E04A092AC9512964E41C3CA64926CDFBE777946602202F295A3BB1282E0AF98F9F5978D4037D75EDEB0EC642519D966D7B9B5826E61B",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
},
|
||||
"binary": "12001914003222000000092400000005201B00000016202A0000000068400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100DAB7343B26035702FF7E0736E04A092AC9512964E41C3CA64926CDFBE777946602202F295A3BB1282E0AF98F9F5978D4037D75EDEB0EC642519D966D7B9B5826E61B751868747470733A2F2F677265677765697362726F642E636F6D8114B5F762798A53D543A014CAF8B297CFF8F2F937E8"
|
||||
},
|
||||
"meta": {
|
||||
"json": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Balance": "99999999999999940",
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 5,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 6
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
|
||||
"PreviousFields": {
|
||||
"Balance": "99999999999999952",
|
||||
"MintedNFTokens": 4,
|
||||
"Sequence": 5
|
||||
},
|
||||
"PreviousTxnID": "E9BFEE7C403F74445B59B8FA8E972ABD642A360E1FBC15C53BAA717573BEC462",
|
||||
"PreviousTxnLgrSeq": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E85B974D9F00000004",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LedgerEntryType": "NFTokenPage",
|
||||
"LedgerIndex": "B5F762798A53D543A014CAF8B297CFF8F2F937E8FFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"PreviousFields": {
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PreviousTxnID": "E9BFEE7C403F74445B59B8FA8E972ABD642A360E1FBC15C53BAA717573BEC462",
|
||||
"PreviousTxnLgrSeq": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 4,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"binary": "201C00000004F8E5110061250000000355E9BFEE7C403F74445B59B8FA8E972ABD642A360E1FBC15C53BAA717573BEC462562B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8E62400000005202B0000000462416345785D89FFD0E1E7220000000024000000062D00000001202B0000000562416345785D89FFC48114B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1E5110050250000000355E9BFEE7C403F74445B59B8FA8E972ABD642A360E1FBC15C53BAA717573BEC46256B5F762798A53D543A014CAF8B297CFF8F2F937E8FFFFFFFFFFFFFFFFFFFFFFFFE6FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E72200000000FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E85B974D9F00000004751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E1F1031000"
|
||||
}
|
||||
},
|
||||
"NFTokenBurn": {
|
||||
"tx": {
|
||||
"json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Fee": "12",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 23,
|
||||
"Sequence": 6,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E85B974D9F00000004",
|
||||
"TransactionType": "NFTokenBurn",
|
||||
"TxnSignature": "3045022100D614E1F0A1C41A05652B8998FC2C4DC8658B95BFD89F4A0DEBE3FFDCB75CE1D8022027DF89138FC442C803DC2BEC07636CEB8D0EC6297E23262A729B83D32F93FD3D"
|
||||
},
|
||||
"binary": "12001A22000000002400000006201B000000175A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E85B974D9F0000000468400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100D614E1F0A1C41A05652B8998FC2C4DC8658B95BFD89F4A0DEBE3FFDCB75CE1D8022027DF89138FC442C803DC2BEC07636CEB8D0EC6297E23262A729B83D32F93FD3D8114B5F762798A53D543A014CAF8B297CFF8F2F937E8"
|
||||
},
|
||||
"meta": {
|
||||
"json": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Balance": "99999999999999928",
|
||||
"BurnedNFTokens": 1,
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 5,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 7
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
|
||||
"PreviousFields": {
|
||||
"Balance": "99999999999999940",
|
||||
"Sequence": 6
|
||||
},
|
||||
"PreviousTxnID": "5F0E3A19F1D5B028A31B8A0FDE8533B0FD185E4AE306F79CFF51D18E68985231",
|
||||
"PreviousTxnLgrSeq": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LedgerEntryType": "NFTokenPage",
|
||||
"LedgerIndex": "B5F762798A53D543A014CAF8B297CFF8F2F937E8FFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"PreviousFields": {
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E85B974D9F00000004",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PreviousTxnID": "5F0E3A19F1D5B028A31B8A0FDE8533B0FD185E4AE306F79CFF51D18E68985231",
|
||||
"PreviousTxnLgrSeq": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"binary": "201C00000000F8E51100612500000003555F0E3A19F1D5B028A31B8A0FDE8533B0FD185E4AE306F79CFF51D18E68985231562B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8E6240000000662416345785D89FFC4E1E7220000000024000000072D00000001202B00000005202C0000000162416345785D89FFB88114B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1E51100502500000003555F0E3A19F1D5B028A31B8A0FDE8533B0FD185E4AE306F79CFF51D18E6898523156B5F762798A53D543A014CAF8B297CFF8F2F937E8FFFFFFFFFFFFFFFFFFFFFFFFE6FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E85B974D9F00000004751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E72200000000FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E1F1031000"
|
||||
}
|
||||
},
|
||||
"NFTokenCreateOffer": {
|
||||
"tx": {
|
||||
"json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Amount": "100",
|
||||
"Destination": "rV3WAvwwXgvPrYiUgSoytn9w3mejtPgLo",
|
||||
"Expiration": 999999999,
|
||||
"Fee": "12",
|
||||
"Flags": 1,
|
||||
"LastLedgerSequence": 26,
|
||||
"Sequence": 9,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"TransactionType": "NFTokenCreateOffer",
|
||||
"TxnSignature": "3045022100BCEEEF98B9DB3A2ACA7CE80AB91B9398E3429B93F660BB8A063F134AA798AE970220667C560D16E555DF5EF30536804C082DAEC7A446DF2C7533ADB1E2437AF2CCB0"
|
||||
},
|
||||
"binary": "12001B220000000124000000092A3B9AC9FF201B0000001A5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B0000000061400000000000006468400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100BCEEEF98B9DB3A2ACA7CE80AB91B9398E3429B93F660BB8A063F134AA798AE970220667C560D16E555DF5EF30536804C082DAEC7A446DF2C7533ADB1E2437AF2CCB08114B5F762798A53D543A014CAF8B297CFF8F2F937E883140551EBD684BF2ADE0EF093A92B6E2C55D15BD9AE"
|
||||
},
|
||||
"meta": {
|
||||
"json": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "NFTokenOffer",
|
||||
"LedgerIndex": "1DEF39A07F364CB73BF5F8306BE22628D0AE517A2CB0AE5341269B1E671F2052",
|
||||
"NewFields": {
|
||||
"Amount": "100",
|
||||
"Expiration": 999999999,
|
||||
"Flags": 1,
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Balance": "99999999999999892",
|
||||
"BurnedNFTokens": 1,
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 5,
|
||||
"OwnerCount": 2,
|
||||
"Sequence": 10
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
|
||||
"PreviousFields": {
|
||||
"Balance": "99999999999999904",
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 9
|
||||
},
|
||||
"PreviousTxnID": "D73C0ACEA1D4C9186A4AF1EAE2A4BD0A719A78AF6CE897C289AB297D371BEF53",
|
||||
"PreviousTxnLgrSeq": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "86992C19DA69763CAA9A4FC1697508140A995F15173EB00892C8EE23D5FD8FC3",
|
||||
"NewFields": {
|
||||
"Flags": 2,
|
||||
"RootIndex": "86992C19DA69763CAA9A4FC1697508140A995F15173EB00892C8EE23D5FD8FC3",
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA635204",
|
||||
"NewFields": {
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"RootIndex": "D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA635204"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"binary": "201C00000000F8E3110037561DEF39A07F364CB73BF5F8306BE22628D0AE517A2CB0AE5341269B1E671F2052E822000000012A3B9AC9FF5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B000000006140000000000000648214B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1E5110061250000000655D73C0ACEA1D4C9186A4AF1EAE2A4BD0A719A78AF6CE897C289AB297D371BEF53562B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8E624000000092D0000000162416345785D89FFA0E1E72200000000240000000A2D00000002202B00000005202C0000000162416345785D89FF948114B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1E31100645686992C19DA69763CAA9A4FC1697508140A995F15173EB00892C8EE23D5FD8FC3E822000000025886992C19DA69763CAA9A4FC1697508140A995F15173EB00892C8EE23D5FD8FC35A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000E1E1E311006456D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA635204E858D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA6352048214B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1F1031000"
|
||||
}
|
||||
},
|
||||
"NFTokenCancelOffer": {
|
||||
"tx": {
|
||||
"json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Fee": "12",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 27,
|
||||
"Sequence": 10,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"NFTokenOffers": [
|
||||
"00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000"
|
||||
],
|
||||
"TransactionType": "NFTokenCancelOffer",
|
||||
"TxnSignature": "3044022075EAF267D19A626B3D970A96C363380FC7CCFB81178D75F723C5F097309B9FBC022027A896B759E882BFCB810C8AB5B3D819AEBFCAD6E0AF17F909BB3AFA9085EBEE"
|
||||
},
|
||||
"binary": "12001C2200000000240000000A201B0000001B68400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074463044022075EAF267D19A626B3D970A96C363380FC7CCFB81178D75F723C5F097309B9FBC022027A896B759E882BFCB810C8AB5B3D819AEBFCAD6E0AF17F909BB3AFA9085EBEE8114B5F762798A53D543A014CAF8B297CFF8F2F937E804132000090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000"
|
||||
},
|
||||
"meta": {
|
||||
"json": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Balance": "99999999999999880",
|
||||
"BurnedNFTokens": 1,
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 5,
|
||||
"OwnerCount": 2,
|
||||
"Sequence": 11
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
|
||||
"PreviousFields": {
|
||||
"Balance": "99999999999999892",
|
||||
"Sequence": 10
|
||||
},
|
||||
"PreviousTxnID": "4D43E602582E492DC685408C36B18CFB326FBC06C03DA46580F03356F91D590D",
|
||||
"PreviousTxnLgrSeq": 7
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"binary": "201C00000000F8E51100612500000007554D43E602582E492DC685408C36B18CFB326FBC06C03DA46580F03356F91D590D562B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8E6240000000A62416345785D89FF94E1E72200000000240000000B2D00000002202B00000005202C0000000162416345785D89FF888114B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1F1031000"
|
||||
}
|
||||
},
|
||||
"NFTokenAcceptOffer": {
|
||||
"tx": {
|
||||
"json": {
|
||||
"Account": "rKBmBAi3cWzuj6iZYx6K7F3xF1LSs3br3o",
|
||||
"Fee": "12",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 37,
|
||||
"NFTokenSellOffer": "AED08CC1F50DD5F23A1948AF86153A3F3B7593E5EC77D65A02BB1B29E05AB6AF",
|
||||
"Sequence": 9,
|
||||
"SigningPubKey": "ED3C94824B6696F16CA54F0E3085A5ED8867D19DC4BA572086E03DCAB30B094D79",
|
||||
"TransactionType": "NFTokenAcceptOffer",
|
||||
"TxnSignature": "D6653C5BDA53E29CFF05905BE4EA36A913D28D8730EAAB339FFC57D0484230349E195303A301490DDF5DC3BC01AD22047D9A0BBC37983D96ED06DBBFE43F9A08"
|
||||
},
|
||||
"binary": "12001D22000000002400000009201B00000025501DAED08CC1F50DD5F23A1948AF86153A3F3B7593E5EC77D65A02BB1B29E05AB6AF68400000000000000C7321ED3C94824B6696F16CA54F0E3085A5ED8867D19DC4BA572086E03DCAB30B094D797440D6653C5BDA53E29CFF05905BE4EA36A913D28D8730EAAB339FFC57D0484230349E195303A301490DDF5DC3BC01AD22047D9A0BBC37983D96ED06DBBFE43F9A088114C77B4F8423139A8F0939DDEB9EB076CC74F4A3B3"
|
||||
},
|
||||
"meta": {
|
||||
"json": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Balance": "99997999999999932",
|
||||
"BurnedNFTokens": 1,
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 5,
|
||||
"OwnerCount": 3,
|
||||
"Sequence": 15
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
|
||||
"PreviousFields": {
|
||||
"Balance": "99997999999999832",
|
||||
"OwnerCount": 4
|
||||
},
|
||||
"PreviousTxnID": "BB2608749900A1762B2C7E60AFB437091F56810B39E85545E9541A5F33FD2785",
|
||||
"PreviousTxnLgrSeq": 16
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 2,
|
||||
"RootIndex": "45D3F54AACBCD7F8A5FB0737DA561BE9F0EA924276B2FDB0B8EA8D7FE4319632",
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "45D3F54AACBCD7F8A5FB0737DA561BE9F0EA924276B2FDB0B8EA8D7FE4319632"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rKBmBAi3cWzuj6iZYx6K7F3xF1LSs3br3o",
|
||||
"Balance": "1999999999888",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 10
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "4BDDA92DDF4C9702E2952261A181E7E1EFF37E9C2AC9D390D0E81AF34FC8A325",
|
||||
"PreviousFields": {
|
||||
"Balance": "2000000000000",
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 9
|
||||
},
|
||||
"PreviousTxnID": "2B07B79F67C41680E07ED8EDCA5BC20827F1694D51207EFD800F5174FE76ADB3",
|
||||
"PreviousTxnLgrSeq": 13
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Amount": "100",
|
||||
"Flags": 1,
|
||||
"NFTokenOfferNode": "0000000000000000",
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"OwnerNode": "0000000000000000",
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003"
|
||||
},
|
||||
"LedgerEntryType": "NFTokenOffer",
|
||||
"LedgerIndex": "AED08CC1F50DD5F23A1948AF86153A3F3B7593E5EC77D65A02BB1B29E05AB6AF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LedgerEntryType": "NFTokenPage",
|
||||
"LedgerIndex": "B5F762798A53D543A014CAF8B297CFF8F2F937E8FFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"PreviousFields": {
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PreviousTxnID": "EF14A0EB3B1E7E928A07F4B6A659EEA4FB0F839499397B224E19DE61CAA884C7",
|
||||
"PreviousTxnLgrSeq": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "NFTokenPage",
|
||||
"LedgerIndex": "C77B4F8423139A8F0939DDEB9EB076CC74F4A3B3FFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"NewFields": {
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003",
|
||||
"URI": "68747470733A2F2F677265677765697362726F642E636F6D"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"RootIndex": "D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA635204"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA635204"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"binary": "201C00000000F8E5110061250000001055BB2608749900A1762B2C7E60AFB437091F56810B39E85545E9541A5F33FD2785562B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8E62D0000000462416343A6B43FDF58E1E72200000000240000000F2D00000003202B00000005202C0000000162416343A6B43FDFBC8114B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1E41100645645D3F54AACBCD7F8A5FB0737DA561BE9F0EA924276B2FDB0B8EA8D7FE4319632E722000000025845D3F54AACBCD7F8A5FB0737DA561BE9F0EA924276B2FDB0B8EA8D7FE43196325A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003E1E1E5110061250000000D552B07B79F67C41680E07ED8EDCA5BC20827F1694D51207EFD800F5174FE76ADB3564BDDA92DDF4C9702E2952261A181E7E1EFF37E9C2AC9D390D0E81AF34FC8A325E624000000092D0000000062400001D1A94A2000E1E72200000000240000000A2D0000000162400001D1A94A1F908114C77B4F8423139A8F0939DDEB9EB076CC74F4A3B3E1E1E411003756AED08CC1F50DD5F23A1948AF86153A3F3B7593E5EC77D65A02BB1B29E05AB6AFE722000000013400000000000000003C00000000000000005A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E000000036140000000000000648214B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1E5110050250000000455EF14A0EB3B1E7E928A07F4B6A659EEA4FB0F839499397B224E19DE61CAA884C756B5F762798A53D543A014CAF8B297CFF8F2F937E8FFFFFFFFFFFFFFFFFFFFFFFFE6FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E72200000000FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E80000099B00000000751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E816E5DA9C00000001751868747470733A2F2F677265677765697362726F642E636F6DE1EC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E82DCBAB9D00000002751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E1E311005056C77B4F8423139A8F0939DDEB9EB076CC74F4A3B3FFFFFFFFFFFFFFFFFFFFFFFFE8FAEC5A00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003751868747470733A2F2F677265677765697362726F642E636F6DE1F1E1E1E511006456D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA635204E7220000000058D8120FC732737A2CF2E9968FDF3797A43B457F2A81AA06D2653171A1EA6352048214B5F762798A53D543A014CAF8B297CFF8F2F937E8E1E1F1031000"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"12000F5016C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA61986140000000000F42406240000000000F4240712132D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A764630440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B"
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"TransactionType": "PaymentChannelClaim",
|
||||
"Channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"Balance": "1000000",
|
||||
"Amount": "1000000",
|
||||
"Signature": "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B",
|
||||
"PublicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
"12000D2300002DE32E00005BB820241FC78D66202700015180614000000000002710712132D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A81144B4E9C06F24296074F7BC48F92A97916C6DC5EA98314204288D2E47F8EF6C99BCC457966320D12409711"
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"TransactionType": "PaymentChannelCreate",
|
||||
"Amount": "10000",
|
||||
"Destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SettleDelay": 86400,
|
||||
"PublicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
||||
"CancelAfter": 533171558,
|
||||
"DestinationTag": 23480,
|
||||
"SourceTag": 11747
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"12000E2A206023E65016C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198614000000000030D4081144B4E9C06F24296074F7BC48F92A97916C6DC5EA9"
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"TransactionType": "PaymentChannelFund",
|
||||
"Channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"Amount": "200000",
|
||||
"Expiration": 543171558
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"12000C22800000002400003B49201B01724E3520230000000368400000000000000B73210315B15964B3704B171E860DE1FC914D283395EE825C8546AEEBF0D24A5802BBC574463044022069FC98D0BC32F510D4F94ECC726613E957D290050E428DD86EDA2C2515A1732D02207064EF085437B3F12A744AC6528D9E0C59FAA5A9FE903DF3639D2F09B522175F81144901F90028CEAD8AF389AC6FA0F83643DB67E95BF4EB1300018114EA97C2F7C88AE5735A59811F6F89E825B478982FE1EB1300018114B4AC72AF6C0EE5A1B8C94A3C20BE09599BBB57EEE1EB1300018114FA7420343B9EA7C9B294C3AF802AE80103F0B11BE1F1"
|
||||
+1
@@ -0,0 +1 @@
|
||||
"201C00000008F8E51100612501724363554CD30C2526418A76ABED74713DF144B19F1B29BD8F7BC9EADCF16D33D7EC83D8560DAF42BEE40F0EEFCFD8D54E81ECACD9371D281CDD9B77384FCDAF0E16560A44E62400003B4962400000010F99515AE1E722000000002400003B4A2D0000001962400000010F99514F81144901F90028CEAD8AF389AC6FA0F83643DB67E95B8814CAA26A38FC8F4E5D6D142432B0D7D94A2880DDDFE1E1E51100535616F6AEEC6B85C9658B4BF604671677B7A7B2FAAFDB2FA5A0B72CBB49CAE80924E72200000000202300000003202600000000340000000000000000F4EB1300018114B4AC72AF6C0EE5A1B8C94A3C20BE09599BBB57EEE1EB1300018114EA97C2F7C88AE5735A59811F6F89E825B478982FE1EB1300018114FA7420343B9EA7C9B294C3AF802AE80103F0B11BE1F1E1E1F1031000"
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"Account": "rfCp6hiUS4qqN1i4hTyX4ogA49MEbXgCau",
|
||||
"Fee": "11",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 24268341,
|
||||
"Sequence": 15177,
|
||||
"SignerEntries": [
|
||||
{
|
||||
"SignerEntry": {
|
||||
"Account": "r4PQv7BCpp4SAJx3isNpQM8T2BuGrMQs5U",
|
||||
"SignerWeight": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"SignerEntry": {
|
||||
"Account": "rH7KDR67MZR7LDV7gesmEMXtaqU3FaK7Lr",
|
||||
"SignerWeight": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"SignerEntry": {
|
||||
"Account": "rPqHsX34XApKSfE4UxKbqVXb3WRmmgMY2u",
|
||||
"SignerWeight": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"SignerQuorum": 3,
|
||||
"SigningPubKey": "0315B15964B3704B171E860DE1FC914D283395EE825C8546AEEBF0D24A5802BBC5",
|
||||
"TransactionType": "SignerListSet",
|
||||
"TxnSignature": "3044022069FC98D0BC32F510D4F94ECC726613E957D290050E428DD86EDA2C2515A1732D02207064EF085437B3F12A744AC6528D9E0C59FAA5A9FE903DF3639D2F09B522175F",
|
||||
"date": 527847001,
|
||||
"hash": "98C33CABFAE9F830CE842C260E34C25B0F987EE691941C0C9225AD476871B73D",
|
||||
"inLedger": 24268339,
|
||||
"ledger_index": 24268339,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfCp6hiUS4qqN1i4hTyX4ogA49MEbXgCau",
|
||||
"Balance": "4556673359",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 25,
|
||||
"RegularKey": "rK7ShY9CeDMBHLNFSMtTrSAUd9uzwcymcL",
|
||||
"Sequence": 15178
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "0DAF42BEE40F0EEFCFD8D54E81ECACD9371D281CDD9B77384FCDAF0E16560A44",
|
||||
"PreviousFields": {
|
||||
"Balance": "4556673370",
|
||||
"Sequence": 15177
|
||||
},
|
||||
"PreviousTxnID": "4CD30C2526418A76ABED74713DF144B19F1B29BD8F7BC9EADCF16D33D7EC83D8",
|
||||
"PreviousTxnLgrSeq": 24265571
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"SignerEntries": [
|
||||
{
|
||||
"SignerEntry": {
|
||||
"Account": "rH7KDR67MZR7LDV7gesmEMXtaqU3FaK7Lr",
|
||||
"SignerWeight": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"SignerEntry": {
|
||||
"Account": "r4PQv7BCpp4SAJx3isNpQM8T2BuGrMQs5U",
|
||||
"SignerWeight": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"SignerEntry": {
|
||||
"Account": "rPqHsX34XApKSfE4UxKbqVXb3WRmmgMY2u",
|
||||
"SignerWeight": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"SignerListID": 0,
|
||||
"SignerQuorum": 3
|
||||
},
|
||||
"LedgerEntryType": "SignerList",
|
||||
"LedgerIndex": "16F6AEEC6B85C9658B4BF604671677B7A7B2FAAFDB2FA5A0B72CBB49CAE80924"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 8,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
"12000A240000000E2028000000016840000000000027108114D5024F157225CA9F8F4C73094D61A8FDD746E0DB"
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"TransactionType": "TicketCreate",
|
||||
"TicketCount": 1,
|
||||
"Account": "rLRH6HciuPv5rQBNFBYH1iPPAuVFERtNXZ",
|
||||
"Sequence": 14,
|
||||
"Fee": "10000"
|
||||
}
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"transactions": [{
|
||||
"rjson": {
|
||||
"Account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
|
||||
"Destination": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
|
||||
"SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
|
||||
"Amount": "10000000000",
|
||||
"DestinationTag": 1010,
|
||||
"SourceTag": 84854,
|
||||
"Fee": "10",
|
||||
"Flags": 0,
|
||||
"Sequence": 62
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "X7tFPvjMH7nDxP8nTGkeeggcUpCZj8UbyT2QoiRHGDfjqrB",
|
||||
"Destination": "XVYmGpJqHS95ir411XvanwY1xt5Z2314WsamHPVgUNABUGV",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
|
||||
"SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
|
||||
"Amount": "10000000000",
|
||||
"Fee": "10",
|
||||
"Flags": 0,
|
||||
"Sequence": 62
|
||||
}
|
||||
},
|
||||
{
|
||||
"rjson": {
|
||||
"Account": "r4DymtkgUAh2wqRxVfdd3Xtswzim6eC6c5",
|
||||
"Amount": "199000000",
|
||||
"Destination": "rsekGH9p9neiPxym2TMJhqaCzHFuokenTU",
|
||||
"DestinationTag": 3663729509,
|
||||
"Fee": "6335",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57313352,
|
||||
"Sequence": 105791,
|
||||
"SigningPubKey": "02053A627976CE1157461336AC65290EC1571CAAD1B327339980F7BF65EF776F83",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "30440220086D3330CD6CE01D891A26BA0355D8D5A5D28A5C9A1D0C5E06E321C81A02318A0220027C3F6606E41FEA35103EDE5224CC489B6514ACFE27543185B0419DD02E301C"
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "r4DymtkgUAh2wqRxVfdd3Xtswzim6eC6c5",
|
||||
"Amount": "199000000",
|
||||
"Destination": "X7cBoj6a5xSEfPCr6AStN9YPhbMAA2yaN2XYWwRJKAKb3y5",
|
||||
"Fee": "6335",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57313352,
|
||||
"Sequence": 105791,
|
||||
"SigningPubKey": "02053A627976CE1157461336AC65290EC1571CAAD1B327339980F7BF65EF776F83",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "30440220086D3330CD6CE01D891A26BA0355D8D5A5D28A5C9A1D0C5E06E321C81A02318A0220027C3F6606E41FEA35103EDE5224CC489B6514ACFE27543185B0419DD02E301C"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rjson": {
|
||||
"Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
|
||||
"Amount": "105302107",
|
||||
"Destination": "r33hypJXDs47LVpmvta7hMW9pR8DYeBtkW",
|
||||
"DestinationTag": 1658156118,
|
||||
"Fee": "60000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57313566,
|
||||
"Sequence": 1113196,
|
||||
"SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100FCA10FBAC65EA60C115A970CD52E6A526B1F9DDB6C4F843DA3DE7A97DFF9492D022037824D0FC6F663FB08BE0F2812CBADE1F61836528D44945FC37F10CC03215111"
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
|
||||
"Amount": "105302107",
|
||||
"Destination": "X7ikFY5asEwp6ikt2AJdTfBLALEs5JN35kkeqKVeT1GdvY1",
|
||||
"Fee": "60000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57313566,
|
||||
"Sequence": 1113196,
|
||||
"SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100FCA10FBAC65EA60C115A970CD52E6A526B1F9DDB6C4F843DA3DE7A97DFF9492D022037824D0FC6F663FB08BE0F2812CBADE1F61836528D44945FC37F10CC03215111"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rjson": {
|
||||
"Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
|
||||
"Amount": "3899911571",
|
||||
"Destination": "rU2mEJSLqBRkYLVTv55rFTgQajkLTnT6mA",
|
||||
"DestinationTag": 255406,
|
||||
"Fee": "60000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57313566,
|
||||
"Sequence": 1113197,
|
||||
"SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3044022077642D94BB3C49BF3CB4C804255EC830D2C6009EA4995E38A84602D579B8AAD702206FAD977C49980226E8B495BF03C8D9767380F1546BBF5A4FD47D604C0D2CCF9B"
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
|
||||
"Amount": "3899911571",
|
||||
"Destination": "XVfH8gwNWVbB5Kft16jmTNgGTqgw1dzA8ZTBkNjSLw6JdXS",
|
||||
"Fee": "60000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57313566,
|
||||
"Sequence": 1113197,
|
||||
"SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3044022077642D94BB3C49BF3CB4C804255EC830D2C6009EA4995E38A84602D579B8AAD702206FAD977C49980226E8B495BF03C8D9767380F1546BBF5A4FD47D604C0D2CCF9B"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rjson": {
|
||||
"Account": "r4eEbLKZGbVSBHnSUBZW8i5XaMjGLdqT4a",
|
||||
"Amount": "820370849",
|
||||
"Destination": "rDhmyBh4JwDAtXyRZDarNgg52UcLLRoGje",
|
||||
"DestinationTag": 2017780486,
|
||||
"Fee": "6000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57315579,
|
||||
"Sequence": 234254,
|
||||
"SigningPubKey": "038CF47114672A12B269AEE015BF7A8438609B994B0640E4B28B2F56E93D948B15",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3044022015004653B1CBDD5CCA1F7B38555F1B37FE3F811E9D5070281CCC6C8A93460D870220679E9899184901EA69750C8A9325768490B1B9C1A733842446727653FF3D1DC0"
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "r4eEbLKZGbVSBHnSUBZW8i5XaMjGLdqT4a",
|
||||
"Amount": "820370849",
|
||||
"Destination": "XV31huWNJQXsAJFwgE6rnC8uf8jRx4H4waq4MyGUxz5CXzS",
|
||||
"Fee": "6000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57315579,
|
||||
"Sequence": 234254,
|
||||
"SigningPubKey": "038CF47114672A12B269AEE015BF7A8438609B994B0640E4B28B2F56E93D948B15",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3044022015004653B1CBDD5CCA1F7B38555F1B37FE3F811E9D5070281CCC6C8A93460D870220679E9899184901EA69750C8A9325768490B1B9C1A733842446727653FF3D1DC0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rjson": {
|
||||
"Account": "rsGeDwS4rpocUumu9smpXomzaaeG4Qyifz",
|
||||
"Amount": "1500000000",
|
||||
"Destination": "rDxfhNRgCDNDckm45zT5ayhKDC4Ljm7UoP",
|
||||
"DestinationTag": 1000635172,
|
||||
"Fee": "5000",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 55741075,
|
||||
"SigningPubKey": "02ECB814477DF9D8351918878E235EE6AF147A2A5C20F1E71F291F0F3303357C36",
|
||||
"SourceTag": 1000635172,
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "304402202A90972E21823214733082E1977F9EA2D6B5101902F108E7BDD7D128CEEA7AF3022008852C8DAD746A7F18E66A47414FABF551493674783E8EA7409C501D3F05F99A"
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "rsGeDwS4rpocUumu9smpXomzaaeG4Qyifz",
|
||||
"Amount": "1500000000",
|
||||
"Destination": "XVBkK1yLutMqFGwTm6hykn7YXGDUrjsZSkpzMgRveZrMbHs",
|
||||
"Fee": "5000",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 55741075,
|
||||
"SigningPubKey": "02ECB814477DF9D8351918878E235EE6AF147A2A5C20F1E71F291F0F3303357C36",
|
||||
"SourceTag": 1000635172,
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "304402202A90972E21823214733082E1977F9EA2D6B5101902F108E7BDD7D128CEEA7AF3022008852C8DAD746A7F18E66A47414FABF551493674783E8EA7409C501D3F05F99A"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rjson": {
|
||||
"Account": "rHWcuuZoFvDS6gNbmHSdpb7u1hZzxvCoMt",
|
||||
"Amount": "48918500000",
|
||||
"Destination": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
|
||||
"DestinationTag": 105959914,
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 32641,
|
||||
"SigningPubKey": "02E98DA545CCCC5D14C82594EE9E6CCFCF5171108E2410B3E784183E1068D33429",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "304502210091DCA7AF189CD9DC93BDE24DEAE87381FBF16789C43113EE312241D648982B2402201C6055FEFFF1F119640AAC0B32C4F37375B0A96033E0527A21C1366920D6A524"
|
||||
},
|
||||
"xjson": {
|
||||
"Account": "rHWcuuZoFvDS6gNbmHSdpb7u1hZzxvCoMt",
|
||||
"Amount": "48918500000",
|
||||
"Destination": "XVH3aqvbYGhRhrD1FYSzGooNuxdzbG3VR2fuM47oqbXxQr7",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 32641,
|
||||
"SigningPubKey": "02E98DA545CCCC5D14C82594EE9E6CCFCF5171108E2410B3E784183E1068D33429",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "304502210091DCA7AF189CD9DC93BDE24DEAE87381FBF16789C43113EE312241D648982B2402201C6055FEFFF1F119640AAC0B32C4F37375B0A96033E0527A21C1366920D6A524"
|
||||
}
|
||||
}]
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
const { coreTypes } = require('../src/types')
|
||||
const { Hash128, Hash160, Hash256, AccountID, Currency } = coreTypes
|
||||
const { Buffer } = require('buffer/')
|
||||
|
||||
describe('Hash128', function () {
|
||||
test('has a static width member', function () {
|
||||
expect(Hash128.width).toBe(16)
|
||||
})
|
||||
test('can be unset', function () {
|
||||
const h1 = Hash128.from('')
|
||||
expect(h1.toJSON()).toBe('')
|
||||
})
|
||||
test('can be compared against another', function () {
|
||||
const h1 = Hash128.from('100000000000000000000000000000000')
|
||||
const h2 = Hash128.from('200000000000000000000000000000000')
|
||||
const h3 = Hash128.from('000000000000000000000000000000003')
|
||||
expect(h1.lt(h2)).toBe(true)
|
||||
expect(h3.lt(h2)).toBe(true)
|
||||
expect(h2.gt(h1)).toBe(true)
|
||||
expect(h1.gt(h3)).toBe(true)
|
||||
})
|
||||
test('throws when constructed from invalid hash length', () => {
|
||||
expect(() => Hash128.from('1000000000000000000000000000000')).toThrow(
|
||||
'Invalid Hash length 15',
|
||||
)
|
||||
expect(() => Hash128.from('10000000000000000000000000000000000')).toThrow(
|
||||
'Invalid Hash length 17',
|
||||
)
|
||||
})
|
||||
})
|
||||
describe('Hash160', function () {
|
||||
test('has a static width member', function () {
|
||||
expect(Hash160.width).toBe(20)
|
||||
})
|
||||
test('inherited by subclasses', function () {
|
||||
expect(AccountID.width).toBe(20)
|
||||
expect(Currency.width).toBe(20)
|
||||
})
|
||||
test('can be compared against another', function () {
|
||||
const h1 = Hash160.from('1000000000000000000000000000000000000000')
|
||||
const h2 = Hash160.from('2000000000000000000000000000000000000000')
|
||||
const h3 = Hash160.from('0000000000000000000000000000000000000003')
|
||||
expect(h1.lt(h2)).toBe(true)
|
||||
expect(h3.lt(h2)).toBe(true)
|
||||
})
|
||||
test('throws when constructed from invalid hash length', () => {
|
||||
expect(() =>
|
||||
Hash160.from('10000000000000000000000000000000000000'),
|
||||
).toThrow('Invalid Hash length 19')
|
||||
expect(() =>
|
||||
Hash160.from('100000000000000000000000000000000000000000'),
|
||||
).toThrow('Invalid Hash length 21')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Hash256', function () {
|
||||
test('has a static width member', function () {
|
||||
expect(Hash256.width).toBe(32)
|
||||
})
|
||||
test('has a ZERO_256 member', function () {
|
||||
expect(Hash256.ZERO_256.toJSON()).toBe(
|
||||
'0000000000000000000000000000000000000000000000000000000000000000',
|
||||
)
|
||||
})
|
||||
test('supports getting the nibblet values at given positions', function () {
|
||||
const h = Hash256.from(
|
||||
'1359BD0000000000000000000000000000000000000000000000000000000000',
|
||||
)
|
||||
expect(h.nibblet(0)).toBe(0x1)
|
||||
expect(h.nibblet(1)).toBe(0x3)
|
||||
expect(h.nibblet(2)).toBe(0x5)
|
||||
expect(h.nibblet(3)).toBe(0x9)
|
||||
expect(h.nibblet(4)).toBe(0x0b)
|
||||
expect(h.nibblet(5)).toBe(0xd)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Currency', function () {
|
||||
test('Decoding allows dodgy XRP without throwing', function () {
|
||||
const currencyCode = '0000000000000000000000005852500000000000'
|
||||
expect(Currency.from(currencyCode).toJSON()).toBe(currencyCode)
|
||||
})
|
||||
test('Currency code with lowercase letters decodes to ISO code', () => {
|
||||
expect(Currency.from('xRp').toJSON()).toBe('xRp')
|
||||
})
|
||||
test('Currency codes with symbols decodes to ISO code', () => {
|
||||
expect(Currency.from('x|p').toJSON()).toBe('x|p')
|
||||
})
|
||||
test('Currency code with non-standard symbols decodes to hex', () => {
|
||||
expect(Currency.from(':::').toJSON()).toBe(
|
||||
'0000000000000000000000003A3A3A0000000000',
|
||||
)
|
||||
})
|
||||
test('Currency codes can be exclusively standard symbols', () => {
|
||||
expect(Currency.from('![]').toJSON()).toBe('![]')
|
||||
})
|
||||
test('Currency codes with uppercase and 0-9 decode to ISO codes', () => {
|
||||
expect(Currency.from('X8P').toJSON()).toBe('X8P')
|
||||
expect(Currency.from('USD').toJSON()).toBe('USD')
|
||||
})
|
||||
|
||||
test('Currency codes with no contiguous zeroes in first 96 type code & reserved bits', function () {
|
||||
expect(
|
||||
Currency.from('0000000023410000000000005852520000000000').iso(),
|
||||
).toBe(null)
|
||||
})
|
||||
|
||||
test('Currency codes with no contiguous zeroes in last 40 reserved bits', function () {
|
||||
expect(
|
||||
Currency.from('0000000000000000000000005852527570656500').iso(),
|
||||
).toBe(null)
|
||||
})
|
||||
|
||||
test('can be constructed from a Buffer', function () {
|
||||
const xrp = new Currency(Buffer.alloc(20))
|
||||
expect(xrp.iso()).toBe('XRP')
|
||||
})
|
||||
test('Can handle non-standard currency codes', () => {
|
||||
const currency = '015841551A748AD2C1F76FF6ECB0CCCD00000000'
|
||||
expect(Currency.from(currency).toJSON()).toBe(currency)
|
||||
})
|
||||
|
||||
test('Can handle other non-standard currency codes', () => {
|
||||
const currency = '0000000000414C6F676F30330000000000000000'
|
||||
expect(Currency.from(currency).toJSON()).toBe(currency)
|
||||
})
|
||||
|
||||
test('throws on invalid reprs', function () {
|
||||
expect(() => Currency.from(Buffer.alloc(19))).toThrow()
|
||||
expect(() => Currency.from(1)).toThrow()
|
||||
expect(() =>
|
||||
Currency.from('00000000000000000000000000000000000000m'),
|
||||
).toThrow()
|
||||
})
|
||||
})
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
const { loadFixture } = require('./utils')
|
||||
const {
|
||||
transactionTreeHash,
|
||||
ledgerHash,
|
||||
accountStateHash,
|
||||
} = require('../src/ledger-hashes')
|
||||
|
||||
describe('Ledger Hashes', function () {
|
||||
function testFactory(ledgerFixture) {
|
||||
describe(`can calculate hashes for ${ledgerFixture}`, function () {
|
||||
const ledger = loadFixture(ledgerFixture)
|
||||
test('computes correct account state hash', function () {
|
||||
expect(accountStateHash(ledger.accountState).toHex()).toBe(
|
||||
ledger.account_hash,
|
||||
)
|
||||
})
|
||||
test('computes correct transaction tree hash', function () {
|
||||
expect(transactionTreeHash(ledger.transactions).toHex()).toBe(
|
||||
ledger.transaction_hash,
|
||||
)
|
||||
})
|
||||
test('computes correct ledger header hash', function () {
|
||||
expect(ledgerHash(ledger).toHex()).toBe(ledger.hash)
|
||||
})
|
||||
})
|
||||
}
|
||||
testFactory('ledger-full-40000.json')
|
||||
testFactory('ledger-full-38129.json')
|
||||
})
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
const { encode, decode } = require('../src')
|
||||
|
||||
let str =
|
||||
'1100612200000000240000000125000068652D0000000055B6632D6376A2D9319F20A1C6DCCB486432D1E4A79951229D4C3DE2946F51D56662400009184E72A00081140DD319918CD5AE792BF7EC80D63B0F01B4573BBC'
|
||||
let lower = str.toLowerCase()
|
||||
|
||||
let bin =
|
||||
'1100612200000000240000000125000000082D00000000550735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E56240000002540BE400811479927BAFFD3D04A26096C0C97B1B0D45B01AD3C0'
|
||||
let json = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rUnFEsHjxqTswbivzL2DNHBb34rhAgZZZK',
|
||||
PreviousTxnLgrSeq: 8,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'0735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E5'.toLowerCase(),
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
let jsonUpper = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rUnFEsHjxqTswbivzL2DNHBb34rhAgZZZK',
|
||||
PreviousTxnLgrSeq: 8,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'0735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E5',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
describe('Lowercase hex test', () => {
|
||||
test('Correctly decodes', () => {
|
||||
expect(decode(lower)).toEqual(decode(str))
|
||||
})
|
||||
test('Re-encodes to uppercase hex', () => {
|
||||
expect(encode(decode(lower))).toEqual(str)
|
||||
})
|
||||
test('Encode when hex field lowercase', () => {
|
||||
expect(encode(json)).toBe(bin)
|
||||
})
|
||||
test('Re-decodes to uppercase hex', () => {
|
||||
expect(decode(encode(json))).toEqual(jsonUpper)
|
||||
})
|
||||
})
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
const { encode, decode } = require('../src')
|
||||
|
||||
let json = {
|
||||
Account: 'rrrrrrrrrrrrrrrrrrrrrhoLvTp',
|
||||
Sequence: 0,
|
||||
Fee: '0',
|
||||
SigningPubKey: '',
|
||||
Signature: '',
|
||||
}
|
||||
|
||||
let json_blank_acct = {
|
||||
Account: '',
|
||||
Sequence: 0,
|
||||
Fee: '0',
|
||||
SigningPubKey: '',
|
||||
Signature: '',
|
||||
}
|
||||
|
||||
let binary =
|
||||
'24000000006840000000000000007300760081140000000000000000000000000000000000000000'
|
||||
|
||||
describe('Can encode Pseudo Transactions', () => {
|
||||
test('Correctly encodes Pseudo Transaciton', () => {
|
||||
expect(encode(json)).toEqual(binary)
|
||||
})
|
||||
|
||||
test('Can decode account objects', () => {
|
||||
expect(decode(encode(json))).toEqual(json)
|
||||
})
|
||||
|
||||
test('Blank AccountID is ACCOUNT_ZERO', () => {
|
||||
expect(encode(json_blank_acct)).toEqual(binary)
|
||||
})
|
||||
|
||||
test('Decodes Blank AccountID', () => {
|
||||
expect(decode(encode(json_blank_acct))).toEqual(json)
|
||||
})
|
||||
})
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
const { quality } = require('../src/coretypes')
|
||||
|
||||
describe('Quality encode/decode', function () {
|
||||
const bookDirectory =
|
||||
'4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0'
|
||||
const expectedQuality = '195796912.5171664'
|
||||
test('can decode', function () {
|
||||
const decimal = quality.decode(bookDirectory)
|
||||
expect(decimal.toString()).toBe(expectedQuality)
|
||||
})
|
||||
test('can encode', function () {
|
||||
const bytes = quality.encode(expectedQuality)
|
||||
expect(bytes.toString('hex').toUpperCase()).toBe(bookDirectory.slice(-16))
|
||||
})
|
||||
})
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
const { ShaMap } = require('../src/shamap')
|
||||
const { binary, HashPrefix } = require('../src/coretypes')
|
||||
const { coreTypes } = require('../src/types')
|
||||
const { loadFixture } = require('./utils')
|
||||
const { Buffer } = require('buffer/')
|
||||
|
||||
function now() {
|
||||
return Number(Date.now()) / 1000
|
||||
}
|
||||
|
||||
const ZERO = '0000000000000000000000000000000000000000000000000000000000000000'
|
||||
|
||||
function makeItem(indexArg) {
|
||||
let str = indexArg
|
||||
while (str.length < 64) {
|
||||
str += '0'
|
||||
}
|
||||
const index = coreTypes.Hash256.from(str)
|
||||
const item = {
|
||||
toBytesSink(sink) {
|
||||
index.toBytesSink(sink)
|
||||
},
|
||||
hashPrefix() {
|
||||
return Buffer.from([1, 3, 3, 7])
|
||||
},
|
||||
}
|
||||
return [index, item]
|
||||
}
|
||||
|
||||
describe('ShaMap', () => {
|
||||
now()
|
||||
|
||||
test('hashes to zero when empty', () => {
|
||||
const map = new ShaMap()
|
||||
expect(map.hash().toHex()).toBe(ZERO)
|
||||
})
|
||||
test('creates the same hash no matter which order items are added', () => {
|
||||
let map = new ShaMap()
|
||||
const items = [
|
||||
'0',
|
||||
'1',
|
||||
'11',
|
||||
'7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E20000000000000000',
|
||||
'7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E21000000000000000',
|
||||
'7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E22000000000000000',
|
||||
'7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E23000000000000000',
|
||||
'12',
|
||||
'122',
|
||||
]
|
||||
items.forEach((i) => map.addItem(...makeItem(i)))
|
||||
const h1 = map.hash()
|
||||
expect(h1.eq(h1)).toBe(true)
|
||||
map = new ShaMap()
|
||||
items.reverse().forEach((i) => map.addItem(...makeItem(i)))
|
||||
expect(map.hash()).toStrictEqual(h1)
|
||||
})
|
||||
function factory(fixture) {
|
||||
test(`recreate account state hash from ${fixture}`, () => {
|
||||
const map = new ShaMap()
|
||||
const ledger = loadFixture(fixture)
|
||||
// const t = now();
|
||||
const leafNodePrefix = HashPrefix.accountStateEntry
|
||||
ledger.accountState
|
||||
.map((e, i) => {
|
||||
if ((i > 1000) & (i % 1000 === 0)) {
|
||||
console.log(e.index)
|
||||
console.log(i)
|
||||
}
|
||||
const bytes = binary.serializeObject(e)
|
||||
return {
|
||||
index: coreTypes.Hash256.from(e.index),
|
||||
hashPrefix() {
|
||||
return leafNodePrefix
|
||||
},
|
||||
toBytesSink(sink) {
|
||||
sink.put(bytes)
|
||||
},
|
||||
}
|
||||
})
|
||||
.forEach((so) => map.addItem(so.index, so))
|
||||
expect(map.hash().toHex()).toBe(ledger.account_hash)
|
||||
// console.log('took seconds: ', (now() - t));
|
||||
})
|
||||
}
|
||||
factory('ledger-full-38129.json')
|
||||
factory('ledger-full-40000.json')
|
||||
// factory('ledger-4320277.json');
|
||||
// factory('14280680.json');
|
||||
})
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
const { throws } = require('assert')
|
||||
const {
|
||||
encodeForSigning,
|
||||
encodeForSigningClaim,
|
||||
encodeForMultisigning,
|
||||
} = require('../src')
|
||||
|
||||
const tx_json = {
|
||||
Account: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
||||
Amount: '1000',
|
||||
Destination: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
|
||||
Fee: '10',
|
||||
Flags: 2147483648,
|
||||
Sequence: 1,
|
||||
TransactionType: 'Payment',
|
||||
TxnSignature:
|
||||
'30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1' +
|
||||
'E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80' +
|
||||
'ECA3CD7B9B',
|
||||
Signature:
|
||||
'30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E72' +
|
||||
'1B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA' +
|
||||
'3CD7B9B',
|
||||
SigningPubKey:
|
||||
'ED5F5AC8B98974A3CA843326D9B88CEBD0560177B973EE0B149F782CFAA06DC66A',
|
||||
}
|
||||
|
||||
describe('Signing data', function () {
|
||||
test('can create single signing blobs', function () {
|
||||
const actual = encodeForSigning(tx_json)
|
||||
expect(actual).toBe(
|
||||
[
|
||||
'53545800', // signingPrefix
|
||||
// TransactionType
|
||||
'12',
|
||||
'0000',
|
||||
// Flags
|
||||
'22',
|
||||
'80000000',
|
||||
// Sequence
|
||||
'24',
|
||||
'00000001',
|
||||
// Amount
|
||||
'61',
|
||||
// native amount
|
||||
'40000000000003E8',
|
||||
// Fee
|
||||
'68',
|
||||
// native amount
|
||||
'400000000000000A',
|
||||
// SigningPubKey
|
||||
'73',
|
||||
// VLLength
|
||||
'21',
|
||||
'ED5F5AC8B98974A3CA843326D9B88CEBD0560177B973EE0B149F782CFAA06DC66A',
|
||||
// Account
|
||||
'81',
|
||||
// VLLength
|
||||
'14',
|
||||
'5B812C9D57731E27A2DA8B1830195F88EF32A3B6',
|
||||
// Destination
|
||||
'83',
|
||||
// VLLength
|
||||
'14',
|
||||
'B5F762798A53D543A014CAF8B297CFF8F2F937E8',
|
||||
].join(''),
|
||||
)
|
||||
})
|
||||
|
||||
test('can fail gracefully for invalid TransactionType', function () {
|
||||
const invalidTransactionType = {
|
||||
...tx_json,
|
||||
TransactionType: 'NotAPayment',
|
||||
}
|
||||
|
||||
throws(() => encodeForSigning(invalidTransactionType), /NotAPayment/u)
|
||||
})
|
||||
|
||||
test('can create multi signing blobs', function () {
|
||||
const signingAccount = 'rJZdUusLDtY9NEsGea7ijqhVrXv98rYBYN'
|
||||
const signingJson = Object.assign({}, tx_json, { SigningPubKey: '' })
|
||||
const actual = encodeForMultisigning(signingJson, signingAccount)
|
||||
expect(actual).toBe(
|
||||
[
|
||||
'534D5400', // signingPrefix
|
||||
// TransactionType
|
||||
'12',
|
||||
'0000',
|
||||
// Flags
|
||||
'22',
|
||||
'80000000',
|
||||
// Sequence
|
||||
'24',
|
||||
'00000001',
|
||||
// Amount
|
||||
'61',
|
||||
// native amount
|
||||
'40000000000003E8',
|
||||
// Fee
|
||||
'68',
|
||||
// native amount
|
||||
'400000000000000A',
|
||||
// SigningPubKey
|
||||
'73',
|
||||
// VLLength
|
||||
'00',
|
||||
// '',
|
||||
// Account
|
||||
'81',
|
||||
// VLLength
|
||||
'14',
|
||||
'5B812C9D57731E27A2DA8B1830195F88EF32A3B6',
|
||||
// Destination
|
||||
'83',
|
||||
// VLLength
|
||||
'14',
|
||||
'B5F762798A53D543A014CAF8B297CFF8F2F937E8',
|
||||
// signingAccount suffix
|
||||
'C0A5ABEF242802EFED4B041E8F2D4A8CC86AE3D1',
|
||||
].join(''),
|
||||
)
|
||||
})
|
||||
test('can create claim blob', function () {
|
||||
const channel =
|
||||
'43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1'
|
||||
const amount = '1000'
|
||||
const json = { channel, amount }
|
||||
const actual = encodeForSigningClaim(json)
|
||||
expect(actual).toBe(
|
||||
[
|
||||
// hash prefix
|
||||
'434C4D00',
|
||||
// channel ID
|
||||
'43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1',
|
||||
// amount as a uint64
|
||||
'00000000000003E8',
|
||||
].join(''),
|
||||
)
|
||||
})
|
||||
})
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
const { encode, decode } = require('../src')
|
||||
|
||||
// Notice: no Amount or Fee
|
||||
const tx_json = {
|
||||
Account: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
||||
// Amount: '1000',
|
||||
Destination: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
|
||||
// Fee: '10',
|
||||
|
||||
// JavaScript converts operands to 32-bit signed ints after doing bitwise
|
||||
// operations. We need to convert it back to an unsigned int with >>> 0.
|
||||
Flags: (1 << 31) >>> 0, // tfFullyCanonicalSig
|
||||
|
||||
Sequence: 1,
|
||||
TransactionType: 'Payment',
|
||||
// TxnSignature,
|
||||
// Signature,
|
||||
// SigningPubKey
|
||||
}
|
||||
|
||||
describe('encoding and decoding tx_json', function () {
|
||||
test('can encode tx_json without Amount or Fee', function () {
|
||||
const encoded = encode(tx_json)
|
||||
const decoded = decode(encoded)
|
||||
expect(tx_json).toEqual(decoded)
|
||||
})
|
||||
test('can encode tx_json with Amount and Fee', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Amount: '1000',
|
||||
Fee: '10',
|
||||
})
|
||||
const encoded = encode(my_tx)
|
||||
const decoded = decode(encoded)
|
||||
expect(my_tx).toEqual(decoded)
|
||||
})
|
||||
test('can encode tx_json with TicketCount', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
TicketCount: 2,
|
||||
})
|
||||
const encoded = encode(my_tx)
|
||||
const decoded = decode(encoded)
|
||||
expect(my_tx).toEqual(decoded)
|
||||
})
|
||||
test('can encode tx_json with TicketSequence', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Sequence: 0,
|
||||
TicketSequence: 2,
|
||||
})
|
||||
const encoded = encode(my_tx)
|
||||
const decoded = decode(encoded)
|
||||
expect(my_tx).toEqual(decoded)
|
||||
})
|
||||
test('can decode a transaction with an issued currency that evaluates to XRP', function () {
|
||||
// Encoding is done prior, because this is disallowed during encoding with client libraries to avoid scam XRP tokens.
|
||||
const expectedTx = {
|
||||
TransactionType: 'TrustSet',
|
||||
Flags: 0,
|
||||
Sequence: 19,
|
||||
LimitAmount: {
|
||||
value: '200',
|
||||
currency: '0000000000000000000000005852500000000000',
|
||||
issuer: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
||||
},
|
||||
Fee: '10',
|
||||
SigningPubKey:
|
||||
'023076CBB7A61837F1A23D4A3DD7CE810B694992EB0959AB9D6F4BB6FED6F8CC26',
|
||||
TxnSignature:
|
||||
'304502202D0CD77D8E765E3783C309CD663723B18406B7950A348A6F301492916A990FC70221008A76D586111205304F10ADEFDFDDAF804EF202D8CD1E492DC6E1AA8030EA1844',
|
||||
Account: 'rPtfQWdcdhuL9eNeNv5YfmekSX3K7vJHbG',
|
||||
}
|
||||
const encoded = encode(expectedTx)
|
||||
const decoded = decode(encoded)
|
||||
expect(expectedTx).toEqual(decoded)
|
||||
})
|
||||
test('throws when Amount is invalid', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Amount: '1000.001',
|
||||
Fee: '10',
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow()
|
||||
})
|
||||
test('throws when Fee is invalid', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Amount: '1000',
|
||||
Fee: '10.123',
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow()
|
||||
})
|
||||
test('throws when Amount and Fee are invalid', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Amount: '1000.789',
|
||||
Fee: '10.123',
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow()
|
||||
})
|
||||
test('throws when Amount is a number instead of a string-encoded integer', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Amount: 1000.789,
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow()
|
||||
})
|
||||
|
||||
test('throws when Fee is a number instead of a string-encoded integer', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
Amount: 1234.56,
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow()
|
||||
})
|
||||
})
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
const { coreTypes } = require('../src/types')
|
||||
const { SerializedType } = require('../src/types/serialized-type')
|
||||
|
||||
describe('SerializedType interfaces', () => {
|
||||
Object.entries(coreTypes).forEach(([name, Value]) => {
|
||||
test(`${name} has a \`from\` static constructor`, () => {
|
||||
expect(Value.from && Value.from !== Array.from).toBe(true)
|
||||
})
|
||||
test(`${name} has a default constructor`, () => {
|
||||
expect(new Value()).not.toBe(undefined)
|
||||
})
|
||||
test(`${name}.from will return the same object`, () => {
|
||||
const instance = new Value()
|
||||
expect(Value.from(instance) === instance).toBe(true)
|
||||
})
|
||||
test(`${name} instances have toBytesSink`, () => {
|
||||
expect(new Value().toBytesSink).not.toBe(undefined)
|
||||
})
|
||||
test(`${name} instances have toJSON`, () => {
|
||||
expect(new Value().toJSON).not.toBe(undefined)
|
||||
})
|
||||
test(`${name}.from(json).toJSON() == json`, () => {
|
||||
const newJSON = new Value().toJSON()
|
||||
expect(Value.from(newJSON).toJSON()).toEqual(newJSON)
|
||||
})
|
||||
describe(`${name} supports all methods of the SerializedType mixin`, () => {
|
||||
Object.keys(SerializedType.prototype).forEach((k) => {
|
||||
test(`new ${name}.prototype.${k} !== undefined`, () => {
|
||||
expect(Value.prototype[k]).not.toBe(undefined)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
const { coreTypes } = require('../src/types')
|
||||
const { UInt8, UInt64 } = coreTypes
|
||||
|
||||
const { encode } = require('../src')
|
||||
|
||||
const binary =
|
||||
'11007222000300003700000000000000003800000000000000006280000000000000000000000000000000000000005553440000000000000000000000000000000000000000000000000166D5438D7EA4C680000000000000000000000000005553440000000000AE123A8556F3CF91154711376AFB0F894F832B3D67D5438D7EA4C680000000000000000000000000005553440000000000F51DFC2A09D62CBBA1DFBDD4691DAC96AD98B90F'
|
||||
const json = {
|
||||
Balance: {
|
||||
currency: 'USD',
|
||||
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||
value: '0',
|
||||
},
|
||||
Flags: 196608,
|
||||
HighLimit: {
|
||||
currency: 'USD',
|
||||
issuer: 'rPMh7Pi9ct699iZUTWaytJUoHcJ7cgyziK',
|
||||
value: '1000',
|
||||
},
|
||||
HighNode: '0',
|
||||
LedgerEntryType: 'RippleState',
|
||||
LowLimit: {
|
||||
currency: 'USD',
|
||||
issuer: 'rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn',
|
||||
value: '1000',
|
||||
},
|
||||
LowNode: '0',
|
||||
}
|
||||
|
||||
const binaryEntry0 =
|
||||
'11007222001100002501EC24873700000000000000003800000000000000A35506FC7DE374089D50F81AAE13E7BBF3D0E694769331E14F55351B38D0148018EA62D44BF89AC2A40B800000000000000000000000004A50590000000000000000000000000000000000000000000000000166D6C38D7EA4C680000000000000000000000000004A5059000000000047C1258B4B79774B28176324068F759EDE226F686780000000000000000000000000000000000000004A505900000000005BBC0F22F61D9224A110650CFE21CC0C4BE13098'
|
||||
const jsonEntry0 = {
|
||||
Balance: {
|
||||
currency: 'JPY',
|
||||
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||
value: '0.3369568318',
|
||||
},
|
||||
Flags: 1114112,
|
||||
HighLimit: {
|
||||
currency: 'JPY',
|
||||
issuer: 'r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN',
|
||||
value: '0',
|
||||
},
|
||||
HighNode: 'a3',
|
||||
LedgerEntryType: 'RippleState',
|
||||
LowLimit: {
|
||||
currency: 'JPY',
|
||||
issuer: 'rfYQMgj3g3Qp8VLoZNvvU35mEuuJC8nCmY',
|
||||
value: '1000000000',
|
||||
},
|
||||
LowNode: '0',
|
||||
PreviousTxnID:
|
||||
'06FC7DE374089D50F81AAE13E7BBF3D0E694769331E14F55351B38D0148018EA',
|
||||
PreviousTxnLgrSeq: 32253063,
|
||||
index: '000319BAE0A618A7D3BB492F17E98E5D92EA0C6458AFEBED44206B5B4798A840',
|
||||
}
|
||||
|
||||
const binaryEntry1 =
|
||||
'1100642200000000320000000000000002580CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E7528214BA53D10260FFCC968ACD16BA30F7CEABAD6E5D92011340A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6AE1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F'
|
||||
const jsonEntry1 = {
|
||||
Flags: 0,
|
||||
IndexPrevious: '2',
|
||||
Indexes: [
|
||||
'A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6A',
|
||||
'E1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F',
|
||||
],
|
||||
LedgerEntryType: 'DirectoryNode',
|
||||
Owner: 'rHzDaMNybxQppiE3uWyt2N265KvAKdiRdP',
|
||||
RootIndex: '0CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E752',
|
||||
index: '0B4A2E68C111F7E42FAEEE405F7344560C8240840B151D9D04131EB79D080167',
|
||||
}
|
||||
|
||||
const binaryEntry2 =
|
||||
'1100722200210000250178D1CA37000000000000000038000000000000028355C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D66946280000000000000000000000000000000000000004743420000000000000000000000000000000000000000000000000166D6071AFD498D000000000000000000000000000047434200000000002599D1D255BCA61189CA64C84528F2FCBE4BFC3867800000000000000000000000000000000000000047434200000000006EEBB1D1852CE667876A0B3630861FB6C6AB358E'
|
||||
const jsonEntry2 = {
|
||||
Balance: {
|
||||
currency: 'GCB',
|
||||
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||
value: '0',
|
||||
},
|
||||
Flags: 2162688,
|
||||
HighLimit: {
|
||||
currency: 'GCB',
|
||||
issuer: 'rBfVgTnsdh8ckC19RM8aVGNuMZnpwrMP6n',
|
||||
value: '0',
|
||||
},
|
||||
HighNode: '283',
|
||||
LedgerEntryType: 'RippleState',
|
||||
LowLimit: {
|
||||
currency: 'GCB',
|
||||
issuer: 'rhRFGCy2RJTA8oxkjjtYTvofPVGqcgvXWj',
|
||||
value: '2000000',
|
||||
},
|
||||
LowNode: '0',
|
||||
PreviousTxnID:
|
||||
'C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D6694',
|
||||
PreviousTxnLgrSeq: 24695242,
|
||||
index: '0000041EFD027808D3F78C8352F97E324CB816318E00B977C74ECDDC7CD975B2',
|
||||
}
|
||||
|
||||
test('compareToTests[0]', () => {
|
||||
expect(UInt8.from(124).compareTo(UInt64.from(124))).toBe(0)
|
||||
})
|
||||
|
||||
test('compareToTest[1]', () => {
|
||||
expect(UInt64.from(124).compareTo(UInt8.from(124))).toBe(0)
|
||||
})
|
||||
|
||||
test('compareToTest[2]', () => {
|
||||
expect(UInt64.from(124).compareTo(UInt8.from(123))).toBe(1)
|
||||
})
|
||||
|
||||
test('compareToTest[3]', () => {
|
||||
expect(UInt8.from(124).compareTo(UInt8.from(13))).toBe(1)
|
||||
})
|
||||
|
||||
test('compareToTest[4]', () => {
|
||||
expect(UInt8.from(124).compareTo(124)).toBe(0)
|
||||
})
|
||||
|
||||
test('compareToTest[5]', () => {
|
||||
expect(UInt64.from(124).compareTo(124)).toBe(0)
|
||||
})
|
||||
|
||||
test('compareToTest[6]', () => {
|
||||
expect(UInt64.from(124).compareTo(123)).toBe(1)
|
||||
})
|
||||
|
||||
test('compareToTest[7]', () => {
|
||||
expect(UInt8.from(124).compareTo(13)).toBe(1)
|
||||
})
|
||||
|
||||
test('UInt64 from string zero', () => {
|
||||
expect(UInt64.from('0')).toEqual(UInt64.from(0))
|
||||
expect(encode(json)).toEqual(binary)
|
||||
})
|
||||
|
||||
test('UInt64 from non 16 length hex', () => {
|
||||
expect(encode(jsonEntry0)).toEqual(binaryEntry0)
|
||||
expect(encode(jsonEntry1)).toEqual(binaryEntry1)
|
||||
expect(encode(jsonEntry2)).toEqual(binaryEntry2)
|
||||
})
|
||||
|
||||
test('valueOfTests', () => {
|
||||
let val = UInt8.from(1)
|
||||
val |= 0x2
|
||||
expect(val).toBe(3)
|
||||
})
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
const fs = require("fs");
|
||||
const { Buffer } = require('buffer/')
|
||||
|
||||
function hexOnly(hex) {
|
||||
return hex.replace(/[^a-fA-F0-9]/g, "");
|
||||
}
|
||||
|
||||
function unused() {}
|
||||
|
||||
function parseHexOnly(hex) {
|
||||
return Buffer.from(hexOnly(hex), "hex");
|
||||
}
|
||||
|
||||
function loadFixture(relativePath) {
|
||||
const fn = __dirname + "/fixtures/" + relativePath;
|
||||
return require(fn);
|
||||
}
|
||||
|
||||
function loadFixtureText(relativePath) {
|
||||
const fn = __dirname + "/fixtures/" + relativePath;
|
||||
return fs.readFileSync(fn).toString("utf8");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hexOnly,
|
||||
parseHexOnly,
|
||||
loadFixture,
|
||||
loadFixtureText,
|
||||
unused,
|
||||
};
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
const { encode, decode } = require('./../src/index')
|
||||
const fixtures = require('./fixtures/x-codec-fixtures.json')
|
||||
|
||||
let json_x1 = {
|
||||
OwnerCount: 0,
|
||||
Account: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
let json_r1 = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
SourceTag: 12345,
|
||||
}
|
||||
|
||||
let json_null_x = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Issuer: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P4GETfNyyXGaoqBj71',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
let json_invalid_x = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Issuer: 'XVXdn5wEVm5g4UhEHWDPqjvdeH361P4GETfNyyXGaoqBj71',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
let json_null_r = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Issuer: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
let invalid_json_issuer_tagged = {
|
||||
OwnerCount: 0,
|
||||
Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
|
||||
Issuer: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
}
|
||||
|
||||
let invalid_json_x_and_tagged = {
|
||||
OwnerCount: 0,
|
||||
Account: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT',
|
||||
PreviousTxnLgrSeq: 7,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
PreviousTxnID:
|
||||
'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
|
||||
Flags: 0,
|
||||
Sequence: 1,
|
||||
Balance: '10000000000',
|
||||
SourceTag: 12345,
|
||||
}
|
||||
|
||||
let json_issued_x = {
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: 'X7WZKEeNVS2p9Tire9DtNFkzWBZbFtJHWxDjN9fCrBGqVA4',
|
||||
value: '7072.8',
|
||||
},
|
||||
}
|
||||
|
||||
let json_issued_r = {
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
value: '7072.8',
|
||||
},
|
||||
}
|
||||
|
||||
let json_issued_with_tag = {
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: 'X7WZKEeNVS2p9Tire9DtNFkzWBZbFtSiS2eDBib7svZXuc2',
|
||||
value: '7072.8',
|
||||
},
|
||||
}
|
||||
|
||||
describe('X-Address Account is equivalent to a classic address w/ SourceTag', () => {
|
||||
let encoded_x = encode(json_x1)
|
||||
let encoded_r = encode(json_r1)
|
||||
test('Can encode with x-Address', () => {
|
||||
expect(encoded_x).toEqual(encoded_r)
|
||||
})
|
||||
|
||||
test('decoded X-address is object w/ source and tag', () => {
|
||||
let decoded_x = decode(encoded_x)
|
||||
expect(decoded_x).toEqual(json_r1)
|
||||
})
|
||||
|
||||
test('Encoding issuer X-Address w/ undefined destination tag', () => {
|
||||
expect(encode(json_null_x)).toEqual(encode(json_null_r))
|
||||
})
|
||||
|
||||
test('Throws when X-Address is invalid', () => {
|
||||
expect(() => encode(json_invalid_x)).toThrow('checksum_invalid')
|
||||
})
|
||||
|
||||
test('Encodes issued currency w/ x-address', () => {
|
||||
expect(encode(json_issued_x)).toEqual(encode(json_issued_r))
|
||||
})
|
||||
})
|
||||
|
||||
describe('Invalid X-Address behavior', () => {
|
||||
test('X-Address with tag throws value for invalid field', () => {
|
||||
expect(() => encode(invalid_json_issuer_tagged)).toThrow(
|
||||
new Error('Issuer cannot have an associated tag'),
|
||||
)
|
||||
})
|
||||
|
||||
test('Throws when Account has both X-Addr and Destination Tag', () => {
|
||||
expect(() => encode(invalid_json_x_and_tagged)).toThrow(
|
||||
new Error('Cannot have Account X-Address and SourceTag'),
|
||||
)
|
||||
})
|
||||
|
||||
test('Throws when issued currency has tag', () => {
|
||||
expect(() => encode(json_issued_with_tag)).toThrow(
|
||||
'Only allowed to have tag on Account or Destination',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('ripple-binary-codec x-address test', function () {
|
||||
function makeSuite(name, entries) {
|
||||
describe(name, function () {
|
||||
entries.forEach((t, testN) => {
|
||||
test(`${name}[${testN}] encodes X-address json equivalent to classic address json`, () => {
|
||||
expect(encode(t.rjson)).toEqual(encode(t.xjson))
|
||||
})
|
||||
test(`${name}[${testN}] decodes X-address json equivalent to classic address json`, () => {
|
||||
expect(decode(encode(t.xjson))).toEqual(t.rjson)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
makeSuite('transactions', fixtures.transactions)
|
||||
})
|
||||
Reference in New Issue
Block a user