koilib 5.1.0 → 5.1.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/koinos.js CHANGED
@@ -10701,7 +10701,11 @@ class Serializer {
10701
10701
  valueBtypeDecoded[name] = valueBtypeEncoded[name].map((itemEncoded) => {
10702
10702
  // custom objects
10703
10703
  if (!nativeTypes.includes(type)) {
10704
- const protoBuf = this.root.lookupType(type);
10704
+ const protoBuf = this.root.lookupTypeOrEnum(type);
10705
+ if (!protoBuf.fields) {
10706
+ // it's an enum
10707
+ return itemEncoded;
10708
+ }
10705
10709
  return this.btypeDecode(itemEncoded, protoBuf);
10706
10710
  }
10707
10711
  // native types
@@ -10711,7 +10715,12 @@ class Serializer {
10711
10715
  }
10712
10716
  // custom objects
10713
10717
  if (!nativeTypes.includes(type)) {
10714
- const protoBuf = this.root.lookupType(type);
10718
+ const protoBuf = this.root.lookupTypeOrEnum(type);
10719
+ if (!protoBuf.fields) {
10720
+ // it's an enum
10721
+ valueBtypeDecoded[name] = valueBtypeEncoded[name];
10722
+ return;
10723
+ }
10715
10724
  valueBtypeDecoded[name] = this.btypeDecode(valueBtypeEncoded[name], protoBuf);
10716
10725
  return;
10717
10726
  }
@@ -10739,7 +10748,11 @@ class Serializer {
10739
10748
  valueBtypeEncoded[name] = valueBtypeDecoded[name].map((itemDecoded) => {
10740
10749
  // custom objects
10741
10750
  if (!nativeTypes.includes(type)) {
10742
- const protoBuf = this.root.lookupType(type);
10751
+ const protoBuf = this.root.lookupTypeOrEnum(type);
10752
+ if (!protoBuf.fields) {
10753
+ // it's an enum
10754
+ return itemDecoded;
10755
+ }
10743
10756
  return this.btypeEncode(itemDecoded, protoBuf);
10744
10757
  }
10745
10758
  // native types
@@ -10749,7 +10762,12 @@ class Serializer {
10749
10762
  }
10750
10763
  // custom objects
10751
10764
  if (!nativeTypes.includes(type)) {
10752
- const protoBuf = this.root.lookupType(type);
10765
+ const protoBuf = this.root.lookupTypeOrEnum(type);
10766
+ if (!protoBuf.fields) {
10767
+ // it's an enum
10768
+ valueBtypeEncoded[name] = valueBtypeDecoded[name];
10769
+ return;
10770
+ }
10753
10771
  valueBtypeEncoded[name] = this.btypeEncode(valueBtypeDecoded[name], protoBuf);
10754
10772
  return;
10755
10773
  }