@hashgraphonline/standards-sdk 0.0.106 → 0.0.107

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 (214) hide show
  1. package/dist/es/standards-sdk.es100.js +58 -129
  2. package/dist/es/standards-sdk.es100.js.map +1 -1
  3. package/dist/es/standards-sdk.es101.js +5 -171
  4. package/dist/es/standards-sdk.es101.js.map +1 -1
  5. package/dist/es/standards-sdk.es102.js +15 -2282
  6. package/dist/es/standards-sdk.es102.js.map +1 -1
  7. package/dist/es/standards-sdk.es103.js +4 -10
  8. package/dist/es/standards-sdk.es103.js.map +1 -1
  9. package/dist/es/standards-sdk.es104.js +45 -13
  10. package/dist/es/standards-sdk.es104.js.map +1 -1
  11. package/dist/es/standards-sdk.es105.js +2 -32
  12. package/dist/es/standards-sdk.es105.js.map +1 -1
  13. package/dist/es/standards-sdk.es106.js +135 -14
  14. package/dist/es/standards-sdk.es106.js.map +1 -1
  15. package/dist/es/standards-sdk.es107.js +172 -4
  16. package/dist/es/standards-sdk.es107.js.map +1 -1
  17. package/dist/es/standards-sdk.es108.js +13 -4
  18. package/dist/es/standards-sdk.es108.js.map +1 -1
  19. package/dist/es/standards-sdk.es109.js +13 -16
  20. package/dist/es/standards-sdk.es109.js.map +1 -1
  21. package/dist/es/standards-sdk.es110.js +31 -4
  22. package/dist/es/standards-sdk.es110.js.map +1 -1
  23. package/dist/es/standards-sdk.es111.js +15 -39
  24. package/dist/es/standards-sdk.es111.js.map +1 -1
  25. package/dist/es/standards-sdk.es112.js +4 -40
  26. package/dist/es/standards-sdk.es112.js.map +1 -1
  27. package/dist/es/standards-sdk.es113.js +4 -37
  28. package/dist/es/standards-sdk.es113.js.map +1 -1
  29. package/dist/es/standards-sdk.es114.js +15 -77
  30. package/dist/es/standards-sdk.es114.js.map +1 -1
  31. package/dist/es/standards-sdk.es115.js +5 -3
  32. package/dist/es/standards-sdk.es115.js.map +1 -1
  33. package/dist/es/standards-sdk.es116.js +39 -2
  34. package/dist/es/standards-sdk.es116.js.map +1 -1
  35. package/dist/es/standards-sdk.es117.js +40 -2
  36. package/dist/es/standards-sdk.es117.js.map +1 -1
  37. package/dist/es/standards-sdk.es118.js +37 -34
  38. package/dist/es/standards-sdk.es118.js.map +1 -1
  39. package/dist/es/standards-sdk.es119.js +74 -29
  40. package/dist/es/standards-sdk.es119.js.map +1 -1
  41. package/dist/es/standards-sdk.es120.js +3 -9
  42. package/dist/es/standards-sdk.es120.js.map +1 -1
  43. package/dist/es/standards-sdk.es121.js +2 -34
  44. package/dist/es/standards-sdk.es121.js.map +1 -1
  45. package/dist/es/standards-sdk.es122.js +2 -10
  46. package/dist/es/standards-sdk.es122.js.map +1 -1
  47. package/dist/es/standards-sdk.es123.js +33 -10
  48. package/dist/es/standards-sdk.es123.js.map +1 -1
  49. package/dist/es/standards-sdk.es124.js +31 -16
  50. package/dist/es/standards-sdk.es124.js.map +1 -1
  51. package/dist/es/standards-sdk.es125.js +9 -6
  52. package/dist/es/standards-sdk.es125.js.map +1 -1
  53. package/dist/es/standards-sdk.es126.js +34 -9
  54. package/dist/es/standards-sdk.es126.js.map +1 -1
  55. package/dist/es/standards-sdk.es13.js +2 -2
  56. package/dist/es/standards-sdk.es15.js +1 -1
  57. package/dist/es/standards-sdk.es18.js +2 -2
  58. package/dist/es/standards-sdk.es19.js +88 -1
  59. package/dist/es/standards-sdk.es19.js.map +1 -1
  60. package/dist/es/standards-sdk.es20.js +1 -1
  61. package/dist/es/standards-sdk.es21.js +2 -2
  62. package/dist/es/standards-sdk.es24.js +6 -6
  63. package/dist/es/standards-sdk.es26.js +3 -7190
  64. package/dist/es/standards-sdk.es26.js.map +1 -1
  65. package/dist/es/standards-sdk.es27.js +4168 -36
  66. package/dist/es/standards-sdk.es27.js.map +1 -1
  67. package/dist/es/standards-sdk.es28.js +7163 -21
  68. package/dist/es/standards-sdk.es28.js.map +1 -1
  69. package/dist/es/standards-sdk.es29.js +9 -5
  70. package/dist/es/standards-sdk.es29.js.map +1 -1
  71. package/dist/es/standards-sdk.es30.js +2 -10
  72. package/dist/es/standards-sdk.es30.js.map +1 -1
  73. package/dist/es/standards-sdk.es31.js +36 -3
  74. package/dist/es/standards-sdk.es31.js.map +1 -1
  75. package/dist/es/standards-sdk.es32.js +48 -4168
  76. package/dist/es/standards-sdk.es32.js.map +1 -1
  77. package/dist/es/standards-sdk.es33.js +5 -9
  78. package/dist/es/standards-sdk.es33.js.map +1 -1
  79. package/dist/es/standards-sdk.es34.js +10 -2
  80. package/dist/es/standards-sdk.es34.js.map +1 -1
  81. package/dist/es/standards-sdk.es35.js +2 -419
  82. package/dist/es/standards-sdk.es35.js.map +1 -1
  83. package/dist/es/standards-sdk.es36.js +101 -2
  84. package/dist/es/standards-sdk.es36.js.map +1 -1
  85. package/dist/es/standards-sdk.es37.js +2 -120
  86. package/dist/es/standards-sdk.es37.js.map +1 -1
  87. package/dist/es/standards-sdk.es38.js +15 -7135
  88. package/dist/es/standards-sdk.es38.js.map +1 -1
  89. package/dist/es/standards-sdk.es39.js +408 -3
  90. package/dist/es/standards-sdk.es39.js.map +1 -1
  91. package/dist/es/standards-sdk.es40.js +2282 -3
  92. package/dist/es/standards-sdk.es40.js.map +1 -1
  93. package/dist/es/standards-sdk.es41.js +164 -2
  94. package/dist/es/standards-sdk.es41.js.map +1 -1
  95. package/dist/es/standards-sdk.es42.js +21 -82
  96. package/dist/es/standards-sdk.es42.js.map +1 -1
  97. package/dist/es/standards-sdk.es43.js +172 -21
  98. package/dist/es/standards-sdk.es43.js.map +1 -1
  99. package/dist/es/standards-sdk.es44.js +73 -130
  100. package/dist/es/standards-sdk.es44.js.map +1 -1
  101. package/dist/es/standards-sdk.es45.js +185 -81
  102. package/dist/es/standards-sdk.es45.js.map +1 -1
  103. package/dist/es/standards-sdk.es46.js +431 -167
  104. package/dist/es/standards-sdk.es46.js.map +1 -1
  105. package/dist/es/standards-sdk.es47.js +21 -191
  106. package/dist/es/standards-sdk.es47.js.map +1 -1
  107. package/dist/es/standards-sdk.es48.js +115 -414
  108. package/dist/es/standards-sdk.es48.js.map +1 -1
  109. package/dist/es/standards-sdk.es49.js +8 -15
  110. package/dist/es/standards-sdk.es49.js.map +1 -1
  111. package/dist/es/standards-sdk.es50.js +22 -132
  112. package/dist/es/standards-sdk.es50.js.map +1 -1
  113. package/dist/es/standards-sdk.es51.js +20 -9
  114. package/dist/es/standards-sdk.es51.js.map +1 -1
  115. package/dist/es/standards-sdk.es52.js +13 -21
  116. package/dist/es/standards-sdk.es52.js.map +1 -1
  117. package/dist/es/standards-sdk.es53.js +28 -13
  118. package/dist/es/standards-sdk.es53.js.map +1 -1
  119. package/dist/es/standards-sdk.es54.js +10 -13
  120. package/dist/es/standards-sdk.es54.js.map +1 -1
  121. package/dist/es/standards-sdk.es55.js +49 -32
  122. package/dist/es/standards-sdk.es55.js.map +1 -1
  123. package/dist/es/standards-sdk.es56.js +1284 -13
  124. package/dist/es/standards-sdk.es56.js.map +1 -1
  125. package/dist/es/standards-sdk.es57.js +139 -52
  126. package/dist/es/standards-sdk.es57.js.map +1 -1
  127. package/dist/es/standards-sdk.es58.js +79 -1284
  128. package/dist/es/standards-sdk.es58.js.map +1 -1
  129. package/dist/es/standards-sdk.es60.js +1 -1
  130. package/dist/es/standards-sdk.es61.js +1 -1
  131. package/dist/es/standards-sdk.es62.js +1 -1
  132. package/dist/es/standards-sdk.es63.js +2 -2
  133. package/dist/es/standards-sdk.es64.js +22 -359
  134. package/dist/es/standards-sdk.es64.js.map +1 -1
  135. package/dist/es/standards-sdk.es65.js +25 -5
  136. package/dist/es/standards-sdk.es65.js.map +1 -1
  137. package/dist/es/standards-sdk.es66.js +36 -177
  138. package/dist/es/standards-sdk.es66.js.map +1 -1
  139. package/dist/es/standards-sdk.es67.js +16 -76
  140. package/dist/es/standards-sdk.es67.js.map +1 -1
  141. package/dist/es/standards-sdk.es68.js +3 -114
  142. package/dist/es/standards-sdk.es68.js.map +1 -1
  143. package/dist/es/standards-sdk.es69.js +3 -51
  144. package/dist/es/standards-sdk.es69.js.map +1 -1
  145. package/dist/es/standards-sdk.es7.js +3 -3
  146. package/dist/es/standards-sdk.es70.js +7136 -10
  147. package/dist/es/standards-sdk.es70.js.map +1 -1
  148. package/dist/es/standards-sdk.es71.js +9 -96
  149. package/dist/es/standards-sdk.es71.js.map +1 -1
  150. package/dist/es/standards-sdk.es72.js +10 -3
  151. package/dist/es/standards-sdk.es72.js.map +1 -1
  152. package/dist/es/standards-sdk.es73.js +18 -2
  153. package/dist/es/standards-sdk.es73.js.map +1 -1
  154. package/dist/es/standards-sdk.es74.js +4 -111
  155. package/dist/es/standards-sdk.es74.js.map +1 -1
  156. package/dist/es/standards-sdk.es75.js +8 -73
  157. package/dist/es/standards-sdk.es75.js.map +1 -1
  158. package/dist/es/standards-sdk.es76.js +417 -4
  159. package/dist/es/standards-sdk.es76.js.map +1 -1
  160. package/dist/es/standards-sdk.es77.js +2 -5
  161. package/dist/es/standards-sdk.es77.js.map +1 -1
  162. package/dist/es/standards-sdk.es78.js +109 -210
  163. package/dist/es/standards-sdk.es78.js.map +1 -1
  164. package/dist/es/standards-sdk.es79.js +361 -55
  165. package/dist/es/standards-sdk.es79.js.map +1 -1
  166. package/dist/es/standards-sdk.es8.js +2 -2
  167. package/dist/es/standards-sdk.es80.js +6 -69
  168. package/dist/es/standards-sdk.es80.js.map +1 -1
  169. package/dist/es/standards-sdk.es81.js +177 -25
  170. package/dist/es/standards-sdk.es81.js.map +1 -1
  171. package/dist/es/standards-sdk.es82.js +79 -24
  172. package/dist/es/standards-sdk.es82.js.map +1 -1
  173. package/dist/es/standards-sdk.es83.js +112 -36
  174. package/dist/es/standards-sdk.es83.js.map +1 -1
  175. package/dist/es/standards-sdk.es84.js +48 -17
  176. package/dist/es/standards-sdk.es84.js.map +1 -1
  177. package/dist/es/standards-sdk.es85.js +9 -100
  178. package/dist/es/standards-sdk.es85.js.map +1 -1
  179. package/dist/es/standards-sdk.es86.js +97 -2
  180. package/dist/es/standards-sdk.es86.js.map +1 -1
  181. package/dist/es/standards-sdk.es87.js +3 -15
  182. package/dist/es/standards-sdk.es87.js.map +1 -1
  183. package/dist/es/standards-sdk.es88.js +2 -409
  184. package/dist/es/standards-sdk.es88.js.map +1 -1
  185. package/dist/es/standards-sdk.es89.js +98 -149
  186. package/dist/es/standards-sdk.es89.js.map +1 -1
  187. package/dist/es/standards-sdk.es9.js +1 -1
  188. package/dist/es/standards-sdk.es90.js +70 -28
  189. package/dist/es/standards-sdk.es90.js.map +1 -1
  190. package/dist/es/standards-sdk.es91.js +5 -62
  191. package/dist/es/standards-sdk.es91.js.map +1 -1
  192. package/dist/es/standards-sdk.es92.js +4 -49
  193. package/dist/es/standards-sdk.es92.js.map +1 -1
  194. package/dist/es/standards-sdk.es93.js +219 -8
  195. package/dist/es/standards-sdk.es93.js.map +1 -1
  196. package/dist/es/standards-sdk.es94.js +52 -59
  197. package/dist/es/standards-sdk.es94.js.map +1 -1
  198. package/dist/es/standards-sdk.es95.js +68 -5
  199. package/dist/es/standards-sdk.es95.js.map +1 -1
  200. package/dist/es/standards-sdk.es96.js +30 -13
  201. package/dist/es/standards-sdk.es96.js.map +1 -1
  202. package/dist/es/standards-sdk.es97.js +63 -7
  203. package/dist/es/standards-sdk.es97.js.map +1 -1
  204. package/dist/es/standards-sdk.es98.js +47 -42
  205. package/dist/es/standards-sdk.es98.js.map +1 -1
  206. package/dist/es/standards-sdk.es99.js +10 -2
  207. package/dist/es/standards-sdk.es99.js.map +1 -1
  208. package/dist/es/utils/transaction-parser.d.ts +25 -0
  209. package/dist/es/utils/transaction-parser.d.ts.map +1 -1
  210. package/dist/umd/standards-sdk.umd.js +1 -1
  211. package/dist/umd/standards-sdk.umd.js.map +1 -1
  212. package/dist/umd/utils/transaction-parser.d.ts +25 -0
  213. package/dist/umd/utils/transaction-parser.d.ts.map +1 -1
  214. package/package.json +2 -2
