mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Support encoding and decoding of NegativeUNL pseudo-transactions (#89)
* Support encoding and decoding of NegativeUNL pseudo-transactions
This commit is contained in:
37
packages/ripple-binary-codec/test/pseudo-transaction.test.js
Normal file
37
packages/ripple-binary-codec/test/pseudo-transaction.test.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const { encode, decode } = require('../dist')
|
||||
|
||||
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);
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user