@hashgraphonline/standards-sdk 0.0.91 → 0.0.92

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 (166) hide show
  1. package/dist/es/hcs-10/browser.d.ts.map +1 -1
  2. package/dist/es/hcs-10/types.d.ts +19 -48
  3. package/dist/es/hcs-10/types.d.ts.map +1 -1
  4. package/dist/es/standards-sdk.es101.js +1 -1
  5. package/dist/es/standards-sdk.es102.js +3 -3
  6. package/dist/es/standards-sdk.es105.js +1 -1
  7. package/dist/es/standards-sdk.es107.js +1 -1
  8. package/dist/es/standards-sdk.es108.js +6 -6
  9. package/dist/es/standards-sdk.es109.js +3 -3
  10. package/dist/es/standards-sdk.es116.js +1 -1
  11. package/dist/es/standards-sdk.es117.js +2 -2
  12. package/dist/es/standards-sdk.es13.js +3 -3
  13. package/dist/es/standards-sdk.es15.js +1 -1
  14. package/dist/es/standards-sdk.es18.js +2 -2
  15. package/dist/es/standards-sdk.es19.js +1 -1
  16. package/dist/es/standards-sdk.es22.js +5 -1767
  17. package/dist/es/standards-sdk.es22.js.map +1 -1
  18. package/dist/es/standards-sdk.es23.js +1767 -3
  19. package/dist/es/standards-sdk.es23.js.map +1 -1
  20. package/dist/es/standards-sdk.es24.js +6864 -3841
  21. package/dist/es/standards-sdk.es24.js.map +1 -1
  22. package/dist/es/standards-sdk.es25.js +10 -10
  23. package/dist/es/standards-sdk.es27.js +17 -17
  24. package/dist/es/standards-sdk.es28.js +3 -7190
  25. package/dist/es/standards-sdk.es28.js.map +1 -1
  26. package/dist/es/standards-sdk.es30.js +4167 -5
  27. package/dist/es/standards-sdk.es30.js.map +1 -1
  28. package/dist/es/standards-sdk.es34.js +4 -2
  29. package/dist/es/standards-sdk.es34.js.map +1 -1
  30. package/dist/es/standards-sdk.es35.js +7132 -191
  31. package/dist/es/standards-sdk.es35.js.map +1 -1
  32. package/dist/es/standards-sdk.es36.js +2 -438
  33. package/dist/es/standards-sdk.es36.js.map +1 -1
  34. package/dist/es/standards-sdk.es37.js +3 -25
  35. package/dist/es/standards-sdk.es37.js.map +1 -1
  36. package/dist/es/standards-sdk.es38.js +73 -128
  37. package/dist/es/standards-sdk.es38.js.map +1 -1
  38. package/dist/es/standards-sdk.es39.js +22 -17
  39. package/dist/es/standards-sdk.es39.js.map +1 -1
  40. package/dist/es/standards-sdk.es40.js +140 -21
  41. package/dist/es/standards-sdk.es40.js.map +1 -1
  42. package/dist/es/standards-sdk.es41.js +87 -25
  43. package/dist/es/standards-sdk.es41.js.map +1 -1
  44. package/dist/es/standards-sdk.es42.js +358 -15
  45. package/dist/es/standards-sdk.es42.js.map +1 -1
  46. package/dist/es/standards-sdk.es43.js +5 -43
  47. package/dist/es/standards-sdk.es43.js.map +1 -1
  48. package/dist/es/standards-sdk.es44.js +174 -13
  49. package/dist/es/standards-sdk.es44.js.map +1 -1
  50. package/dist/es/standards-sdk.es45.js +76 -56
  51. package/dist/es/standards-sdk.es45.js.map +1 -1
  52. package/dist/es/standards-sdk.es46.js +104 -1279
  53. package/dist/es/standards-sdk.es46.js.map +1 -1
  54. package/dist/es/standards-sdk.es47.js +42 -138
  55. package/dist/es/standards-sdk.es47.js.map +1 -1
  56. package/dist/es/standards-sdk.es48.js +10 -91
  57. package/dist/es/standards-sdk.es48.js.map +1 -1
  58. package/dist/es/standards-sdk.es49.js +89 -76
  59. package/dist/es/standards-sdk.es49.js.map +1 -1
  60. package/dist/es/standards-sdk.es5.js +1 -1
  61. package/dist/es/standards-sdk.es50.js +3 -31
  62. package/dist/es/standards-sdk.es50.js.map +1 -1
  63. package/dist/es/standards-sdk.es51.js +2 -6
  64. package/dist/es/standards-sdk.es51.js.map +1 -1
  65. package/dist/es/standards-sdk.es52.js +99 -145
  66. package/dist/es/standards-sdk.es52.js.map +1 -1
  67. package/dist/es/standards-sdk.es53.js +71 -20
  68. package/dist/es/standards-sdk.es53.js.map +1 -1
  69. package/dist/es/standards-sdk.es54.js +5 -792
  70. package/dist/es/standards-sdk.es54.js.map +1 -1
  71. package/dist/es/standards-sdk.es55.js +4 -173
  72. package/dist/es/standards-sdk.es55.js.map +1 -1
  73. package/dist/es/standards-sdk.es56.js +202 -124
  74. package/dist/es/standards-sdk.es56.js.map +1 -1
  75. package/dist/es/standards-sdk.es57.js +58 -4
  76. package/dist/es/standards-sdk.es57.js.map +1 -1
  77. package/dist/es/standards-sdk.es58.js +69 -21
  78. package/dist/es/standards-sdk.es58.js.map +1 -1
  79. package/dist/es/standards-sdk.es59.js +193 -25
  80. package/dist/es/standards-sdk.es59.js.map +1 -1
  81. package/dist/es/standards-sdk.es60.js +436 -24
  82. package/dist/es/standards-sdk.es60.js.map +1 -1
  83. package/dist/es/standards-sdk.es61.js +23 -36
  84. package/dist/es/standards-sdk.es61.js.map +1 -1
  85. package/dist/es/standards-sdk.es62.js +131 -93
  86. package/dist/es/standards-sdk.es62.js.map +1 -1
  87. package/dist/es/standards-sdk.es63.js +18 -2
  88. package/dist/es/standards-sdk.es63.js.map +1 -1
  89. package/dist/es/standards-sdk.es64.js +28 -15
  90. package/dist/es/standards-sdk.es64.js.map +1 -1
  91. package/dist/es/standards-sdk.es65.js +24 -404
  92. package/dist/es/standards-sdk.es65.js.map +1 -1
  93. package/dist/es/standards-sdk.es66.js +21 -2282
  94. package/dist/es/standards-sdk.es66.js.map +1 -1
  95. package/dist/es/standards-sdk.es67.js +38 -158
  96. package/dist/es/standards-sdk.es67.js.map +1 -1
  97. package/dist/es/standards-sdk.es68.js +18 -3
  98. package/dist/es/standards-sdk.es68.js.map +1 -1
  99. package/dist/es/standards-sdk.es69.js +54 -357
  100. package/dist/es/standards-sdk.es69.js.map +1 -1
  101. package/dist/es/standards-sdk.es7.js +3 -3
  102. package/dist/es/standards-sdk.es70.js +1287 -4
  103. package/dist/es/standards-sdk.es70.js.map +1 -1
  104. package/dist/es/standards-sdk.es71.js +27 -174
  105. package/dist/es/standards-sdk.es71.js.map +1 -1
  106. package/dist/es/standards-sdk.es72.js +5 -80
  107. package/dist/es/standards-sdk.es72.js.map +1 -1
  108. package/dist/es/standards-sdk.es73.js +149 -104
  109. package/dist/es/standards-sdk.es73.js.map +1 -1
  110. package/dist/es/standards-sdk.es74.js +786 -45
  111. package/dist/es/standards-sdk.es74.js.map +1 -1
  112. package/dist/es/standards-sdk.es75.js +100 -9
  113. package/dist/es/standards-sdk.es75.js.map +1 -1
  114. package/dist/es/standards-sdk.es76.js +2 -97
  115. package/dist/es/standards-sdk.es76.js.map +1 -1
  116. package/dist/es/standards-sdk.es77.js +15 -3
  117. package/dist/es/standards-sdk.es77.js.map +1 -1
  118. package/dist/es/standards-sdk.es78.js +409 -2
  119. package/dist/es/standards-sdk.es78.js.map +1 -1
  120. package/dist/es/standards-sdk.es79.js +163 -102
  121. package/dist/es/standards-sdk.es79.js.map +1 -1
  122. package/dist/es/standards-sdk.es8.js +3 -3
  123. package/dist/es/standards-sdk.es8.js.map +1 -1
  124. package/dist/es/standards-sdk.es80.js +138 -69
  125. package/dist/es/standards-sdk.es80.js.map +1 -1
  126. package/dist/es/standards-sdk.es81.js +2282 -6
  127. package/dist/es/standards-sdk.es81.js.map +1 -1
  128. package/dist/es/standards-sdk.es82.js +163 -4
  129. package/dist/es/standards-sdk.es82.js.map +1 -1
  130. package/dist/es/standards-sdk.es83.js +26 -215
  131. package/dist/es/standards-sdk.es83.js.map +1 -1
  132. package/dist/es/standards-sdk.es84.js +60 -55
  133. package/dist/es/standards-sdk.es84.js.map +1 -1
  134. package/dist/es/standards-sdk.es85.js +50 -69
  135. package/dist/es/standards-sdk.es85.js.map +1 -1
  136. package/dist/es/standards-sdk.es86.js +8 -7134
  137. package/dist/es/standards-sdk.es86.js.map +1 -1
  138. package/dist/es/standards-sdk.es87.js +60 -27
  139. package/dist/es/standards-sdk.es87.js.map +1 -1
  140. package/dist/es/standards-sdk.es88.js +6 -63
  141. package/dist/es/standards-sdk.es88.js.map +1 -1
  142. package/dist/es/standards-sdk.es89.js +12 -47
  143. package/dist/es/standards-sdk.es89.js.map +1 -1
  144. package/dist/es/standards-sdk.es90.js +7 -10
  145. package/dist/es/standards-sdk.es90.js.map +1 -1
  146. package/dist/es/standards-sdk.es91.js +41 -61
  147. package/dist/es/standards-sdk.es91.js.map +1 -1
  148. package/dist/es/standards-sdk.es92.js +2 -6
  149. package/dist/es/standards-sdk.es92.js.map +1 -1
  150. package/dist/es/standards-sdk.es93.js +134 -13
  151. package/dist/es/standards-sdk.es93.js.map +1 -1
  152. package/dist/es/standards-sdk.es94.js +171 -6
  153. package/dist/es/standards-sdk.es94.js.map +1 -1
  154. package/dist/es/standards-sdk.es95.js +21 -45
  155. package/dist/es/standards-sdk.es95.js.map +1 -1
  156. package/dist/es/standards-sdk.es96.js +27 -2
  157. package/dist/es/standards-sdk.es96.js.map +1 -1
  158. package/dist/es/standards-sdk.es97.js +26 -136
  159. package/dist/es/standards-sdk.es97.js.map +1 -1
  160. package/dist/es/standards-sdk.es98.js +38 -172
  161. package/dist/es/standards-sdk.es98.js.map +1 -1
  162. package/dist/umd/hcs-10/browser.d.ts.map +1 -1
  163. package/dist/umd/hcs-10/types.d.ts +19 -48
  164. package/dist/umd/hcs-10/types.d.ts.map +1 -1
  165. package/dist/umd/standards-sdk.umd.js.map +1 -1
  166. package/package.json +1 -1
