@hashgraphonline/standards-sdk 0.0.91 → 0.0.93

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.
Files changed (211) hide show
  1. package/dist/es/hcs-10/browser.d.ts.map +1 -1
  2. package/dist/es/hcs-10/registrations.d.ts.map +1 -1
  3. package/dist/es/hcs-10/types.d.ts +20 -54
  4. package/dist/es/hcs-10/types.d.ts.map +1 -1
  5. package/dist/es/standards-sdk.es100.js +16 -13
  6. package/dist/es/standards-sdk.es100.js.map +1 -1
  7. package/dist/es/standards-sdk.es101.js +4 -31
  8. package/dist/es/standards-sdk.es101.js.map +1 -1
  9. package/dist/es/standards-sdk.es102.js +39 -15
  10. package/dist/es/standards-sdk.es102.js.map +1 -1
  11. package/dist/es/standards-sdk.es103.js +40 -4
  12. package/dist/es/standards-sdk.es103.js.map +1 -1
  13. package/dist/es/standards-sdk.es104.js +37 -4
  14. package/dist/es/standards-sdk.es104.js.map +1 -1
  15. package/dist/es/standards-sdk.es105.js +77 -15
  16. package/dist/es/standards-sdk.es105.js.map +1 -1
  17. package/dist/es/standards-sdk.es106.js +7135 -4
  18. package/dist/es/standards-sdk.es106.js.map +1 -1
  19. package/dist/es/standards-sdk.es107.js +3 -39
  20. package/dist/es/standards-sdk.es107.js.map +1 -1
  21. package/dist/es/standards-sdk.es108.js +2 -40
  22. package/dist/es/standards-sdk.es108.js.map +1 -1
  23. package/dist/es/standards-sdk.es109.js +2 -37
  24. package/dist/es/standards-sdk.es109.js.map +1 -1
  25. package/dist/es/standards-sdk.es110.js +31 -75
  26. package/dist/es/standards-sdk.es110.js.map +1 -1
  27. package/dist/es/standards-sdk.es111.js +33 -3
  28. package/dist/es/standards-sdk.es111.js.map +1 -1
  29. package/dist/es/standards-sdk.es112.js +9 -2
  30. package/dist/es/standards-sdk.es112.js.map +1 -1
  31. package/dist/es/standards-sdk.es113.js +34 -2
  32. package/dist/es/standards-sdk.es113.js.map +1 -1
  33. package/dist/es/standards-sdk.es114.js +416 -31
  34. package/dist/es/standards-sdk.es114.js.map +1 -1
  35. package/dist/es/standards-sdk.es115.js +2 -33
  36. package/dist/es/standards-sdk.es115.js.map +1 -1
  37. package/dist/es/standards-sdk.es116.js +120 -9
  38. package/dist/es/standards-sdk.es116.js.map +1 -1
  39. package/dist/es/standards-sdk.es117.js +4 -34
  40. package/dist/es/standards-sdk.es117.js.map +1 -1
  41. package/dist/es/standards-sdk.es13.js +3 -3
  42. package/dist/es/standards-sdk.es18.js +2 -2
  43. package/dist/es/standards-sdk.es19.js +3 -3
  44. package/dist/es/standards-sdk.es22.js +966 -1692
  45. package/dist/es/standards-sdk.es22.js.map +1 -1
  46. package/dist/es/standards-sdk.es23.js +1767 -3
  47. package/dist/es/standards-sdk.es23.js.map +1 -1
  48. package/dist/es/standards-sdk.es24.js +36 -4167
  49. package/dist/es/standards-sdk.es24.js.map +1 -1
  50. package/dist/es/standards-sdk.es25.js +46 -1039
  51. package/dist/es/standards-sdk.es25.js.map +1 -1
  52. package/dist/es/standards-sdk.es26.js +7190 -36
  53. package/dist/es/standards-sdk.es26.js.map +1 -1
  54. package/dist/es/standards-sdk.es27.js +3 -48
  55. package/dist/es/standards-sdk.es27.js.map +1 -1
  56. package/dist/es/standards-sdk.es28.js +2 -7190
  57. package/dist/es/standards-sdk.es28.js.map +1 -1
  58. package/dist/es/standards-sdk.es29.js +4167 -2
  59. package/dist/es/standards-sdk.es29.js.map +1 -1
  60. package/dist/es/standards-sdk.es30.js +2 -2
  61. package/dist/es/standards-sdk.es31.js +2 -419
  62. package/dist/es/standards-sdk.es31.js.map +1 -1
  63. package/dist/es/standards-sdk.es32.js +364 -2
  64. package/dist/es/standards-sdk.es32.js.map +1 -1
  65. package/dist/es/standards-sdk.es33.js +5 -119
  66. package/dist/es/standards-sdk.es33.js.map +1 -1
  67. package/dist/es/standards-sdk.es34.js +179 -2
  68. package/dist/es/standards-sdk.es34.js.map +1 -1
  69. package/dist/es/standards-sdk.es35.js +74 -188
  70. package/dist/es/standards-sdk.es35.js.map +1 -1
  71. package/dist/es/standards-sdk.es36.js +99 -423
  72. package/dist/es/standards-sdk.es36.js.map +1 -1
  73. package/dist/es/standards-sdk.es37.js +47 -20
  74. package/dist/es/standards-sdk.es37.js.map +1 -1
  75. package/dist/es/standards-sdk.es38.js +9 -138
  76. package/dist/es/standards-sdk.es38.js.map +1 -1
  77. package/dist/es/standards-sdk.es39.js +92 -13
  78. package/dist/es/standards-sdk.es39.js.map +1 -1
  79. package/dist/es/standards-sdk.es4.js +1 -1
  80. package/dist/es/standards-sdk.es40.js +3 -28
  81. package/dist/es/standards-sdk.es40.js.map +1 -1
  82. package/dist/es/standards-sdk.es41.js +2 -29
  83. package/dist/es/standards-sdk.es41.js.map +1 -1
  84. package/dist/es/standards-sdk.es42.js +107 -15
  85. package/dist/es/standards-sdk.es42.js.map +1 -1
  86. package/dist/es/standards-sdk.es43.js +71 -41
  87. package/dist/es/standards-sdk.es43.js.map +1 -1
  88. package/dist/es/standards-sdk.es44.js +5 -17
  89. package/dist/es/standards-sdk.es44.js.map +1 -1
  90. package/dist/es/standards-sdk.es45.js +4 -60
  91. package/dist/es/standards-sdk.es45.js.map +1 -1
  92. package/dist/es/standards-sdk.es46.js +191 -1259
  93. package/dist/es/standards-sdk.es46.js.map +1 -1
  94. package/dist/es/standards-sdk.es47.js +52 -142
  95. package/dist/es/standards-sdk.es47.js.map +1 -1
  96. package/dist/es/standards-sdk.es48.js +69 -91
  97. package/dist/es/standards-sdk.es48.js.map +1 -1
  98. package/dist/es/standards-sdk.es49.js +3 -3
  99. package/dist/es/standards-sdk.es5.js +3 -3
  100. package/dist/es/standards-sdk.es50.js +21 -30
  101. package/dist/es/standards-sdk.es50.js.map +1 -1
  102. package/dist/es/standards-sdk.es51.js +147 -5
  103. package/dist/es/standards-sdk.es51.js.map +1 -1
  104. package/dist/es/standards-sdk.es52.js +76 -144
  105. package/dist/es/standards-sdk.es52.js.map +1 -1
  106. package/dist/es/standards-sdk.es53.js +190 -18
  107. package/dist/es/standards-sdk.es53.js.map +1 -1
  108. package/dist/es/standards-sdk.es54.js +394 -749
  109. package/dist/es/standards-sdk.es54.js.map +1 -1
  110. package/dist/es/standards-sdk.es55.js +21 -170
  111. package/dist/es/standards-sdk.es55.js.map +1 -1
  112. package/dist/es/standards-sdk.es56.js +125 -129
  113. package/dist/es/standards-sdk.es56.js.map +1 -1
  114. package/dist/es/standards-sdk.es57.js +17 -3
  115. package/dist/es/standards-sdk.es57.js.map +1 -1
  116. package/dist/es/standards-sdk.es58.js +21 -13
  117. package/dist/es/standards-sdk.es58.js.map +1 -1
  118. package/dist/es/standards-sdk.es59.js +27 -25
  119. package/dist/es/standards-sdk.es59.js.map +1 -1
  120. package/dist/es/standards-sdk.es60.js +19 -24
  121. package/dist/es/standards-sdk.es60.js.map +1 -1
  122. package/dist/es/standards-sdk.es61.js +42 -36
  123. package/dist/es/standards-sdk.es61.js.map +1 -1
  124. package/dist/es/standards-sdk.es62.js +17 -100
  125. package/dist/es/standards-sdk.es62.js.map +1 -1
  126. package/dist/es/standards-sdk.es63.js +61 -2
  127. package/dist/es/standards-sdk.es63.js.map +1 -1
  128. package/dist/es/standards-sdk.es64.js +1288 -15
  129. package/dist/es/standards-sdk.es64.js.map +1 -1
  130. package/dist/es/standards-sdk.es65.js +26 -403
  131. package/dist/es/standards-sdk.es65.js.map +1 -1
  132. package/dist/es/standards-sdk.es66.js +6 -2282
  133. package/dist/es/standards-sdk.es66.js.map +1 -1
  134. package/dist/es/standards-sdk.es67.js +143 -148
  135. package/dist/es/standards-sdk.es67.js.map +1 -1
  136. package/dist/es/standards-sdk.es68.js +793 -3
  137. package/dist/es/standards-sdk.es68.js.map +1 -1
  138. package/dist/es/standards-sdk.es69.js +125 -346
  139. package/dist/es/standards-sdk.es69.js.map +1 -1
  140. package/dist/es/standards-sdk.es7.js +3 -3
  141. package/dist/es/standards-sdk.es70.js +173 -5
  142. package/dist/es/standards-sdk.es70.js.map +1 -1
  143. package/dist/es/standards-sdk.es71.js +3 -179
  144. package/dist/es/standards-sdk.es71.js.map +1 -1
  145. package/dist/es/standards-sdk.es72.js +153 -70
  146. package/dist/es/standards-sdk.es72.js.map +1 -1
  147. package/dist/es/standards-sdk.es73.js +29 -111
  148. package/dist/es/standards-sdk.es73.js.map +1 -1
  149. package/dist/es/standards-sdk.es74.js +56 -45
  150. package/dist/es/standards-sdk.es74.js.map +1 -1
  151. package/dist/es/standards-sdk.es75.js +49 -9
  152. package/dist/es/standards-sdk.es75.js.map +1 -1
  153. package/dist/es/standards-sdk.es76.js +9 -96
  154. package/dist/es/standards-sdk.es76.js.map +1 -1
  155. package/dist/es/standards-sdk.es77.js +64 -3
  156. package/dist/es/standards-sdk.es77.js.map +1 -1
  157. package/dist/es/standards-sdk.es78.js +6 -2
  158. package/dist/es/standards-sdk.es78.js.map +1 -1
  159. package/dist/es/standards-sdk.es79.js +11 -109
  160. package/dist/es/standards-sdk.es79.js.map +1 -1
  161. package/dist/es/standards-sdk.es8.js +3 -3
  162. package/dist/es/standards-sdk.es8.js.map +1 -1
  163. package/dist/es/standards-sdk.es80.js +6 -73
  164. package/dist/es/standards-sdk.es80.js.map +1 -1
  165. package/dist/es/standards-sdk.es81.js +45 -6
  166. package/dist/es/standards-sdk.es81.js.map +1 -1
  167. package/dist/es/standards-sdk.es82.js +2 -5
  168. package/dist/es/standards-sdk.es82.js.map +1 -1
  169. package/dist/es/standards-sdk.es83.js +122 -207
  170. package/dist/es/standards-sdk.es83.js.map +1 -1
  171. package/dist/es/standards-sdk.es84.js +163 -49
  172. package/dist/es/standards-sdk.es84.js.map +1 -1
  173. package/dist/es/standards-sdk.es85.js +101 -69
  174. package/dist/es/standards-sdk.es85.js.map +1 -1
  175. package/dist/es/standards-sdk.es86.js +2 -7136
  176. package/dist/es/standards-sdk.es86.js.map +1 -1
  177. package/dist/es/standards-sdk.es87.js +15 -31
  178. package/dist/es/standards-sdk.es87.js.map +1 -1
  179. package/dist/es/standards-sdk.es88.js +403 -57
  180. package/dist/es/standards-sdk.es88.js.map +1 -1
  181. package/dist/es/standards-sdk.es89.js +17 -46
  182. package/dist/es/standards-sdk.es89.js.map +1 -1
  183. package/dist/es/standards-sdk.es9.js +4 -2
  184. package/dist/es/standards-sdk.es9.js.map +1 -1
  185. package/dist/es/standards-sdk.es90.js +25 -8
  186. package/dist/es/standards-sdk.es90.js.map +1 -1
  187. package/dist/es/standards-sdk.es91.js +24 -63
  188. package/dist/es/standards-sdk.es91.js.map +1 -1
  189. package/dist/es/standards-sdk.es92.js +38 -6
  190. package/dist/es/standards-sdk.es92.js.map +1 -1
  191. package/dist/es/standards-sdk.es93.js +13 -15
  192. package/dist/es/standards-sdk.es93.js.map +1 -1
  193. package/dist/es/standards-sdk.es94.js +13 -7
  194. package/dist/es/standards-sdk.es94.js.map +1 -1
  195. package/dist/es/standards-sdk.es95.js +30 -43
  196. package/dist/es/standards-sdk.es95.js.map +1 -1
  197. package/dist/es/standards-sdk.es96.js +15 -2
  198. package/dist/es/standards-sdk.es96.js.map +1 -1
  199. package/dist/es/standards-sdk.es97.js +4 -136
  200. package/dist/es/standards-sdk.es97.js.map +1 -1
  201. package/dist/es/standards-sdk.es98.js +4 -172
  202. package/dist/es/standards-sdk.es98.js.map +1 -1
  203. package/dist/es/standards-sdk.es99.js +2281 -12
  204. package/dist/es/standards-sdk.es99.js.map +1 -1
  205. package/dist/umd/hcs-10/browser.d.ts.map +1 -1
  206. package/dist/umd/hcs-10/registrations.d.ts.map +1 -1
  207. package/dist/umd/hcs-10/types.d.ts +20 -54
  208. package/dist/umd/hcs-10/types.d.ts.map +1 -1
  209. package/dist/umd/standards-sdk.umd.js +1 -1
  210. package/dist/umd/standards-sdk.umd.js.map +1 -1
  211. package/package.json +1 -1
