ripple-binary-codec 2.1.0 → 4.0.0-mpt-beta

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.
@@ -18,7 +18,7 @@
18
18
  "PathSet": 18,
19
19
  "Vector256": 19,
20
20
  "UInt96": 20,
21
- "UInt192": 21,
21
+ "Hash192": 21,
22
22
  "UInt384": 22,
23
23
  "UInt512": 23,
24
24
  "Issue": 24,
@@ -53,6 +53,8 @@
53
53
  "AMM": 121,
54
54
  "DID": 73,
55
55
  "Oracle": 128,
56
+ "MPTokenIssuance": 126,
57
+ "MPToken": 127,
56
58
  "Any": -3,
57
59
  "Child": -2,
58
60
  "Nickname": 110,
@@ -260,6 +262,16 @@
260
262
  "type": "UInt8"
261
263
  }
262
264
  ],
265
+ [
266
+ "AssetScale",
267
+ {
268
+ "nth": 20,
269
+ "isVLEncoded": false,
270
+ "isSerialized": true,
271
+ "isSigningField": true,
272
+ "type": "UInt8"
273
+ }
274
+ ],
263
275
  [
264
276
  "LedgerEntryType",
265
277
  {
@@ -1070,6 +1082,46 @@
1070
1082
  "type": "UInt64"
1071
1083
  }
1072
1084
  ],
1085
+ [
1086
+ "MaximumAmount",
1087
+ {
1088
+ "nth": 24,
1089
+ "isVLEncoded": false,
1090
+ "isSerialized": true,
1091
+ "isSigningField": true,
1092
+ "type": "UInt64"
1093
+ }
1094
+ ],
1095
+ [
1096
+ "OutstandingAmount",
1097
+ {
1098
+ "nth": 25,
1099
+ "isVLEncoded": false,
1100
+ "isSerialized": true,
1101
+ "isSigningField": true,
1102
+ "type": "UInt64"
1103
+ }
1104
+ ],
1105
+ [
1106
+ "LockedAmount",
1107
+ {
1108
+ "nth": 26,
1109
+ "isVLEncoded": false,
1110
+ "isSerialized": true,
1111
+ "isSigningField": true,
1112
+ "type": "UInt64"
1113
+ }
1114
+ ],
1115
+ [
1116
+ "MPTAmount",
1117
+ {
1118
+ "nth": 27,
1119
+ "isVLEncoded": false,
1120
+ "isSerialized": true,
1121
+ "isSigningField": true,
1122
+ "type": "UInt64"
1123
+ }
1124
+ ],
1073
1125
  [
1074
1126
  "EmailHash",
1075
1127
  {
@@ -1120,6 +1172,16 @@
1120
1172
  "type": "Hash160"
1121
1173
  }
1122
1174
  ],
1175
+ [
1176
+ "MPTokenIssuanceID",
1177
+ {
1178
+ "nth": 1,
1179
+ "isVLEncoded": false,
1180
+ "isSerialized": true,
1181
+ "isSigningField": true,
1182
+ "type": "Hash192"
1183
+ }
1184
+ ],
1123
1185
  [
1124
1186
  "LedgerHash",
1125
1187
  {
@@ -1980,6 +2042,16 @@
1980
2042
  "type": "Blob"
1981
2043
  }
1982
2044
  ],
2045
+ [
2046
+ "MPTokenMetadata",
2047
+ {
2048
+ "nth": 30,
2049
+ "isVLEncoded": true,
2050
+ "isSerialized": true,
2051
+ "isSigningField": true,
2052
+ "type": "Blob"
2053
+ }
2054
+ ],
1983
2055
  [
1984
2056
  "Account",
1985
2057
  {
@@ -2070,6 +2142,16 @@
2070
2142
  "type": "AccountID"
2071
2143
  }
2072
2144
  ],
