ripple-binary-codec 1.5.0-beta.0 → 1.5.0-beta.1
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 +306 -0
- package/package.json +2 -2
- package/dist/types/bridge.d.ts +0 -45
- package/dist/types/bridge.js +0 -104
- package/dist/types/bridge.js.map +0 -1
- package/dist/types/sidechain.d.ts +0 -45
- package/dist/types/sidechain.js +0 -104
- package/dist/types/sidechain.js.map +0 -1
- package/dist/types/signature.d.ts +0 -39
- package/dist/types/signature.js +0 -125
- package/dist/types/signature.js.map +0 -1
- package/dist/types/xchain-claim-proof.d.ts +0 -55
- package/dist/types/xchain-claim-proof.js +0 -115
- package/dist/types/xchain-claim-proof.js.map +0 -1
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"NegativeUNL": 78,
|
|
51
51
|
"NFTokenPage": 80,
|
|
52
52
|
"NFTokenOffer": 55,
|
|
53
|
+
"AMM": 121,
|
|
53
54
|
"Any": -3,
|
|
54
55
|
"Child": -2,
|
|
55
56
|
"Nickname": 110,
|
|
@@ -287,6 +288,16 @@
|
|
|
287
288
|
"type": "UInt16"
|
|
288
289
|
}
|
|
289
290
|
],
|
|
291
|
+
[
|
|
292
|
+
"TradingFee",
|
|
293
|
+
{
|
|
294
|
+
"nth": 5,
|
|
295
|
+
"isVLEncoded": false,
|
|
296
|
+
"isSerialized": true,
|
|
297
|
+
"isSigningField": true,
|
|
298
|
+
"type": "UInt16"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
290
301
|
[
|
|
291
302
|
"Version",
|
|
292
303
|
{
|
|
@@ -777,6 +788,46 @@
|
|
|
777
788
|
"type": "UInt32"
|
|
778
789
|
}
|
|
779
790
|
],
|
|
791
|
+
[
|
|
792
|
+
"FeeVal",
|
|
793
|
+
{
|
|
794
|
+
"nth": 47,
|
|
795
|
+
"isVLEncoded": false,
|
|
796
|
+
"isSerialized": true,
|
|
797
|
+
"isSigningField": true,
|
|
798
|
+
"type": "UInt32"
|
|
799
|
+
}
|
|
800
|
+
],
|
|
801
|
+
[
|
|
802
|
+
"VoteWeight",
|
|
803
|
+
{
|
|
804
|
+
"nth": 48,
|
|
805
|
+
"isVLEncoded": false,
|
|
806
|
+
"isSerialized": true,
|
|
807
|
+
"isSigningField": true,
|
|
808
|
+
"type": "UInt32"
|
|
809
|
+
}
|
|
810
|
+
],
|
|
811
|
+
[
|
|
812
|
+
"TimeStamp",
|
|
813
|
+
{
|
|
814
|
+
"nth": 49,
|
|
815
|
+
"isVLEncoded": false,
|
|
816
|
+
"isSerialized": true,
|
|
817
|
+
"isSigningField": true,
|
|
818
|
+
"type": "UInt32"
|
|
819
|
+
}
|
|
820
|
+
],
|
|
821
|
+
[
|
|
822
|
+
"DiscountedFee",
|
|
823
|
+
{
|
|
824
|
+
"nth": 50,
|
|
825
|
+
"isVLEncoded": false,
|
|
826
|
+
"isSerialized": true,
|
|
827
|
+
"isSigningField": true,
|
|
828
|
+
"type": "UInt32"
|
|
829
|
+
}
|
|
830
|
+
],
|
|
780
831
|
[
|
|
781
832
|
"IndexNext",
|
|
782
833
|
{
|
|
@@ -1027,6 +1078,26 @@
|
|
|
1027
1078
|
"type": "Hash160"
|
|
1028
1079
|
}
|
|
1029
1080
|
],
|
|
1081
|
+
[
|
|
1082
|
+
"TokenCurrency",
|
|
1083
|
+
{
|
|
1084
|
+
"nth": 5,
|
|
1085
|
+
"isVLEncoded": false,
|
|
1086
|
+
"isSerialized": true,
|
|
1087
|
+
"isSigningField": true,
|
|
1088
|
+
"type": "Hash160"
|
|
1089
|
+
}
|
|
1090
|
+
],
|
|
1091
|
+
[
|
|
1092
|
+
"TokenIssuer",
|
|
1093
|
+
{
|
|
1094
|
+
"nth": 6,
|
|
1095
|
+
"isVLEncoded": false,
|
|
1096
|
+
"isSerialized": true,
|
|
1097
|
+
"isSigningField": true,
|
|
1098
|
+
"type": "Hash160"
|
|
1099
|
+
}
|
|
1100
|
+
],
|
|
1030
1101
|
[
|
|
1031
1102
|
"LedgerHash",
|
|
1032
1103
|
{
|
|
@@ -1157,6 +1228,16 @@
|
|
|
1157
1228
|
"type": "Hash256"
|
|
1158
1229
|
}
|
|
1159
1230
|
],
|
|
1231
|
+
[
|
|
1232
|
+
"AMMID",
|
|
1233
|
+
{
|
|
1234
|
+
"nth": 14,
|
|
1235
|
+
"isVLEncoded": false,
|
|
1236
|
+
"isSerialized": true,
|
|
1237
|
+
"isSigningField": true,
|
|
1238
|
+
"type": "Hash256"
|
|
1239
|
+
}
|
|
1240
|
+
],
|
|
1160
1241
|
[
|
|
1161
1242
|
"BookDirectory",
|
|
1162
1243
|
{
|
|
@@ -1427,6 +1508,46 @@
|
|
|
1427
1508
|
"type": "Amount"
|
|
1428
1509
|
}
|
|
1429
1510
|
],
|
|
1511
|
+
[
|
|
1512
|
+
"Asset1",
|
|
1513
|
+
{
|
|
1514
|
+
"nth": 11,
|
|
1515
|
+
"isVLEncoded": false,
|
|
1516
|
+
"isSerialized": true,
|
|
1517
|
+
"isSigningField": true,
|
|
1518
|
+
"type": "Amount"
|
|
1519
|
+
}
|
|
1520
|
+
],
|
|
1521
|
+
[
|
|
1522
|
+
"Asset2",
|
|
1523
|
+
{
|
|
1524
|
+
"nth": 12,
|
|
1525
|
+
"isVLEncoded": false,
|
|
1526
|
+
"isSerialized": true,
|
|
1527
|
+
"isSigningField": true,
|
|
1528
|
+
"type": "Amount"
|
|
1529
|
+
}
|
|
1530
|
+
],
|
|
1531
|
+
[
|
|
1532
|
+
"MinSlotPrice",
|
|
1533
|
+
{
|
|
1534
|
+
"nth": 13,
|
|
1535
|
+
"isVLEncoded": false,
|
|
1536
|
+
"isSerialized": true,
|
|
1537
|
+
"isSigningField": true,
|
|
1538
|
+
"type": "Amount"
|
|
1539
|
+
}
|
|
1540
|
+
],
|
|
1541
|
+
[
|
|
1542
|
+
"MaxSlotPrice",
|
|
1543
|
+
{
|
|
1544
|
+
"nth": 14,
|
|
1545
|
+
"isVLEncoded": false,
|
|
1546
|
+
"isSerialized": true,
|
|
1547
|
+
"isSigningField": true,
|
|
1548
|
+
"type": "Amount"
|
|
1549
|
+
}
|
|
1550
|
+
],
|
|
1430
1551
|
[
|
|
1431
1552
|
"MinimumOffer",
|
|
1432
1553
|
{
|
|
@@ -1467,6 +1588,86 @@
|
|
|
1467
1588
|
"type": "Amount"
|
|
1468
1589
|
}
|
|
1469
1590
|
],
|
|
1591
|
+
[
|
|
1592
|
+
"Asset1In",
|
|
1593
|
+
{
|
|
1594
|
+
"nth": 20,
|
|
1595
|
+
"isVLEncoded": false,
|
|
1596
|
+
"isSerialized": true,
|
|
1597
|
+
"isSigningField": true,
|
|
1598
|
+
"type": "Amount"
|
|
1599
|
+
}
|
|
1600
|
+
],
|
|
1601
|
+
[
|
|
1602
|
+
"Asset2In",
|
|
1603
|
+
{
|
|
1604
|
+
"nth": 21,
|
|
1605
|
+
"isVLEncoded": false,
|
|
1606
|
+
"isSerialized": true,
|
|
1607
|
+
"isSigningField": true,
|
|
1608
|
+
"type": "Amount"
|
|
1609
|
+
}
|
|
1610
|
+
],
|
|
1611
|
+
[
|
|
1612
|
+
"Asset1Out",
|
|
1613
|
+
{
|
|
1614
|
+
"nth": 22,
|
|
1615
|
+
"isVLEncoded": false,
|
|
1616
|
+
"isSerialized": true,
|
|
1617
|
+
"isSigningField": true,
|
|
1618
|
+
"type": "Amount"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
[
|
|
1622
|
+
"Asset2Out",
|
|
1623
|
+
{
|
|
1624
|
+
"nth": 23,
|
|
1625
|
+
"isVLEncoded": false,
|
|
1626
|
+
"isSerialized": true,
|
|
1627
|
+
"isSigningField": true,
|
|
1628
|
+
"type": "Amount"
|
|
1629
|
+
}
|
|
1630
|
+
],
|
|
1631
|
+
[
|
|
1632
|
+
"LPToken",
|
|
1633
|
+
{
|
|
1634
|
+
"nth": 24,
|
|
1635
|
+
"isVLEncoded": false,
|
|
1636
|
+
"isSerialized": true,
|
|
1637
|
+
"isSigningField": true,
|
|
1638
|
+
"type": "Amount"
|
|
1639
|
+
}
|
|
1640
|
+
],
|
|
1641
|
+
[
|
|
1642
|
+
"EPrice",
|
|
1643
|
+
{
|
|
1644
|
+
"nth": 25,
|
|
1645
|
+
"isVLEncoded": false,
|
|
1646
|
+
"isSerialized": true,
|
|
1647
|
+
"isSigningField": true,
|
|
1648
|
+
"type": "Amount"
|
|
1649
|
+
}
|
|
1650
|
+
],
|
|
1651
|
+
[
|
|
1652
|
+
"Price",
|
|
1653
|
+
{
|
|
1654
|
+
"nth": 26,
|
|
1655
|
+
"isVLEncoded": false,
|
|
1656
|
+
"isSerialized": true,
|
|
1657
|
+
"isSigningField": true,
|
|
1658
|
+
"type": "Amount"
|
|
1659
|
+
}
|
|
1660
|
+
],
|
|
1661
|
+
[
|
|
1662
|
+
"LPTokenBalance",
|
|
1663
|
+
{
|
|
1664
|
+
"nth": 27,
|
|
1665
|
+
"isVLEncoded": false,
|
|
1666
|
+
"isSerialized": true,
|
|
1667
|
+
"isSigningField": true,
|
|
1668
|
+
"type": "Amount"
|
|
1669
|
+
}
|
|
1670
|
+
],
|
|
1470
1671
|
[
|
|
1471
1672
|
"XChainFee",
|
|
1472
1673
|
{
|
|
@@ -1827,6 +2028,16 @@
|
|
|
1827
2028
|
"type": "AccountID"
|
|
1828
2029
|
}
|
|
1829
2030
|
],
|
|
2031
|
+
[
|
|
2032
|
+
"AMMAccount",
|
|
2033
|
+
{
|
|
2034
|
+
"nth": 11,
|
|
2035
|
+
"isVLEncoded": true,
|
|
2036
|
+
"isSerialized": true,
|
|
2037
|
+
"isSigningField": true,
|
|
2038
|
+
"type": "AccountID"
|
|
2039
|
+
}
|
|
2040
|
+
],
|
|
1830
2041
|
[
|
|
1831
2042
|
"HookAccount",
|
|
1832
2043
|
{
|
|
@@ -2127,6 +2338,16 @@
|
|
|
2127
2338
|
"type": "STObject"
|
|
2128
2339
|
}
|
|
2129
2340
|
],
|
|
2341
|
+
[
|
|
2342
|
+
"AMM",
|
|
2343
|
+
{
|
|
2344
|
+
"nth": 15,
|
|
2345
|
+
"isVLEncoded": false,
|
|
2346
|
+
"isSerialized": true,
|
|
2347
|
+
"isSigningField": true,
|
|
2348
|
+
"type": "STObject"
|
|
2349
|
+
}
|
|
2350
|
+
],
|
|
2130
2351
|
[
|
|
2131
2352
|
"Signer",
|
|
2132
2353
|
{
|
|
@@ -2207,6 +2428,66 @@
|
|
|
2207
2428
|
"type": "STObject"
|
|
2208
2429
|
}
|
|
2209
2430
|
],
|
|
2431
|
+
[
|
|
2432
|
+
"VoteEntry",
|
|
2433
|
+
{
|
|
2434
|
+
"nth": 25,
|
|
2435
|
+
"isVLEncoded": false,
|
|
2436
|
+
"isSerialized": true,
|
|
2437
|
+
"isSigningField": true,
|
|
2438
|
+
"type": "STObject"
|
|
2439
|
+
}
|
|
2440
|
+
],
|
|
2441
|
+
[
|
|
2442
|
+
"AuctionSlot",
|
|
2443
|
+
{
|
|
2444
|
+
"nth": 27,
|
|
2445
|
+
"isVLEncoded": false,
|
|
2446
|
+
"isSerialized": true,
|
|
2447
|
+
"isSigningField": true,
|
|
2448
|
+
"type": "STObject"
|
|
2449
|
+
}
|
|
2450
|
+
],
|
|
2451
|
+
[
|
|
2452
|
+
"AuthAccount",
|
|
2453
|
+
{
|
|
2454
|
+
"nth": 28,
|
|
2455
|
+
"isVLEncoded": false,
|
|
2456
|
+
"isSerialized": true,
|
|
2457
|
+
"isSigningField": true,
|
|
2458
|
+
"type": "STObject"
|
|
2459
|
+
}
|
|
2460
|
+
],
|
|
2461
|
+
[
|
|
2462
|
+
"AMMToken",
|
|
2463
|
+
{
|
|
2464
|
+
"nth": 29,
|
|
2465
|
+
"isVLEncoded": false,
|
|
2466
|
+
"isSerialized": true,
|
|
2467
|
+
"isSigningField": true,
|
|
2468
|
+
"type": "STObject"
|
|
2469
|
+
}
|
|
2470
|
+
],
|
|
2471
|
+
[
|
|
2472
|
+
"Token1",
|
|
2473
|
+
{
|
|
2474
|
+
"nth": 30,
|
|
2475
|
+
"isVLEncoded": false,
|
|
2476
|
+
"isSerialized": true,
|
|
2477
|
+
"isSigningField": true,
|
|
2478
|
+
"type": "STObject"
|
|
2479
|
+
}
|
|
2480
|
+
],
|
|
2481
|
+
[
|
|
2482
|
+
"Token2",
|
|
2483
|
+
{
|
|
2484
|
+
"nth": 31,
|
|
2485
|
+
"isVLEncoded": false,
|
|
2486
|
+
"isSerialized": true,
|
|
2487
|
+
"isSigningField": true,
|
|
2488
|
+
"type": "STObject"
|
|
2489
|
+
}
|
|
2490
|
+
],
|
|
2210
2491
|
[
|
|
2211
2492
|
"XChainClaimProofSig",
|
|
2212
2493
|
{
|
|
@@ -2357,6 +2638,16 @@
|
|
|
2357
2638
|
"type": "STArray"
|
|
2358
2639
|
}
|
|
2359
2640
|
],
|
|
2641
|
+
[
|
|
2642
|
+
"VoteSlots",
|
|
2643
|
+
{
|
|
2644
|
+
"nth": 14,
|
|
2645
|
+
"isVLEncoded": false,
|
|
2646
|
+
"isSerialized": true,
|
|
2647
|
+
"isSigningField": true,
|
|
2648
|
+
"type": "STArray"
|
|
2649
|
+
}
|
|
2650
|
+
],
|
|
2360
2651
|
[
|
|
2361
2652
|
"Majorities",
|
|
2362
2653
|
{
|
|
@@ -2456,6 +2747,16 @@
|
|
|
2456
2747
|
"isSigningField": true,
|
|
2457
2748
|
"type": "STArray"
|
|
2458
2749
|
}
|
|
2750
|
+
],
|
|
2751
|
+
[
|
|
2752
|
+
"AuthAccounts",
|
|
2753
|
+
{
|
|
2754
|
+
"nth": 26,
|
|
2755
|
+
"isVLEncoded": false,
|
|
2756
|
+
"isSerialized": true,
|
|
2757
|
+
"isSigningField": true,
|
|
2758
|
+
"type": "STArray"
|
|
2759
|
+
}
|
|
2459
2760
|
]
|
|
2460
2761
|
],
|
|
2461
2762
|
"TRANSACTION_RESULTS": {
|
|
@@ -2660,6 +2961,11 @@
|
|
|
2660
2961
|
"NFTokenCreateOffer": 27,
|
|
2661
2962
|
"NFTokenCancelOffer": 28,
|
|
2662
2963
|
"NFTokenAcceptOffer": 29,
|
|
2964
|
+
"AMMInstanceCreate": 35,
|
|
2965
|
+
"AMMDeposit": 36,
|
|
2966
|
+
"AMMWithdraw": 37,
|
|
2967
|
+
"AMMVote": 38,
|
|
2968
|
+
"AMMBid": 39,
|
|
2663
2969
|
"XChainCreateBridge": 40,
|
|
2664
2970
|
"XChainCreateClaimID": 41,
|
|
2665
2971
|
"XChainCommit": 42,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripple-binary-codec",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.1",
|
|
4
4
|
"description": "XRP Ledger binary codec",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=10.22.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "2d9e397d4fe14ace18c19f278115651eb239f8fa"
|
|
46
46
|
}
|
package/dist/types/bridge.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { BinaryParser } from '../serdes/binary-parser';
|
|
2
|
-
import { JsonObject, SerializedType } from './serialized-type';
|
|
3
|
-
import { Buffer } from 'buffer/';
|
|
4
|
-
import { IssuedCurrencyObject } from './issued-currency';
|
|
5
|
-
/**
|
|
6
|
-
* Interface for JSON objects that represent bridges
|
|
7
|
-
*/
|
|
8
|
-
interface BridgeObject extends JsonObject {
|
|
9
|
-
dst_chain_door: string;
|
|
10
|
-
dst_chain_issue: IssuedCurrencyObject | string;
|
|
11
|
-
src_chain_door: string;
|
|
12
|
-
src_chain_issue: IssuedCurrencyObject | string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Class for serializing/deserializing Bridges
|
|
16
|
-
*/
|
|
17
|
-
declare class Bridge extends SerializedType {
|
|
18
|
-
static readonly ZERO_Bridge: Bridge;
|
|
19
|
-
static readonly TYPE_ORDER: {
|
|
20
|
-
name: string;
|
|
21
|
-
type: typeof SerializedType;
|
|
22
|
-
}[];
|
|
23
|
-
constructor(bytes: Buffer);
|
|
24
|
-
/**
|
|
25
|
-
* Construct a bridge from a JSON
|
|
26
|
-
*
|
|
27
|
-
* @param value Bridge or JSON to parse into a Bridge
|
|
28
|
-
* @returns A Bridge object
|
|
29
|
-
*/
|
|
30
|
-
static from<T extends Bridge | BridgeObject>(value: T): Bridge;
|
|
31
|
-
/**
|
|
32
|
-
* Read a Bridge from a BinaryParser
|
|
33
|
-
*
|
|
34
|
-
* @param parser BinaryParser to read the Bridge from
|
|
35
|
-
* @returns A Bridge object
|
|
36
|
-
*/
|
|
37
|
-
static fromParser(parser: BinaryParser): Bridge;
|
|
38
|
-
/**
|
|
39
|
-
* Get the JSON representation of this Bridge
|
|
40
|
-
*
|
|
41
|
-
* @returns the JSON interpretation of this.bytes
|
|
42
|
-
*/
|
|
43
|
-
toJSON(): BridgeObject;
|
|
44
|
-
}
|
|
45
|
-
export { Bridge, BridgeObject };
|
package/dist/types/bridge.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Bridge = void 0;
|
|
19
|
-
var binary_parser_1 = require("../serdes/binary-parser");
|
|
20
|
-
var account_id_1 = require("./account-id");
|
|
21
|
-
var serialized_type_1 = require("./serialized-type");
|
|
22
|
-
var buffer_1 = require("buffer/");
|
|
23
|
-
var issued_currency_1 = require("./issued-currency");
|
|
24
|
-
/**
|
|
25
|
-
* Type guard for BridgeObject
|
|
26
|
-
*/
|
|
27
|
-
function isBridgeObject(arg) {
|
|
28
|
-
var keys = Object.keys(arg).sort();
|
|
29
|
-
return (keys.length === 4 &&
|
|
30
|
-
keys[0] === 'dst_chain_door' &&
|
|
31
|
-
keys[1] === 'dst_chain_issue' &&
|
|
32
|
-
keys[2] === 'src_chain_door' &&
|
|
33
|
-
keys[3] === 'src_chain_issue');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Class for serializing/deserializing Bridges
|
|
37
|
-
*/
|
|
38
|
-
var Bridge = /** @class */ (function (_super) {
|
|
39
|
-
__extends(Bridge, _super);
|
|
40
|
-
function Bridge(bytes) {
|
|
41
|
-
return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : Bridge.ZERO_Bridge.bytes) || this;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Construct a bridge from a JSON
|
|
45
|
-
*
|
|
46
|
-
* @param value Bridge or JSON to parse into a Bridge
|
|
47
|
-
* @returns A Bridge object
|
|
48
|
-
*/
|
|
49
|
-
Bridge.from = function (value) {
|
|
50
|
-
if (value instanceof Bridge) {
|
|
51
|
-
return value;
|
|
52
|
-
}
|
|
53
|
-
if (isBridgeObject(value)) {
|
|
54
|
-
var bytes_1 = [];
|
|
55
|
-
this.TYPE_ORDER.forEach(function (item) {
|
|
56
|
-
var name = item.name, type = item.type;
|
|
57
|
-
var object = type.from(value[name]);
|
|
58
|
-
bytes_1.push(object.toBytes());
|
|
59
|
-
});
|
|
60
|
-
return new Bridge(buffer_1.Buffer.concat(bytes_1));
|
|
61
|
-
}
|
|
62
|
-
throw new Error('Invalid type to construct a Bridge');
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Read a Bridge from a BinaryParser
|
|
66
|
-
*
|
|
67
|
-
* @param parser BinaryParser to read the Bridge from
|
|
68
|
-
* @returns A Bridge object
|
|
69
|
-
*/
|
|
70
|
-
Bridge.fromParser = function (parser) {
|
|
71
|
-
var bytes = [];
|
|
72
|
-
this.TYPE_ORDER.forEach(function (item) {
|
|
73
|
-
var type = item.type;
|
|
74
|
-
var object = type.fromParser(parser);
|
|
75
|
-
bytes.push(object.toBytes());
|
|
76
|
-
});
|
|
77
|
-
return new Bridge(buffer_1.Buffer.concat(bytes));
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Get the JSON representation of this Bridge
|
|
81
|
-
*
|
|
82
|
-
* @returns the JSON interpretation of this.bytes
|
|
83
|
-
*/
|
|
84
|
-
Bridge.prototype.toJSON = function () {
|
|
85
|
-
var parser = new binary_parser_1.BinaryParser(this.toString());
|
|
86
|
-
var json = {};
|
|
87
|
-
Bridge.TYPE_ORDER.forEach(function (item) {
|
|
88
|
-
var name = item.name, type = item.type;
|
|
89
|
-
var object = type.fromParser(parser).toJSON();
|
|
90
|
-
json[name] = object;
|
|
91
|
-
});
|
|
92
|
-
return json;
|
|
93
|
-
};
|
|
94
|
-
Bridge.ZERO_Bridge = new Bridge(buffer_1.Buffer.alloc(80));
|
|
95
|
-
Bridge.TYPE_ORDER = [
|
|
96
|
-
{ name: 'src_chain_door', type: account_id_1.AccountID },
|
|
97
|
-
{ name: 'src_chain_issue', type: issued_currency_1.IssuedCurrency },
|
|
98
|
-
{ name: 'dst_chain_door', type: account_id_1.AccountID },
|
|
99
|
-
{ name: 'dst_chain_issue', type: issued_currency_1.IssuedCurrency },
|
|
100
|
-
];
|
|
101
|
-
return Bridge;
|
|
102
|
-
}(serialized_type_1.SerializedType));
|
|
103
|
-
exports.Bridge = Bridge;
|
|
104
|
-
//# sourceMappingURL=bridge.js.map
|
package/dist/types/bridge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/types/bridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD,2CAAwC;AACxC,qDAA8D;AAC9D,kCAAgC;AAChC,qDAAwE;AAYxE;;GAEG;AACH,SAAS,cAAc,CAAC,GAAG;IACzB,IAAM,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,gBAAgB;QAC5B,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB;QAC7B,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB;QAC5B,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAC9B,CAAA;AACH,CAAC;AAED;;GAEG;AACH;IAAqB,0BAAc;IAWjC,gBAAY,KAAa;eACvB,kBAAM,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACI,WAAI,GAAX,UAA6C,KAAQ;QACnD,IAAI,KAAK,YAAY,MAAM,EAAE;YAC3B,OAAO,KAAK,CAAA;SACb;QAED,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;YACzB,IAAM,OAAK,GAAkB,EAAE,CAAA;YAC/B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,IAAI;gBACnB,IAAA,IAAI,GAAW,IAAI,KAAf,EAAE,IAAI,GAAK,IAAI,KAAT,CAAS;gBAC3B,IAAM,MAAM,GAAG,IAAI,CAAC,IAA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,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;IAElD,iBAAU,GACxB;QACE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,sBAAS,EAAE;QAC3C,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,gCAAc,EAAE;QACjD,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,sBAAS,EAAE;QAC3C,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,gCAAc,EAAE;KAClD,CAAA;IA+DL,aAAC;CAAA,AAxED,CAAqB,gCAAc,GAwElC;AAEQ,wBAAM"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { BinaryParser } from '../serdes/binary-parser';
|
|
2
|
-
import { JsonObject, SerializedType } from './serialized-type';
|
|
3
|
-
import { Buffer } from 'buffer/';
|
|
4
|
-
import { IssuedCurrencyObject } from './issued-currency';
|
|
5
|
-
/**
|
|
6
|
-
* Interface for JSON objects that represent sidechains
|
|
7
|
-
*/
|
|
8
|
-
interface SidechainObject extends JsonObject {
|
|
9
|
-
dst_chain_door: string;
|
|
10
|
-
dst_chain_issue: IssuedCurrencyObject | string;
|
|
11
|
-
src_chain_door: string;
|
|
12
|
-
src_chain_issue: IssuedCurrencyObject | string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Class for serializing/deserializing Sidechains
|
|
16
|
-
*/
|
|
17
|
-
declare class Sidechain extends SerializedType {
|
|
18
|
-
static readonly ZERO_SIDECHAIN: Sidechain;
|
|
19
|
-
static readonly TYPE_ORDER: {
|
|
20
|
-
name: string;
|
|
21
|
-
type: typeof SerializedType;
|
|
22
|
-
}[];
|
|
23
|
-
constructor(bytes: Buffer);
|
|
24
|
-
/**
|
|
25
|
-
* Construct a sidechain from a JSON
|
|
26
|
-
*
|
|
27
|
-
* @param value Sidechain or JSON to parse into a Sidechain
|
|
28
|
-
* @returns A Sidechain object
|
|
29
|
-
*/
|
|
30
|
-
static from<T extends Sidechain | SidechainObject>(value: T): Sidechain;
|
|
31
|
-
/**
|
|
32
|
-
* Read a Sidechain from a BinaryParser
|
|
33
|
-
*
|
|
34
|
-
* @param parser BinaryParser to read the Sidechain from
|
|
35
|
-
* @returns A Sidechain object
|
|
36
|
-
*/
|
|
37
|
-
static fromParser(parser: BinaryParser): Sidechain;
|
|
38
|
-
/**
|
|
39
|
-
* Get the JSON representation of this Sidechain
|
|
40
|
-
*
|
|
41
|
-
* @returns the JSON interpretation of this.bytes
|
|
42
|
-
*/
|
|
43
|
-
toJSON(): SidechainObject;
|
|
44
|
-
}
|
|
45
|
-
export { Sidechain, SidechainObject };
|
package/dist/types/sidechain.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Sidechain = void 0;
|
|
19
|
-
var binary_parser_1 = require("../serdes/binary-parser");
|
|
20
|
-
var account_id_1 = require("./account-id");
|
|
21
|
-
var serialized_type_1 = require("./serialized-type");
|
|
22
|
-
var buffer_1 = require("buffer/");
|
|
23
|
-
var issued_currency_1 = require("./issued-currency");
|
|
24
|
-
/**
|
|
25
|
-
* Type guard for SidechainObject
|
|
26
|
-
*/
|
|
27
|
-
function isSidechainObject(arg) {
|
|
28
|
-
var keys = Object.keys(arg).sort();
|
|
29
|
-
return (keys.length === 4 &&
|
|
30
|
-
keys[0] === 'dst_chain_door' &&
|
|
31
|
-
keys[1] === 'dst_chain_issue' &&
|
|
32
|
-
keys[2] === 'src_chain_door' &&
|
|
33
|
-
keys[3] === 'src_chain_issue');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Class for serializing/deserializing Sidechains
|
|
37
|
-
*/
|
|
38
|
-
var Sidechain = /** @class */ (function (_super) {
|
|
39
|
-
__extends(Sidechain, _super);
|
|
40
|
-
function Sidechain(bytes) {
|
|
41
|
-
return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : Sidechain.ZERO_SIDECHAIN.bytes) || this;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Construct a sidechain from a JSON
|
|
45
|
-
*
|
|
46
|
-
* @param value Sidechain or JSON to parse into a Sidechain
|
|
47
|
-
* @returns A Sidechain object
|
|
48
|
-
*/
|
|
49
|
-
Sidechain.from = function (value) {
|
|
50
|
-
if (value instanceof Sidechain) {
|
|
51
|
-
return value;
|
|
52
|
-
}
|
|
53
|
-
if (isSidechainObject(value)) {
|
|
54
|
-
var bytes_1 = [];
|
|
55
|
-
this.TYPE_ORDER.forEach(function (item) {
|
|
56
|
-
var name = item.name, type = item.type;
|
|
57
|
-
var object = type.from(value[name]);
|
|
58
|
-
bytes_1.push(object.toBytes());
|
|
59
|
-
});
|
|
60
|
-
return new Sidechain(buffer_1.Buffer.concat(bytes_1));
|
|
61
|
-
}
|
|
62
|
-
throw new Error('Invalid type to construct a Sidechain');
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Read a Sidechain from a BinaryParser
|
|
66
|
-
*
|
|
67
|
-
* @param parser BinaryParser to read the Sidechain from
|
|
68
|
-
* @returns A Sidechain object
|
|
69
|
-
*/
|
|
70
|
-
Sidechain.fromParser = function (parser) {
|
|
71
|
-
var bytes = [];
|
|
72
|
-
this.TYPE_ORDER.forEach(function (item) {
|
|
73
|
-
var type = item.type;
|
|
74
|
-
var object = type.fromParser(parser);
|
|
75
|
-
bytes.push(object.toBytes());
|
|
76
|
-
});
|
|
77
|
-
return new Sidechain(buffer_1.Buffer.concat(bytes));
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Get the JSON representation of this Sidechain
|
|
81
|
-
*
|
|
82
|
-
* @returns the JSON interpretation of this.bytes
|
|
83
|
-
*/
|
|
84
|
-
Sidechain.prototype.toJSON = function () {
|
|
85
|
-
var parser = new binary_parser_1.BinaryParser(this.toString());
|
|
86
|
-
var json = {};
|
|
87
|
-
Sidechain.TYPE_ORDER.forEach(function (item) {
|
|
88
|
-
var name = item.name, type = item.type;
|
|
89
|
-
var object = type.fromParser(parser).toJSON();
|
|
90
|
-
json[name] = object;
|
|
91
|
-
});
|
|
92
|
-
return json;
|
|
93
|
-
};
|
|
94
|
-
Sidechain.ZERO_SIDECHAIN = new Sidechain(buffer_1.Buffer.alloc(80));
|
|
95
|
-
Sidechain.TYPE_ORDER = [
|
|
96
|
-
{ name: 'src_chain_door', type: account_id_1.AccountID },
|
|
97
|
-
{ name: 'src_chain_issue', type: issued_currency_1.IssuedCurrency },
|
|
98
|
-
{ name: 'dst_chain_door', type: account_id_1.AccountID },
|
|
99
|
-
{ name: 'dst_chain_issue', type: issued_currency_1.IssuedCurrency },
|
|
100
|
-
];
|
|
101
|
-
return Sidechain;
|
|
102
|
-
}(serialized_type_1.SerializedType));
|
|
103
|
-
exports.Sidechain = Sidechain;
|
|
104
|
-
//# sourceMappingURL=sidechain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sidechain.js","sourceRoot":"","sources":["../../src/types/sidechain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD,2CAAwC;A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,IAAI,EAAE,gCAAc,EAAE;KAClD,CAAA;IA+DL,gBAAC;CAAA,AAxED,CAAwB,gCAAc,GAwErC;AAEQ,8BAAS"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { BinaryParser } from '../serdes/binary-parser';
|
|
2
|
-
import { JsonObject, SerializedType } from './serialized-type';
|
|
3
|
-
import { Buffer } from 'buffer/';
|
|
4
|
-
/**
|
|
5
|
-
* Interface for JSON objects that represent amounts
|
|
6
|
-
*/
|
|
7
|
-
interface SignatureObject extends JsonObject {
|
|
8
|
-
signature: string;
|
|
9
|
-
signing_key: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Class for serializing/Deserializing Amounts
|
|
13
|
-
*/
|
|
14
|
-
declare class Signature extends SerializedType {
|
|
15
|
-
static readonly ZERO_SIGNATURE: Signature;
|
|
16
|
-
constructor(bytes: Buffer);
|
|
17
|
-
/**
|
|
18
|
-
* Construct an amount from an IOU or string amount
|
|
19
|
-
*
|
|
20
|
-
* @param value An Amount, object representing an IOU, or a string
|
|
21
|
-
* representing an integer amount
|
|
22
|
-
* @returns An Amount object
|
|
23
|
-
*/
|
|
24
|
-
static from<T extends Signature | SignatureObject>(value: T): Signature;
|
|
25
|
-
/**
|
|
26
|
-
* Read an amount from a BinaryParser
|
|
27
|
-
*
|
|
28
|
-
* @param parser BinaryParser to read the Amount from
|
|
29
|
-
* @returns An Amount object
|
|
30
|
-
*/
|
|
31
|
-
static fromParser(parser: BinaryParser): Signature;
|
|
32
|
-
/**
|
|
33
|
-
* Get the JSON representation of this Amount
|
|
34
|
-
*
|
|
35
|
-
* @returns the JSON interpretation of this.bytes
|
|
36
|
-
*/
|
|
37
|
-
toJSON(): SignatureObject;
|
|
38
|
-
}
|
|
39
|
-
export { Signature, SignatureObject };
|
package/dist/types/signature.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Signature = void 0;
|
|
19
|
-
var binary_parser_1 = require("../serdes/binary-parser");
|
|
20
|
-
var serialized_type_1 = require("./serialized-type");
|
|
21
|
-
var buffer_1 = require("buffer/");
|
|
22
|
-
var blob_1 = require("./blob");
|
|
23
|
-
var ripple_address_codec_1 = require("ripple-address-codec");
|
|
24
|
-
/**
|
|
25
|
-
* Type guard for AmountObject
|
|
26
|
-
*/
|
|
27
|
-
function isSignatureObject(arg) {
|
|
28
|
-
var keys = Object.keys(arg).sort();
|
|
29
|
-
return (keys.length === 2 && keys[0] === 'signature' && keys[1] === 'signing_key');
|
|
30
|
-
}
|
|
31
|
-
function encodeVariableLength(length) {
|
|
32
|
-
var lenBytes = buffer_1.Buffer.alloc(3);
|
|
33
|
-
if (length <= 192) {
|
|
34
|
-
lenBytes[0] = length;
|
|
35
|
-
return lenBytes.slice(0, 1);
|
|
36
|
-
}
|
|
37
|
-
else if (length <= 12480) {
|
|
38
|
-
length -= 193;
|
|
39
|
-
lenBytes[0] = 193 + (length >>> 8);
|
|
40
|
-
lenBytes[1] = length & 0xff;
|
|
41
|
-
return lenBytes.slice(0, 2);
|
|
42
|
-
}
|
|
43
|
-
else if (length <= 918744) {
|
|
44
|
-
length -= 12481;
|
|
45
|
-
lenBytes[0] = 241 + (length >>> 16);
|
|
46
|
-
lenBytes[1] = (length >> 8) & 0xff;
|
|
47
|
-
lenBytes[2] = length & 0xff;
|
|
48
|
-
return lenBytes.slice(0, 3);
|
|
49
|
-
}
|
|
50
|
-
throw new Error('Overflow error');
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Class for serializing/Deserializing Amounts
|
|
54
|
-
*/
|
|
55
|
-
var Signature = /** @class */ (function (_super) {
|
|
56
|
-
__extends(Signature, _super);
|
|
57
|
-
function Signature(bytes) {
|
|
58
|
-
return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : Signature.ZERO_SIGNATURE.bytes) || this;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Construct an amount from an IOU or string amount
|
|
62
|
-
*
|
|
63
|
-
* @param value An Amount, object representing an IOU, or a string
|
|
64
|
-
* representing an integer amount
|
|
65
|
-
* @returns An Amount object
|
|
66
|
-
*/
|
|
67
|
-
Signature.from = function (value) {
|
|
68
|
-
if (value instanceof Signature) {
|
|
69
|
-
return value;
|
|
70
|
-
}
|
|
71
|
-
if (isSignatureObject(value)) {
|
|
72
|
-
var signature = blob_1.Blob.from(value.signature).toBytes();
|
|
73
|
-
var signing_key = new blob_1.Blob(buffer_1.Buffer.from((0, ripple_address_codec_1.decodeAccountPublic)(value.signing_key))).toBytes();
|
|
74
|
-
return new Signature(buffer_1.Buffer.concat([
|
|
75
|
-
encodeVariableLength(signing_key.length),
|
|
76
|
-
signing_key,
|
|
77
|
-
encodeVariableLength(signature.length),
|
|
78
|
-
signature,
|
|
79
|
-
]));
|
|
80
|
-
}
|
|
81
|
-
throw new Error('Invalid type to construct a Signature');
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Read an amount from a BinaryParser
|
|
85
|
-
*
|
|
86
|
-
* @param parser BinaryParser to read the Amount from
|
|
87
|
-
* @returns An Amount object
|
|
88
|
-
*/
|
|
89
|
-
Signature.fromParser = function (parser) {
|
|
90
|
-
var bytes = [];
|
|
91
|
-
console.log(parser.bytes);
|
|
92
|
-
var signatureLength = parser.readVariableLengthLength();
|
|
93
|
-
bytes.push(encodeVariableLength(signatureLength));
|
|
94
|
-
console.log(buffer_1.Buffer.concat(bytes).toString('hex'));
|
|
95
|
-
bytes.push(blob_1.Blob.fromParser(parser, signatureLength).toBytes());
|
|
96
|
-
console.log(buffer_1.Buffer.concat(bytes).toString('hex'));
|
|
97
|
-
var signingKeyLength = parser.readVariableLengthLength();
|
|
98
|
-
bytes.push(encodeVariableLength(signingKeyLength));
|
|
99
|
-
console.log(buffer_1.Buffer.concat(bytes).toString('hex'));
|
|
100
|
-
bytes.push(blob_1.Blob.fromParser(parser, signingKeyLength).toBytes());
|
|
101
|
-
console.log(buffer_1.Buffer.concat(bytes).toString('hex'));
|
|
102
|
-
return new Signature(buffer_1.Buffer.concat(bytes));
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Get the JSON representation of this Amount
|
|
106
|
-
*
|
|
107
|
-
* @returns the JSON interpretation of this.bytes
|
|
108
|
-
*/
|
|
109
|
-
Signature.prototype.toJSON = function () {
|
|
110
|
-
var parser = new binary_parser_1.BinaryParser(this.toString());
|
|
111
|
-
var signingKeyLength = parser.readVariableLengthLength();
|
|
112
|
-
var signingKey = blob_1.Blob.fromParser(parser, signingKeyLength);
|
|
113
|
-
var signatureLength = parser.readVariableLengthLength();
|
|
114
|
-
var signature = blob_1.Blob.fromParser(parser, signatureLength).toJSON();
|
|
115
|
-
return {
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- this is fine, they're both different bytes
|
|
117
|
-
signing_key: (0, ripple_address_codec_1.encodeAccountPublic)(signingKey.toBytes()),
|
|
118
|
-
signature: signature,
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
Signature.ZERO_SIGNATURE = new Signature(buffer_1.Buffer.concat([buffer_1.Buffer.alloc(1), buffer_1.Buffer.from([33]), buffer_1.Buffer.alloc(33)]));
|
|
122
|
-
return Signature;
|
|
123
|
-
}(serialized_type_1.SerializedType));
|
|
124
|
-
exports.Signature = Signature;
|
|
125
|
-
//# sourceMappingURL=signature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/types/signature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD,qDAA8D;AAC9D,kCAAgC;AAChC,+BAA6B;AAC7B,6DAA+E;AAU/E;;GAEG;AACH,SAAS,iBAAiB,CAAC,GAAG;IAC5B,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,aAAa,CAC1E,CAAA;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAc;IAC1C,IAAM,QAAQ,GAAG,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAChC,IAAI,MAAM,IAAI,GAAG,EAAE;QACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;QACpB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5B;SAAM,IAAI,MAAM,IAAI,KAAK,EAAE;QAC1B,MAAM,IAAI,GAAG,CAAA;QACb,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAClC,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAA;QAC3B,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5B;SAAM,IAAI,MAAM,IA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CAAC,QAAQ,EAAE,CAAC,CAAA;QAChD,IAAM,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,EAAE,CAAA;QAC1D,IAAM,UAAU,GAAG,WAAI,CAAC,UAAU,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;QAC5D,IAAM,eAAe,GAAG,MAAM,CAAC,wBAAwB,EAAE,CAAA;QACzD,IAAM,SAAS,GAAG,WAAI,CAAC,UAAU,CAC/B,MAAM,EACN,eAAe,CAChB,CAAC,MAAM,EAAY,CAAA;QAEpB,OAAO;YACL,4GAA4G;YAC5G,WAAW,EAAE,IAAA,0CAAmB,EAAC,UAAU,CAAC,OAAO,EAAS,CAAC;YAC7D,SAAS,WAAA;SACV,CAAA;IACH,CAAC;IAlFe,wBAAc,GAAc,IAAI,SAAS,CACvD,eAAM,CAAC,MAAM,CAAC,CAAC,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,eAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,eAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CACtE,CAAA;IAiFH,gBAAC;CAAA,AApFD,CAAwB,gCAAc,GAoFrC;AAEQ,8BAAS"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { BinaryParser } from '../serdes/binary-parser';
|
|
2
|
-
import { JsonObject, SerializedType } from './serialized-type';
|
|
3
|
-
import { Buffer } from 'buffer/';
|
|
4
|
-
import { SidechainObject } from './sidechain';
|
|
5
|
-
/**
|
|
6
|
-
* Interface for JSON objects that represent signatures
|
|
7
|
-
*/
|
|
8
|
-
interface SignatureObject extends JsonObject {
|
|
9
|
-
XChainProofSig: {
|
|
10
|
-
Signature: string;
|
|
11
|
-
PublicKey: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Interface for JSON objects that represent XChainClaimProofs
|
|
16
|
-
*/
|
|
17
|
-
interface XChainClaimProofObject extends JsonObject {
|
|
18
|
-
amount: string;
|
|
19
|
-
sidechain: SidechainObject;
|
|
20
|
-
signatures: SignatureObject[];
|
|
21
|
-
was_src_chain_send: boolean;
|
|
22
|
-
xchain_seq: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Class for serializing/Deserializing XChainClaimProofs
|
|
26
|
-
*/
|
|
27
|
-
declare class XChainClaimProof extends SerializedType {
|
|
28
|
-
static readonly ZERO_PROOF: XChainClaimProof;
|
|
29
|
-
static readonly TYPE_ORDER: {
|
|
30
|
-
name: string;
|
|
31
|
-
type: typeof SerializedType;
|
|
32
|
-
}[];
|
|
33
|
-
constructor(bytes: Buffer);
|
|
34
|
-
/**
|
|
35
|
-
* Construct a XChainClaimProof from a JSON
|
|
36
|
-
*
|
|
37
|
-
* @param value XChainClaimProof or JSON to parse into an XChainClaimProof
|
|
38
|
-
* @returns A XChainClaimProof object
|
|
39
|
-
*/
|
|
40
|
-
static from<T extends XChainClaimProof | XChainClaimProofObject>(value: T): XChainClaimProof;
|
|
41
|
-
/**
|
|
42
|
-
* Read a XChainClaimProof from a BinaryParser
|
|
43
|
-
*
|
|
44
|
-
* @param parser BinaryParser to read the XChainClaimProof from
|
|
45
|
-
* @returns A XChainClaimProof object
|
|
46
|
-
*/
|
|
47
|
-
static fromParser(parser: BinaryParser): XChainClaimProof;
|
|
48
|
-
/**
|
|
49
|
-
* Get the JSON representation of this XChainClaimProof
|
|
50
|
-
*
|
|
51
|
-
* @returns the JSON interpretation of this.bytes
|
|
52
|
-
*/
|
|
53
|
-
toJSON(): XChainClaimProofObject;
|
|
54
|
-
}
|
|
55
|
-
export { XChainClaimProof, XChainClaimProofObject };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.XChainClaimProof = void 0;
|
|
19
|
-
var binary_parser_1 = require("../serdes/binary-parser");
|
|
20
|
-
var serialized_type_1 = require("./serialized-type");
|
|
21
|
-
var buffer_1 = require("buffer/");
|
|
22
|
-
var sidechain_1 = require("./sidechain");
|
|
23
|
-
var amount_1 = require("./amount");
|
|
24
|
-
var uint_8_1 = require("./uint-8");
|
|
25
|
-
var uint_32_1 = require("./uint-32");
|
|
26
|
-
var st_array_1 = require("./st-array");
|
|
27
|
-
/**
|
|
28
|
-
* Type guard for XChainClaimProofObject
|
|
29
|
-
*/
|
|
30
|
-
function isProofObject(arg) {
|
|
31
|
-
var keys = Object.keys(arg).sort();
|
|
32
|
-
return (keys.length === 5 &&
|
|
33
|
-
keys[0] === 'amount' &&
|
|
34
|
-
keys[1] === 'sidechain' &&
|
|
35
|
-
keys[2] === 'signatures' &&
|
|
36
|
-
keys[3] === 'was_src_chain_send' &&
|
|
37
|
-
keys[4] === 'xchain_seq');
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Class for serializing/Deserializing XChainClaimProofs
|
|
41
|
-
*/
|
|
42
|
-
var XChainClaimProof = /** @class */ (function (_super) {
|
|
43
|
-
__extends(XChainClaimProof, _super);
|
|
44
|
-
function XChainClaimProof(bytes) {
|
|
45
|
-
return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : XChainClaimProof.ZERO_PROOF.bytes) || this;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Construct a XChainClaimProof from a JSON
|
|
49
|
-
*
|
|
50
|
-
* @param value XChainClaimProof or JSON to parse into an XChainClaimProof
|
|
51
|
-
* @returns A XChainClaimProof object
|
|
52
|
-
*/
|
|
53
|
-
XChainClaimProof.from = function (value) {
|
|
54
|
-
if (value instanceof XChainClaimProof) {
|
|
55
|
-
return value;
|
|
56
|
-
}
|
|
57
|
-
if (isProofObject(value)) {
|
|
58
|
-
var bytes_1 = [];
|
|
59
|
-
this.TYPE_ORDER.forEach(function (item) {
|
|
60
|
-
var name = item.name, type = item.type;
|
|
61
|
-
var object = type.from(value[name]);
|
|
62
|
-
bytes_1.push(object.toBytes());
|
|
63
|
-
});
|
|
64
|
-
return new XChainClaimProof(buffer_1.Buffer.concat(bytes_1));
|
|
65
|
-
}
|
|
66
|
-
throw new Error('Invalid type to construct a XChainClaimProof');
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Read a XChainClaimProof from a BinaryParser
|
|
70
|
-
*
|
|
71
|
-
* @param parser BinaryParser to read the XChainClaimProof from
|
|
72
|
-
* @returns A XChainClaimProof object
|
|
73
|
-
*/
|
|
74
|
-
XChainClaimProof.fromParser = function (parser) {
|
|
75
|
-
var bytes = [];
|
|
76
|
-
this.TYPE_ORDER.forEach(function (item) {
|
|
77
|
-
var type = item.type;
|
|
78
|
-
var object = type.fromParser(parser);
|
|
79
|
-
bytes.push(object.toBytes());
|
|
80
|
-
});
|
|
81
|
-
return new XChainClaimProof(buffer_1.Buffer.concat(bytes));
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Get the JSON representation of this XChainClaimProof
|
|
85
|
-
*
|
|
86
|
-
* @returns the JSON interpretation of this.bytes
|
|
87
|
-
*/
|
|
88
|
-
XChainClaimProof.prototype.toJSON = function () {
|
|
89
|
-
var parser = new binary_parser_1.BinaryParser(this.toString());
|
|
90
|
-
var json = {};
|
|
91
|
-
XChainClaimProof.TYPE_ORDER.forEach(function (item) {
|
|
92
|
-
var name = item.name, type = item.type;
|
|
93
|
-
var object = type.fromParser(parser).toJSON();
|
|
94
|
-
json[name] = object;
|
|
95
|
-
});
|
|
96
|
-
json['was_src_chain_send'] = Boolean(json['was_src_chain_send']);
|
|
97
|
-
return json;
|
|
98
|
-
};
|
|
99
|
-
XChainClaimProof.ZERO_PROOF = new XChainClaimProof(buffer_1.Buffer.concat([
|
|
100
|
-
sidechain_1.Sidechain.ZERO_SIDECHAIN.toBytes(),
|
|
101
|
-
amount_1.Amount.defaultAmount.toBytes(),
|
|
102
|
-
uint_32_1.UInt32.defaultUInt32.toBytes(),
|
|
103
|
-
uint_8_1.UInt8.defaultUInt8.toBytes(),
|
|
104
|
-
]));
|
|
105
|
-
XChainClaimProof.TYPE_ORDER = [
|
|
106
|
-
{ name: 'sidechain', type: sidechain_1.Sidechain },
|
|
107
|
-
{ name: 'amount', type: amount_1.Amount },
|
|
108
|
-
{ name: 'xchain_seq', type: uint_32_1.UInt32 },
|
|
109
|
-
{ name: 'was_src_chain_send', type: uint_8_1.UInt8 },
|
|
110
|
-
{ name: 'signatures', type: st_array_1.STArray },
|
|
111
|
-
];
|
|
112
|
-
return XChainClaimProof;
|
|
113
|
-
}(serialized_type_1.SerializedType));
|
|
114
|
-
exports.XChainClaimProof = XChainClaimProof;
|
|
115
|
-
//# sourceMappingURL=xchain-claim-proof.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xchain-claim-proof.js","sourceRoot":"","sources":["../../src/types/xchain-claim-proof.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD,qDAA8D;AAC9D,kCAAgC;AAChC,yCAAwD;AACxD,mCAAiC;AACjC,mCAAgC;AAChC,qCAAkC;AAClC,uCAAoC;AAuBpC;;GAEG;AACH,SAAS,aAAa,CAAC,GAAG;IACxB,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