@@ -1,29 +1,441 @@
1
- const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2
- const _32n = /* @__PURE__ */ BigInt(32);
3
- function fromBig(n, le = false) {
4
- if (le)
5
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
6
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
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
+ 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 __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.es73.js";
14
+ import { assert, assertArgument } from "./standards-sdk.es40.js";
15
+ import { concat, getBytesCopy, hexlify } from "./standards-sdk.es41.js";
16
+ import { defineProperties } from "./standards-sdk.es71.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);
24
+ }
25
+ function setNames(result, names) {
26
+ resultNames.set(result, names);
27
+ }
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;
7
32
  }
8
- function split(lst, le = false) {
9
- let Ah = new Uint32Array(lst.length);
10
- let Al = new Uint32Array(lst.length);
11
- for (let i = 0; i < lst.length; i++) {
12
- const { h, l } = fromBig(lst[i], le);
13
- [Ah[i], Al[i]] = [h, l];
14
- }
15
- return [Ah, Al];
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;
49
+ }
50
+ return accum;
51
+ }, {});
16
52
  }
17
- const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
18
- const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
19
- const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
20
- const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
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;
66
+ }
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;
127
+ }
128
+ /**
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;
147
+ }
148
+ /**
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.
155
+ */
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
+ }, {});
164
+ }
165
+ /**
166
+ * @_ignore
167
+ */
168
+ slice(start, end) {
169
+ if (start == null) {
170
+ start = 0;
171
+ }
172
+ if (start < 0) {
173
+ start += this.length;
174
+ if (start < 0) {
175
+ start = 0;
176
+ }
177
+ }
178
+ if (end == null) {
179
+ end = this.length;
180
+ }
181
+ if (end < 0) {
182
+ end += this.length;
183
+ if (end < 0) {
184
+ end = 0;
185
+ }
186
+ }
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);
197
+ }
198
+ /**
199
+ * @_ignore
200
+ */
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);
215
+ }
216
+ /**
217
+ * @_ignore
218
+ */
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;
229
+ }
230
+ /**
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;
248
+ }
249
+ /**
250
+ * Creates a new [[Result]] for %%items%% with each entry
251
+ * also accessible by its corresponding name in %%keys%%.
252
+ */
253
+ static fromItems(items, keys) {
254
+ return new _Result(_guard, items, keys);
255
+ }
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);
291
+ }
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
+ };
333
+ }
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));
394
+ }
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
+ });
429
+ }
430
+ }
431
+ return __privateGet(this, _data2).slice(__privateGet(this, _offset), __privateGet(this, _offset) + alignedLength);
432
+ };
433
+ let Reader = _Reader;
21
434
  export {
22
- fromBig,
23
- rotlBH,
24
- rotlBL,
25
- rotlSH,
26
- rotlSL,
27
- split
435
+ Coder,
436
+ Reader,
437
+ Result,
438
+ WordSize,
439
+ Writer
28
440
  };