2145
+ [
2146
+ "MPTokenHolder",
2147
+ {
2148
+ "nth": 11,
2149
+ "isVLEncoded": true,
2150
+ "isSerialized": true,
2151
+ "isSigningField": true,
2152
+ "type": "AccountID"
2153
+ }
2154
+ ],
2073
2155
  [
2074
2156
  "HookAccount",
2075
2157
  {
@@ -2797,16 +2879,17 @@
2797
2879
  "temUNKNOWN": -264,
2798
2880
  "temSEQ_AND_TICKET": -263,
2799
2881
  "temBAD_NFTOKEN_TRANSFER_FEE": -262,
2800
- "temBAD_AMM_TOKENS": -261,
2801
- "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
2802
- "temXCHAIN_BAD_PROOF": -259,
2803
- "temXCHAIN_BRIDGE_BAD_ISSUES": -258,
2804
- "temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
2805
- "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
2806
- "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
2807
- "temEMPTY_DID": -254,
2808
- "temARRAY_EMPTY": -253,
2809
- "temARRAY_TOO_LARGE": -252,
2882
+ "temBAD_MPTOKEN_TRANSFER_FEE": -261,
2883
+ "temBAD_AMM_TOKENS": -260,
2884
+ "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -259,
2885
+ "temXCHAIN_BAD_PROOF": -258,
2886
+ "temXCHAIN_BRIDGE_BAD_ISSUES": -257,
2887
+ "temXCHAIN_BRIDGE_NONDOOR_OWNER": -256,
2888
+ "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -255,
2889
+ "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -254,
2890
+ "temEMPTY_DID": -253,
2891
+ "temARRAY_EMPTY": -252,
2892
+ "temARRAY_TOO_LARGE": -251,
2810
2893
  "tefFAILURE": -199,
2811
2894
  "tefALREADY": -198,
2812
2895
  "tefBAD_ADD_AUTH": -197,
@@ -2918,7 +3001,11 @@
2918
3001
  "tecINVALID_UPDATE_TIME": 188,
2919
3002
  "tecTOKEN_PAIR_NOT_FOUND": 189,
2920
3003
  "tecARRAY_EMPTY": 190,
2921
- "tecARRAY_TOO_LARGE": 191
3004
+ "tecARRAY_TOO_LARGE": 191,
3005
+ "tecMPTOKEN_EXISTS": 192,
3006
+ "tecMPT_MAX_AMOUNT_EXCEEDED": 193,
3007
+ "tecMPT_LOCKED": 194,
3008
+ "tecMPT_NOT_SUPPORTED": 195
2922
3009
  },
2923
3010
  "TRANSACTION_TYPES": {
2924
3011
  "Invalid": -1,
@@ -2969,6 +3056,10 @@
2969
3056
  "DIDDelete": 50,
2970
3057
  "OracleSet": 51,
2971
3058
  "OracleDelete": 52,
3059
+ "MPTokenIssuanceCreate": 53,
3060
+ "MPTokenIssuanceDestroy": 54,
3061
+ "MPTokenAuthorize": 55,
3062
+ "MPTokenIssuanceSet": 56,
2972
3063
  "EnableAmendment": 100,
2973
3064
  "SetFee": 101,
2974
3065
  "UNLModify": 102
@@ -18,7 +18,7 @@
18
18
  "PathSet": 18,
19
19
  "Vector256": 19,
20
20
  "UInt96": 20,
21
- "UInt192": 21,
21
+ "Hash192": 21,
22
22
  "UInt384": 22,
23
23
  "UInt512": 23,
24
24
  "Issue": 24,
@@ -53,6 +53,8 @@
53
53
  "AMM": 121,
54
54
  "DID": 73,
55
55
  "Oracle": 128,
56
+ "MPTokenIssuance": 126,
57
+ "MPToken": 127,
56
58
  "Any": -3,
57
59
  "Child": -2,
58
60
  "Nickname": 110,
@@ -260,6 +262,16 @@
260
262
  "type": "UInt8"
261
263
  }
262
264
  ],