@@ -1,177 +1,441 @@
1
- import { number, exists, bytes, output } from "./standards-sdk.es81.js";
2
- import { rotlSH, rotlSL, rotlBH, rotlBL, split } from "./standards-sdk.es82.js";
3
- import { wrapConstructor, Hash, u32, toBytes } from "./standards-sdk.es83.js";
4
- const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
5
- const _0n = /* @__PURE__ */ BigInt(0);
6
- const _1n = /* @__PURE__ */ BigInt(1);
7
- const _2n = /* @__PURE__ */ BigInt(2);
8
- const _7n = /* @__PURE__ */ BigInt(7);
9
- const _256n = /* @__PURE__ */ BigInt(256);
10
- const _0x71n = /* @__PURE__ */ BigInt(113);
11
- for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
12
- [x, y] = [y, (2 * x + 3 * y) % 5];
13
- SHA3_PI.push(2 * (5 * y + x));
14
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
15
- let t = _0n;
16
- for (let j = 0; j < 7; j++) {
17
- R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
18
- if (R & _2n)
19
- t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
20
- }
21
- _SHA3_IOTA.push(t);
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.es61.js";
14
+ import { assert, assertArgument } from "./standards-sdk.es57.js";
15
+ import { concat, getBytesCopy, hexlify } from "./standards-sdk.es44.js";
16
+ import { defineProperties } from "./standards-sdk.es59.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;
22
32
  }