29
441
  //# sourceMappingURL=standards-sdk.es60.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es60.js","sources":["../../node_modules/@noble/hashes/esm/_u64.js"],"sourcesContent":["const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map"],"names":[],"mappings":"AAAA,MAAM,aAA6B,uBAAO,KAAK,KAAK,CAAC;AACrD,MAAM,OAAuB,uBAAO,EAAE;AAEtC,SAAS,QAAQ,GAAG,KAAK,OAAO;AAC5B,MAAI;AACA,WAAO,EAAE,GAAG,OAAO,IAAI,UAAU,GAAG,GAAG,OAAQ,KAAK,OAAQ,UAAU,EAAG;AAC7E,SAAO,EAAE,GAAG,OAAQ,KAAK,OAAQ,UAAU,IAAI,GAAG,GAAG,OAAO,IAAI,UAAU,IAAI,EAAG;AACrF;AACA,SAAS,MAAM,KAAK,KAAK,OAAO;AAC5B,MAAI,KAAK,IAAI,YAAY,IAAI,MAAM;AACnC,MAAI,KAAK,IAAI,YAAY,IAAI,MAAM;AACnC,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACjC,UAAM,EAAE,GAAG,EAAG,IAAG,QAAQ,IAAI,CAAC,GAAG,EAAE;AACnC,KAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAAA,EAC9B;AACI,SAAO,CAAC,IAAI,EAAE;AAClB;AAeK,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAK,IAAM,MAAO,KAAK;AAC/C,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAK,IAAM,MAAO,KAAK;AAE/C,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAM,IAAI,KAAQ,MAAO,KAAK;AACtD,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAM,IAAI,KAAQ,MAAO,KAAK;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"standards-sdk.es60.js","sources":["../../node_modules/ethers/lib.esm/abi/coders/abstract-coder.js"],"sourcesContent":["import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument\n/*, isError*/\n } from \"../../utils/index.js\";\n/**\n * @_ignore:\n */\nexport const WordSize = 32;\nconst Padding = new Uint8Array(WordSize);\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [\"then\"];\nconst _guard = {};\nconst resultNames = new WeakMap();\nfunction getNames(result) {\n return resultNames.get(result);\n}\nfunction setNames(result, names) {\n resultNames.set(result, names);\n}\nfunction throwError(name, error) {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);\n wrapped.error = error;\n throw wrapped;\n}\nfunction toObject(names, items, deep) {\n if (names.indexOf(null) >= 0) {\n return items.map((item, index) => {\n if (item instanceof Result) {\n return toObject(getNames(item), item, deep);\n }\n return item;\n });\n }\n return names.reduce((accum, name, index) => {\n let item = items.getValue(name);\n if (!(name in accum)) {\n if (deep && item instanceof Result) {\n item = toObject(getNames(item), item, deep);\n }\n accum[name] = item;\n }\n return accum;\n }, {});\n}\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array {\n // No longer used; but cannot be removed as it will remove the\n // #private field from the .d.ts which may break backwards\n // compatibility\n #names;\n /**\n * @private\n */\n constructor(...args) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n // constructor(guard: any, items: Array<any>, keys?: Array<null | string>);\n const guard = args[0];\n let items = args[1];\n let names = (args[2] || []).slice();\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [];\n wrap = false;\n }\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => { this[index] = item; });\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof (name) === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, (new Map()));\n // Remove any key thats not unique\n setNames(this, Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n })));\n // Dummy operations to prevent TypeScript from complaining\n this.#names = [];\n if (this.#names == null) {\n void (this.#names);\n }\n if (!wrap) {\n return;\n }\n // A wrapped Result is immutable\n Object.freeze(this);\n // Proxy indices and names so we can trap deferred errors\n const proxy = new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof (prop) === \"string\") {\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n return item;\n }\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function (...args) {\n return value.apply((this === receiver) ? target : this, args);\n };\n }\n else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply((this === receiver) ? target : this, [prop]);\n }\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n setNames(proxy, getNames(this));\n return proxy;\n }\n /**\n * Returns the Result as a normal Array. If %%deep%%, any children\n * which are Result objects are also converted to a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray(deep) {\n const result = [];\n this.forEach((item, index) => {\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n if (deep && item instanceof Result) {\n item = item.toArray(deep);\n }\n result.push(item);\n });\n return result;\n }\n /**\n * Returns the Result as an Object with each name-value pair. If\n * %%deep%%, any children which are Result objects are also\n * converted to an Object.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject(deep) {\n const names = getNames(this);\n return names.reduce((accum, name, index) => {\n assert(name != null, `value at index ${index} unnamed`, \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\"\n });\n return toObject(names, this, deep);\n }, {});\n }\n /**\n * @_ignore\n */\n slice(start, end) {\n if (start == null) {\n start = 0;\n }\n if (start < 0) {\n start += this.length;\n if (start < 0) {\n start = 0;\n }\n }\n if (end == null) {\n end = this.length;\n }\n if (end < 0) {\n end += this.length;\n if (end < 0) {\n end = 0;\n }\n }\n if (end > this.length) {\n end = this.length;\n }\n const _names = getNames(this);\n const result = [], names = [];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(_names[i]);\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n filter(callback, thisArg) {\n const _names = getNames(this);\n const result = [], names = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(_names[i]);\n }\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n map(callback, thisArg) {\n const result = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n result.push(callback.call(thisArg, item, i, this));\n }\n return result;\n }\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name) {\n const index = getNames(this).indexOf(name);\n if (index === -1) {\n return undefined;\n }\n const value = this[index];\n if (value instanceof Error) {\n throwError(`property ${JSON.stringify(name)}`, value.error);\n }\n return value;\n }\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items, keys) {\n return new Result(_guard, items, keys);\n }\n}\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result) {\n // Find the first error (if any)\n const errors = [];\n const checkErrors = function (path, object) {\n if (!Array.isArray(object)) {\n return;\n }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n try {\n checkErrors(childPath, object[key]);\n }\n catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n };\n checkErrors([], result);\n return errors;\n}\nfunction getValue(value) {\n let bytes = toBeArray(value);\n assert(bytes.length <= WordSize, \"value out-of-bounds\", \"BUFFER_OVERRUN\", { buffer: bytes, length: WordSize, offset: bytes.length });\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));\n }\n return bytes;\n}\n/**\n * @_ignore\n */\nexport class Coder {\n // The coder name:\n // - address, uint256, tuple, array, etc.\n name;\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n type;\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n localName;\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n dynamic;\n constructor(name, type, localName, dynamic) {\n defineProperties(this, { name, type, localName, dynamic }, {\n name: \"string\", type: \"string\", localName: \"string\", dynamic: \"boolean\"\n });\n }\n _throwError(message, value) {\n assertArgument(false, message, this.localName, value);\n }\n}\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data;\n #dataLength;\n constructor() {\n this.#data = [];\n this.#dataLength = 0;\n }\n get data() {\n return concat(this.#data);\n }\n get length() { return this.#dataLength; }\n #writeData(data) {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n appendWriter(writer) {\n return this.#writeData(getBytesCopy(writer.data));\n }\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value) {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));\n }\n return this.#writeData(bytes);\n }\n // Numeric item; pad on the left *to* WordSize\n writeValue(value) {\n return this.#writeData(getValue(value));\n }\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue() {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n allowLoose;\n #data;\n #offset;\n #bytesRead;\n #parent;\n #maxInflation;\n constructor(data, allowLoose, maxInflation) {\n defineProperties(this, { allowLoose: !!allowLoose });\n this.#data = getBytesCopy(data);\n this.#bytesRead = 0;\n this.#parent = null;\n this.#maxInflation = (maxInflation != null) ? maxInflation : 1024;\n this.#offset = 0;\n }\n get data() { return hexlify(this.#data); }\n get dataLength() { return this.#data.length; }\n get consumed() { return this.#offset; }\n get bytes() { return new Uint8Array(this.#data); }\n #incrementBytesRead(count) {\n if (this.#parent) {\n return this.#parent.#incrementBytesRead(count);\n }\n this.#bytesRead += count;\n // Check for excessive inflation (see: #4537)\n assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\\/github.com/ethers-io/ethers.js/issues/4537 )`, \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data), offset: this.#offset,\n length: count, info: {\n bytesRead: this.#bytesRead,\n dataLength: this.dataLength\n }\n });\n }\n #peekBytes(offset, length, loose) {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {\n alignedLength = length;\n }\n else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength);\n }\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset) {\n const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);\n reader.#parent = this;\n return reader;\n }\n // Read bytes\n readBytes(length, loose) {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#incrementBytesRead(length);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n // Read a numeric values\n readValue() {\n return toBigInt(this.readBytes(WordSize));\n }\n readIndex() {\n return toNumber(this.readBytes(WordSize));\n }\n}\n//# sourceMappingURL=abstract-coder.js.map"],"names":["args","_names","_data"],"mappings":";;;;;;;;;;;;;;;;AAMY,MAAC,WAAW;AACxB,MAAM,UAAU,IAAI,WAAW,QAAQ;AAGvC,MAAM,iBAAiB,CAAC,MAAM;AAC9B,MAAM,SAAS,CAAE;AACjB,MAAM,cAAc,oBAAI,QAAS;AACjC,SAAS,SAAS,QAAQ;AACtB,SAAO,YAAY,IAAI,MAAM;AACjC;AACA,SAAS,SAAS,QAAQ,OAAO;AAC7B,cAAY,IAAI,QAAQ,KAAK;AACjC;AACA,SAAS,WAAW,MAAM,OAAO;AAC7B,QAAM,UAAU,IAAI,MAAM,0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KAAK,cAAc,SAAS,mBAAK,WAAU,UAAU,mBAAKA,QAAM,QAAQ;AACxE,sBAAgB;AAAA,IAChC,OACiB;AACD,aAAO,OAAO,sBAAsB,kBAAkB;AAAA,QAClD,QAAQ,aAAa,mBAAKA,OAAK;AAAA,QAC/B,QAAQ,mBAAKA,QAAM;AAAA,QACnB,QAAQ,mBAAK,WAAU;AAAA,MAC3C,CAAiB;AAAA,IACjB;AAAA,EACA;AACQ,SAAO,mBAAKA,QAAM,MAAM,mBAAK,UAAS,mBAAK,WAAU,aAAa;AAC1E;AApDO,IAAM,SAAN;","x_google_ignoreList":[0]}