265
+ [
266
+ "AssetScale",
267
+ {
268
+ "nth": 20,
269
+ "isVLEncoded": false,
270
+ "isSerialized": true,
271
+ "isSigningField": true,
272
+ "type": "UInt8"
273
+ }
274
+ ],
263
275
  [
264
276
  "LedgerEntryType",
265
277
  {
@@ -1070,6 +1082,46 @@
1070
1082
  "type": "UInt64"
1071
1083
  }
1072
1084
  ],
1085
+ [
1086
+ "MaximumAmount",
1087
+ {
1088
+ "nth": 24,
1089
+ "isVLEncoded": false,
1090
+ "isSerialized": true,
1091
+ "isSigningField": true,
1092
+ "type": "UInt64"
1093
+ }
1094
+ ],
1095
+ [
1096
+ "OutstandingAmount",
1097
+ {
1098
+ "nth": 25,
1099
+ "isVLEncoded": false,
1100
+ "isSerialized": true,
1101
+ "isSigningField": true,
1102
+ "type": "UInt64"
1103
+ }
1104
+ ],
1105
+ [
1106
+ "LockedAmount",
1107
+ {
1108
+ "nth": 26,
1109
+ "isVLEncoded": false,
1110
+ "isSerialized": true,
1111
+ "isSigningField": true,
1112
+ "type": "UInt64"
1113
+ }
1114
+ ],
1115
+ [
1116
+ "MPTAmount",
1117
+ {
1118
+ "nth": 27,
1119
+ "isVLEncoded": false,
1120
+ "isSerialized": true,
1121
+ "isSigningField": true,
1122
+ "type": "UInt64"
1123
+ }
1124
+ ],
1073
1125
  [
1074
1126
  "EmailHash",
1075
1127
  {
@@ -1120,6 +1172,16 @@
1120
1172
  "type": "Hash160"
1121
1173
  }
1122
1174
  ],
1175
+ [
1176
+ "MPTokenIssuanceID",
1177
+ {
1178
+ "nth": 1,
1179
+ "isVLEncoded": false,
1180
+ "isSerialized": true,
1181
+ "isSigningField": true,
1182
+ "type": "Hash192"
1183
+ }
1184
+ ],
1123
1185
  [
1124
1186
  "LedgerHash",
1125
1187
  {
@@ -1980,6 +2042,16 @@
1980
2042
  "type": "Blob"
1981
2043
  }
1982
2044
  ],
2045
+ [
2046
+ "MPTokenMetadata",
2047
+ {
2048
+ "nth": 30,
2049
+ "isVLEncoded": true,
2050
+ "isSerialized": true,
2051
+ "isSigningField": true,
2052
+ "type": "Blob"
2053
+ }
2054
+ ],
1983
2055
  [
1984
2056
  "Account",
1985
2057
  {
@@ -2070,6 +2142,16 @@
2070
2142
  "type": "AccountID"
2071
2143
  }
2072
2144
  ],