@@ -8,789 +8,434 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
8
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var _options;
12
- import { assertPrivate } from "./standards-sdk.es47.js";
13
- import { defineProperties } from "./standards-sdk.es50.js";
14
- const _gaurd = {};
15
- function n(value, width) {
16
- let signed = false;
17
- if (width < 0) {
18
- signed = true;
19
- width *= -1;
20
- }
21
- return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width });
11
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
+ var _names, _data, _dataLength, _Writer_instances, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _Reader_instances, incrementBytesRead_fn, peekBytes_fn;
13
+ import { getNumber, toBigInt, toNumber, toBeArray } from "./standards-sdk.es67.js";
14
+ import { assert, assertArgument } from "./standards-sdk.es51.js";
15
+ import { concat, getBytesCopy, hexlify } from "./standards-sdk.es52.js";
16
+ import { defineProperties } from "./standards-sdk.es65.js";
17
+ const WordSize = 32;
18
+ const Padding = new Uint8Array(WordSize);
19
+ const passProperties = ["then"];
20
+ const _guard = {};
21
+ const resultNames = /* @__PURE__ */ new WeakMap();
22
+ function getNames(result) {
23
+ return resultNames.get(result);
22
24
  }
23
- function b(value, size) {
24
- return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size });
25
+ function setNames(result, names) {
26
+ resultNames.set(result, names);
25
27
  }