23
- const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
24
- const rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
25
- const rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
26
- function keccakP(s, rounds = 24) {
27
- const B = new Uint32Array(5 * 2);
28
- for (let round = 24 - rounds; round < 24; round++) {
29
- for (let x = 0; x < 10; x++)
30
- B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
31
- for (let x = 0; x < 10; x += 2) {
32
- const idx1 = (x + 8) % 10;
33
- const idx0 = (x + 2) % 10;
34
- const B0 = B[idx0];
35
- const B1 = B[idx0 + 1];
36
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
37
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
38
- for (let y = 0; y < 50; y += 10) {
39
- s[x + y] ^= Th;
40
- s[x + y + 1] ^= Tl;
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);
41
47
  }
48
+ accum[name] = item;
42
49
  }
43
- let curH = s[2];
44
- let curL = s[3];
45
- for (let t = 0; t < 24; t++) {
46
- const shift = SHA3_ROTL[t];
47
- const Th = rotlH(curH, curL, shift);
48
- const Tl = rotlL(curH, curL, shift);
49
- const PI = SHA3_PI[t];
50
- curH = s[PI];
51
- curL = s[PI + 1];
52
- s[PI] = Th;
53
- s[PI + 1] = Tl;
54
- }
55
- for (let y = 0; y < 50; y += 10) {
56
- for (let x = 0; x < 10; x++)
57
- B[x] = s[y + x];
58
- for (let x = 0; x < 10; x++)
59
- s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
60
- }
61
- s[0] ^= SHA3_IOTA_H[round];
62
- s[1] ^= SHA3_IOTA_L[round];
63
- }
64
- B.fill(0);
50
+ return accum;
51
+ }, {});
65
52
  }
