From d1f560a786b312e69c28bbd87505086119be6861 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 1 Jun 2022 12:36:52 -0400 Subject: [PATCH] match rippled implementation --- .../src/types/sidechain.ts | 8 +- .../test/fixtures/xchain-door-create.json | 84 +++++++------------ 2 files changed, 36 insertions(+), 56 deletions(-) diff --git a/packages/ripple-binary-codec/src/types/sidechain.ts b/packages/ripple-binary-codec/src/types/sidechain.ts index 26a0b761..22664bde 100644 --- a/packages/ripple-binary-codec/src/types/sidechain.ts +++ b/packages/ripple-binary-codec/src/types/sidechain.ts @@ -62,10 +62,10 @@ class Sidechain extends SerializedType { ).toBytes() return new Sidechain( Buffer.concat([ - dst_chain_door, - dst_chain_issue, src_chain_door, src_chain_issue, + dst_chain_door, + dst_chain_issue, ]), ) } @@ -97,10 +97,10 @@ class Sidechain extends SerializedType { */ toJSON(): SidechainObject { const parser = new BinaryParser(this.toString()) - const dst_chain_door = AccountID.fromParser(parser) as AccountID - const dst_chain_issue = IssuedCurrency.fromParser(parser) const src_chain_door = AccountID.fromParser(parser) as AccountID const src_chain_issue = IssuedCurrency.fromParser(parser) + const dst_chain_door = AccountID.fromParser(parser) as AccountID + const dst_chain_issue = IssuedCurrency.fromParser(parser) return { dst_chain_door: dst_chain_door.toJSON(), diff --git a/packages/ripple-binary-codec/test/fixtures/xchain-door-create.json b/packages/ripple-binary-codec/test/fixtures/xchain-door-create.json index c4021e56..6b4ded67 100644 --- a/packages/ripple-binary-codec/test/fixtures/xchain-door-create.json +++ b/packages/ripple-binary-codec/test/fixtures/xchain-door-create.json @@ -1,57 +1,37 @@ { - "binary": "12001E22800000002023000000048114C48CAD01682D7A86296EF14523074D4852C02EA9F4EB130001811474A41942D90FDD8E4E8BB25A7E91843CFEDB9A5DE1EB1300018114C287E75E44FEB7AF3537173BB3A866A652C91502E1EB1300018114F5B6BA5BA9F91592A4B607E0397E47A298B95EA2E1EB13000181145720A5ABFA7D844BD615F4E62FA7C963E85B0C7DE1EB1300018114B7521887260F712472A8E5775EE6234042641C0CE1F10118CC86E58C9B58D4CF71CB8C1B41F21BB290CE13D4000000000000000000000000555344000000000027B6C49755570AD538DDD42EE417A4708F17EF76C48CAD01682D7A86296EF14523074D4852C02EA90000000000000000000000000000000000000000", + "binary": "12001E2280000000240000000220230000000468400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100B892F08A56487806BCC077CAA854341CEA6A8A2697D4FD068F4D4A391ADC16AE02203D0251CF521FC914CB3CC451A8553662CC9B4B5A6E0747F26C8B836DA2E8F82E8114B5F762798A53D543A014CAF8B297CFF8F2F937E8F4EB130001811474A41942D90FDD8E4E8BB25A7E91843CFEDB9A5DE1EB1300018114C287E75E44FEB7AF3537173BB3A866A652C91502E1EB1300018114F5B6BA5BA9F91592A4B607E0397E47A298B95EA2E1EB13000181145720A5ABFA7D844BD615F4E62FA7C963E85B0C7DE1EB1300018114B7521887260F712472A8E5775EE6234042641C0CE1F10118C48CAD01682D7A86296EF14523074D4852C02EA900000000000000000000000000000000000000000000000000000000000000000000000000000000CC86E58C9B58D4CF71CB8C1B41F21BB290CE13D4000000000000000000000000555344000000000027B6C49755570AD538DDD42EE417A4708F17EF76", "tx": { - "Account" : "rJvExveLEL4jNDEeLKCVdxaSCN9cEBnEQC", - "Flags" : 2147483648, - "Sidechain" : - { - "dst_chain_door" : "rKeSSvHvaMZJp9ykaxutVwkhZgWuWMLnQt", - "dst_chain_issue" : { - "currency" : "USD", - "issuer" : "rhczJR49YsdxwtYTPvxeSc1Jjr7R748cHv" - }, - "src_chain_door" : "rJvExveLEL4jNDEeLKCVdxaSCN9cEBnEQC", - "src_chain_issue" : "XRP" - }, - "SignerEntries" : - [ - { - "SignerEntry" : - { - "Account" : "rBdjyperRHKTzdxnZhyN94MpjN2aknRX8G", - "SignerWeight" : 1 - } - }, - { - "SignerEntry" : - { - "Account" : "rJj2ty2MDGu7dtm1bvZMA5KuhzreNL2HHo", - "SignerWeight" : 1 - } - }, - { - "SignerEntry" : - { - "Account" : "rPQDTwG7tWYNzqjytf8YCYX6hZemGG9TTh", - "SignerWeight" : 1 - } - }, - { - "SignerEntry" : - { - "Account" : "r3AguhaYj2enNDz37mzJNskxcQKb3sAYjE", - "SignerWeight" : 1 - } - }, - { - "SignerEntry" : - { - "Account" : "rH5KrD1ocKBWq3Mf7WGy8tTtEi84M1uwGm", - "SignerWeight" : 1 - } + "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "Fee": "12", + "Flags": 2147483648, + "Sequence": 2, + "Sidechain": {"dst_chain_door": "rKeSSvHvaMZJp9ykaxutVwkhZgWuWMLnQt", + "dst_chain_issue": {"currency": "USD", + "issuer": "rhczJR49YsdxwtYTPvxeSc1Jjr7R748cHv"}, + "src_chain_door": "rJvExveLEL4jNDEeLKCVdxaSCN9cEBnEQC", + "src_chain_issue": "XRP"}, + "SignerEntries": [ + {"SignerEntry": { + "Account": "rBdjyperRHKTzdxnZhyN94MpjN2aknRX8G", + "SignerWeight": 1 } + }, + { + "SignerEntry": { + "Account": "rJj2ty2MDGu7dtm1bvZMA5KuhzreNL2HHo", + "SignerWeight": 1 + } + }, + {"SignerEntry": {"Account": "rPQDTwG7tWYNzqjytf8YCYX6hZemGG9TTh", + "SignerWeight": 1}}, + {"SignerEntry": {"Account": "r3AguhaYj2enNDz37mzJNskxcQKb3sAYjE", + "SignerWeight": 1}}, + {"SignerEntry": {"Account": "rH5KrD1ocKBWq3Mf7WGy8tTtEi84M1uwGm", + "SignerWeight": 1}} ], - "SignerQuorum" : 4, - "TransactionType" : "XChainDoorCreate" - } + "SignerQuorum": 4, + "SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020", + "TransactionType": "XChainDoorCreate", + "TxnSignature": "3045022100B892F08A56487806BCC077CAA854341CEA6A8A2697D4FD068F4D4A391ADC16AE02203D0251CF521FC914CB3CC451A8553662CC9B4B5A6E0747F26C8B836DA2E8F82E", + "hash": "B35633F10A1B7E47F6517C79BB4752D86F832C90DCB0789FC5F367CEB83FD5F4"} }