xrpl 2.9.0 → 2.9.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.
@@ -66713,9 +66713,12 @@ class SerializedType {
66713
66713
  /**
66714
66714
  * Return the JSON representation of a SerializedType
66715
66715
  *
66716
+ * @param _definitions rippled definitions used to parse the values of transaction types and such.
66717
+ * Unused in default, but used in STObject, STArray
66718
+ * Can be customized for sidechains and amendments.
66716
66719
  * @returns any type, if not overloaded returns hexString representation of bytes
66717
66720
  */
66718
- toJSON() {
66721
+ toJSON(_definitions) {
66719
66722
  return this.toHex();
66720
66723
  }
66721
66724
  /**
@@ -66770,6 +66773,7 @@ exports.Comparable = Comparable;
66770
66773
 
66771
66774
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66772
66775
  exports.STArray = void 0;
66776
+ const enums_1 = __webpack_require__(/*! ../enums */ "../../node_modules/ripple-binary-codec/dist/enums/index.js");
66773
66777
  const serialized_type_1 = __webpack_require__(/*! ./serialized-type */ "../../node_modules/ripple-binary-codec/dist/types/serialized-type.js");
66774
66778
  const st_object_1 = __webpack_require__(/*! ./st-object */ "../../node_modules/ripple-binary-codec/dist/types/st-object.js");
66775
66779
  const binary_parser_1 = __webpack_require__(/*! ../serdes/binary-parser */ "../../node_modules/ripple-binary-codec/dist/serdes/binary-parser.js");
@@ -66809,16 +66813,17 @@ class STArray extends serialized_type_1.SerializedType {
66809
66813
  * Construct an STArray from an Array of JSON Objects
66810
66814
  *
66811
66815
  * @param value STArray or Array of Objects to parse into an STArray
66816
+ * @param definitions optional, types and values to use to encode/decode a transaction
66812
66817
  * @returns An STArray object
66813
66818
  */
66814
- static from(value) {
66819
+ static from(value, definitions = enums_1.DEFAULT_DEFINITIONS) {
66815
66820
  if (value instanceof STArray) {
66816
66821
  return value;
66817
66822
  }
66818
66823
  if (isObjects(value)) {
66819
66824
  const bytes = [];
66820
66825
  value.forEach((obj) => {
66821
- bytes.push(st_object_1.STObject.from(obj).toBytes());
66826
+ bytes.push(st_object_1.STObject.from(obj, undefined, definitions).toBytes());
66822
66827
  });
66823
66828
  bytes.push(ARRAY_END_MARKER);
66824
66829
  return new STArray(buffer_1.Buffer.concat(bytes));
@@ -66828,18 +66833,19 @@ class STArray extends serialized_type_1.SerializedType {
66828
66833
  /**
66829
66834
  * Return the JSON representation of this.bytes
66830
66835
  *
66836
+ * @param definitions optional, types and values to use to encode/decode a transaction
66831
66837
  * @returns An Array of JSON objects
66832
66838
  */
66833
- toJSON() {
66839
+ toJSON(definitions = enums_1.DEFAULT_DEFINITIONS) {
66834
66840
  const result = [];
66835
- const arrayParser = new binary_parser_1.BinaryParser(this.toString());
66841
+ const arrayParser = new binary_parser_1.BinaryParser(this.toString(), definitions);
66836
66842
  while (!arrayParser.end()) {
66837
66843
  const field = arrayParser.readField();
66838
66844
  if (field.name === ARRAY_END_MARKER_NAME) {
66839
66845
  break;
66840
66846
  }
66841
66847
  const outer = {};
66842
- outer[field.name] = st_object_1.STObject.fromParser(arrayParser).toJSON();
66848
+ outer[field.name] = st_object_1.STObject.fromParser(arrayParser).toJSON(definitions);
66843
66849
  result.push(outer);
66844
66850
  }
66845
66851
  return result;
@@ -66866,6 +66872,7 @@ const ripple_address_codec_1 = __webpack_require__(/*! ripple-address-codec */ "
66866
66872
  const binary_parser_1 = __webpack_require__(/*! ../serdes/binary-parser */ "../../node_modules/ripple-binary-codec/dist/serdes/binary-parser.js");
66867
66873
  const binary_serializer_1 = __webpack_require__(/*! ../serdes/binary-serializer */ "../../node_modules/ripple-binary-codec/dist/serdes/binary-serializer.js");
66868
66874
  const buffer_1 = __webpack_require__(/*! buffer/ */ "../../node_modules/buffer/index.js");
66875
+ const st_array_1 = __webpack_require__(/*! ./st-array */ "../../node_modules/ripple-binary-codec/dist/types/st-array.js");
66869
66876
  const OBJECT_END_MARKER_BYTE = buffer_1.Buffer.from([0xe1]);
66870
66877
  const OBJECT_END_MARKER = 'ObjectEndMarker';
66871
66878
  const ST_OBJECT = 'STObject';
@@ -66966,7 +66973,11 @@ class STObject extends serialized_type_1.SerializedType {
66966
66973
  sorted = sorted.filter(filter);
66967
66974
  }
66968
66975
  sorted.forEach((field) => {
66969
- const associatedValue = field.associatedType.from(xAddressDecoded[field.name]);
66976
+ const associatedValue = field.type.name === ST_OBJECT
66977
+ ? this.from(xAddressDecoded[field.name], undefined, definitions)
66978
+ : field.type.name === 'STArray'
66979
+ ? st_array_1.STArray.from(xAddressDecoded[field.name], definitions)
66980
+ : field.associatedType.from(xAddressDecoded[field.name]);
66970
66981
  if (associatedValue == undefined) {
66971
66982
  throw new TypeError(`Unable to interpret "${field.name}: ${xAddressDecoded[field.name]}".`);
66972
66983
  }
@@ -66999,7 +67010,9 @@ class STObject extends serialized_type_1.SerializedType {
66999
67010
  if (field.name === OBJECT_END_MARKER) {
67000
67011
  break;
67001
67012
  }
67002
- accumulator[field.name] = objectParser.readFieldValue(field).toJSON();
67013
+ accumulator[field.name] = objectParser
67014
+ .readFieldValue(field)
67015
+ .toJSON(definitions);
67003
67016
  }
67004
67017
  return accumulator;
67005
67018
  }