2145
+ [
2146
+ "MPTokenHolder",
2147
+ {
2148
+ "nth": 11,
2149
+ "isVLEncoded": true,
2150
+ "isSerialized": true,
2151
+ "isSigningField": true,
2152
+ "type": "AccountID"
2153
+ }
2154
+ ],
2073
2155
  [
2074
2156
  "HookAccount",
2075
2157
  {
@@ -2798,16 +2880,17 @@
2798
2880
  "temUNKNOWN": -264,
2799
2881
  "temSEQ_AND_TICKET": -263,
2800
2882
  "temBAD_NFTOKEN_TRANSFER_FEE": -262,
2801
- "temBAD_AMM_TOKENS": -261,
2802
- "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
2803
- "temXCHAIN_BAD_PROOF": -259,
2804
- "temXCHAIN_BRIDGE_BAD_ISSUES": -258,
2805
- "temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
2806
- "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
2807
- "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
2808
- "temEMPTY_DID": -254,
2809
- "temARRAY_EMPTY": -253,
2810
- "temARRAY_TOO_LARGE": -252,
2883
+ "temBAD_MPTOKEN_TRANSFER_FEE": -261,
2884
+ "temBAD_AMM_TOKENS": -260,
2885
+ "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -259,
2886
+ "temXCHAIN_BAD_PROOF": -258,
2887
+ "temXCHAIN_BRIDGE_BAD_ISSUES": -257,
2888
+ "temXCHAIN_BRIDGE_NONDOOR_OWNER": -256,
2889
+ "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -255,
2890
+ "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -254,
2891
+ "temEMPTY_DID": -253,
2892
+ "temARRAY_EMPTY": -252,
2893
+ "temARRAY_TOO_LARGE": -251,
2811
2894
 
2812
2895
  "tefFAILURE": -199,
2813
2896
  "tefALREADY": -198,
@@ -2923,7 +3006,11 @@
2923
3006
  "tecINVALID_UPDATE_TIME": 188,
2924
3007
  "tecTOKEN_PAIR_NOT_FOUND": 189,
2925
3008
  "tecARRAY_EMPTY": 190,
2926
- "tecARRAY_TOO_LARGE": 191
3009
+ "tecARRAY_TOO_LARGE": 191,
3010
+ "tecMPTOKEN_EXISTS": 192,
3011
+ "tecMPT_MAX_AMOUNT_EXCEEDED": 193,
3012
+ "tecMPT_LOCKED": 194,
3013
+ "tecMPT_NOT_SUPPORTED": 195
2927
3014
  },
2928
3015
  "TRANSACTION_TYPES": {
2929
3016
  "Invalid": -1,
@@ -2974,6 +3061,10 @@
2974
3061
  "DIDDelete": 50,
2975
3062
  "OracleSet": 51,
2976
3063
  "OracleDelete": 52,
3064
+ "MPTokenIssuanceCreate": 53,
3065
+ "MPTokenIssuanceDestroy": 54,
3066
+ "MPTokenAuthorize": 55,
3067
+ "MPTokenIssuanceSet": 56,
2977
3068
  "EnableAmendment": 100,
2978
3069
  "SetFee": 101,
2979
3070
  "UNLModify": 102
@@ -18,7 +18,7 @@
18
18
  "PathSet": 18,
19
19
  "Vector256": 19,
20
20
  "UInt96": 20,
21
- "UInt192": 21,
21
+ "Hash192": 21,
22
22
  "UInt384": 22,
23
23
  "UInt512": 23,
24
24
  "Issue": 24,
@@ -53,6 +53,8 @@
53
53
  "AMM": 121,
54
54
  "DID": 73,
55
55
  "Oracle": 128,
56
+ "MPTokenIssuance": 126,
57
+ "MPToken": 127,
56
58
  "Any": -3,
57
59
  "Child": -2,
58
60
  "Nickname": 110,
@@ -260,6 +262,16 @@
260
262
  "type": "UInt8"
261
263
  }
262
264
  ],
265
+ [
266
+ "AssetScale",
267
+ {
268
+ "nth": 20,
269
+ "isVLEncoded": false,
270
+ "isSerialized": true,
271
+ "isSigningField": true,
272
+ "type": "UInt8"
273
+ }
274
+ ],
263
275
  [
264
276
  "LedgerEntryType",
265
277
  {
@@ -1070,6 +1082,46 @@
1070
1082
  "type": "UInt64"
1071
1083
  }
1072
1084
  ],
