@coinbase/cdp-hooks 0.0.90 → 0.0.91

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 (129) hide show
  1. package/dist/esm/index100.js +1 -1
  2. package/dist/esm/index108.js +1 -1
  3. package/dist/esm/index109.js +2 -2
  4. package/dist/esm/index110.js +1 -1
  5. package/dist/esm/index115.js +1 -1
  6. package/dist/esm/index118.js +1 -1
  7. package/dist/esm/index121.js +1 -1
  8. package/dist/esm/index122.js +1 -1
  9. package/dist/esm/index123.js +3 -3
  10. package/dist/esm/index124.js +2 -2
  11. package/dist/esm/index125.js +1 -1
  12. package/dist/esm/index127.js +1 -1
  13. package/dist/esm/index128.js +1 -1
  14. package/dist/esm/index129.js +3 -3
  15. package/dist/esm/index130.js +3 -3
  16. package/dist/esm/index131.js +3 -3
  17. package/dist/esm/index132.js +3 -3
  18. package/dist/esm/index133.js +3 -3
  19. package/dist/esm/index134.js +3 -3
  20. package/dist/esm/index135.js +3 -3
  21. package/dist/esm/index136.js +1 -1
  22. package/dist/esm/index138.js +1 -1
  23. package/dist/esm/index219.js +3 -3
  24. package/dist/esm/index248.js +2 -2
  25. package/dist/esm/index251.js +2 -2
  26. package/dist/esm/index252.js +1 -1
  27. package/dist/esm/index256.js +3 -3
  28. package/dist/esm/index257.js +40 -38
  29. package/dist/esm/index258.js +2 -2
  30. package/dist/esm/index259.js +4 -69
  31. package/dist/esm/index260.js +10 -34
  32. package/dist/esm/index261.js +18 -13
  33. package/dist/esm/index262.js +7 -40
  34. package/dist/esm/index263.js +12 -2
  35. package/dist/esm/index264.js +66 -4
  36. package/dist/esm/index265.js +64 -9
  37. package/dist/esm/index266.js +183 -17
  38. package/dist/esm/index267.js +22 -7
  39. package/dist/esm/index268.js +41 -10
  40. package/dist/esm/index269.js +72 -62
  41. package/dist/esm/index270.js +36 -61
  42. package/dist/esm/index271.js +15 -184
  43. package/dist/esm/index272.js +12 -21
  44. package/dist/esm/index273.js +7 -42
  45. package/dist/esm/index274.js +6 -76
  46. package/dist/esm/index275.js +36 -40
  47. package/dist/esm/index276.js +15 -16
  48. package/dist/esm/index277.js +8 -13
  49. package/dist/esm/index278.js +12 -7
  50. package/dist/esm/index279.js +9 -6
  51. package/dist/esm/index280.js +16 -36
  52. package/dist/esm/index281.js +22 -15
  53. package/dist/esm/index282.js +29 -7
  54. package/dist/esm/index283.js +2 -13
  55. package/dist/esm/index284.js +13 -9
  56. package/dist/esm/index285.js +11 -15
  57. package/dist/esm/index286.js +45 -20
  58. package/dist/esm/index287.js +9 -30
  59. package/dist/esm/index288.js +14 -2
  60. package/dist/esm/index289.js +14 -13
  61. package/dist/esm/index290.js +8 -12
  62. package/dist/esm/index291.js +14 -46
  63. package/dist/esm/index292.js +23 -8
  64. package/dist/esm/index293.js +11 -13
  65. package/dist/esm/index294.js +24 -14
  66. package/dist/esm/index295.js +51 -8
  67. package/dist/esm/index296.js +15 -13
  68. package/dist/esm/index297.js +14 -24
  69. package/dist/esm/index298.js +11 -11
  70. package/dist/esm/index299.js +103 -24
  71. package/dist/esm/index3.js +1 -1
  72. package/dist/esm/index300.js +5 -51
  73. package/dist/esm/index301.js +222 -16
  74. package/dist/esm/index302.js +6 -14
  75. package/dist/esm/index303.js +7 -12
  76. package/dist/esm/index304.js +24 -101
  77. package/dist/esm/index305.js +19 -5
  78. package/dist/esm/index306.js +140 -218
  79. package/dist/esm/index307.js +13 -7
  80. package/dist/esm/index308.js +35 -6
  81. package/dist/esm/index309.js +41 -26
  82. package/dist/esm/index310.js +38 -19
  83. package/dist/esm/index311.js +2 -146
  84. package/dist/esm/index312.js +70 -13
  85. package/dist/esm/index313.js +34 -35
  86. package/dist/esm/index314.js +14 -41
  87. package/dist/esm/index315.js +69 -2
  88. package/dist/esm/index316.js +3 -68
  89. package/dist/esm/index317.js +136 -3
  90. package/dist/esm/index318.js +144 -125
  91. package/dist/esm/index319.js +9 -155
  92. package/dist/esm/index320.js +16 -9
  93. package/dist/esm/index321.js +113 -16
  94. package/dist/esm/index322.js +116 -95
  95. package/dist/esm/index323.js +70 -126
  96. package/dist/esm/index324.js +2 -79
  97. package/dist/esm/index325.js +698 -2
  98. package/dist/esm/index326.js +126 -685
  99. package/dist/esm/index327.js +41 -137
  100. package/dist/esm/index328.js +198 -40
  101. package/dist/esm/index329.js +2 -201
  102. package/dist/esm/index330.js +65 -3
  103. package/dist/esm/index331.js +4 -65
  104. package/dist/esm/index332.js +40 -4
  105. package/dist/esm/index333.js +7 -40
  106. package/dist/esm/index334.js +62 -7
  107. package/dist/esm/index335.js +72 -57
  108. package/dist/esm/index336.js +4 -78
  109. package/dist/esm/index337.js +195 -4
  110. package/dist/esm/index338.js +3 -194
  111. package/dist/esm/index339.js +3 -3
  112. package/dist/esm/index75.js +2 -2
  113. package/dist/esm/index82.js +1 -1
  114. package/dist/esm/index83.js +1 -1
  115. package/dist/esm/index86.js +3 -3
  116. package/dist/esm/index87.js +2 -2
  117. package/dist/esm/index88.js +3 -3
  118. package/dist/esm/index89.js +2 -2
  119. package/dist/esm/index90.js +3 -3
  120. package/dist/esm/index91.js +6 -6
  121. package/dist/esm/index92.js +2 -2
  122. package/dist/esm/index93.js +1 -1
  123. package/dist/esm/index94.js +1 -1
  124. package/dist/esm/index95.js +1 -1
  125. package/dist/esm/index96.js +1 -1
  126. package/dist/esm/index97.js +1 -1
  127. package/dist/esm/index98.js +1 -1
  128. package/dist/esm/index99.js +4 -4
  129. package/package.json +3 -3
