ripple-binary-codec 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/enums/definitions.json +248 -1
- package/dist/enums/src/enums/definitions.json +248 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/xchain-bridge.d.ts +4 -4
- package/dist/types/xchain-bridge.js +5 -5
- package/dist/types/xchain-bridge.js.map +1 -1
- package/package.json +3 -4
- package/src/enums/definitions.json +248 -1
- package/src/types/index.ts +2 -0
- package/src/types/xchain-bridge.ts +128 -0
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"UInt384": 22,
|
|
23
23
|
"UInt512": 23,
|
|
24
24
|
"Issue": 24,
|
|
25
|
+
"XChainBridge": 25,
|
|
25
26
|
"Transaction": 10001,
|
|
26
27
|
"LedgerEntry": 10002,
|
|
27
28
|
"Validation": 10003,
|
|
@@ -35,8 +36,11 @@
|
|
|
35
36
|
"Ticket": 84,
|
|
36
37
|
"SignerList": 83,
|
|
37
38
|
"Offer": 111,
|
|
39
|
+
"Bridge": 105,
|
|
38
40
|
"LedgerHashes": 104,
|
|
39
41
|
"Amendments": 102,
|
|
42
|
+
"XChainOwnedClaimID": 113,
|
|
43
|
+
"XChainOwnedCreateAccountClaimID": 116,
|
|
40
44
|
"FeeSettings": 115,
|
|
41
45
|
"Escrow": 117,
|
|
42
46
|
"PayChannel": 120,
|
|
@@ -233,6 +237,16 @@
|
|
|
233
237
|
"type": "UInt8"
|
|
234
238
|
}
|
|
235
239
|
],
|
|
240
|
+
[
|
|
241
|
+
"WasLockingChainSend",
|
|
242
|
+
{
|
|
243
|
+
"nth": 19,
|
|
244
|
+
"isVLEncoded": false,
|
|
245
|
+
"isSerialized": true,
|
|
246
|
+
"isSigningField": true,
|
|
247
|
+
"type": "UInt8"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
236
250
|
[
|
|
237
251
|
"LedgerEntryType",
|
|
238
252
|
{
|
|
@@ -983,6 +997,36 @@
|
|
|
983
997
|
"type": "UInt64"
|
|
984
998
|
}
|
|
985
999
|
],
|
|
1000
|
+
[
|
|
1001
|
+
"XChainClaimID",
|
|
1002
|
+
{
|
|
1003
|
+
"nth": 20,
|
|
1004
|
+
"isVLEncoded": false,
|
|
1005
|
+
"isSerialized": true,
|
|
1006
|
+
"isSigningField": true,
|
|
1007
|
+
"type": "UInt64"
|
|
1008
|
+
}
|
|
1009
|
+
],
|
|
1010
|
+
[
|
|
1011
|
+
"XChainAccountCreateCount",
|
|
1012
|
+
{
|
|
1013
|
+
"nth": 21,
|
|
1014
|
+
"isVLEncoded": false,
|
|
1015
|
+
"isSerialized": true,
|
|
1016
|
+
"isSigningField": true,
|
|
1017
|
+
"type": "UInt64"
|
|
1018
|
+
}
|
|
1019
|
+
],
|
|
1020
|
+
[
|
|
1021
|
+
"XChainAccountClaimCount",
|
|
1022
|
+
{
|
|
1023
|
+
"nth": 22,
|
|
1024
|
+
"isVLEncoded": false,
|
|
1025
|
+
"isSerialized": true,
|
|
1026
|
+
"isSigningField": true,
|
|
1027
|
+
"type": "UInt64"
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
986
1030
|
[
|
|
987
1031
|
"EmailHash",
|
|
988
1032
|
{
|
|
@@ -1583,6 +1627,26 @@
|
|
|
1583
1627
|
"type": "Amount"
|
|
1584
1628
|
}
|
|
1585
1629
|
],
|
|
1630
|
+
[
|
|
1631
|
+
"SignatureReward",
|
|
1632
|
+
{
|
|
1633
|
+
"nth": 29,
|
|
1634
|
+
"isVLEncoded": false,
|
|
1635
|
+
"isSerialized": true,
|
|
1636
|
+
"isSigningField": true,
|
|
1637
|
+
"type": "Amount"
|
|
1638
|
+
}
|
|
1639
|
+
],
|
|
1640
|
+
[
|
|
1641
|
+
"MinAccountCreateAmount",
|
|
1642
|
+
{
|
|
1643
|
+
"nth": 30,
|
|
1644
|
+
"isVLEncoded": false,
|
|
1645
|
+
"isSerialized": true,
|
|
1646
|
+
"isSigningField": true,
|
|
1647
|
+
"type": "Amount"
|
|
1648
|
+
}
|
|
1649
|
+
],
|
|
1586
1650
|
[
|
|
1587
1651
|
"LPTokenBalance",
|
|
1588
1652
|
{
|
|
@@ -1933,6 +1997,66 @@
|
|
|
1933
1997
|
"type": "AccountID"
|
|
1934
1998
|
}
|
|
1935
1999
|
],
|
|
2000
|
+
[
|
|
2001
|
+
"OtherChainSource",
|
|
2002
|
+
{
|
|
2003
|
+
"nth": 18,
|
|
2004
|
+
"isVLEncoded": true,
|
|
2005
|
+
"isSerialized": true,
|
|
2006
|
+
"isSigningField": true,
|
|
2007
|
+
"type": "AccountID"
|
|
2008
|
+
}
|
|
2009
|
+
],
|
|
2010
|
+
[
|
|
2011
|
+
"OtherChainDestination",
|
|
2012
|
+
{
|
|
2013
|
+
"nth": 19,
|
|
2014
|
+
"isVLEncoded": true,
|
|
2015
|
+
"isSerialized": true,
|
|
2016
|
+
"isSigningField": true,
|
|
2017
|
+
"type": "AccountID"
|
|
2018
|
+
}
|
|
2019
|
+
],
|
|
2020
|
+
[
|
|
2021
|
+
"AttestationSignerAccount",
|
|
2022
|
+
{
|
|
2023
|
+
"nth": 20,
|
|
2024
|
+
"isVLEncoded": true,
|
|
2025
|
+
"isSerialized": true,
|
|
2026
|
+
"isSigningField": true,
|
|
2027
|
+
"type": "AccountID"
|
|
2028
|
+
}
|
|
2029
|
+
],
|
|
2030
|
+
[
|
|
2031
|
+
"AttestationRewardAccount",
|
|
2032
|
+
{
|
|
2033
|
+
"nth": 21,
|
|
2034
|
+
"isVLEncoded": true,
|
|
2035
|
+
"isSerialized": true,
|
|
2036
|
+
"isSigningField": true,
|
|
2037
|
+
"type": "AccountID"
|
|
2038
|
+
}
|
|
2039
|
+
],
|
|
2040
|
+
[
|
|
2041
|
+
"LockingChainDoor",
|
|
2042
|
+
{
|
|
2043
|
+
"nth": 22,
|
|
2044
|
+
"isVLEncoded": true,
|
|
2045
|
+
"isSerialized": true,
|
|
2046
|
+
"isSigningField": true,
|
|
2047
|
+
"type": "AccountID"
|
|
2048
|
+
}
|
|
2049
|
+
],
|
|
2050
|
+
[
|
|
2051
|
+
"IssuingChainDoor",
|
|
2052
|
+
{
|
|
2053
|
+
"nth": 23,
|
|
2054
|
+
"isVLEncoded": true,
|
|
2055
|
+
"isSerialized": true,
|
|
2056
|
+
"isSigningField": true,
|
|
2057
|
+
"type": "AccountID"
|
|
2058
|
+
}
|
|
2059
|
+
],
|
|
1936
2060
|
[
|
|
1937
2061
|
"Indexes",
|
|
1938
2062
|
{
|
|
@@ -1983,6 +2107,26 @@
|
|
|
1983
2107
|
"type": "PathSet"
|
|
1984
2108
|
}
|
|
1985
2109
|
],
|
|
2110
|
+
[
|
|
2111
|
+
"LockingChainIssue",
|
|
2112
|
+
{
|
|
2113
|
+
"nth": 1,
|
|
2114
|
+
"isVLEncoded": false,
|
|
2115
|
+
"isSerialized": true,
|
|
2116
|
+
"isSigningField": true,
|
|
2117
|
+
"type": "Issue"
|
|
2118
|
+
}
|
|
2119
|
+
],
|
|
2120
|
+
[
|
|
2121
|
+
"IssuingChainIssue",
|
|
2122
|
+
{
|
|
2123
|
+
"nth": 2,
|
|
2124
|
+
"isVLEncoded": false,
|
|
2125
|
+
"isSerialized": true,
|
|
2126
|
+
"isSigningField": true,
|
|
2127
|
+
"type": "Issue"
|
|
2128
|
+
}
|
|
2129
|
+
],
|
|
1986
2130
|
[
|
|
1987
2131
|
"Asset",
|
|
1988
2132
|
{
|
|
@@ -2003,6 +2147,16 @@
|
|
|
2003
2147
|
"type": "Issue"
|
|
2004
2148
|
}
|
|
2005
2149
|
],
|
|
2150
|
+
[
|
|
2151
|
+
"XChainBridge",
|
|
2152
|
+
{
|
|
2153
|
+
"nth": 1,
|
|
2154
|
+
"isVLEncoded": false,
|
|
2155
|
+
"isSerialized": true,
|
|
2156
|
+
"isSigningField": true,
|
|
2157
|
+
"type": "XChainBridge"
|
|
2158
|
+
}
|
|
2159
|
+
],
|
|
2006
2160
|
[
|
|
2007
2161
|
"TransactionMetaData",
|
|
2008
2162
|
{
|
|
@@ -2243,6 +2397,46 @@
|
|
|
2243
2397
|
"type": "STObject"
|
|
2244
2398
|
}
|
|
2245
2399
|
],
|
|
2400
|
+
[
|
|
2401
|
+
"XChainClaimProofSig",
|
|
2402
|
+
{
|
|
2403
|
+
"nth": 28,
|
|
2404
|
+
"isVLEncoded": false,
|
|
2405
|
+
"isSerialized": true,
|
|
2406
|
+
"isSigningField": true,
|
|
2407
|
+
"type": "STObject"
|
|
2408
|
+
}
|
|
2409
|
+
],
|
|
2410
|
+
[
|
|
2411
|
+
"XChainCreateAccountProofSig",
|
|
2412
|
+
{
|
|
2413
|
+
"nth": 29,
|
|
2414
|
+
"isVLEncoded": false,
|
|
2415
|
+
"isSerialized": true,
|
|
2416
|
+
"isSigningField": true,
|
|
2417
|
+
"type": "STObject"
|
|
2418
|
+
}
|
|
2419
|
+
],
|
|
2420
|
+
[
|
|
2421
|
+
"XChainClaimAttestationCollectionElement",
|
|
2422
|
+
{
|
|
2423
|
+
"nth": 30,
|
|
2424
|
+
"isVLEncoded": false,
|
|
2425
|
+
"isSerialized": true,
|
|
2426
|
+
"isSigningField": true,
|
|
2427
|
+
"type": "STObject"
|
|
2428
|
+
}
|
|
2429
|
+
],
|
|
2430
|
+
[
|
|
2431
|
+
"XChainCreateAccountAttestationCollectionElement",
|
|
2432
|
+
{
|
|
2433
|
+
"nth": 31,
|
|
2434
|
+
"isVLEncoded": false,
|
|
2435
|
+
"isSerialized": true,
|
|
2436
|
+
"isSigningField": true,
|
|
2437
|
+
"type": "STObject"
|
|
2438
|
+
}
|
|
2439
|
+
],
|
|
2246
2440
|
[
|
|
2247
2441
|
"Signers",
|
|
2248
2442
|
{
|
|
@@ -2393,6 +2587,26 @@
|
|
|
2393
2587
|
"type": "STArray"
|
|
2394
2588
|
}
|
|
2395
2589
|
],
|
|
2590
|
+
[
|
|
2591
|
+
"XChainClaimAttestations",
|
|
2592
|
+
{
|
|
2593
|
+
"nth": 21,
|
|
2594
|
+
"isVLEncoded": false,
|
|
2595
|
+
"isSerialized": true,
|
|
2596
|
+
"isSigningField": true,
|
|
2597
|
+
"type": "STArray"
|
|
2598
|
+
}
|
|
2599
|
+
],
|
|
2600
|
+
[
|
|
2601
|
+
"XChainCreateAccountAttestations",
|
|
2602
|
+
{
|
|
2603
|
+
"nth": 22,
|
|
2604
|
+
"isVLEncoded": false,
|
|
2605
|
+
"isSerialized": true,
|
|
2606
|
+
"isSigningField": true,
|
|
2607
|
+
"type": "STArray"
|
|
2608
|
+
}
|
|
2609
|
+
],
|
|
2396
2610
|
[
|
|
2397
2611
|
"AuthAccounts",
|
|
2398
2612
|
{
|
|
@@ -2460,6 +2674,12 @@
|
|
|
2460
2674
|
"temSEQ_AND_TICKET": -263,
|
|
2461
2675
|
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
|
2462
2676
|
"temBAD_AMM_TOKENS": -261,
|
|
2677
|
+
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
|
|
2678
|
+
"temXCHAIN_BAD_PROOF": -259,
|
|
2679
|
+
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
|
|
2680
|
+
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
|
|
2681
|
+
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
|
2682
|
+
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
|
2463
2683
|
"tefFAILURE": -199,
|
|
2464
2684
|
"tefALREADY": -198,
|
|
2465
2685
|
"tefBAD_ADD_AUTH": -197,
|
|
@@ -2494,6 +2714,7 @@
|
|
|
2494
2714
|
"terQUEUED": -89,
|
|
2495
2715
|
"terPRE_TICKET": -88,
|
|
2496
2716
|
"terNO_AMM": -87,
|
|
2717
|
+
"terSUBMITTED": -86,
|
|
2497
2718
|
"tesSUCCESS": 0,
|
|
2498
2719
|
"tecCLAIM": 100,
|
|
2499
2720
|
"tecPATH_PARTIAL": 101,
|
|
@@ -2533,6 +2754,7 @@
|
|
|
2533
2754
|
"tecKILLED": 150,
|
|
2534
2755
|
"tecHAS_OBLIGATIONS": 151,
|
|
2535
2756
|
"tecTOO_SOON": 152,
|
|
2757
|
+
"tecHOOK_ERROR": 153,
|
|
2536
2758
|
"tecMAX_SEQUENCE_REACHED": 154,
|
|
2537
2759
|
"tecNO_SUITABLE_NFTOKEN_PAGE": 155,
|
|
2538
2760
|
"tecNFTOKEN_BUY_SELL_MISMATCH": 156,
|
|
@@ -2548,7 +2770,24 @@
|
|
|
2548
2770
|
"tecAMM_EMPTY": 166,
|
|
2549
2771
|
"tecAMM_NOT_EMPTY": 167,
|
|
2550
2772
|
"tecAMM_ACCOUNT": 168,
|
|
2551
|
-
"tecINCOMPLETE": 169
|
|
2773
|
+
"tecINCOMPLETE": 169,
|
|
2774
|
+
"tecXCHAIN_BAD_TRANSFER_ISSUE": 170,
|
|
2775
|
+
"tecXCHAIN_NO_CLAIM_ID": 171,
|
|
2776
|
+
"tecXCHAIN_BAD_CLAIM_ID": 172,
|
|
2777
|
+
"tecXCHAIN_CLAIM_NO_QUORUM": 173,
|
|
2778
|
+
"tecXCHAIN_PROOF_UNKNOWN_KEY": 174,
|
|
2779
|
+
"tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 175,
|
|
2780
|
+
"tecXCHAIN_WRONG_CHAIN": 176,
|
|
2781
|
+
"tecXCHAIN_REWARD_MISMATCH": 177,
|
|
2782
|
+
"tecXCHAIN_NO_SIGNERS_LIST": 178,
|
|
2783
|
+
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 179,
|
|
2784
|
+
"tecXCHAIN_INSUFF_CREATE_AMOUNT": 180,
|
|
2785
|
+
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
|
|
2786
|
+
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
|
|
2787
|
+
"tecXCHAIN_PAYMENT_FAILED": 183,
|
|
2788
|
+
"tecXCHAIN_SELF_COMMIT": 184,
|
|
2789
|
+
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
|
|
2790
|
+
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186
|
|
2552
2791
|
},
|
|
2553
2792
|
"TRANSACTION_TYPES": {
|
|
2554
2793
|
"Invalid": -1,
|
|
@@ -2587,6 +2826,14 @@
|
|
|
2587
2826
|
"AMMVote": 38,
|
|
2588
2827
|
"AMMBid": 39,
|
|
2589
2828
|
"AMMDelete": 40,
|
|
2829
|
+
"XChainCreateClaimID": 41,
|
|
2830
|
+
"XChainCommit": 42,
|
|
2831
|
+
"XChainClaim": 43,
|
|
2832
|
+
"XChainAccountCreateCommit": 44,
|
|
2833
|
+
"XChainAddClaimAttestation": 45,
|
|
2834
|
+
"XChainAddAccountCreateAttestation": 46,
|
|
2835
|
+
"XChainModifyBridge": 47,
|
|
2836
|
+
"XChainCreateBridge": 48,
|
|
2590
2837
|
"EnableAmendment": 100,
|
|
2591
2838
|
"SetFee": 101,
|
|
2592
2839
|
"UNLModify": 102
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"UInt384": 22,
|
|
23
23
|
"UInt512": 23,
|
|
24
24
|
"Issue": 24,
|
|
25
|
+
"XChainBridge": 25,
|
|
25
26
|
"Transaction": 10001,
|
|
26
27
|
"LedgerEntry": 10002,
|
|
27
28
|
"Validation": 10003,
|
|
@@ -35,8 +36,11 @@
|
|
|
35
36
|
"Ticket": 84,
|
|
36
37
|
"SignerList": 83,
|
|
37
38
|
"Offer": 111,
|
|
39
|
+
"Bridge": 105,
|
|
38
40
|
"LedgerHashes": 104,
|
|
39
41
|
"Amendments": 102,
|
|
42
|
+
"XChainOwnedClaimID": 113,
|
|
43
|
+
"XChainOwnedCreateAccountClaimID": 116,
|
|
40
44
|
"FeeSettings": 115,
|
|
41
45
|
"Escrow": 117,
|
|
42
46
|
"PayChannel": 120,
|
|
@@ -233,6 +237,16 @@
|
|
|
233
237
|
"type": "UInt8"
|
|
234
238
|
}
|
|
235
239
|
],
|
|
240
|
+
[
|
|
241
|
+
"WasLockingChainSend",
|
|
242
|
+
{
|
|
243
|
+
"nth": 19,
|
|
244
|
+
"isVLEncoded": false,
|
|
245
|
+
"isSerialized": true,
|
|
246
|
+
"isSigningField": true,
|
|
247
|
+
"type": "UInt8"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
236
250
|
[
|
|
237
251
|
"LedgerEntryType",
|
|
238
252
|
{
|
|
@@ -983,6 +997,36 @@
|
|
|
983
997
|
"type": "UInt64"
|
|
984
998
|
}
|
|
985
999
|
],
|
|
1000
|
+
[
|
|
1001
|
+
"XChainClaimID",
|
|
1002
|
+
{
|
|
1003
|
+
"nth": 20,
|
|
1004
|
+
"isVLEncoded": false,
|
|
1005
|
+
"isSerialized": true,
|
|
1006
|
+
"isSigningField": true,
|
|
1007
|
+
"type": "UInt64"
|
|
1008
|
+
}
|
|
1009
|
+
],
|
|
1010
|
+
[
|
|
1011
|
+
"XChainAccountCreateCount",
|
|
1012
|
+
{
|
|
1013
|
+
"nth": 21,
|
|
1014
|
+
"isVLEncoded": false,
|
|
1015
|
+
"isSerialized": true,
|
|
1016
|
+
"isSigningField": true,
|
|
1017
|
+
"type": "UInt64"
|
|
1018
|
+
}
|
|
1019
|
+
],
|
|
1020
|
+
[
|
|
1021
|
+
"XChainAccountClaimCount",
|
|
1022
|
+
{
|
|
1023
|
+
"nth": 22,
|
|
1024
|
+
"isVLEncoded": false,
|
|
1025
|
+
"isSerialized": true,
|
|
1026
|
+
"isSigningField": true,
|
|
1027
|
+
"type": "UInt64"
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
986
1030
|
[
|
|
987
1031
|
"EmailHash",
|
|
988
1032
|
{
|
|
@@ -1583,6 +1627,26 @@
|
|
|
1583
1627
|
"type": "Amount"
|
|
1584
1628
|
}
|
|
1585
1629
|
],
|
|
1630
|
+
[
|
|
1631
|
+
"SignatureReward",
|
|
1632
|
+
{
|
|
1633
|
+
"nth": 29,
|
|
1634
|
+
"isVLEncoded": false,
|
|
1635
|
+
"isSerialized": true,
|
|
1636
|
+
"isSigningField": true,
|
|
1637
|
+
"type": "Amount"
|
|
1638
|
+
}
|
|
1639
|
+
],
|
|
1640
|
+
[
|
|
1641
|
+
"MinAccountCreateAmount",
|
|
1642
|
+
{
|
|
1643
|
+
"nth": 30,
|
|
1644
|
+
"isVLEncoded": false,
|
|
1645
|
+
"isSerialized": true,
|
|
1646
|
+
"isSigningField": true,
|
|
1647
|
+
"type": "Amount"
|
|
1648
|
+
}
|
|
1649
|
+
],
|
|
1586
1650
|
[
|
|
1587
1651
|
"LPTokenBalance",
|
|
1588
1652
|
{
|
|
@@ -1933,6 +1997,66 @@
|
|
|
1933
1997
|
"type": "AccountID"
|
|
1934
1998
|
}
|
|
1935
1999
|
],
|
|
2000
|
+
[
|
|
2001
|
+
"OtherChainSource",
|
|
2002
|
+
{
|
|
2003
|
+
"nth": 18,
|
|
2004
|
+
"isVLEncoded": true,
|
|
2005
|
+
"isSerialized": true,
|
|
2006
|
+
"isSigningField": true,
|
|
2007
|
+
"type": "AccountID"
|
|
2008
|
+
}
|
|
2009
|
+
],
|
|
2010
|
+
[
|
|
2011
|
+
"OtherChainDestination",
|
|
2012
|
+
{
|
|
2013
|
+
"nth": 19,
|
|
2014
|
+
"isVLEncoded": true,
|
|
2015
|
+
"isSerialized": true,
|
|
2016
|
+
"isSigningField": true,
|
|
2017
|
+
"type": "AccountID"
|
|
2018
|
+
}
|
|
2019
|
+
],
|
|
2020
|
+
[
|
|
2021
|
+
"AttestationSignerAccount",
|
|
2022
|
+
{
|
|
2023
|
+
"nth": 20,
|
|
2024
|
+
"isVLEncoded": true,
|
|
2025
|
+
"isSerialized": true,
|
|
2026
|
+
"isSigningField": true,
|
|
2027
|
+
"type": "AccountID"
|
|
2028
|
+
}
|
|
2029
|
+
],
|
|
2030
|
+
[
|
|
2031
|
+
"AttestationRewardAccount",
|
|
2032
|
+
{
|
|
2033
|
+
"nth": 21,
|
|
2034
|
+
"isVLEncoded": true,
|
|
2035
|
+
"isSerialized": true,
|
|
2036
|
+
"isSigningField": true,
|
|
2037
|
+
"type": "AccountID"
|
|
2038
|
+
}
|
|
2039
|
+
],
|
|
2040
|
+
[
|
|
2041
|
+
"LockingChainDoor",
|
|
2042
|
+
{
|
|
2043
|
+
"nth": 22,
|
|
2044
|
+
"isVLEncoded": true,
|
|
2045
|
+
"isSerialized": true,
|
|
2046
|
+
"isSigningField": true,
|
|
2047
|
+
"type": "AccountID"
|
|
2048
|
+
}
|
|
2049
|
+
],
|
|
2050
|
+
[
|
|
2051
|
+
"IssuingChainDoor",
|
|
2052
|
+
{
|
|
2053
|
+
"nth": 23,
|
|
2054
|
+
"isVLEncoded": true,
|
|
2055
|
+
"isSerialized": true,
|
|
2056
|
+
"isSigningField": true,
|
|
2057
|
+
"type": "AccountID"
|
|
2058
|
+
}
|
|
2059
|
+
],
|
|
1936
2060
|
[
|
|
1937
2061
|
"Indexes",
|
|
1938
2062
|
{
|
|
@@ -1983,6 +2107,26 @@
|
|
|
1983
2107
|
"type": "PathSet"
|
|
1984
2108
|
}
|
|
1985
2109
|
],
|
|
2110
|
+
[
|
|
2111
|
+
"LockingChainIssue",
|
|
2112
|
+
{
|
|
2113
|
+
"nth": 1,
|
|
2114
|
+
"isVLEncoded": false,
|
|
2115
|
+
"isSerialized": true,
|
|
2116
|
+
"isSigningField": true,
|
|
2117
|
+
"type": "Issue"
|
|
2118
|
+
}
|
|
2119
|
+
],
|
|
2120
|
+
[
|
|
2121
|
+
"IssuingChainIssue",
|
|
2122
|
+
{
|
|
2123
|
+
"nth": 2,
|
|
2124
|
+
"isVLEncoded": false,
|
|
2125
|
+
"isSerialized": true,
|
|
2126
|
+
"isSigningField": true,
|
|
2127
|
+
"type": "Issue"
|
|
2128
|
+
}
|
|
2129
|
+
],
|
|
1986
2130
|
[
|
|
1987
2131
|
"Asset",
|
|
1988
2132
|
{
|
|
@@ -2003,6 +2147,16 @@
|
|
|
2003
2147
|
"type": "Issue"
|
|
2004
2148
|
}
|
|
2005
2149
|
],
|
|
2150
|
+
[
|
|
2151
|
+
"XChainBridge",
|
|
2152
|
+
{
|
|
2153
|
+
"nth": 1,
|
|
2154
|
+
"isVLEncoded": false,
|
|
2155
|
+
"isSerialized": true,
|
|
2156
|
+
"isSigningField": true,
|
|
2157
|
+
"type": "XChainBridge"
|
|
2158
|
+
}
|
|
2159
|
+
],
|
|
2006
2160
|
[
|
|
2007
2161
|
"TransactionMetaData",
|
|
2008
2162
|
{
|
|
@@ -2243,6 +2397,46 @@
|
|
|
2243
2397
|
"type": "STObject"
|
|
2244
2398
|
}
|
|
2245
2399
|
],
|
|
2400
|
+
[
|
|
2401
|
+
"XChainClaimProofSig",
|
|
2402
|
+
{
|
|
2403
|
+
"nth": 28,
|
|
2404
|
+
"isVLEncoded": false,
|
|
2405
|
+
"isSerialized": true,
|
|
2406
|
+
"isSigningField": true,
|
|
2407
|
+
"type": "STObject"
|
|
2408
|
+
}
|
|
2409
|
+
],
|
|
2410
|
+
[
|
|
2411
|
+
"XChainCreateAccountProofSig",
|
|
2412
|
+
{
|
|
2413
|
+
"nth": 29,
|
|
2414
|
+
"isVLEncoded": false,
|
|
2415
|
+
"isSerialized": true,
|
|
2416
|
+
"isSigningField": true,
|
|
2417
|
+
"type": "STObject"
|
|
2418
|
+
}
|
|
2419
|
+
],
|
|
2420
|
+
[
|
|
2421
|
+
"XChainClaimAttestationCollectionElement",
|
|
2422
|
+
{
|
|
2423
|
+
"nth": 30,
|
|
2424
|
+
"isVLEncoded": false,
|
|
2425
|
+
"isSerialized": true,
|
|
2426
|
+
"isSigningField": true,
|
|
2427
|
+
"type": "STObject"
|
|
2428
|
+
}
|
|
2429
|
+
],
|
|
2430
|
+
[
|
|
2431
|
+
"XChainCreateAccountAttestationCollectionElement",
|
|
2432
|
+
{
|
|
2433
|
+
"nth": 31,
|
|
2434
|
+
"isVLEncoded": false,
|
|
2435
|
+
"isSerialized": true,
|
|
2436
|
+
"isSigningField": true,
|
|
2437
|
+
"type": "STObject"
|
|
2438
|
+
}
|
|
2439
|
+
],
|
|
2246
2440
|
[
|
|
2247
2441
|
"Signers",
|
|
2248
2442
|
{
|
|
@@ -2393,6 +2587,26 @@
|
|
|
2393
2587
|
"type": "STArray"
|
|
2394
2588
|
}
|
|
2395
2589
|
],
|
|
2590
|
+
[
|
|
2591
|
+
"XChainClaimAttestations",
|
|
2592
|
+
{
|
|
2593
|
+
"nth": 21,
|
|
2594
|
+
"isVLEncoded": false,
|
|
2595
|
+
"isSerialized": true,
|
|
2596
|
+
"isSigningField": true,
|
|
2597
|
+
"type": "STArray"
|
|
2598
|
+
}
|
|
2599
|
+
],
|
|
2600
|
+
[
|
|
2601
|
+
"XChainCreateAccountAttestations",
|
|
2602
|
+
{
|
|
2603
|
+
"nth": 22,
|
|
2604
|
+
"isVLEncoded": false,
|
|
2605
|
+
"isSerialized": true,
|
|
2606
|
+
"isSigningField": true,
|
|
2607
|
+
"type": "STArray"
|
|
2608
|
+
}
|
|
2609
|
+
],
|
|
2396
2610
|
[
|
|
2397
2611
|
"AuthAccounts",
|
|
2398
2612
|
{
|
|
@@ -2461,6 +2675,12 @@
|
|
|
2461
2675
|
"temSEQ_AND_TICKET": -263,
|
|
2462
2676
|
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
|
2463
2677
|
"temBAD_AMM_TOKENS": -261,
|
|
2678
|
+
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
|
|
2679
|
+
"temXCHAIN_BAD_PROOF": -259,
|
|
2680
|
+
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
|
|
2681
|
+
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
|
|
2682
|
+
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
|
2683
|
+
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
|
2464
2684
|
|
|
2465
2685
|
"tefFAILURE": -199,
|
|
2466
2686
|
"tefALREADY": -198,
|
|
@@ -2497,6 +2717,7 @@
|
|
|
2497
2717
|
"terQUEUED": -89,
|
|
2498
2718
|
"terPRE_TICKET": -88,
|
|
2499
2719
|
"terNO_AMM": -87,
|
|
2720
|
+
"terSUBMITTED": -86,
|
|
2500
2721
|
|
|
2501
2722
|
"tesSUCCESS": 0,
|
|
2502
2723
|
|
|
@@ -2538,6 +2759,7 @@
|
|
|
2538
2759
|
"tecKILLED": 150,
|
|
2539
2760
|
"tecHAS_OBLIGATIONS": 151,
|
|
2540
2761
|
"tecTOO_SOON": 152,
|
|
2762
|
+
"tecHOOK_ERROR": 153,
|
|
2541
2763
|
"tecMAX_SEQUENCE_REACHED": 154,
|
|
2542
2764
|
"tecNO_SUITABLE_NFTOKEN_PAGE": 155,
|
|
2543
2765
|
"tecNFTOKEN_BUY_SELL_MISMATCH": 156,
|
|
@@ -2553,7 +2775,24 @@
|
|
|
2553
2775
|
"tecAMM_EMPTY": 166,
|
|
2554
2776
|
"tecAMM_NOT_EMPTY": 167,
|
|
2555
2777
|
"tecAMM_ACCOUNT": 168,
|
|
2556
|
-
"tecINCOMPLETE": 169
|
|
2778
|
+
"tecINCOMPLETE": 169,
|
|
2779
|
+
"tecXCHAIN_BAD_TRANSFER_ISSUE": 170,
|
|
2780
|
+
"tecXCHAIN_NO_CLAIM_ID": 171,
|
|
2781
|
+
"tecXCHAIN_BAD_CLAIM_ID": 172,
|
|
2782
|
+
"tecXCHAIN_CLAIM_NO_QUORUM": 173,
|
|
2783
|
+
"tecXCHAIN_PROOF_UNKNOWN_KEY": 174,
|
|
2784
|
+
"tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 175,
|
|
2785
|
+
"tecXCHAIN_WRONG_CHAIN": 176,
|
|
2786
|
+
"tecXCHAIN_REWARD_MISMATCH": 177,
|
|
2787
|
+
"tecXCHAIN_NO_SIGNERS_LIST": 178,
|
|
2788
|
+
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 179,
|
|
2789
|
+
"tecXCHAIN_INSUFF_CREATE_AMOUNT": 180,
|
|
2790
|
+
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
|
|
2791
|
+
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
|
|
2792
|
+
"tecXCHAIN_PAYMENT_FAILED": 183,
|
|
2793
|
+
"tecXCHAIN_SELF_COMMIT": 184,
|
|
2794
|
+
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
|
|
2795
|
+
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186
|
|
2557
2796
|
},
|
|
2558
2797
|
"TRANSACTION_TYPES": {
|
|
2559
2798
|
"Invalid": -1,
|
|
@@ -2592,6 +2831,14 @@
|
|
|
2592
2831
|
"AMMVote": 38,
|
|
2593
2832
|
"AMMBid": 39,
|
|
2594
2833
|
"AMMDelete": 40,
|
|
2834
|
+
"XChainCreateClaimID": 41,
|
|
2835
|
+
"XChainCommit": 42,
|
|
2836
|
+
"XChainClaim": 43,
|
|
2837
|
+
"XChainAccountCreateCommit": 44,
|
|
2838
|
+
"XChainAddClaimAttestation": 45,
|
|
2839
|
+
"XChainAddAccountCreateAttestation": 46,
|
|
2840
|
+
"XChainModifyBridge": 47,
|
|
2841
|
+
"XChainCreateBridge": 48,
|
|
2595
2842
|
"EnableAmendment": 100,
|
|
2596
2843
|
"SetFee": 101,
|
|
2597
2844
|
"UNLModify": 102
|
package/dist/types/index.js
CHANGED
|
@@ -32,6 +32,7 @@ const uint_8_1 = require("./uint-8");
|
|
|
32
32
|
Object.defineProperty(exports, "UInt8", { enumerable: true, get: function () { return uint_8_1.UInt8; } });
|
|
33
33
|
const vector_256_1 = require("./vector-256");
|
|
34
34
|
Object.defineProperty(exports, "Vector256", { enumerable: true, get: function () { return vector_256_1.Vector256; } });
|
|
35
|
+
const xchain_bridge_1 = require("./xchain-bridge");
|
|
35
36
|
const enums_1 = require("../enums");
|
|
36
37
|
const coreTypes = {
|
|
37
38
|
AccountID: account_id_1.AccountID,
|
|
@@ -50,6 +51,7 @@ const coreTypes = {
|
|
|
50
51
|
UInt32: uint_32_1.UInt32,
|
|
51
52
|
UInt64: uint_64_1.UInt64,
|
|
52
53
|
Vector256: vector_256_1.Vector256,
|
|
54
|
+
XChainBridge: xchain_bridge_1.XChainBridge,
|
|
53
55
|
};
|
|
54
56
|
exports.coreTypes = coreTypes;
|
|
55
57
|
// Ensures that the DEFAULT_DEFINITIONS object connects these types to fields for serializing/deserializing
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AA+CtC,0FA/CO,sBAAS,OA+CP;AA9CX,qCAAiC;AA+C/B,uFA/CO,eAAM,OA+CP;AA9CR,iCAA6B;AA+C3B,qFA/CO,WAAI,OA+CP;AA9CN,yCAAqC;AA+CnC,yFA/CO,mBAAQ,OA+CP;AA9CV,yCAAoC;AA+ClC,wFA/CO,kBAAO,OA+CP;AA9CT,yCAAoC;AA+ClC,wFA/CO,kBAAO,OA+CP;AA9CT,yCAAoC;AA+ClC,wFA/CO,kBAAO,OA+CP;AA9CT,mCAA+B;AAC/B,yCAAoC;AA8ClC,wFA9CO,kBAAO,OA8CP;AA7CT,yCAAoC;AA8ClC,wFA9CO,kBAAO,OA8CP;AA7CT,2CAAsC;AA8CpC,yFA9CO,oBAAQ,OA8CP;AA7CV,uCAAkC;AA+ChC,uFA/CO,gBAAM,OA+CP;AA9CR,uCAAkC;AA+ChC,uFA/CO,gBAAM,OA+CP;AA9CR,uCAAkC;AA+ChC,uFA/CO,gBAAM,OA+CP;AA9CR,qCAAgC;AA2C9B,sFA3CO,cAAK,OA2CP;AA1CP,6CAAwC;AA8CtC,0FA9CO,sBAAS,OA8CP;AA7CX,mDAA8C;AAE9C,oCAA8C;AAE9C,MAAM,SAAS,GAA0C;IACvD,SAAS,EAAT,sBAAS;IACT,MAAM,EAAN,eAAM;IACN,IAAI,EAAJ,WAAI;IACJ,QAAQ,EAAR,mBAAQ;IACR,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,KAAK,EAAL,aAAK;IACL,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,QAAQ,EAAR,oBAAQ;IACR,KAAK,EAAL,cAAK;IACL,MAAM,EAAN,gBAAM;IACN,MAAM,EAAN,gBAAM;IACN,MAAM,EAAN,gBAAM;IACN,SAAS,EAAT,sBAAS;IACT,YAAY,EAAZ,4BAAY;CACb,CAAA;AAQC,8BAAS;AANX,2GAA2G;AAC3G,gFAAgF;AAChF,8FAA8F;AAC9F,2BAAmB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA"}
|
|
@@ -24,15 +24,15 @@ declare class XChainBridge extends SerializedType {
|
|
|
24
24
|
/**
|
|
25
25
|
* Construct a cross-chain bridge from a JSON
|
|
26
26
|
*
|
|
27
|
-
* @param value XChainBridge or JSON to parse into
|
|
28
|
-
* @returns
|
|
27
|
+
* @param value XChainBridge or JSON to parse into an XChainBridge
|
|
28
|
+
* @returns An XChainBridge object
|
|
29
29
|
*/
|
|
30
30
|
static from<T extends XChainBridge | XChainBridgeObject>(value: T): XChainBridge;
|
|
31
31
|
/**
|
|
32
|
-
* Read
|
|
32
|
+
* Read an XChainBridge from a BinaryParser
|
|
33
33
|
*
|
|
34
34
|
* @param parser BinaryParser to read the XChainBridge from
|
|
35
|
-
* @returns
|
|
35
|
+
* @returns An XChainBridge object
|
|
36
36
|
*/
|
|
37
37
|
static fromParser(parser: BinaryParser): XChainBridge;
|
|
38
38
|
/**
|
|
@@ -27,8 +27,8 @@ class XChainBridge extends serialized_type_1.SerializedType {
|
|
|
27
27
|
/**
|
|
28
28
|
* Construct a cross-chain bridge from a JSON
|
|
29
29
|
*
|
|
30
|
-
* @param value XChainBridge or JSON to parse into
|
|
31
|
-
* @returns
|
|
30
|
+
* @param value XChainBridge or JSON to parse into an XChainBridge
|
|
31
|
+
* @returns An XChainBridge object
|
|
32
32
|
*/
|
|
33
33
|
static from(value) {
|
|
34
34
|
if (value instanceof XChainBridge) {
|
|
@@ -46,13 +46,13 @@ class XChainBridge extends serialized_type_1.SerializedType {
|
|
|
46
46
|
});
|
|
47
47
|
return new XChainBridge(buffer_1.Buffer.concat(bytes));
|
|
48
48
|
}
|
|
49
|
-
throw new Error('Invalid type to construct
|
|
49
|
+
throw new Error('Invalid type to construct an XChainBridge');
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Read
|
|
52
|
+
* Read an XChainBridge from a BinaryParser
|
|
53
53
|
*
|
|
54
54
|
* @param parser BinaryParser to read the XChainBridge from
|
|
55
|
-
* @returns
|
|
55
|
+
* @returns An XChainBridge object
|
|
56
56
|
*/
|
|
57
57
|
static fromParser(parser) {
|
|
58
58
|
const bytes = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xchain-bridge.js","sourceRoot":"","sources":["../../src/types/xchain-bridge.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AAEtD,6CAAwC;AACxC,uDAA8D;AAC9D,oCAAgC;AAChC,mCAA4C;AAY5C;;GAEG;AACH,SAAS,oBAAoB,CAAC,GAAG;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,IAAI,CAAC,CAAC,CAAC,KAAK,kBAAkB;QAC9B,IAAI,CAAC,CAAC,CAAC,KAAK,mBAAmB;QAC/B,IAAI,CAAC,CAAC,CAAC,KAAK,kBAAkB;QAC9B,IAAI,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAChC,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,YAAa,SAAQ,gCAAc;IAkBvC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,YAAY,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;IACvD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CACT,KAAQ;QAER,IAAI,KAAK,YAAY,YAAY,EAAE;YACjC,OAAO,KAAK,CAAA;SACb;QAED,IAAI,oBAAoB,CAAC,KAAK,CAAC,EAAE;YAC/B,MAAM,KAAK,GAAkB,EAAE,CAAA;YAC/B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC/B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;gBAC3B,IAAI,IAAI,KAAK,sBAAS,EAAE;oBACtB,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;iBAChC;gBACD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;gBACrC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;YAC9B,CAAC,CAAC,CAAA;YACF,OAAO,IAAI,YAAY,CAAC,eAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;SAC9C;QAED,MAAM,IAAI,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"xchain-bridge.js","sourceRoot":"","sources":["../../src/types/xchain-bridge.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripple-binary-codec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "XRP Ledger binary codec",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"buffer": "6.0.3",
|
|
17
17
|
"create-hash": "^1.2.0",
|
|
18
18
|
"decimal.js": "^10.2.0",
|
|
19
|
-
"ripple-address-codec": "^4.3.
|
|
19
|
+
"ripple-address-codec": "^4.3.1"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
|
@@ -38,6 +38,5 @@
|
|
|
38
38
|
"prettier": "@xrplf/prettier-config",
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 10"
|
|
41
|
-
}
|
|
42
|
-
"gitHead": "37fbc03584f4671317576a97ad2cdb3f6c1e1bed"
|
|
41
|
+
}
|
|
43
42
|
}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"UInt384": 22,
|
|
23
23
|
"UInt512": 23,
|
|
24
24
|
"Issue": 24,
|
|
25
|
+
"XChainBridge": 25,
|
|
25
26
|
"Transaction": 10001,
|
|
26
27
|
"LedgerEntry": 10002,
|
|
27
28
|
"Validation": 10003,
|
|
@@ -35,8 +36,11 @@
|
|
|
35
36
|
"Ticket": 84,
|
|
36
37
|
"SignerList": 83,
|
|
37
38
|
"Offer": 111,
|
|
39
|
+
"Bridge": 105,
|
|
38
40
|
"LedgerHashes": 104,
|
|
39
41
|
"Amendments": 102,
|
|
42
|
+
"XChainOwnedClaimID": 113,
|
|
43
|
+
"XChainOwnedCreateAccountClaimID": 116,
|
|
40
44
|
"FeeSettings": 115,
|
|
41
45
|
"Escrow": 117,
|
|
42
46
|
"PayChannel": 120,
|
|
@@ -233,6 +237,16 @@
|
|
|
233
237
|
"type": "UInt8"
|
|
234
238
|
}
|
|
235
239
|
],
|
|
240
|
+
[
|
|
241
|
+
"WasLockingChainSend",
|
|
242
|
+
{
|
|
243
|
+
"nth": 19,
|
|
244
|
+
"isVLEncoded": false,
|
|
245
|
+
"isSerialized": true,
|
|
246
|
+
"isSigningField": true,
|
|
247
|
+
"type": "UInt8"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
236
250
|
[
|
|
237
251
|
"LedgerEntryType",
|
|
238
252
|
{
|
|
@@ -983,6 +997,36 @@
|
|
|
983
997
|
"type": "UInt64"
|
|
984
998
|
}
|
|
985
999
|
],
|
|
1000
|
+
[
|
|
1001
|
+
"XChainClaimID",
|
|
1002
|
+
{
|
|
1003
|
+
"nth": 20,
|
|
1004
|
+
"isVLEncoded": false,
|
|
1005
|
+
"isSerialized": true,
|
|
1006
|
+
"isSigningField": true,
|
|
1007
|
+
"type": "UInt64"
|
|
1008
|
+
}
|
|
1009
|
+
],
|
|
1010
|
+
[
|
|
1011
|
+
"XChainAccountCreateCount",
|
|
1012
|
+
{
|
|
1013
|
+
"nth": 21,
|
|
1014
|
+
"isVLEncoded": false,
|
|
1015
|
+
"isSerialized": true,
|
|
1016
|
+
"isSigningField": true,
|
|
1017
|
+
"type": "UInt64"
|
|
1018
|
+
}
|
|
1019
|
+
],
|
|
1020
|
+
[
|
|
1021
|
+
"XChainAccountClaimCount",
|
|
1022
|
+
{
|
|
1023
|
+
"nth": 22,
|
|
1024
|
+
"isVLEncoded": false,
|
|
1025
|
+
"isSerialized": true,
|
|
1026
|
+
"isSigningField": true,
|
|
1027
|
+
"type": "UInt64"
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
986
1030
|
[
|
|
987
1031
|
"EmailHash",
|
|
988
1032
|
{
|
|
@@ -1583,6 +1627,26 @@
|
|
|
1583
1627
|
"type": "Amount"
|
|
1584
1628
|
}
|
|
1585
1629
|
],
|
|
1630
|
+
[
|
|
1631
|
+
"SignatureReward",
|
|
1632
|
+
{
|
|
1633
|
+
"nth": 29,
|
|
1634
|
+
"isVLEncoded": false,
|
|
1635
|
+
"isSerialized": true,
|
|
1636
|
+
"isSigningField": true,
|
|
1637
|
+
"type": "Amount"
|
|
1638
|
+
}
|
|
1639
|
+
],
|
|
1640
|
+
[
|
|
1641
|
+
"MinAccountCreateAmount",
|
|
1642
|
+
{
|
|
1643
|
+
"nth": 30,
|
|
1644
|
+
"isVLEncoded": false,
|
|
1645
|
+
"isSerialized": true,
|
|
1646
|
+
"isSigningField": true,
|
|
1647
|
+
"type": "Amount"
|
|
1648
|
+
}
|
|
1649
|
+
],
|
|
1586
1650
|
[
|
|
1587
1651
|
"LPTokenBalance",
|
|
1588
1652
|
{
|
|
@@ -1933,6 +1997,66 @@
|
|
|
1933
1997
|
"type": "AccountID"
|
|
1934
1998
|
}
|
|
1935
1999
|
],
|
|
2000
|
+
[
|
|
2001
|
+
"OtherChainSource",
|
|
2002
|
+
{
|
|
2003
|
+
"nth": 18,
|
|
2004
|
+
"isVLEncoded": true,
|
|
2005
|
+
"isSerialized": true,
|
|
2006
|
+
"isSigningField": true,
|
|
2007
|
+
"type": "AccountID"
|
|
2008
|
+
}
|
|
2009
|
+
],
|
|
2010
|
+
[
|
|
2011
|
+
"OtherChainDestination",
|
|
2012
|
+
{
|
|
2013
|
+
"nth": 19,
|
|
2014
|
+
"isVLEncoded": true,
|
|
2015
|
+
"isSerialized": true,
|
|
2016
|
+
"isSigningField": true,
|
|
2017
|
+
"type": "AccountID"
|
|
2018
|
+
}
|
|
2019
|
+
],
|
|
2020
|
+
[
|
|
2021
|
+
"AttestationSignerAccount",
|
|
2022
|
+
{
|
|
2023
|
+
"nth": 20,
|
|
2024
|
+
"isVLEncoded": true,
|
|
2025
|
+
"isSerialized": true,
|
|
2026
|
+
"isSigningField": true,
|
|
2027
|
+
"type": "AccountID"
|
|
2028
|
+
}
|
|
2029
|
+
],
|
|
2030
|
+
[
|
|
2031
|
+
"AttestationRewardAccount",
|
|
2032
|
+
{
|
|
2033
|
+
"nth": 21,
|
|
2034
|
+
"isVLEncoded": true,
|
|
2035
|
+
"isSerialized": true,
|
|
2036
|
+
"isSigningField": true,
|
|
2037
|
+
"type": "AccountID"
|
|
2038
|
+
}
|
|
2039
|
+
],
|
|
2040
|
+
[
|
|
2041
|
+
"LockingChainDoor",
|
|
2042
|
+
{
|
|
2043
|
+
"nth": 22,
|
|
2044
|
+
"isVLEncoded": true,
|
|
2045
|
+
"isSerialized": true,
|
|
2046
|
+
"isSigningField": true,
|
|
2047
|
+
"type": "AccountID"
|
|
2048
|
+
}
|
|
2049
|
+
],
|
|
2050
|
+
[
|
|
2051
|
+
"IssuingChainDoor",
|
|
2052
|
+
{
|
|
2053
|
+
"nth": 23,
|
|
2054
|
+
"isVLEncoded": true,
|
|
2055
|
+
"isSerialized": true,
|
|
2056
|
+
"isSigningField": true,
|
|
2057
|
+
"type": "AccountID"
|
|
2058
|
+
}
|
|
2059
|
+
],
|
|
1936
2060
|
[
|
|
1937
2061
|
"Indexes",
|
|
1938
2062
|
{
|
|
@@ -1983,6 +2107,26 @@
|
|
|
1983
2107
|
"type": "PathSet"
|
|
1984
2108
|
}
|
|
1985
2109
|
],
|
|
2110
|
+
[
|
|
2111
|
+
"LockingChainIssue",
|
|
2112
|
+
{
|
|
2113
|
+
"nth": 1,
|
|
2114
|
+
"isVLEncoded": false,
|
|
2115
|
+
"isSerialized": true,
|
|
2116
|
+
"isSigningField": true,
|
|
2117
|
+
"type": "Issue"
|
|
2118
|
+
}
|
|
2119
|
+
],
|
|
2120
|
+
[
|
|
2121
|
+
"IssuingChainIssue",
|
|
2122
|
+
{
|
|
2123
|
+
"nth": 2,
|
|
2124
|
+
"isVLEncoded": false,
|
|
2125
|
+
"isSerialized": true,
|
|
2126
|
+
"isSigningField": true,
|
|
2127
|
+
"type": "Issue"
|
|
2128
|
+
}
|
|
2129
|
+
],
|
|
1986
2130
|
[
|
|
1987
2131
|
"Asset",
|
|
1988
2132
|
{
|
|
@@ -2003,6 +2147,16 @@
|
|
|
2003
2147
|
"type": "Issue"
|
|
2004
2148
|
}
|
|
2005
2149
|
],
|
|
2150
|
+
[
|
|
2151
|
+
"XChainBridge",
|
|
2152
|
+
{
|
|
2153
|
+
"nth": 1,
|
|
2154
|
+
"isVLEncoded": false,
|
|
2155
|
+
"isSerialized": true,
|
|
2156
|
+
"isSigningField": true,
|
|
2157
|
+
"type": "XChainBridge"
|
|
2158
|
+
}
|
|
2159
|
+
],
|
|
2006
2160
|
[
|
|
2007
2161
|
"TransactionMetaData",
|
|
2008
2162
|
{
|
|
@@ -2243,6 +2397,46 @@
|
|
|
2243
2397
|
"type": "STObject"
|
|
2244
2398
|
}
|
|
2245
2399
|
],
|
|
2400
|
+
[
|
|
2401
|
+
"XChainClaimProofSig",
|
|
2402
|
+
{
|
|
2403
|
+
"nth": 28,
|
|
2404
|
+
"isVLEncoded": false,
|
|
2405
|
+
"isSerialized": true,
|
|
2406
|
+
"isSigningField": true,
|
|
2407
|
+
"type": "STObject"
|
|
2408
|
+
}
|
|
2409
|
+
],
|
|
2410
|
+
[
|
|
2411
|
+
"XChainCreateAccountProofSig",
|
|
2412
|
+
{
|
|
2413
|
+
"nth": 29,
|
|
2414
|
+
"isVLEncoded": false,
|
|
2415
|
+
"isSerialized": true,
|
|
2416
|
+
"isSigningField": true,
|
|
2417
|
+
"type": "STObject"
|
|
2418
|
+
}
|
|
2419
|
+
],
|
|
2420
|
+
[
|
|
2421
|
+
"XChainClaimAttestationCollectionElement",
|
|
2422
|
+
{
|
|
2423
|
+
"nth": 30,
|
|
2424
|
+
"isVLEncoded": false,
|
|
2425
|
+
"isSerialized": true,
|
|
2426
|
+
"isSigningField": true,
|
|
2427
|
+
"type": "STObject"
|
|
2428
|
+
}
|
|
2429
|
+
],
|
|
2430
|
+
[
|
|
2431
|
+
"XChainCreateAccountAttestationCollectionElement",
|
|
2432
|
+
{
|
|
2433
|
+
"nth": 31,
|
|
2434
|
+
"isVLEncoded": false,
|
|
2435
|
+
"isSerialized": true,
|
|
2436
|
+
"isSigningField": true,
|
|
2437
|
+
"type": "STObject"
|
|
2438
|
+
}
|
|
2439
|
+
],
|
|
2246
2440
|
[
|
|
2247
2441
|
"Signers",
|
|
2248
2442
|
{
|
|
@@ -2393,6 +2587,26 @@
|
|
|
2393
2587
|
"type": "STArray"
|
|
2394
2588
|
}
|
|
2395
2589
|
],
|
|
2590
|
+
[
|
|
2591
|
+
"XChainClaimAttestations",
|
|
2592
|
+
{
|
|
2593
|
+
"nth": 21,
|
|
2594
|
+
"isVLEncoded": false,
|
|
2595
|
+
"isSerialized": true,
|
|
2596
|
+
"isSigningField": true,
|
|
2597
|
+
"type": "STArray"
|
|
2598
|
+
}
|
|
2599
|
+
],
|
|
2600
|
+
[
|
|
2601
|
+
"XChainCreateAccountAttestations",
|
|
2602
|
+
{
|
|
2603
|
+
"nth": 22,
|
|
2604
|
+
"isVLEncoded": false,
|
|
2605
|
+
"isSerialized": true,
|
|
2606
|
+
"isSigningField": true,
|
|
2607
|
+
"type": "STArray"
|
|
2608
|
+
}
|
|
2609
|
+
],
|
|
2396
2610
|
[
|
|
2397
2611
|
"AuthAccounts",
|
|
2398
2612
|
{
|
|
@@ -2461,6 +2675,12 @@
|
|
|
2461
2675
|
"temSEQ_AND_TICKET": -263,
|
|
2462
2676
|
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
|
2463
2677
|
"temBAD_AMM_TOKENS": -261,
|
|
2678
|
+
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
|
|
2679
|
+
"temXCHAIN_BAD_PROOF": -259,
|
|
2680
|
+
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
|
|
2681
|
+
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
|
|
2682
|
+
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
|
2683
|
+
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
|
2464
2684
|
|
|
2465
2685
|
"tefFAILURE": -199,
|
|
2466
2686
|
"tefALREADY": -198,
|
|
@@ -2497,6 +2717,7 @@
|
|
|
2497
2717
|
"terQUEUED": -89,
|
|
2498
2718
|
"terPRE_TICKET": -88,
|
|
2499
2719
|
"terNO_AMM": -87,
|
|
2720
|
+
"terSUBMITTED": -86,
|
|
2500
2721
|
|
|
2501
2722
|
"tesSUCCESS": 0,
|
|
2502
2723
|
|
|
@@ -2538,6 +2759,7 @@
|
|
|
2538
2759
|
"tecKILLED": 150,
|
|
2539
2760
|
"tecHAS_OBLIGATIONS": 151,
|
|
2540
2761
|
"tecTOO_SOON": 152,
|
|
2762
|
+
"tecHOOK_ERROR": 153,
|
|
2541
2763
|
"tecMAX_SEQUENCE_REACHED": 154,
|
|
2542
2764
|
"tecNO_SUITABLE_NFTOKEN_PAGE": 155,
|
|
2543
2765
|
"tecNFTOKEN_BUY_SELL_MISMATCH": 156,
|
|
@@ -2553,7 +2775,24 @@
|
|
|
2553
2775
|
"tecAMM_EMPTY": 166,
|
|
2554
2776
|
"tecAMM_NOT_EMPTY": 167,
|
|
2555
2777
|
"tecAMM_ACCOUNT": 168,
|
|
2556
|
-
"tecINCOMPLETE": 169
|
|
2778
|
+
"tecINCOMPLETE": 169,
|
|
2779
|
+
"tecXCHAIN_BAD_TRANSFER_ISSUE": 170,
|
|
2780
|
+
"tecXCHAIN_NO_CLAIM_ID": 171,
|
|
2781
|
+
"tecXCHAIN_BAD_CLAIM_ID": 172,
|
|
2782
|
+
"tecXCHAIN_CLAIM_NO_QUORUM": 173,
|
|
2783
|
+
"tecXCHAIN_PROOF_UNKNOWN_KEY": 174,
|
|
2784
|
+
"tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 175,
|
|
2785
|
+
"tecXCHAIN_WRONG_CHAIN": 176,
|
|
2786
|
+
"tecXCHAIN_REWARD_MISMATCH": 177,
|
|
2787
|
+
"tecXCHAIN_NO_SIGNERS_LIST": 178,
|
|
2788
|
+
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 179,
|
|
2789
|
+
"tecXCHAIN_INSUFF_CREATE_AMOUNT": 180,
|
|
2790
|
+
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
|
|
2791
|
+
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
|
|
2792
|
+
"tecXCHAIN_PAYMENT_FAILED": 183,
|
|
2793
|
+
"tecXCHAIN_SELF_COMMIT": 184,
|
|
2794
|
+
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
|
|
2795
|
+
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186
|
|
2557
2796
|
},
|
|
2558
2797
|
"TRANSACTION_TYPES": {
|
|
2559
2798
|
"Invalid": -1,
|
|
@@ -2592,6 +2831,14 @@
|
|
|
2592
2831
|
"AMMVote": 38,
|
|
2593
2832
|
"AMMBid": 39,
|
|
2594
2833
|
"AMMDelete": 40,
|
|
2834
|
+
"XChainCreateClaimID": 41,
|
|
2835
|
+
"XChainCommit": 42,
|
|
2836
|
+
"XChainClaim": 43,
|
|
2837
|
+
"XChainAccountCreateCommit": 44,
|
|
2838
|
+
"XChainAddClaimAttestation": 45,
|
|
2839
|
+
"XChainAddAccountCreateAttestation": 46,
|
|
2840
|
+
"XChainModifyBridge": 47,
|
|
2841
|
+
"XChainCreateBridge": 48,
|
|
2595
2842
|
"EnableAmendment": 100,
|
|
2596
2843
|
"SetFee": 101,
|
|
2597
2844
|
"UNLModify": 102
|
package/src/types/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { UInt32 } from './uint-32'
|
|
|
14
14
|
import { UInt64 } from './uint-64'
|
|
15
15
|
import { UInt8 } from './uint-8'
|
|
16
16
|
import { Vector256 } from './vector-256'
|
|
17
|
+
import { XChainBridge } from './xchain-bridge'
|
|
17
18
|
import { type SerializedType } from './serialized-type'
|
|
18
19
|
import { DEFAULT_DEFINITIONS } from '../enums'
|
|
19
20
|
|
|
@@ -34,6 +35,7 @@ const coreTypes: Record<string, typeof SerializedType> = {
|
|
|
34
35
|
UInt32,
|
|
35
36
|
UInt64,
|
|
36
37
|
Vector256,
|
|
38
|
+
XChainBridge,
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
// Ensures that the DEFAULT_DEFINITIONS object connects these types to fields for serializing/deserializing
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { BinaryParser } from '../serdes/binary-parser'
|
|
2
|
+
|
|
3
|
+
import { AccountID } from './account-id'
|
|
4
|
+
import { JsonObject, SerializedType } from './serialized-type'
|
|
5
|
+
import { Buffer } from 'buffer/'
|
|
6
|
+
import { Issue, IssueObject } from './issue'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Interface for JSON objects that represent cross-chain bridges
|
|
10
|
+
*/
|
|
11
|
+
interface XChainBridgeObject extends JsonObject {
|
|
12
|
+
LockingChainDoor: string
|
|
13
|
+
LockingChainIssue: IssueObject | string
|
|
14
|
+
IssuingChainDoor: string
|
|
15
|
+
IssuingChainIssue: IssueObject | string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Type guard for XChainBridgeObject
|
|
20
|
+
*/
|
|
21
|
+
function isXChainBridgeObject(arg): arg is XChainBridgeObject {
|
|
22
|
+
const keys = Object.keys(arg).sort()
|
|
23
|
+
return (
|
|
24
|
+
keys.length === 4 &&
|
|
25
|
+
keys[0] === 'IssuingChainDoor' &&
|
|
26
|
+
keys[1] === 'IssuingChainIssue' &&
|
|
27
|
+
keys[2] === 'LockingChainDoor' &&
|
|
28
|
+
keys[3] === 'LockingChainIssue'
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Class for serializing/deserializing XChainBridges
|
|
34
|
+
*/
|
|
35
|
+
class XChainBridge extends SerializedType {
|
|
36
|
+
static readonly ZERO_XCHAIN_BRIDGE: XChainBridge = new XChainBridge(
|
|
37
|
+
Buffer.concat([
|
|
38
|
+
Buffer.from([0x14]),
|
|
39
|
+
Buffer.alloc(40),
|
|
40
|
+
Buffer.from([0x14]),
|
|
41
|
+
Buffer.alloc(40),
|
|
42
|
+
]),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
static readonly TYPE_ORDER: { name: string; type: typeof SerializedType }[] =
|
|
46
|
+
[
|
|
47
|
+
{ name: 'LockingChainDoor', type: AccountID },
|
|
48
|
+
{ name: 'LockingChainIssue', type: Issue },
|
|
49
|
+
{ name: 'IssuingChainDoor', type: AccountID },
|
|
50
|
+
{ name: 'IssuingChainIssue', type: Issue },
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
constructor(bytes: Buffer) {
|
|
54
|
+
super(bytes ?? XChainBridge.ZERO_XCHAIN_BRIDGE.bytes)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Construct a cross-chain bridge from a JSON
|
|
59
|
+
*
|
|
60
|
+
* @param value XChainBridge or JSON to parse into an XChainBridge
|
|
61
|
+
* @returns An XChainBridge object
|
|
62
|
+
*/
|
|
63
|
+
static from<T extends XChainBridge | XChainBridgeObject>(
|
|
64
|
+
value: T,
|
|
65
|
+
): XChainBridge {
|
|
66
|
+
if (value instanceof XChainBridge) {
|
|
67
|
+
return value
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (isXChainBridgeObject(value)) {
|
|
71
|
+
const bytes: Array<Buffer> = []
|
|
72
|
+
this.TYPE_ORDER.forEach((item) => {
|
|
73
|
+
const { name, type } = item
|
|
74
|
+
if (type === AccountID) {
|
|
75
|
+
bytes.push(Buffer.from([0x14]))
|
|
76
|
+
}
|
|
77
|
+
const object = type.from(value[name])
|
|
78
|
+
bytes.push(object.toBytes())
|
|
79
|
+
})
|
|
80
|
+
return new XChainBridge(Buffer.concat(bytes))
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw new Error('Invalid type to construct an XChainBridge')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Read an XChainBridge from a BinaryParser
|
|
88
|
+
*
|
|
89
|
+
* @param parser BinaryParser to read the XChainBridge from
|
|
90
|
+
* @returns An XChainBridge object
|
|
91
|
+
*/
|
|
92
|
+
static fromParser(parser: BinaryParser): XChainBridge {
|
|
93
|
+
const bytes: Array<Buffer> = []
|
|
94
|
+
|
|
95
|
+
this.TYPE_ORDER.forEach((item) => {
|
|
96
|
+
const { type } = item
|
|
97
|
+
if (type === AccountID) {
|
|
98
|
+
parser.skip(1)
|
|
99
|
+
bytes.push(Buffer.from([0x14]))
|
|
100
|
+
}
|
|
101
|
+
const object = type.fromParser(parser)
|
|
102
|
+
bytes.push(object.toBytes())
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
return new XChainBridge(Buffer.concat(bytes))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get the JSON representation of this XChainBridge
|
|
110
|
+
*
|
|
111
|
+
* @returns the JSON interpretation of this.bytes
|
|
112
|
+
*/
|
|
113
|
+
toJSON(): XChainBridgeObject {
|
|
114
|
+
const parser = new BinaryParser(this.toString())
|
|
115
|
+
const json = {}
|
|
116
|
+
XChainBridge.TYPE_ORDER.forEach((item) => {
|
|
117
|
+
const { name, type } = item
|
|
118
|
+
if (type === AccountID) {
|
|
119
|
+
parser.skip(1)
|
|
120
|
+
}
|
|
121
|
+
const object = type.fromParser(parser).toJSON()
|
|
122
|
+
json[name] = object
|
|
123
|
+
})
|
|
124
|
+
return json as XChainBridgeObject
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { XChainBridge, XChainBridgeObject }
|