@@ -1,41 +1,28 @@
1
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
- const u8a = (a) => a instanceof Uint8Array;
3
- const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
4
- const isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
5
- if (!isLE)
6
- throw new Error("Non little-endian hardware is not supported");
7
- function utf8ToBytes(str) {
8
- if (typeof str !== "string")
9
- throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
10
- return new Uint8Array(new TextEncoder().encode(str));
11
- }
12
- function toBytes(data) {
13
- if (typeof data === "string")
14
- data = utf8ToBytes(data);
15
- if (!u8a(data))
16
- throw new Error(`expected Uint8Array, got ${typeof data}`);
17
- return data;
18
- }
19
- class Hash {
20
- // Safe version that clones internal state
21
- clone() {
22
- return this._cloneInto();
1
+ import { toBeHex } from "./standards-sdk.es73.js";
2
+ import { Typed } from "./standards-sdk.es74.js";
3
+ import { Coder } from "./standards-sdk.es60.js";
4
+ import { getAddress } from "./standards-sdk.es38.js";
5
+ class AddressCoder extends Coder {
6
+ constructor(localName) {
7
+ super("address", "address", localName, false);
8
+ }
9
+ defaultValue() {
10
+ return "0x0000000000000000000000000000000000000000";
11
+ }
12
+ encode(writer, _value) {
13
+ let value = Typed.dereference(_value, "string");
14
+ try {
15
+ value = getAddress(value);
16
+ } catch (error) {
17
+ return this._throwError(error.message, _value);
18
+ }
19
+ return writer.writeValue(value);
20
+ }
21
+ decode(reader) {
22
+ return getAddress(toBeHex(reader.readValue(), 20));
23
23
  }
24
- }
25
- function wrapConstructor(hashCons) {
26
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
27
- const tmp = hashCons();
28
- hashC.outputLen = tmp.outputLen;
29
- hashC.blockLen = tmp.blockLen;
30
- hashC.create = () => hashCons();
31
- return hashC;
32
24
  }
33
25
  export {
34
- Hash,
35
- isLE,
36
- toBytes,
37
- u32,
38
- utf8ToBytes,
39
- wrapConstructor
26
+ AddressCoder
40
27
  };
41
28
  //# sourceMappingURL=standards-sdk.es61.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es61.js","sources":["../../node_modules/@noble/hashes/esm/utils.js"],"sourcesContent":["/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map"],"names":[],"mappings":"AAAA;AAQA,MAAM,MAAM,CAAC,MAAM,aAAa;AAGpB,MAAC,MAAM,CAAC,QAAQ,IAAI,YAAY,IAAI,QAAQ,IAAI,YAAY,KAAK,MAAM,IAAI,aAAa,CAAC,CAAC;AAO1F,MAAC,OAAO,IAAI,WAAW,IAAI,YAAY,CAAC,SAAU,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM;AAChF,IAAI,CAAC;AACD,QAAM,IAAI,MAAM,6CAA6C;AAuD1D,SAAS,YAAY,KAAK;AAC7B,MAAI,OAAO,QAAQ;AACf,UAAM,IAAI,MAAM,oCAAoC,OAAO,GAAG,EAAE;AACpE,SAAO,IAAI,WAAW,IAAI,YAAa,EAAC,OAAO,GAAG,CAAC;AACvD;AAMO,SAAS,QAAQ,MAAM;AAC1B,MAAI,OAAO,SAAS;AAChB,WAAO,YAAY,IAAI;AAC3B,MAAI,CAAC,IAAI,IAAI;AACT,UAAM,IAAI,MAAM,4BAA4B,OAAO,IAAI,EAAE;AAC7D,SAAO;AACX;AAgBO,MAAM,KAAK;AAAA;AAAA,EAEd,QAAQ;AACJ,WAAO,KAAK,WAAY;AAAA,EAChC;AACA;AAQO,SAAS,gBAAgB,UAAU;AACtC,QAAM,QAAQ,CAAC,QAAQ,SAAU,EAAC,OAAO,QAAQ,GAAG,CAAC,EAAE,OAAQ;AAC/D,QAAM,MAAM,SAAU;AACtB,QAAM,YAAY,IAAI;AACtB,QAAM,WAAW,IAAI;AACrB,QAAM,SAAS,MAAM,SAAU;AAC/B,SAAO;AACX;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"standards-sdk.es61.js","sources":["../../node_modules/ethers/lib.esm/abi/coders/address.js"],"sourcesContent":["import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n constructor(localName) {\n super(\"address\", \"address\", localName, false);\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000\";\n }\n encode(writer, _value) {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n }\n catch (error) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n return getAddress(toBeHex(reader.readValue(), 20));\n }\n}\n//# sourceMappingURL=address.js.map"],"names":[],"mappings":";;;;AAOO,MAAM,qBAAqB,MAAM;AAAA,EACpC,YAAY,WAAW;AACnB,UAAM,WAAW,WAAW,WAAW,KAAK;AAAA,EACpD;AAAA,EACI,eAAe;AACX,WAAO;AAAA,EACf;AAAA,EACI,OAAO,QAAQ,QAAQ;AACnB,QAAI,QAAQ,MAAM,YAAY,QAAQ,QAAQ;AAC9C,QAAI;AACA,cAAQ,WAAW,KAAK;AAAA,IACpC,SACe,OAAO;AACV,aAAO,KAAK,YAAY,MAAM,SAAS,MAAM;AAAA,IACzD;AACQ,WAAO,OAAO,WAAW,KAAK;AAAA,EACtC;AAAA,EACI,OAAO,QAAQ;AACX,WAAO,WAAW,QAAQ,OAAO,UAAW,GAAE,EAAE,CAAC;AAAA,EACzD;AACA;","x_google_ignoreList":[0]}