@@ -1,19 +1,116 @@
1
- import { concatHex as i } from "./index180.js";
2
- import { hexToBytes as m } from "./index175.js";
3
- import { numberToHex as c } from "./index176.js";
4
- import { toRlp as d } from "./index221.js";
5
- import { keccak256 as f } from "./index177.js";
6
- function b(o) {
7
- const { chainId: t, nonce: r, to: s } = o, e = o.contractAddress ?? o.address, n = f(i([
8
- "0x05",
9
- d([
10
- t ? c(t) : "0x",
11
- e,
12
- r ? c(r) : "0x"
13
- ])
14
- ]));
15
- return s === "bytes" ? m(n) : n;
1
+ import { BaseError as y } from "./index330.js";
2
+ import { keccak256 as v } from "./index333.js";
3
+ import { validate as $, slice as A, fromString as S } from "./index318.js";
4
+ import { isArgOfType as E, normalizeSignature as p, getAmbiguousTypes as B } from "./index334.js";
5
+ import { parseAbiItem as l } from "./index267.js";
6
+ import { formatAbiItem as h } from "./index259.js";
7
+ function H(e, r = {}) {
8
+ const { prepare: i = !0 } = r, n = Array.isArray(e) ? l(e) : typeof e == "string" ? l(e) : e;
9
+ return {
10
+ ...n,
11
+ ...i ? { hash: s(n) } : {}
12
+ };
13
+ }
14
+ function M(e, r, i) {
15
+ const { args: n = [], prepare: f = !0 } = i ?? {}, b = $(r, { strict: !1 }), u = e.filter((t) => b ? t.type === "function" || t.type === "error" ? T(t) === A(r, 0, 4) : t.type === "event" ? s(t) === r : !1 : "name" in t && t.name === r);
16
+ if (u.length === 0)
17
+ throw new d({ name: r });
18
+ if (u.length === 1)
19
+ return {
20
+ ...u[0],
21
+ ...f ? { hash: s(u[0]) } : {}
22
+ };
23
+ let o;
24
+ for (const t of u) {
25
+ if (!("inputs" in t))
26
+ continue;
27
+ if (!n || n.length === 0) {
28
+ if (!t.inputs || t.inputs.length === 0)
29
+ return {
30
+ ...t,
31
+ ...f ? { hash: s(t) } : {}
32
+ };
33
+ continue;
34
+ }
35
+ if (!t.inputs || t.inputs.length === 0 || t.inputs.length !== n.length)
36
+ continue;
37
+ if (n.every((a, w) => {
38
+ const g = "inputs" in t && t.inputs[w];
39
+ return g ? E(a, g) : !1;
40
+ })) {
41
+ if (o && "inputs" in o && o.inputs) {
42
+ const a = B(t.inputs, o.inputs, n);
43
+ if (a)
44
+ throw new O({
45
+ abiItem: t,
46
+ type: a[0]
47
+ }, {
48
+ abiItem: o,
49
+ type: a[1]
50
+ });
51
+ }
52
+ o = t;
53
+ }
54
+ }
55
+ const c = (() => {
56
+ if (o)
57
+ return o;
58
+ const [t, ...m] = u;
59
+ return { ...t, overloads: m };
60
+ })();
61
+ if (!c)
62
+ throw new d({ name: r });
63
+ return {
64
+ ...c,
65
+ ...f ? { hash: s(c) } : {}
66
+ };
67
+ }
68
+ function T(e) {
69
+ return A(s(e), 0, 4);
70
+ }
71
+ function F(e) {
72
+ const r = typeof e == "string" ? e : h(e);
73
+ return p(r);
74
+ }
75
+ function s(e) {
76
+ return typeof e != "string" && "hash" in e && e.hash ? e.hash : v(S(F(e)));
77
+ }
78
+ class O extends y {
79
+ constructor(r, i) {
80
+ super("Found ambiguous types in overloaded ABI Items.", {
81
+ metaMessages: [
82
+ // TODO: abitype to add support for signature-formatted ABI items.
83
+ `\`${r.type}\` in \`${p(h(r.abiItem))}\`, and`,
84
+ `\`${i.type}\` in \`${p(h(i.abiItem))}\``,
85
+ "",
86
+ "These types encode differently and cannot be distinguished at runtime.",
87
+ "Remove one of the ambiguous items in the ABI."
88
+ ]
89
+ }), Object.defineProperty(this, "name", {
90
+ enumerable: !0,
91
+ configurable: !0,
92
+ writable: !0,
93
+ value: "AbiItem.AmbiguityError"
94
+ });
95
+ }
96
+ }
97
+ class d extends y {
98
+ constructor({ name: r, data: i, type: n = "item" }) {
99
+ const f = r ? ` with name "${r}"` : i ? ` with data "${i}"` : "";
100
+ super(`ABI ${n}${f} not found.`), Object.defineProperty(this, "name", {
101
+ enumerable: !0,
102
+ configurable: !0,
103
+ writable: !0,
104
+ value: "AbiItem.NotFoundError"
105
+ });
106
+ }
16
107
  }
17
108
  export {
18
- b as hashAuthorization
109
+ O as AmbiguityError,
110
+ d as NotFoundError,
111
+ H as from,
112
+ M as fromAbi,
113
+ T as getSelector,
114
+ F as getSignature,
115
+ s as getSignatureHash
19
116
  };
@@ -1,116 +1,137 @@
1
- import { BaseError as y } from "./index331.js";
2
- import { keccak256 as v } from "./index334.js";
3
- import { validate as $, slice as A, fromString as S } from "./index319.js";
4
- import { isArgOfType as E, normalizeSignature as p, getAmbiguousTypes as B } from "./index335.js";
5
- import { parseAbiItem as l } from "./index272.js";
6
- import { formatAbiItem as h } from "./index264.js";
7
- function H(e, r = {}) {
8
- const { prepare: i = !0 } = r, n = Array.isArray(e) ? l(e) : typeof e == "string" ? l(e) : e;
9
- return {
10
- ...n,
11
- ...i ? { hash: s(n) } : {}
12
- };
1
+ import { assert as p } from "./index335.js";
2
+ import { BaseError as u } from "./index330.js";
3
+ import { size as y, padLeft as f, fromString as x, fromBoolean as w, fromNumber as E, padRight as P, concat as g } from "./index318.js";
4
+ import { integerRegex as A, bytesRegex as $, arrayRegex as L } from "./index336.js";
5
+ import { prepareParameters as z, encode as I } from "./index337.js";
6
+ function N(n, e, t) {
7
+ const { checksumAddress: r = !1 } = {};
8
+ if (n.length !== e.length)
9
+ throw new b({
10
+ expectedLength: n.length,
11
+ givenLength: e.length
12
+ });
13
+ const a = z({
14
+ checksumAddress: r,
15
+ parameters: n,
16
+ values: e
17
+ }), s = I(a);
18
+ return s.length === 0 ? "0x" : s;
19
+ }
20
+ function m(n, e) {
21
+ if (n.length !== e.length)
22
+ throw new b({
23
+ expectedLength: n.length,
24
+ givenLength: e.length
25
+ });
26
+ const t = [];
27
+ for (let r = 0; r < n.length; r++) {
28
+ const a = n[r], s = e[r];
29
+ t.push(m.encode(a, s));
30
+ }
31
+ return g(...t);
13
32
  }
14
- function M(e, r, i) {
15
- const { args: n = [], prepare: f = !0 } = i ?? {}, b = $(r, { strict: !1 }), u = e.filter((t) => b ? t.type === "function" || t.type === "error" ? T(t) === A(r, 0, 4) : t.type === "event" ? s(t) === r : !1 : "name" in t && t.name === r);
16
- if (u.length === 0)
17
- throw new d({ name: r });
18
- if (u.length === 1)
19
- return {
20
- ...u[0],
21
- ...f ? { hash: s(u[0]) } : {}
22
- };
23
- let o;
24
- for (const t of u) {
25
- if (!("inputs" in t))
26
- continue;
27
- if (!n || n.length === 0) {
28
- if (!t.inputs || t.inputs.length === 0)
29
- return {
30
- ...t,
31
- ...f ? { hash: s(t) } : {}
32
- };
33
- continue;
33
+ (function(n) {
34
+ function e(t, r, a = !1) {
35
+ if (t === "address") {
36
+ const i = r;
37
+ return p(i), f(i.toLowerCase(), a ? 32 : 0);
38
+ }
39
+ if (t === "string")
40
+ return x(r);
41
+ if (t === "bytes")
42
+ return r;
43
+ if (t === "bool")
44
+ return f(w(r), a ? 32 : 1);
45
+ const s = t.match(A);
46
+ if (s) {
47
+ const [i, o, c = "256"] = s, h = Number.parseInt(c) / 8;
48
+ return E(r, {
49
+ size: a ? 32 : h,
50
+ signed: o === "int"
51
+ });
52
+ }
53
+ const d = t.match($);
54
+ if (d) {
55
+ const [i, o] = d;
56
+ if (Number.parseInt(o) !== (r.length - 2) / 2)
57
+ throw new M({
58
+ expectedSize: Number.parseInt(o),
59
+ value: r
60
+ });
61
+ return P(r, a ? 32 : 0);
34
62
  }
35
- if (!t.inputs || t.inputs.length === 0 || t.inputs.length !== n.length)
36
- continue;
37
- if (n.every((a, w) => {
38
- const g = "inputs" in t && t.inputs[w];
39
- return g ? E(a, g) : !1;
40
- })) {
41
- if (o && "inputs" in o && o.inputs) {
42
- const a = B(t.inputs, o.inputs, n);
43
- if (a)
44
- throw new O({
45
- abiItem: t,
46
- type: a[0]
47
- }, {
48
- abiItem: o,
49
- type: a[1]
50
- });
51
- }
52
- o = t;
63
+ const l = t.match(L);
64
+ if (l && Array.isArray(r)) {
65
+ const [i, o] = l, c = [];
66
+ for (let h = 0; h < r.length; h++)
67
+ c.push(e(o, r[h], !0));
68
+ return c.length === 0 ? "0x" : g(...c);
53
69
  }
70
+ throw new j(t);
71
+ }
72
+ n.encode = e;
73
+ })(m || (m = {}));
74
+ class R extends u {
75
+ constructor({ expectedLength: e, givenLength: t, type: r }) {
76
+ super(`Array length mismatch for type \`${r}\`. Expected: \`${e}\`. Given: \`${t}\`.`), Object.defineProperty(this, "name", {
77
+ enumerable: !0,
78
+ configurable: !0,
79
+ writable: !0,
80
+ value: "AbiParameters.ArrayLengthMismatchError"
81
+ });
54
82
  }
55
- const c = (() => {
56
- if (o)
57
- return o;
58
- const [t, ...m] = u;
59
- return { ...t, overloads: m };
60
- })();
61
- if (!c)
62
- throw new d({ name: r });
63
- return {
64
- ...c,
65
- ...f ? { hash: s(c) } : {}
66
- };
67
- }
68
- function T(e) {
69
- return A(s(e), 0, 4);
70
83
  }
71
- function F(e) {
72
- const r = typeof e == "string" ? e : h(e);
73
- return p(r);
84
+ class M extends u {
85
+ constructor({ expectedSize: e, value: t }) {
86
+ super(`Size of bytes "${t}" (bytes${y(t)}) does not match expected size (bytes${e}).`), Object.defineProperty(this, "name", {
87
+ enumerable: !0,
88
+ configurable: !0,
89
+ writable: !0,
90
+ value: "AbiParameters.BytesSizeMismatchError"
91
+ });
92
+ }
74
93
  }
75
- function s(e) {
76
- return typeof e != "string" && "hash" in e && e.hash ? e.hash : v(S(F(e)));
94
+ class b extends u {
95
+ constructor({ expectedLength: e, givenLength: t }) {
96
+ super([
97
+ "ABI encoding parameters/values length mismatch.",
98
+ `Expected length (parameters): ${e}`,
99
+ `Given length (values): ${t}`
100
+ ].join(`
101
+ `)), Object.defineProperty(this, "name", {
102
+ enumerable: !0,
103
+ configurable: !0,
104
+ writable: !0,
105
+ value: "AbiParameters.LengthMismatchError"
106
+ });
107
+ }
77
108
  }
78
- class O extends y {
79
- constructor(r, i) {
80
- super("Found ambiguous types in overloaded ABI Items.", {
81
- metaMessages: [
82
- // TODO: abitype to add support for signature-formatted ABI items.
83
- `\`${r.type}\` in \`${p(h(r.abiItem))}\`, and`,
84
- `\`${i.type}\` in \`${p(h(i.abiItem))}\``,
85
- "",
86
- "These types encode differently and cannot be distinguished at runtime.",
87
- "Remove one of the ambiguous items in the ABI."
88
- ]
89
- }), Object.defineProperty(this, "name", {
109
+ class _ extends u {
110
+ constructor(e) {
111
+ super(`Value \`${e}\` is not a valid array.`), Object.defineProperty(this, "name", {
90
112
  enumerable: !0,
91
113
  configurable: !0,
92
114
  writable: !0,
93
- value: "AbiItem.AmbiguityError"
115
+ value: "AbiParameters.InvalidArrayError"
94
116
  });
95
117
  }
96
118
  }
97
- class d extends y {
98
- constructor({ name: r, data: i, type: n = "item" }) {
99
- const f = r ? ` with name "${r}"` : i ? ` with data "${i}"` : "";
100
- super(`ABI ${n}${f} not found.`), Object.defineProperty(this, "name", {
119
+ class j extends u {
120
+ constructor(e) {
121
+ super(`Type \`${e}\` is not a valid ABI Type.`), Object.defineProperty(this, "name", {
101
122
  enumerable: !0,
102
123
  configurable: !0,
103
124
  writable: !0,
104
- value: "AbiItem.NotFoundError"
125
+ value: "AbiParameters.InvalidTypeError"
105
126
  });
106
127
  }
107
128
  }
108
129
  export {
109
- O as AmbiguityError,
110
- d as NotFoundError,
111
- H as from,
112
- M as fromAbi,
113
- T as getSelector,
114
- F as getSignature,
115
- s as getSignatureHash
130
+ R as ArrayLengthMismatchError,
131
+ M as BytesSizeMismatchError,
132
+ _ as InvalidArrayError,
133
+ j as InvalidTypeError,
134
+ b as LengthMismatchError,
135
+ N as encode,
136
+ m as encodePacked
116
137
  };
@@ -1,137 +1,81 @@
1
- import { assert as p } from "./index336.js";
2
- import { BaseError as u } from "./index331.js";
3
- import { size as y, padLeft as f, fromString as x, fromBoolean as w, fromNumber as E, padRight as P, concat as g } from "./index319.js";
4
- import { integerRegex as A, bytesRegex as $, arrayRegex as L } from "./index337.js";
5
- import { prepareParameters as z, encode as I } from "./index338.js";
6
- function N(n, e, t) {
7
- const { checksumAddress: r = !1 } = {};
8
- if (n.length !== e.length)
9
- throw new b({
10
- expectedLength: n.length,
11
- givenLength: e.length
12
- });
13
- const a = z({
14
- checksumAddress: r,
15
- parameters: n,
16
- values: e
17
- }), s = I(a);
18
- return s.length === 0 ? "0x" : s;
1
+ import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index306.js";
2
+ function y(o, t, s, n) {
3
+ if (typeof o.setBigUint64 == "function")
4
+ return o.setBigUint64(t, s, n);
5
+ const i = BigInt(32), h = BigInt(4294967295), e = Number(s >> i & h), r = Number(s & h), c = n ? 4 : 0, u = n ? 0 : 4;
6
+ o.setUint32(t + c, e, n), o.setUint32(t + u, r, n);
19
7
  }
20
- function m(n, e) {
21
- if (n.length !== e.length)
22
- throw new b({
23
- expectedLength: n.length,
24
- givenLength: e.length
25
- });
26
- const t = [];
27
- for (let r = 0; r < n.length; r++) {
28
- const a = n[r], s = e[r];
29
- t.push(m.encode(a, s));
30
- }
31
- return g(...t);
8
+ function U(o, t, s) {
9
+ return o & t ^ ~o & s;
32
10
  }
33
- (function(n) {
34
- function e(t, r, a = !1) {
35
- if (t === "address") {
36
- const i = r;
37
- return p(i), f(i.toLowerCase(), a ? 32 : 0);
38
- }
39
- if (t === "string")
40
- return x(r);
41
- if (t === "bytes")
42
- return r;
43
- if (t === "bool")
44
- return f(w(r), a ? 32 : 1);
45
- const s = t.match(A);
46
- if (s) {
47
- const [i, o, c = "256"] = s, h = Number.parseInt(c) / 8;
48
- return E(r, {
49
- size: a ? 32 : h,
50
- signed: o === "int"
51
- });
52
- }
53
- const d = t.match($);
54
- if (d) {
55
- const [i, o] = d;
56
- if (Number.parseInt(o) !== (r.length - 2) / 2)
57
- throw new M({
58
- expectedSize: Number.parseInt(o),
59
- value: r
60
- });
61
- return P(r, a ? 32 : 0);
62
- }
63
- const l = t.match(L);
64
- if (l && Array.isArray(r)) {
65
- const [i, o] = l, c = [];
66
- for (let h = 0; h < r.length; h++)
67
- c.push(e(o, r[h], !0));
68
- return c.length === 0 ? "0x" : g(...c);
69
- }
70
- throw new j(t);
11
+ function _(o, t, s) {
12
+ return o & t ^ o & s ^ t & s;
13
+ }
14
+ class m extends g {
15
+ constructor(t, s, n, i) {
16
+ super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
71
17
  }
72
- n.encode = e;
73
- })(m || (m = {}));
74
- class R extends u {
75
- constructor({ expectedLength: e, givenLength: t, type: r }) {
76
- super(`Array length mismatch for type \`${r}\`. Expected: \`${e}\`. Given: \`${t}\`.`), Object.defineProperty(this, "name", {
77
- enumerable: !0,
78
- configurable: !0,
79
- writable: !0,
80
- value: "AbiParameters.ArrayLengthMismatchError"
81
- });
18
+ update(t) {
19
+ b(this), t = a(t), d(t);
20
+ const { view: s, buffer: n, blockLen: i } = this, h = t.length;
21
+ for (let e = 0; e < h; ) {
22
+ const r = Math.min(i - this.pos, h - e);
23
+ if (r === i) {
24
+ const c = l(t);
25
+ for (; i <= h - e; e += i)
26
+ this.process(c, e);
27
+ continue;
28
+ }
29
+ n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
30
+ }
31
+ return this.length += t.length, this.roundClean(), this;
82
32
  }
83
- }
84
- class M extends u {
85
- constructor({ expectedSize: e, value: t }) {
86
- super(`Size of bytes "${t}" (bytes${y(t)}) does not match expected size (bytes${e}).`), Object.defineProperty(this, "name", {
87
- enumerable: !0,
88
- configurable: !0,
89
- writable: !0,
90
- value: "AbiParameters.BytesSizeMismatchError"
91
- });
33
+ digestInto(t) {
34
+ b(this), x(t, this), this.finished = !0;
35
+ const { buffer: s, view: n, blockLen: i, isLE: h } = this;
36
+ let { pos: e } = this;
37
+ s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
38
+ for (let f = e; f < i; f++)
39
+ s[f] = 0;
40
+ y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
41
+ const r = l(t), c = this.outputLen;
42
+ if (c % 4)
43
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
44
+ const u = c / 4, p = this.get();
45
+ if (u > p.length)
46
+ throw new Error("_sha2: outputLen bigger than state");
47
+ for (let f = 0; f < u; f++)
48
+ r.setUint32(4 * f, p[f], h);
92
49
  }
93
- }
94
- class b extends u {
95
- constructor({ expectedLength: e, givenLength: t }) {
96
- super([
97
- "ABI encoding parameters/values length mismatch.",
98
- `Expected length (parameters): ${e}`,
99
- `Given length (values): ${t}`
100
- ].join(`
101
- `)), Object.defineProperty(this, "name", {
102
- enumerable: !0,
103
- configurable: !0,
104
- writable: !0,
105
- value: "AbiParameters.LengthMismatchError"
106
- });
50
+ digest() {
51
+ const { buffer: t, outputLen: s } = this;
52
+ this.digestInto(t);
53
+ const n = t.slice(0, s);
54
+ return this.destroy(), n;
107
55
  }
108
- }
109
- class _ extends u {
110
- constructor(e) {
111
- super(`Value \`${e}\` is not a valid array.`), Object.defineProperty(this, "name", {
112
- enumerable: !0,
113
- configurable: !0,
114
- writable: !0,
115
- value: "AbiParameters.InvalidArrayError"
116
- });
56
+ _cloneInto(t) {
57
+ t || (t = new this.constructor()), t.set(...this.get());
58
+ const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
59
+ return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
117
60
  }
118
- }
119
- class j extends u {
120
- constructor(e) {
121
- super(`Type \`${e}\` is not a valid ABI Type.`), Object.defineProperty(this, "name", {
122
- enumerable: !0,
123
- configurable: !0,
124
- writable: !0,
125
- value: "AbiParameters.InvalidTypeError"
126
- });
61
+ clone() {
62
+ return this._cloneInto();
127
63
  }
128
64
  }
65
+ const B = /* @__PURE__ */ Uint32Array.from([
66
+ 1779033703,
67
+ 3144134277,
68
+ 1013904242,
69
+ 2773480762,
70
+ 1359893119,
71
+ 2600822924,
72
+ 528734635,
73
+ 1541459225
74
+ ]);
129
75
  export {
130
- R as ArrayLengthMismatchError,
131
- M as BytesSizeMismatchError,
132
- _ as InvalidArrayError,
133
- j as InvalidTypeError,
134
- b as LengthMismatchError,
135
- N as encode,
136
- m as encodePacked
76
+ U as Chi,
77
+ m as HashMD,
78
+ _ as Maj,
79
+ B as SHA256_IV,
80
+ y as setBigUint64
137
81
  };
@@ -1,81 +1,4 @@
1
- import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index311.js";
2
- function y(o, t, s, n) {
3
- if (typeof o.setBigUint64 == "function")
4
- return o.setBigUint64(t, s, n);
5
- const i = BigInt(32), h = BigInt(4294967295), e = Number(s >> i & h), r = Number(s & h), c = n ? 4 : 0, u = n ? 0 : 4;
6
- o.setUint32(t + c, e, n), o.setUint32(t + u, r, n);
7
- }
8
- function U(o, t, s) {
9
- return o & t ^ ~o & s;
10
- }
11
- function _(o, t, s) {
12
- return o & t ^ o & s ^ t & s;
13
- }
14
- class m extends g {
15
- constructor(t, s, n, i) {
16
- super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
17
- }
18
- update(t) {
19
- b(this), t = a(t), d(t);
20
- const { view: s, buffer: n, blockLen: i } = this, h = t.length;
21
- for (let e = 0; e < h; ) {
22
- const r = Math.min(i - this.pos, h - e);
23
- if (r === i) {
24
- const c = l(t);
25
- for (; i <= h - e; e += i)
26
- this.process(c, e);
27
- continue;
28
- }
29
- n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
30
- }
31
- return this.length += t.length, this.roundClean(), this;
32
- }
33
- digestInto(t) {
34
- b(this), x(t, this), this.finished = !0;
35
- const { buffer: s, view: n, blockLen: i, isLE: h } = this;
36
- let { pos: e } = this;
37
- s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
38
- for (let f = e; f < i; f++)
39
- s[f] = 0;
40
- y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
41
- const r = l(t), c = this.outputLen;
42
- if (c % 4)
43
- throw new Error("_sha2: outputLen should be aligned to 32bit");
44
- const u = c / 4, p = this.get();
45
- if (u > p.length)
46
- throw new Error("_sha2: outputLen bigger than state");
47
- for (let f = 0; f < u; f++)
48
- r.setUint32(4 * f, p[f], h);
49
- }
50
- digest() {
51
- const { buffer: t, outputLen: s } = this;
52
- this.digestInto(t);
53
- const n = t.slice(0, s);
54
- return this.destroy(), n;
55
- }
56
- _cloneInto(t) {
57
- t || (t = new this.constructor()), t.set(...this.get());
58
- const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
59
- return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
60
- }
61
- clone() {
62
- return this._cloneInto();
63
- }
64
- }
65
- const B = /* @__PURE__ */ Uint32Array.from([
66
- 1779033703,
67
- 3144134277,
68
- 1013904242,
69
- 2773480762,
70
- 1359893119,
71
- 2600822924,
72
- 528734635,
73
- 1541459225
74
- ]);
1
+ const o = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
75
2
  export {
76
- U as Chi,
77
- m as HashMD,
78
- _ as Maj,
79
- B as SHA256_IV,
80
- y as setBigUint64
3
+ o as crypto
81
4
  };