1085
+ [
1086
+ "MaximumAmount",
1087
+ {
1088
+ "nth": 24,
1089
+ "isVLEncoded": false,
1090
+ "isSerialized": true,
1091
+ "isSigningField": true,
1092
+ "type": "UInt64"
1093
+ }
1094
+ ],
1095
+ [
1096
+ "OutstandingAmount",
1097
+ {
1098
+ "nth": 25,
1099
+ "isVLEncoded": false,
1100
+ "isSerialized": true,
1101
+ "isSigningField": true,
1102
+ "type": "UInt64"
1103
+ }
1104
+ ],
1105
+ [
1106
+ "LockedAmount",
1107
+ {
1108
+ "nth": 26,
1109
+ "isVLEncoded": false,
1110
+ "isSerialized": true,
1111
+ "isSigningField": true,
1112
+ "type": "UInt64"
1113
+ }
1114
+ ],
1115
+ [
1116
+ "MPTAmount",
1117
+ {
1118
+ "nth": 27,
1119
+ "isVLEncoded": false,
1120
+ "isSerialized": true,
1121
+ "isSigningField": true,
1122
+ "type": "UInt64"
1123
+ }
1124
+ ],
1073
1125
  [
1074
1126
  "EmailHash",
1075
1127
  {
@@ -1120,6 +1172,16 @@
1120
1172
  "type": "Hash160"
1121
1173
  }
1122
1174
  ],
1175
+ [
1176
+ "MPTokenIssuanceID",
1177
+ {
1178
+ "nth": 1,
1179
+ "isVLEncoded": false,
1180
+ "isSerialized": true,
1181
+ "isSigningField": true,
1182
+ "type": "Hash192"
1183
+ }
1184
+ ],
1123
1185
  [
1124
1186
  "LedgerHash",
1125
1187
  {
@@ -1980,6 +2042,16 @@
1980
2042
  "type": "Blob"
1981
2043
  }
1982
2044
  ],
2045
+ [
2046
+ "MPTokenMetadata",
2047
+ {
2048
+ "nth": 30,
2049
+ "isVLEncoded": true,
2050
+ "isSerialized": true,
2051
+ "isSigningField": true,
2052
+ "type": "Blob"
2053
+ }
2054
+ ],
1983
2055
  [
1984
2056
  "Account",
1985
2057
  {
@@ -2070,6 +2142,16 @@
2070
2142
  "type": "AccountID"
2071
2143
  }
2072
2144
  ],
