ripple-binary-codec 1.5.0-beta.2 → 1.6.0-beta.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.
@@ -2099,9 +2099,9 @@
2099
2099
  }
2100
2100
  ],
2101
2101
  [
2102
- "Asset",
2102
+ "IssuingChainIssue",
2103
2103
  {
2104
- "nth": 3,
2104
+ "nth": 2,
2105
2105
  "isVLEncoded": false,
2106
2106
  "isSerialized": true,
2107
2107
  "isSigningField": true,
@@ -2109,9 +2109,9 @@
2109
2109
  }
2110
2110
  ],
2111
2111
  [
2112
- "IssuingChainIssue",
2112
+ "Asset",
2113
2113
  {
2114
- "nth": 2,
2114
+ "nth": 3,
2115
2115
  "isVLEncoded": false,
2116
2116
  "isSerialized": true,
2117
2117
  "isSigningField": true,
@@ -2741,8 +2741,7 @@
2741
2741
  "temUNKNOWN": -264,
2742
2742
  "temSEQ_AND_TICKET": -263,
2743
2743
  "temBAD_NFTOKEN_TRANSFER_FEE": -262,
2744
- "temBAD_AMM_OPTIONS": -261,
2745
- "temBAD_AMM_TOKENS": -260,
2744
+ "temAMM_BAD_TOKENS": -261,
2746
2745
  "temEQUAL_DOOR_ACCOUNTS": -259,
2747
2746
  "temBAD_XCHAIN_PROOF": -258,
2748
2747
  "temSIDECHAIN_BAD_ISSUES": -257,
@@ -2831,14 +2830,13 @@
2831
2830
  "tecINSUFFICIENT_FUNDS": 159,
2832
2831
  "tecOBJECT_NOT_FOUND": 160,
2833
2832
  "tecINSUFFICIENT_PAYMENT": 161,
2834
- "tecUNFUNDED_AMM": 162,
2833
+ "tecAMM_UNFUNDED": 162,
2835
2834
  "tecAMM_BALANCE": 163,
2836
2835
  "tecAMM_FAILED_DEPOSIT": 164,
2837
2836
  "tecAMM_FAILED_WITHDRAW": 165,
2838
2837
  "tecAMM_INVALID_TOKENS": 166,
2839
- "tecAMM_EXISTS": 167,
2840
- "tecAMM_FAILED_BID": 168,
2841
- "tecAMM_FAILED_VOTE": 169,
2838
+ "tecAMM_FAILED_BID": 167,
2839
+ "tecAMM_FAILED_VOTE": 168,
2842
2840
  "tecBAD_XCHAIN_TRANSFER_ISSUE": 171,
2843
2841
  "tecXCHAIN_NO_CLAIM_ID": 172,
2844
2842
  "tecXCHAIN_BAD_CLAIM_ID": 173,
@@ -2099,9 +2099,9 @@
2099
2099
  }
2100
2100
  ],
2101
2101
  [
2102
- "Asset",
2102
+ "IssuingChainIssue",
2103
2103
  {
2104
- "nth": 3,
2104
+ "nth": 2,
2105
2105
  "isVLEncoded": false,
2106
2106
  "isSerialized": true,
2107
2107
  "isSigningField": true,
@@ -2109,9 +2109,9 @@
2109
2109
  }
2110
2110
  ],