66
- class Keccak extends Hash {
67
- // NOTE: we accept arguments in bytes instead of bits here.
68
- constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
69
- super();
70
- this.blockLen = blockLen;
71
- this.suffix = suffix;
72
- this.outputLen = outputLen;
73
- this.enableXOF = enableXOF;
74
- this.rounds = rounds;
75
- this.pos = 0;
76
- this.posOut = 0;
77
- this.finished = false;
78
- this.destroyed = false;
79
- number(outputLen);
80
- if (0 >= this.blockLen || this.blockLen >= 200)
81
- throw new Error("Sha3 supports only keccak-f1600 function");
82
- this.state = new Uint8Array(200);
83
- this.state32 = u32(this.state);
84
- }
85
- keccak() {
86
- keccakP(this.state32, this.rounds);
87
- this.posOut = 0;
88
- this.pos = 0;
89
- }
90
- update(data) {
91
- exists(this);
92
- const { blockLen, state } = this;
93
- data = toBytes(data);
94
- const len = data.length;
95
- for (let pos = 0; pos < len; ) {
96
- const take = Math.min(blockLen - this.pos, len - pos);
97
- for (let i = 0; i < take; i++)
98
- state[this.pos++] ^= data[pos++];
99
- if (this.pos === blockLen)
100
- this.keccak();
101
- }
102
- return this;
103
- }
104
- finish() {
105
- if (this.finished)
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) {
106
93
  return;
107
- this.finished = true;
108
- const { state, suffix, pos, blockLen } = this;
109
- state[pos] ^= suffix;
110
- if ((suffix & 128) !== 0 && pos === blockLen - 1)
111
- this.keccak();
112
- state[blockLen - 1] ^= 128;
113
- this.keccak();
114
- }
115
- writeInto(out) {
116
- exists(this, false);
117
- bytes(out);
118
- this.finish();
119
- const bufferOut = this.state;
120
- const { blockLen } = this;
121
- for (let pos = 0, len = out.length; pos < len; ) {
122
- if (this.posOut >= blockLen)
123
- this.keccak();
124
- const take = Math.min(blockLen - this.posOut, len - pos);
125
- out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
126
- this.posOut += take;
127
- pos += take;
128
- }
129
- return out;
130
- }
131
- xofInto(out) {
132
- if (!this.enableXOF)
133
- throw new Error("XOF is not possible for this instance");
134
- return this.writeInto(out);
135
- }
136
- xof(bytes2) {
137
- number(bytes2);
138
- return this.xofInto(new Uint8Array(bytes2));
139
- }
140
- digestInto(out) {
141
- output(out, this);
142
- if (this.finished)
143
- throw new Error("digest() was already called");
144
- this.writeInto(out);
145
- this.destroy();
146
- return out;
147
- }
148
- digest() {
149
- return this.digestInto(new Uint8Array(this.outputLen));
150
- }
151
- destroy() {
152
- this.destroyed = true;
153
- this.state.fill(0);
154
- }
155
- _cloneInto(to) {
156
- const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
157
- to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
158
- to.state32.set(this.state32);
159
- to.pos = this.pos;
160
- to.posOut = this.posOut;
161
- to.finished = this.finished;
162
- to.rounds = rounds;
163
- to.suffix = suffix;
164
- to.outputLen = outputLen;
165
- to.enableXOF = enableXOF;
166
- to.destroyed = this.destroyed;
167
- return to;
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);
168
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;
169
266
  }
170
- const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
171
- const keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
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;
172
434
  export {
173
- Keccak,
174
- keccakP,
175
- keccak_256
435
+ Coder,
436
+ Reader,
437
+ Result,
438
+ WordSize,
439
+ Writer
176
440
  };
177
441
  //# sourceMappingURL=standards-sdk.es46.js.map