2145
+ [
2146
+ "MPTokenHolder",
2147
+ {
2148
+ "nth": 11,
2149
+ "isVLEncoded": true,
2150
+ "isSerialized": true,
2151
+ "isSigningField": true,
2152
+ "type": "AccountID"
2153
+ }
2154
+ ],
2073
2155
  [
2074
2156
  "HookAccount",
2075
2157
  {
@@ -2797,16 +2879,17 @@
2797
2879
  "temUNKNOWN": -264,
2798
2880
  "temSEQ_AND_TICKET": -263,
2799
2881
  "temBAD_NFTOKEN_TRANSFER_FEE": -262,
2800
- "temBAD_AMM_TOKENS": -261,
2801
- "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
2802
- "temXCHAIN_BAD_PROOF": -259,
2803
- "temXCHAIN_BRIDGE_BAD_ISSUES": -258,
2804
- "temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
2805
- "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
2806
- "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
2807
- "temEMPTY_DID": -254,
2808
- "temARRAY_EMPTY": -253,
2809
- "temARRAY_TOO_LARGE": -252,
2882
+ "temBAD_MPTOKEN_TRANSFER_FEE": -261,
2883
+ "temBAD_AMM_TOKENS": -260,
2884
+ "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -259,
2885
+ "temXCHAIN_BAD_PROOF": -258,
2886
+ "temXCHAIN_BRIDGE_BAD_ISSUES": -257,
2887
+ "temXCHAIN_BRIDGE_NONDOOR_OWNER": -256,
2888
+ "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -255,
2889
+ "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -254,
2890
+ "temEMPTY_DID": -253,
2891
+ "temARRAY_EMPTY": -252,
2892
+ "temARRAY_TOO_LARGE": -251,
2810
2893
  "tefFAILURE": -199,
2811
2894
  "tefALREADY": -198,
2812
2895
  "tefBAD_ADD_AUTH": -197,
@@ -2918,7 +3001,11 @@
2918
3001
  "tecINVALID_UPDATE_TIME": 188,
2919
3002
  "tecTOKEN_PAIR_NOT_FOUND": 189,
2920
3003
  "tecARRAY_EMPTY": 190,
2921
- "tecARRAY_TOO_LARGE": 191
3004
+ "tecARRAY_TOO_LARGE": 191,
3005
+ "tecMPTOKEN_EXISTS": 192,
3006
+ "tecMPT_MAX_AMOUNT_EXCEEDED": 193,
3007
+ "tecMPT_LOCKED": 194,
3008
+ "tecMPT_NOT_SUPPORTED": 195
2922
3009
  },
2923
3010
  "TRANSACTION_TYPES": {
2924
3011
  "Invalid": -1,
@@ -2969,6 +3056,10 @@
2969
3056
  "DIDDelete": 50,
2970
3057
  "OracleSet": 51,
2971
3058
  "OracleDelete": 52,
3059
+ "MPTokenIssuanceCreate": 53,
3060
+ "MPTokenIssuanceDestroy": 54,
3061
+ "MPTokenAuthorize": 55,
3062
+ "MPTokenIssuanceSet": 56,
2972
3063
  "EnableAmendment": 100,
2973
3064
  "SetFee": 101,
2974
3065
  "UNLModify": 102
@@ -1,13 +1,18 @@
1
1
  import { BinaryParser } from '../serdes/binary-parser';
2
2
  import { JsonObject, SerializedType } from './serialized-type';
3
- /**
4
- * Interface for JSON objects that represent amounts
5
- */
6
- interface AmountObject extends JsonObject {
3
+ interface AmountObjectIOU extends JsonObject {
7
4
  value: string;
8
5
  currency: string;
9
6
  issuer: string;
10
7
  }
8
+ interface AmountObjectMPT extends JsonObject {
9
+ value: string;
10
+ mpt_issuance_id: string;
11
+ }
12
+ /**
13
+ * Interface for JSON objects that represent amounts
14
+ */
15
+ type AmountObject = AmountObjectIOU | AmountObjectMPT;
11
16
  /**
12
17
  * Class for serializing/Deserializing Amounts
13
18
  */
@@ -15,7 +20,7 @@ declare class Amount extends SerializedType {
15
20
  static defaultAmount: Amount;
16
21
  constructor(bytes: Uint8Array);
17
22
  /**
18
- * Construct an amount from an IOU or string amount
23
+ * Construct an amount from an IOU, MPT or string amount
19
24
  *
20
25
  * @param value An Amount, object representing an IOU, or a string
21
26
  * representing an integer amount
@@ -49,6 +54,13 @@ declare class Amount extends SerializedType {
49
54
  * @returns void, but will throw if invalid amount
50
55
  */
51
56
  private static assertIouIsValid;
57
+ /**
58
+ * Validate MPT.value amount
59
+ *
60
+ * @param decimal BigNumber object representing MPT.value
61
+ * @returns void, but will throw if invalid amount
62
+ */
63
+ private static assertMptIsValid;
52
64
  /**
53
65
  * Ensure that the value after being multiplied by the exponent does not
54
66
  * contain a decimal.
@@ -63,5 +75,17 @@ declare class Amount extends SerializedType {
63
75
  * @returns true if Native (XRP)
64
76
  */
65
77
  private isNative;
78
+ /**
79
+ * Test if this amount is in units of MPT
80
+ *
81
+ * @returns true if MPT
82
+ */
83
+ private isMPT;
84
+ /**
85
+ * Test if this amount is in units of IOU
86
+ *
87
+ * @returns true if IOU
88
+ */
89
+ private isIOU;
66
90
  }
67
91
  export { Amount, AmountObject };