2111
2111
  [
2112
- "IssuingChainIssue",
2112
+ "Asset",
2113
2113
  {
2114
- "nth": 2,
2114
+ "nth": 3,
2115
2115
  "isVLEncoded": false,
2116
2116
  "isSerialized": true,
2117
2117
  "isSigningField": true,
@@ -2742,8 +2742,7 @@
2742
2742
  "temUNKNOWN": -264,
2743
2743
  "temSEQ_AND_TICKET": -263,
2744
2744
  "temBAD_NFTOKEN_TRANSFER_FEE": -262,
2745
- "temBAD_AMM_OPTIONS": -261,
2746
- "temBAD_AMM_TOKENS": -260,
2745
+ "temAMM_BAD_TOKENS": -261,
2747
2746
  "temEQUAL_DOOR_ACCOUNTS": -259,
2748
2747
  "temBAD_XCHAIN_PROOF": -258,
2749
2748
  "temSIDECHAIN_BAD_ISSUES": -257,
@@ -2836,14 +2835,13 @@
2836
2835
  "tecINSUFFICIENT_FUNDS": 159,
2837
2836
  "tecOBJECT_NOT_FOUND": 160,
2838
2837
  "tecINSUFFICIENT_PAYMENT": 161,
2839
- "tecUNFUNDED_AMM": 162,
2838
+ "tecAMM_UNFUNDED": 162,
2840
2839
  "tecAMM_BALANCE": 163,
2841
2840
  "tecAMM_FAILED_DEPOSIT": 164,
2842
2841
  "tecAMM_FAILED_WITHDRAW": 165,
2843
2842
  "tecAMM_INVALID_TOKENS": 166,
2844
- "tecAMM_EXISTS": 167,
2845
- "tecAMM_FAILED_BID": 168,
2846
- "tecAMM_FAILED_VOTE": 169,
2843
+ "tecAMM_FAILED_BID": 167,
2844
+ "tecAMM_FAILED_VOTE": 168,
2847
2845
  "tecBAD_XCHAIN_TRANSFER_ISSUE": 171,
2848
2846
  "tecXCHAIN_NO_CLAIM_ID": 172,
2849
2847
  "tecXCHAIN_BAD_CLAIM_ID": 173,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripple-binary-codec",
3
- "version": "1.5.0-beta.2",
3
+ "version": "1.6.0-beta.0",
4
4
  "description": "XRP Ledger binary codec",
5
5
  "files": [
6
6
  "dist/*",
@@ -40,5 +40,5 @@
40
40
  "engines": {
41
41
  "node": ">=10.22.0"
42
42
  },
43
- "gitHead": "f47513b341ed00f1f73e57e04a2d29e123809e75"
43
+ "gitHead": "409bafd29a26e20dc8195f2b723c788332aa4e48"
44
44
  }
@@ -1,46 +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 IssuedCurrencyObject extends JsonObject {
8
- currency: string;
9
- issuer: string;
10
- }
11
- /**
12
- * Class for serializing/Deserializing Amounts
13
- */
14
- declare class IssuedCurrency extends SerializedType {
15
- static readonly ZERO_ISSUED_CURRENCY: IssuedCurrency;
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 IssuedCurrency | IssuedCurrencyObject | string>(value: T): IssuedCurrency;
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): IssuedCurrency;
32
- /**
33
- * Get the JSON representation of this Amount
34
- *
35
- * @returns the JSON interpretation of this.bytes
36
- */
37
- toJSON(): IssuedCurrencyObject | string;
38
- /**
39
- * Validate XRP amount
40
- *
41
- * @param value String representing XRP amount
42
- * @returns void, but will throw if invalid amount
43
- */
44
- private static assertXrpIsValid;
45
- }
46
- export { IssuedCurrency, IssuedCurrencyObject };
@@ -1,108 +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.IssuedCurrency = void 0;
19
- var binary_parser_1 = require("../serdes/binary-parser");
20
- var account_id_1 = require("./account-id");
21
- var currency_1 = require("./currency");
22
- var serialized_type_1 = require("./serialized-type");
23
- var buffer_1 = require("buffer/");
24
- /**
25
- * Type guard for AmountObject
26
- */
27
- function isIssuedCurrencyObject(arg) {
28
- var keys = Object.keys(arg).sort();
29
- return keys.length === 2 && keys[0] === 'currency' && keys[1] === 'issuer';
30
- }
31
- /**
32
- * Class for serializing/Deserializing Amounts
33
- */
34
- var IssuedCurrency = /** @class */ (function (_super) {
35
- __extends(IssuedCurrency, _super);
36
- function IssuedCurrency(bytes) {
37
- return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : IssuedCurrency.ZERO_ISSUED_CURRENCY.bytes) || this;
38
- }
39
- /**
40
- * Construct an amount from an IOU or string amount
41
- *
42
- * @param value An Amount, object representing an IOU, or a string
43
- * representing an integer amount
44
- * @returns An Amount object
45
- */
46
- IssuedCurrency.from = function (value) {
47
- if (value instanceof IssuedCurrency) {
48
- return value;
49
- }
50
- if (typeof value === 'string') {
51
- IssuedCurrency.assertXrpIsValid(value);
52
- var currency = currency_1.Currency.from(value).toBytes();
53
- return new IssuedCurrency(currency);
54
- }
55
- if (isIssuedCurrencyObject(value)) {
56
- var currency = currency_1.Currency.from(value.currency).toBytes();
57
- var issuer = account_id_1.AccountID.from(value.issuer).toBytes();
58
- return new IssuedCurrency(buffer_1.Buffer.concat([currency, issuer]));
59
- }
60
- throw new Error('Invalid type to construct an Amount');
61
- };
62
- /**
63
- * Read an amount from a BinaryParser
64
- *
65
- * @param parser BinaryParser to read the Amount from
66
- * @returns An Amount object
67
- */
68
- IssuedCurrency.fromParser = function (parser) {
69
- var currency = parser.read(20);
70
- if (new currency_1.Currency(currency).toJSON() === 'XRP') {
71
- return new IssuedCurrency(currency);
72
- }
73
- var currencyAndIssuer = [currency, parser.read(20)];
74
- return new IssuedCurrency(buffer_1.Buffer.concat(currencyAndIssuer));
75
- };
76
- /**
77
- * Get the JSON representation of this Amount
78
- *
79
- * @returns the JSON interpretation of this.bytes
80
- */
81
- IssuedCurrency.prototype.toJSON = function () {
82
- var parser = new binary_parser_1.BinaryParser(this.toString());
83
- var currency = currency_1.Currency.fromParser(parser);
84
- if (currency.toJSON() === 'XRP') {
85
- return currency.toJSON();
86
- }
87
- var issuer = account_id_1.AccountID.fromParser(parser);
88
- return {
89
- currency: currency.toJSON(),
90
- issuer: issuer.toJSON(),
91
- };
92
- };
93
- /**
94
- * Validate XRP amount
95
- *
96
- * @param value String representing XRP amount
97
- * @returns void, but will throw if invalid amount
98
- */
99
- IssuedCurrency.assertXrpIsValid = function (value) {
100
- if (value !== 'XRP') {
101
- throw new Error("".concat(value, " is an illegal amount"));
102
- }
103
- };
104
- IssuedCurrency.ZERO_ISSUED_CURRENCY = new IssuedCurrency(buffer_1.Buffer.alloc(20));
105
- return IssuedCurrency;
106
- }(serialized_type_1.SerializedType));
107
- exports.IssuedCurrency = IssuedCurrency;
108
- //# sourceMappingURL=issued-currency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issued-currency.js","sourceRoot":"","sources":["../../src/types/issued-currency.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD,2CAAwC;AACxC,uCAAqC;AACrC,qDAA8D;AAC9D,kCAAgC;AAUhC;;GAEG;AACH,SAAS,sBAAsB,CAAC,GAAG;IACjC,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAA;AAC5E,CAAC;AAED;;GAEG;AACH;IAA6B,kCAAc;IAKzC,wBAAY,KAAa;eACvB,kBAAM,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,cAAc,CAAC,oBAAoB,CAAC,KAAK,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACI,mBAAI,GAAX,UACE,KAAQ;QAER,IAAI,KAAK,YAAY,cAAc,EAAE;YACnC,OAAO,KAAK,CAAA;SACb;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,cAAc,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;YAEtC,IAAM,QAAQ,GAAG,mBAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAA;YAE/C,OAAO,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAA;SACpC;QAED,IAAI,sBAAsB,CAAC,KAAK,CAAC,EAAE;YACjC,IAAM,QAAQ,GAAG,mBAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAA;YACxD,IAAM,MAAM,GAAG,sBAAS,CAAC,IAAI,CAAC,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