26
- const _typedSymbol = Symbol.for("_ethers_typed");
27
- const _Typed = class _Typed {
28
- /**
29
- * @_ignore:
30
- */
31
- constructor(gaurd, type, value, options) {
32
- /**
33
- * The type, as a Solidity-compatible type.
34
- */
35
- __publicField(this, "type");
36
- /**
37
- * The actual value.
38
- */
39
- __publicField(this, "value");
40
- __privateAdd(this, _options);
41
- /**
42
- * @_ignore:
43
- */
44
- __publicField(this, "_typedSymbol");
45
- if (options == null) {
46
- options = null;
28
+ function throwError(name, error) {
29
+ const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);
30
+ wrapped.error = error;
31
+ throw wrapped;
32
+ }
33
+ function toObject(names, items, deep) {
34
+ if (names.indexOf(null) >= 0) {
35
+ return items.map((item, index) => {
36
+ if (item instanceof Result) {
37
+ return toObject(getNames(item), item, deep);
38
+ }
39
+ return item;
40
+ });
41
+ }
42
+ return names.reduce((accum, name, index) => {
43
+ let item = items.getValue(name);
44
+ if (!(name in accum)) {
45
+ if (deep && item instanceof Result) {
46
+ item = toObject(getNames(item), item, deep);
47
+ }
48
+ accum[name] = item;
47
49
  }
48
- assertPrivate(_gaurd, gaurd, "Typed");
49
- defineProperties(this, { _typedSymbol, type, value });
50
- __privateSet(this, _options, options);
51
- this.format();
52
- }
53
- /**
54
- * Format the type as a Human-Readable type.
55
- */
56
- format() {
57
- if (this.type === "array") {
58
- throw new Error("");
59
- } else if (this.type === "dynamicArray") {
60
- throw new Error("");
61
- } else if (this.type === "tuple") {
62
- return `tuple(${this.value.map((v) => v.format()).join(",")})`;
50
+ return accum;
51
+ }, {});
52
+ }
53
+ const _Result = class _Result extends Array {
54
+ /**
55
+ * @private
56
+ */
57
+ constructor(...args) {
58
+ const guard = args[0];
59
+ let items = args[1];
60
+ let names = (args[2] || []).slice();
61
+ let wrap = true;
62
+ if (guard !== _guard) {
63
+ items = args;
64
+ names = [];
65
+ wrap = false;
63
66
  }
64
- return this.type;
65
- }
66
- /**
67
- * The default value returned by this type.
68
- */
69
- defaultValue() {
70
- return 0;
71
- }
72
- /**
73
- * The minimum value for numeric types.
74
- */
75
- minValue() {
76
- return 0;
77
- }
78
- /**
79
- * The maximum value for numeric types.
80
- */
81
- maxValue() {
82
- return 0;
83
- }
84
- /**
85
- * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].
86
- */
87
- isBigInt() {
88
- return !!this.type.match(/^u?int[0-9]+$/);
67
+ super(items.length);
68
+ // No longer used; but cannot be removed as it will remove the
69
+ // #private field from the .d.ts which may break backwards
70
+ // compatibility
71
+ __privateAdd(this, _names);
72
+ items.forEach((item, index) => {
73
+ this[index] = item;
74
+ });
75
+ const nameCounts = names.reduce((accum, name) => {
76
+ if (typeof name === "string") {
77
+ accum.set(name, (accum.get(name) || 0) + 1);
78
+ }
79
+ return accum;
80
+ }, /* @__PURE__ */ new Map());
81
+ setNames(this, Object.freeze(items.map((item, index) => {
82
+ const name = names[index];
83
+ if (name != null && nameCounts.get(name) === 1) {
84
+ return name;
85
+ }
86
+ return null;
87
+ })));
88
+ __privateSet(this, _names, []);
89
+ if (__privateGet(this, _names) == null) {
90
+ void __privateGet(this, _names);
91
+ }
92
+ if (!wrap) {
93
+ return;
94
+ }
95
+ Object.freeze(this);
96
+ const proxy = new Proxy(this, {
97
+ get: (target, prop, receiver) => {
98
+ if (typeof prop === "string") {
99
+ if (prop.match(/^[0-9]+$/)) {
100
+ const index = getNumber(prop, "%index");
101
+ if (index < 0 || index >= this.length) {
102
+ throw new RangeError("out of result range");
103
+ }
104
+ const item = target[index];
105
+ if (item instanceof Error) {
106
+ throwError(`index ${index}`, item);
107
+ }
108
+ return item;
109
+ }
110
+ if (passProperties.indexOf(prop) >= 0) {
111
+ return Reflect.get(target, prop, receiver);
112
+ }
113
+ const value = target[prop];
114
+ if (value instanceof Function) {
115
+ return function(...args2) {
116
+ return value.apply(this === receiver ? target : this, args2);
117
+ };
118
+ } else if (!(prop in target)) {
119
+ return target.getValue.apply(this === receiver ? target : this, [prop]);
120
+ }
121
+ }
122
+ return Reflect.get(target, prop, receiver);
123
+ }
124
+ });
125
+ setNames(proxy, getNames(this));
126
+ return proxy;
89
127
  }
90
128
  /**
91
- * Returns ``true`` and provides a type guard is this is a [[TypedData]].
92
- */
93
- isData() {
94
- return this.type.startsWith("bytes");
129
+ * Returns the Result as a normal Array. If %%deep%%, any children
130
+ * which are Result objects are also converted to a normal Array.
131
+ *
132
+ * This will throw if there are any outstanding deferred
133
+ * errors.
134
+ */
135
+ toArray(deep) {
136
+ const result = [];
137
+ this.forEach((item, index) => {
138
+ if (item instanceof Error) {
139
+ throwError(`index ${index}`, item);
140
+ }
141
+ if (deep && item instanceof _Result) {
142
+ item = item.toArray(deep);
143
+ }
144
+ result.push(item);
145
+ });
146
+ return result;
95
147
  }
96
148
  /**
97
- * Returns ``true`` and provides a type guard is this is a [[TypedString]].
149
+ * Returns the Result as an Object with each name-value pair. If
150
+ * %%deep%%, any children which are Result objects are also
151
+ * converted to an Object.
152
+ *
153
+ * This will throw if any value is unnamed, or if there are
154
+ * any outstanding deferred errors.
98
155
  */
99
- isString() {
100
- return this.type === "string";
156
+ toObject(deep) {
157
+ const names = getNames(this);
158
+ return names.reduce((accum, name, index) => {
159
+ assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", {
160
+ operation: "toObject()"
161
+ });
162
+ return toObject(names, this, deep);
163
+ }, {});
101
164
  }
102
165
  /**
103
- * Returns the tuple name, if this is a tuple. Throws otherwise.
166
+ * @_ignore
104
167
  */
105
- get tupleName() {
106
- if (this.type !== "tuple") {
107
- throw TypeError("not a tuple");
168
+ slice(start, end) {
169
+ if (start == null) {
170
+ start = 0;
108
171
  }
109
- return __privateGet(this, _options);
110
- }
111
- // Returns the length of this type as an array
112
- // - `null` indicates the length is unforced, it could be dynamic
113
- // - `-1` indicates the length is dynamic
114
- // - any other value indicates it is a static array and is its length
115
- /**
116
- * Returns the length of the array type or ``-1`` if it is dynamic.
117
- *
118
- * Throws if the type is not an array.
119
- */
120
- get arrayLength() {
121
- if (this.type !== "array") {
122
- throw TypeError("not an array");
172
+ if (start < 0) {
173
+ start += this.length;
174
+ if (start < 0) {
175
+ start = 0;
176
+ }
123
177
  }
124
- if (__privateGet(this, _options) === true) {
125
- return -1;
178
+ if (end == null) {
179
+ end = this.length;
126
180
  }
127
- if (__privateGet(this, _options) === false) {
128
- return this.value.length;
181
+ if (end < 0) {
182
+ end += this.length;
183
+ if (end < 0) {
184
+ end = 0;
185
+ }
129
186
  }
130
- return null;
131
- }
132
- /**
133
- * Returns a new **Typed** of %%type%% with the %%value%%.
134
- */
135
- static from(type, value) {
136
- return new _Typed(_gaurd, type, value);
137
- }
138
- /**
139
- * Return a new ``uint8`` type for %%v%%.
140
- */
141
- static uint8(v) {
142
- return n(v, 8);
143
- }
144
- /**
145
- * Return a new ``uint16`` type for %%v%%.
146
- */
147
- static uint16(v) {
148
- return n(v, 16);
149
- }
150
- /**
151
- * Return a new ``uint24`` type for %%v%%.
152
- */
153
- static uint24(v) {
154
- return n(v, 24);
155
- }
156
- /**
157
- * Return a new ``uint32`` type for %%v%%.
158
- */
159
- static uint32(v) {
160
- return n(v, 32);
161
- }
162
- /**
163
- * Return a new ``uint40`` type for %%v%%.
164
- */
165
- static uint40(v) {
166
- return n(v, 40);
167
- }
168
- /**
169
- * Return a new ``uint48`` type for %%v%%.
170
- */
171
- static uint48(v) {
172
- return n(v, 48);
173
- }
174
- /**
175
- * Return a new ``uint56`` type for %%v%%.
176
- */
177
- static uint56(v) {
178
- return n(v, 56);
179
- }
180
- /**
181
- * Return a new ``uint64`` type for %%v%%.
182
- */
183
- static uint64(v) {
184
- return n(v, 64);
185
- }
186
- /**
187
- * Return a new ``uint72`` type for %%v%%.
188
- */
189
- static uint72(v) {
190
- return n(v, 72);
191
- }
192
- /**
193
- * Return a new ``uint80`` type for %%v%%.
194
- */
195
- static uint80(v) {
196
- return n(v, 80);
197
- }
198
- /**
199
- * Return a new ``uint88`` type for %%v%%.
200
- */
201
- static uint88(v) {
202
- return n(v, 88);
203
- }
204
- /**
205
- * Return a new ``uint96`` type for %%v%%.
206
- */
207
- static uint96(v) {
208
- return n(v, 96);
209
- }
210
- /**
211
- * Return a new ``uint104`` type for %%v%%.
212
- */
213
- static uint104(v) {
214
- return n(v, 104);
215
- }
216
- /**
217
- * Return a new ``uint112`` type for %%v%%.
218
- */
219
- static uint112(v) {
220
- return n(v, 112);
221
- }
222
- /**
223
- * Return a new ``uint120`` type for %%v%%.
224
- */
225
- static uint120(v) {
226
- return n(v, 120);
227
- }
228
- /**
229
- * Return a new ``uint128`` type for %%v%%.
230
- */
231
- static uint128(v) {
232
- return n(v, 128);
233
- }
234
- /**
235
- * Return a new ``uint136`` type for %%v%%.
236
- */
237
- static uint136(v) {
238
- return n(v, 136);
239
- }
240
- /**
241
- * Return a new ``uint144`` type for %%v%%.
242
- */
243
- static uint144(v) {
244
- return n(v, 144);
245
- }
246
- /**
247
- * Return a new ``uint152`` type for %%v%%.
248
- */
249
- static uint152(v) {
250
- return n(v, 152);
251
- }
252
- /**
253
- * Return a new ``uint160`` type for %%v%%.
254
- */
255
- static uint160(v) {
256
- return n(v, 160);
257
- }
258
- /**
259
- * Return a new ``uint168`` type for %%v%%.
260
- */
261
- static uint168(v) {
262
- return n(v, 168);
263
- }
264
- /**
265
- * Return a new ``uint176`` type for %%v%%.
266
- */
267
- static uint176(v) {
268
- return n(v, 176);
269
- }
270
- /**
271
- * Return a new ``uint184`` type for %%v%%.
272
- */
273
- static uint184(v) {
274
- return n(v, 184);
275
- }
276
- /**
277
- * Return a new ``uint192`` type for %%v%%.
278
- */
279
- static uint192(v) {
280
- return n(v, 192);
281
- }
282
- /**
283
- * Return a new ``uint200`` type for %%v%%.
284
- */
285
- static uint200(v) {
286
- return n(v, 200);
287
- }
288
- /**
289
- * Return a new ``uint208`` type for %%v%%.
290
- */
291
- static uint208(v) {
292
- return n(v, 208);
293
- }
294
- /**
295
- * Return a new ``uint216`` type for %%v%%.
296
- */
297
- static uint216(v) {
298
- return n(v, 216);
299
- }
300
- /**
301
- * Return a new ``uint224`` type for %%v%%.
302
- */
303
- static uint224(v) {
304
- return n(v, 224);
305
- }
306
- /**
307
- * Return a new ``uint232`` type for %%v%%.
308
- */
309
- static uint232(v) {
310
- return n(v, 232);
311
- }
312
- /**
313
- * Return a new ``uint240`` type for %%v%%.
314
- */
315
- static uint240(v) {
316
- return n(v, 240);
317
- }
318
- /**
319
- * Return a new ``uint248`` type for %%v%%.
320
- */
321
- static uint248(v) {
322
- return n(v, 248);
323
- }
324
- /**
325
- * Return a new ``uint256`` type for %%v%%.
326
- */
327
- static uint256(v) {
328
- return n(v, 256);
329
- }
330
- /**
331
- * Return a new ``uint256`` type for %%v%%.
332
- */
333
- static uint(v) {
334
- return n(v, 256);
335
- }
336
- /**
337
- * Return a new ``int8`` type for %%v%%.
338
- */
339
- static int8(v) {
340
- return n(v, -8);
341
- }
342
- /**
343
- * Return a new ``int16`` type for %%v%%.
344
- */
345
- static int16(v) {
346
- return n(v, -16);
347
- }
348
- /**
349
- * Return a new ``int24`` type for %%v%%.
350
- */
351
- static int24(v) {
352
- return n(v, -24);
353
- }
354
- /**
355
- * Return a new ``int32`` type for %%v%%.
356
- */
357
- static int32(v) {
358
- return n(v, -32);
359
- }
360
- /**
361
- * Return a new ``int40`` type for %%v%%.
362
- */
363
- static int40(v) {
364
- return n(v, -40);
365
- }
366
- /**
367
- * Return a new ``int48`` type for %%v%%.
368
- */
369
- static int48(v) {
370
- return n(v, -48);
371
- }
372
- /**
373
- * Return a new ``int56`` type for %%v%%.
374
- */
375
- static int56(v) {
376
- return n(v, -56);
377
- }
378
- /**
379
- * Return a new ``int64`` type for %%v%%.
380
- */
381
- static int64(v) {
382
- return n(v, -64);
383
- }
384
- /**
385
- * Return a new ``int72`` type for %%v%%.
386
- */
387
- static int72(v) {
388
- return n(v, -72);
389
- }
390
- /**
391
- * Return a new ``int80`` type for %%v%%.
392
- */
393
- static int80(v) {
394
- return n(v, -80);
395
- }
396
- /**
397
- * Return a new ``int88`` type for %%v%%.
398
- */
399
- static int88(v) {
400
- return n(v, -88);
401
- }
402
- /**
403
- * Return a new ``int96`` type for %%v%%.
404
- */
405
- static int96(v) {
406
- return n(v, -96);
407
- }
408
- /**
409
- * Return a new ``int104`` type for %%v%%.
410
- */
411
- static int104(v) {
412
- return n(v, -104);
413
- }
414
- /**
415
- * Return a new ``int112`` type for %%v%%.
416
- */
417
- static int112(v) {
418
- return n(v, -112);
419
- }
420
- /**
421
- * Return a new ``int120`` type for %%v%%.
422
- */
423
- static int120(v) {
424
- return n(v, -120);
425
- }
426
- /**
427
- * Return a new ``int128`` type for %%v%%.
428
- */
429
- static int128(v) {
430
- return n(v, -128);
431
- }
432
- /**
433
- * Return a new ``int136`` type for %%v%%.
434
- */
435
- static int136(v) {
436
- return n(v, -136);
437
- }
438
- /**
439
- * Return a new ``int144`` type for %%v%%.
440
- */
441
- static int144(v) {
442
- return n(v, -144);
443
- }
444
- /**
445
- * Return a new ``int52`` type for %%v%%.
446
- */
447
- static int152(v) {
448
- return n(v, -152);
449
- }
450
- /**
451
- * Return a new ``int160`` type for %%v%%.
452
- */
453
- static int160(v) {
454
- return n(v, -160);
455
- }
456
- /**
457
- * Return a new ``int168`` type for %%v%%.
458
- */
459
- static int168(v) {
460
- return n(v, -168);
461
- }
462
- /**
463
- * Return a new ``int176`` type for %%v%%.
464
- */
465
- static int176(v) {
466
- return n(v, -176);
467
- }
468
- /**
469
- * Return a new ``int184`` type for %%v%%.
470
- */
471
- static int184(v) {
472
- return n(v, -184);
473
- }
474
- /**
475
- * Return a new ``int92`` type for %%v%%.
476
- */
477
- static int192(v) {
478
- return n(v, -192);
479
- }
480
- /**
481
- * Return a new ``int200`` type for %%v%%.
482
- */
483
- static int200(v) {
484
- return n(v, -200);
485
- }
486
- /**
487
- * Return a new ``int208`` type for %%v%%.
488
- */
489
- static int208(v) {
490
- return n(v, -208);
491
- }
492
- /**
493
- * Return a new ``int216`` type for %%v%%.
494
- */
495
- static int216(v) {
496
- return n(v, -216);
497
- }
498
- /**
499
- * Return a new ``int224`` type for %%v%%.
500
- */
501
- static int224(v) {
502
- return n(v, -224);
503
- }
504
- /**
505
- * Return a new ``int232`` type for %%v%%.
506
- */
507
- static int232(v) {
508
- return n(v, -232);
509
- }
510
- /**
511
- * Return a new ``int240`` type for %%v%%.
512
- */
513
- static int240(v) {
514
- return n(v, -240);
515
- }
516
- /**
517
- * Return a new ``int248`` type for %%v%%.
518
- */
519
- static int248(v) {
520
- return n(v, -248);
521
- }
522
- /**
523
- * Return a new ``int256`` type for %%v%%.
524
- */
525
- static int256(v) {
526
- return n(v, -256);
527
- }
528
- /**
529
- * Return a new ``int256`` type for %%v%%.
530
- */
531
- static int(v) {
532
- return n(v, -256);
533
- }
534
- /**
535
- * Return a new ``bytes1`` type for %%v%%.
536
- */
537
- static bytes1(v) {
538
- return b(v, 1);
539
- }
540
- /**
541
- * Return a new ``bytes2`` type for %%v%%.
542
- */
543
- static bytes2(v) {
544
- return b(v, 2);
545
- }
546
- /**
547
- * Return a new ``bytes3`` type for %%v%%.
548
- */
549
- static bytes3(v) {
550
- return b(v, 3);
551
- }
552
- /**
553
- * Return a new ``bytes4`` type for %%v%%.
554
- */
555
- static bytes4(v) {
556
- return b(v, 4);
557
- }
558
- /**
559
- * Return a new ``bytes5`` type for %%v%%.
560
- */
561
- static bytes5(v) {
562
- return b(v, 5);
563
- }
564
- /**
565
- * Return a new ``bytes6`` type for %%v%%.
566
- */
567
- static bytes6(v) {
568
- return b(v, 6);
569
- }
570
- /**
571
- * Return a new ``bytes7`` type for %%v%%.
572
- */
573
- static bytes7(v) {
574
- return b(v, 7);
575
- }
576
- /**
577
- * Return a new ``bytes8`` type for %%v%%.
578
- */
579
- static bytes8(v) {
580
- return b(v, 8);
581
- }
582
- /**
583
- * Return a new ``bytes9`` type for %%v%%.
584
- */
585
- static bytes9(v) {
586
- return b(v, 9);
587
- }
588
- /**
589
- * Return a new ``bytes10`` type for %%v%%.
590
- */
591
- static bytes10(v) {
592
- return b(v, 10);
593
- }
594
- /**
595
- * Return a new ``bytes11`` type for %%v%%.
596
- */
597
- static bytes11(v) {
598
- return b(v, 11);
599
- }
600
- /**
601
- * Return a new ``bytes12`` type for %%v%%.
602
- */
603
- static bytes12(v) {
604
- return b(v, 12);
605
- }
606
- /**
607
- * Return a new ``bytes13`` type for %%v%%.
608
- */
609
- static bytes13(v) {
610
- return b(v, 13);
611
- }
612
- /**
613
- * Return a new ``bytes14`` type for %%v%%.
614
- */
615
- static bytes14(v) {
616
- return b(v, 14);
617
- }
618
- /**
619
- * Return a new ``bytes15`` type for %%v%%.
620
- */
621
- static bytes15(v) {
622
- return b(v, 15);
623
- }
624
- /**
625
- * Return a new ``bytes16`` type for %%v%%.
626
- */
627
- static bytes16(v) {
628
- return b(v, 16);
629
- }
630
- /**
631
- * Return a new ``bytes17`` type for %%v%%.
632
- */
633
- static bytes17(v) {
634
- return b(v, 17);
635
- }
636
- /**
637
- * Return a new ``bytes18`` type for %%v%%.
638
- */
639
- static bytes18(v) {
640
- return b(v, 18);
641
- }
642
- /**
643
- * Return a new ``bytes19`` type for %%v%%.
644
- */
645
- static bytes19(v) {
646
- return b(v, 19);
647
- }
648
- /**
649
- * Return a new ``bytes20`` type for %%v%%.
650
- */
651
- static bytes20(v) {
652
- return b(v, 20);
653
- }
654
- /**
655
- * Return a new ``bytes21`` type for %%v%%.
656
- */
657
- static bytes21(v) {
658
- return b(v, 21);
659
- }
660
- /**
661
- * Return a new ``bytes22`` type for %%v%%.
662
- */
663
- static bytes22(v) {
664
- return b(v, 22);
665
- }
666
- /**
667
- * Return a new ``bytes23`` type for %%v%%.
668
- */
669
- static bytes23(v) {
670
- return b(v, 23);
671
- }
672
- /**
673
- * Return a new ``bytes24`` type for %%v%%.
674
- */
675
- static bytes24(v) {
676
- return b(v, 24);
677
- }
678
- /**
679
- * Return a new ``bytes25`` type for %%v%%.
680
- */
681
- static bytes25(v) {
682
- return b(v, 25);
683
- }
684
- /**
685
- * Return a new ``bytes26`` type for %%v%%.
686
- */
687
- static bytes26(v) {
688
- return b(v, 26);
689
- }
690
- /**
691
- * Return a new ``bytes27`` type for %%v%%.
692
- */
693
- static bytes27(v) {
694
- return b(v, 27);
695
- }
696
- /**
697
- * Return a new ``bytes28`` type for %%v%%.
698
- */
699
- static bytes28(v) {
700
- return b(v, 28);
701
- }
702
- /**
703
- * Return a new ``bytes29`` type for %%v%%.
704
- */
705
- static bytes29(v) {
706
- return b(v, 29);
707
- }
708
- /**
709
- * Return a new ``bytes30`` type for %%v%%.
710
- */
711
- static bytes30(v) {
712
- return b(v, 30);
713
- }
714
- /**
715
- * Return a new ``bytes31`` type for %%v%%.
716
- */
717
- static bytes31(v) {
718
- return b(v, 31);
719
- }
720
- /**
721
- * Return a new ``bytes32`` type for %%v%%.
722
- */
723
- static bytes32(v) {
724
- return b(v, 32);
725
- }
726
- /**
727
- * Return a new ``address`` type for %%v%%.
728
- */
729
- static address(v) {
730
- return new _Typed(_gaurd, "address", v);
187
+ if (end > this.length) {
188
+ end = this.length;
189
+ }
190
+ const _names2 = getNames(this);
191
+ const result = [], names = [];
192
+ for (let i = start; i < end; i++) {
193
+ result.push(this[i]);
194
+ names.push(_names2[i]);
195
+ }
196
+ return new _Result(_guard, result, names);
731
197
  }
732
198
  /**
733
- * Return a new ``bool`` type for %%v%%.
199
+ * @_ignore
734
200
  */
735
- static bool(v) {
736
- return new _Typed(_gaurd, "bool", !!v);
201
+ filter(callback, thisArg) {
202
+ const _names2 = getNames(this);
203
+ const result = [], names = [];
204
+ for (let i = 0; i < this.length; i++) {
205
+ const item = this[i];
206
+ if (item instanceof Error) {
207
+ throwError(`index ${i}`, item);
208
+ }
209
+ if (callback.call(thisArg, item, i, this)) {
210
+ result.push(item);
211
+ names.push(_names2[i]);
212
+ }
213
+ }
214
+ return new _Result(_guard, result, names);
737
215
  }
738
216
  /**
739
- * Return a new ``bytes`` type for %%v%%.
217
+ * @_ignore
740
218
  */
741
- static bytes(v) {
742
- return new _Typed(_gaurd, "bytes", v);
219
+ map(callback, thisArg) {
220
+ const result = [];
221
+ for (let i = 0; i < this.length; i++) {
222
+ const item = this[i];
223
+ if (item instanceof Error) {
224
+ throwError(`index ${i}`, item);
225
+ }
226
+ result.push(callback.call(thisArg, item, i, this));
227
+ }
228
+ return result;
743
229
  }
744
230
  /**
745
- * Return a new ``string`` type for %%v%%.
746
- */
747
- static string(v) {
748
- return new _Typed(_gaurd, "string", v);
231
+ * Returns the value for %%name%%.
232
+ *
233
+ * Since it is possible to have a key whose name conflicts with
234
+ * a method on a [[Result]] or its superclass Array, or any
235
+ * JavaScript keyword, this ensures all named values are still
236
+ * accessible by name.
237
+ */
238
+ getValue(name) {
239
+ const index = getNames(this).indexOf(name);
240
+ if (index === -1) {
241
+ return void 0;
242
+ }
243
+ const value = this[index];
244
+ if (value instanceof Error) {
245
+ throwError(`property ${JSON.stringify(name)}`, value.error);
246
+ }
247
+ return value;
749
248
  }
750
249
  /**
751
- * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.
250
+ * Creates a new [[Result]] for %%items%% with each entry
251
+ * also accessible by its corresponding name in %%keys%%.
752
252
  */
753
- static array(v, dynamic) {
754
- throw new Error("not implemented yet");
253
+ static fromItems(items, keys) {
254
+ return new _Result(_guard, items, keys);
755
255
  }
756
- /**
757
- * Return a new ``tuple`` type for %%v%%, with the optional %%name%%.
758
- */
759
- static tuple(v, name) {
760
- throw new Error("not implemented yet");
256
+ };
257
+ _names = new WeakMap();
258
+ let Result = _Result;
259
+ function getValue(value) {
260
+ let bytes = toBeArray(value);
261
+ assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length });
262
+ if (bytes.length !== WordSize) {
263
+ bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));
264
+ }
265
+ return bytes;
266
+ }
267
+ class Coder {
268
+ constructor(name, type, localName, dynamic) {
269
+ // The coder name:
270
+ // - address, uint256, tuple, array, etc.
271
+ __publicField(this, "name");
272
+ // The fully expanded type, including composite types:
273
+ // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.
274
+ __publicField(this, "type");
275
+ // The localName bound in the signature, in this example it is "baz":
276
+ // - tuple(address foo, uint bar) baz
277
+ __publicField(this, "localName");
278
+ // Whether this type is dynamic:
279
+ // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.
280
+ // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)
281
+ __publicField(this, "dynamic");
282
+ defineProperties(this, { name, type, localName, dynamic }, {
283
+ name: "string",
284
+ type: "string",
285
+ localName: "string",
286
+ dynamic: "boolean"
287
+ });
288
+ }
289
+ _throwError(message, value) {
290
+ assertArgument(false, message, this.localName, value);
761
291
  }
762
- /**
763
- * Return a new ``uint8`` type for %%v%%.
764
- */
765
- static overrides(v) {
766
- return new _Typed(_gaurd, "overrides", Object.assign({}, v));
292
+ }
293
+ class Writer {
294
+ constructor() {
295
+ __privateAdd(this, _Writer_instances);
296
+ // An array of WordSize lengthed objects to concatenation
297
+ __privateAdd(this, _data);
298
+ __privateAdd(this, _dataLength);
299
+ __privateSet(this, _data, []);
300
+ __privateSet(this, _dataLength, 0);
301
+ }
302
+ get data() {
303
+ return concat(__privateGet(this, _data));
304
+ }
305
+ get length() {
306
+ return __privateGet(this, _dataLength);
307
+ }
308
+ appendWriter(writer) {
309
+ return __privateMethod(this, _Writer_instances, writeData_fn).call(this, getBytesCopy(writer.data));
310
+ }
311
+ // Arrayish item; pad on the right to *nearest* WordSize
312
+ writeBytes(value) {
313
+ let bytes = getBytesCopy(value);
314
+ const paddingOffset = bytes.length % WordSize;
315
+ if (paddingOffset) {
316
+ bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));
317
+ }
318
+ return __privateMethod(this, _Writer_instances, writeData_fn).call(this, bytes);
319
+ }
320
+ // Numeric item; pad on the left *to* WordSize
321
+ writeValue(value) {
322
+ return __privateMethod(this, _Writer_instances, writeData_fn).call(this, getValue(value));
323
+ }
324
+ // Inserts a numeric place-holder, returning a callback that can
325
+ // be used to asjust the value later
326
+ writeUpdatableValue() {
327
+ const offset = __privateGet(this, _data).length;
328
+ __privateGet(this, _data).push(Padding);
329
+ __privateSet(this, _dataLength, __privateGet(this, _dataLength) + WordSize);
330
+ return (value) => {
331
+ __privateGet(this, _data)[offset] = getValue(value);
332
+ };
767
333
  }
768
- /**
769
- * Returns true only if %%value%% is a [[Typed]] instance.
770
- */
771
- static isTyped(value) {
772
- return value && typeof value === "object" && "_typedSymbol" in value && value._typedSymbol === _typedSymbol;
334
+ }
335
+ _data = new WeakMap();
336
+ _dataLength = new WeakMap();
337
+ _Writer_instances = new WeakSet();
338
+ writeData_fn = function(data) {
339
+ __privateGet(this, _data).push(data);
340
+ __privateSet(this, _dataLength, __privateGet(this, _dataLength) + data.length);
341
+ return data.length;
342
+ };
343
+ const _Reader = class _Reader {
344
+ constructor(data, allowLoose, maxInflation) {
345
+ __privateAdd(this, _Reader_instances);
346
+ // Allows incomplete unpadded data to be read; otherwise an error
347
+ // is raised if attempting to overrun the buffer. This is required
348
+ // to deal with an old Solidity bug, in which event data for
349
+ // external (not public thoguh) was tightly packed.
350
+ __publicField(this, "allowLoose");
351
+ __privateAdd(this, _data2);
352
+ __privateAdd(this, _offset);
353
+ __privateAdd(this, _bytesRead);
354
+ __privateAdd(this, _parent);
355
+ __privateAdd(this, _maxInflation);
356
+ defineProperties(this, { allowLoose: !!allowLoose });
357
+ __privateSet(this, _data2, getBytesCopy(data));
358
+ __privateSet(this, _bytesRead, 0);
359
+ __privateSet(this, _parent, null);
360
+ __privateSet(this, _maxInflation, maxInflation != null ? maxInflation : 1024);
361
+ __privateSet(this, _offset, 0);
362
+ }
363
+ get data() {
364
+ return hexlify(__privateGet(this, _data2));
365
+ }
366
+ get dataLength() {
367
+ return __privateGet(this, _data2).length;
368
+ }
369
+ get consumed() {
370
+ return __privateGet(this, _offset);
371
+ }
372
+ get bytes() {
373
+ return new Uint8Array(__privateGet(this, _data2));
374
+ }
375
+ // Create a sub-reader with the same underlying data, but offset
376
+ subReader(offset) {
377
+ const reader = new _Reader(__privateGet(this, _data2).slice(__privateGet(this, _offset) + offset), this.allowLoose, __privateGet(this, _maxInflation));
378
+ __privateSet(reader, _parent, this);
379
+ return reader;
380
+ }
381
+ // Read bytes
382
+ readBytes(length, loose) {
383
+ let bytes = __privateMethod(this, _Reader_instances, peekBytes_fn).call(this, 0, length, !!loose);
384
+ __privateMethod(this, _Reader_instances, incrementBytesRead_fn).call(this, length);
385
+ __privateSet(this, _offset, __privateGet(this, _offset) + bytes.length);
386
+ return bytes.slice(0, length);
387
+ }
388
+ // Read a numeric values
389
+ readValue() {
390
+ return toBigInt(this.readBytes(WordSize));
391
+ }
392
+ readIndex() {
393
+ return toNumber(this.readBytes(WordSize));
773
394
  }
774
- /**
775
- * If the value is a [[Typed]] instance, validates the underlying value
776
- * and returns it, otherwise returns value directly.
777
- *
778
- * This is useful for functions that with to accept either a [[Typed]]
779
- * object or values.
780
- */
781
- static dereference(value, type) {
782
- if (_Typed.isTyped(value)) {
783
- if (value.type !== type) {
784
- throw new Error(`invalid type: expecetd ${type}, got ${value.type}`);
785
- }
786
- return value.value;
395
+ };
396
+ _data2 = new WeakMap();
397
+ _offset = new WeakMap();
398
+ _bytesRead = new WeakMap();
399
+ _parent = new WeakMap();
400
+ _maxInflation = new WeakMap();
401
+ _Reader_instances = new WeakSet();
402
+ incrementBytesRead_fn = function(count) {
403
+ var _a;
404
+ if (__privateGet(this, _parent)) {
405
+ return __privateMethod(_a = __privateGet(this, _parent), _Reader_instances, incrementBytesRead_fn).call(_a, count);
406
+ }
407
+ __privateSet(this, _bytesRead, __privateGet(this, _bytesRead) + count);
408
+ assert(__privateGet(this, _maxInflation) < 1 || __privateGet(this, _bytesRead) <= __privateGet(this, _maxInflation) * this.dataLength, `compressed ABI data exceeds inflation ratio of ${__privateGet(this, _maxInflation)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
409
+ buffer: getBytesCopy(__privateGet(this, _data2)),
410
+ offset: __privateGet(this, _offset),
411
+ length: count,
412
+ info: {
413
+ bytesRead: __privateGet(this, _bytesRead),
414
+ dataLength: this.dataLength
415
+ }
416
+ });
417
+ };
418
+ peekBytes_fn = function(offset, length, loose) {
419
+ let alignedLength = Math.ceil(length / WordSize) * WordSize;
420
+ if (__privateGet(this, _offset) + alignedLength > __privateGet(this, _data2).length) {
421
+ if (this.allowLoose && loose && __privateGet(this, _offset) + length <= __privateGet(this, _data2).length) {
422
+ alignedLength = length;
423
+ } else {
424
+ assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
425
+ buffer: getBytesCopy(__privateGet(this, _data2)),
426
+ length: __privateGet(this, _data2).length,
427
+ offset: __privateGet(this, _offset) + alignedLength
428
+ });
787
429
  }
788
- return value;
789
430
  }
431
+ return __privateGet(this, _data2).slice(__privateGet(this, _offset), __privateGet(this, _offset) + alignedLength);
790
432
  };
791
- _options = new WeakMap();
792
- let Typed = _Typed;
433
+ let Reader = _Reader;
793
434
  export {
794
- Typed
435
+ Coder,
436
+ Reader,
437
+ Result,
438
+ WordSize,
439
+ Writer
795
440
  };
796
441
  //# sourceMappingURL=standards-sdk.es54.js.map