@gardenfi/utils 2.0.6 → 2.1.0-beta.2

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 (230) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +22 -20
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +37 -19
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +26 -126
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +3 -113
  9. package/dist/index102.cjs +1 -1
  10. package/dist/index102.js +10 -77
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +20 -2
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +11 -16
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +17 -17
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +639 -12
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +161 -212
  21. package/dist/index109.cjs +1 -1
  22. package/dist/index109.js +127 -34
  23. package/dist/index11.cjs +1 -1
  24. package/dist/index11.js +19 -134
  25. package/dist/index110.cjs +1 -1
  26. package/dist/index110.js +2 -19
  27. package/dist/index111.cjs +1 -1
  28. package/dist/index111.js +2 -70
  29. package/dist/index112.cjs +1 -1
  30. package/dist/index112.js +33 -63
  31. package/dist/index113.cjs +1 -1
  32. package/dist/index113.js +39 -2
  33. package/dist/index114.cjs +1 -1
  34. package/dist/index114.js +5 -41
  35. package/dist/index115.cjs +1 -1
  36. package/dist/index115.js +10 -643
  37. package/dist/index116.cjs +1 -1
  38. package/dist/index116.js +6 -231
  39. package/dist/index117.cjs +1 -1
  40. package/dist/index117.js +17 -169
  41. package/dist/index118.cjs +1 -0
  42. package/dist/index118.js +7 -0
  43. package/dist/index12.cjs +1 -1
  44. package/dist/index12.js +136 -10
  45. package/dist/index13.cjs +1 -1
  46. package/dist/index13.js +15 -2
  47. package/dist/index14.cjs +1 -1
  48. package/dist/index14.js +2 -34
  49. package/dist/index15.cjs +1 -1
  50. package/dist/index15.js +32 -17
  51. package/dist/index16.cjs +1 -1
  52. package/dist/index16.js +14 -183
  53. package/dist/index17.cjs +1 -1
  54. package/dist/index17.js +187 -92
  55. package/dist/index18.cjs +1 -1
  56. package/dist/index18.js +92 -34
  57. package/dist/index19.cjs +1 -1
  58. package/dist/index19.js +36 -32
  59. package/dist/index20.cjs +1 -16
  60. package/dist/index20.js +30 -112
  61. package/dist/index21.cjs +16 -1
  62. package/dist/index21.js +113 -30
  63. package/dist/index22.cjs +1 -1
  64. package/dist/index22.js +31 -18
  65. package/dist/index23.cjs +1 -1
  66. package/dist/index23.js +41 -7
  67. package/dist/index24.cjs +1 -1
  68. package/dist/index24.js +3 -3
  69. package/dist/index25.cjs +1 -1
  70. package/dist/index25.js +23 -19
  71. package/dist/index26.cjs +1 -1
  72. package/dist/index26.js +6 -8
  73. package/dist/index27.cjs +1 -1
  74. package/dist/index27.js +12 -30
  75. package/dist/index28.cjs +1 -1
  76. package/dist/index28.js +15 -26
  77. package/dist/index29.cjs +1 -2
  78. package/dist/index29.js +5 -65
  79. package/dist/index30.cjs +1 -1
  80. package/dist/index30.js +13 -51
  81. package/dist/index31.cjs +1 -1
  82. package/dist/index31.js +10 -12
  83. package/dist/index32.cjs +1 -1
  84. package/dist/index32.js +12 -24
  85. package/dist/index33.cjs +1 -1
  86. package/dist/index33.js +11 -75
  87. package/dist/index34.cjs +1 -1
  88. package/dist/index34.js +13 -23
  89. package/dist/index35.cjs +1 -1
  90. package/dist/index35.js +23 -7
  91. package/dist/index36.cjs +1 -1
  92. package/dist/index36.js +55 -32
  93. package/dist/index37.cjs +1 -1
  94. package/dist/index37.js +16 -15
  95. package/dist/index38.cjs +1 -1
  96. package/dist/index38.js +6 -2
  97. package/dist/index39.cjs +1 -1
  98. package/dist/index39.js +8 -8
  99. package/dist/index4.cjs +1 -1
  100. package/dist/index4.js +2 -2
  101. package/dist/index40.cjs +1 -1
  102. package/dist/index40.js +171 -20
  103. package/dist/index41.cjs +1 -1
  104. package/dist/index41.js +100 -9
  105. package/dist/index42.cjs +1 -1
  106. package/dist/index42.js +20 -33
  107. package/dist/index43.cjs +1 -2
  108. package/dist/index43.js +17 -59
  109. package/dist/index44.cjs +1 -1
  110. package/dist/index44.js +8 -2
  111. package/dist/index45.cjs +1 -1
  112. package/dist/index45.js +21 -6
  113. package/dist/index46.cjs +1 -1
  114. package/dist/index46.js +8 -6
  115. package/dist/index47.cjs +1 -1
  116. package/dist/index47.js +31 -4
  117. package/dist/index48.cjs +1 -1
  118. package/dist/index48.js +26 -11
  119. package/dist/index49.cjs +2 -5
  120. package/dist/index49.js +53 -44
  121. package/dist/index50.cjs +1 -2
  122. package/dist/index50.js +50 -33
  123. package/dist/index51.cjs +1 -1
  124. package/dist/index51.js +12 -5
  125. package/dist/index52.cjs +1 -1
  126. package/dist/index52.js +24 -3
  127. package/dist/index53.cjs +1 -1
  128. package/dist/index53.js +75 -21
  129. package/dist/index54.cjs +1 -1
  130. package/dist/index54.js +7 -12
  131. package/dist/index55.cjs +1 -1
  132. package/dist/index55.js +32 -55
  133. package/dist/index56.cjs +1 -1
  134. package/dist/index56.js +15 -8
  135. package/dist/index57.cjs +1 -1
  136. package/dist/index57.js +2 -22
  137. package/dist/index58.cjs +1 -1
  138. package/dist/index58.js +8 -11
  139. package/dist/index59.cjs +1 -1
  140. package/dist/index59.js +20 -8
  141. package/dist/index6.cjs +1 -1
  142. package/dist/index6.js +40 -22
  143. package/dist/index60.cjs +1 -1
  144. package/dist/index60.js +11 -9
  145. package/dist/index61.cjs +1 -1
  146. package/dist/index61.js +34 -11
  147. package/dist/index62.cjs +1 -1
  148. package/dist/index62.js +40 -6
  149. package/dist/index63.cjs +1 -1
  150. package/dist/index63.js +34 -13
  151. package/dist/index64.cjs +1 -1
  152. package/dist/index64.js +68 -31
  153. package/dist/index65.cjs +1 -1
  154. package/dist/index65.js +112 -14
  155. package/dist/index66.cjs +1 -1
  156. package/dist/index66.js +64 -61
  157. package/dist/index67.cjs +1 -1
  158. package/dist/index67.js +2 -28
  159. package/dist/index68.cjs +1 -1
  160. package/dist/index68.js +17 -3
  161. package/dist/index69.cjs +1 -1
  162. package/dist/index69.js +223 -3
  163. package/dist/index7.cjs +1 -1
  164. package/dist/index7.js +24 -2
  165. package/dist/index70.cjs +1 -1
  166. package/dist/index70.js +231 -13
  167. package/dist/index71.cjs +2 -1
  168. package/dist/index71.js +59 -41
  169. package/dist/index72.cjs +1 -1
  170. package/dist/index72.js +21 -5
  171. package/dist/index73.cjs +1 -1
  172. package/dist/index73.js +4 -8
  173. package/dist/index74.cjs +1 -1
  174. package/dist/index74.js +3 -103
  175. package/dist/index75.cjs +1 -1
  176. package/dist/index75.js +8 -191
  177. package/dist/index76.cjs +1 -1
  178. package/dist/index76.js +102 -16
  179. package/dist/index77.cjs +1 -1
  180. package/dist/index77.js +16 -10
  181. package/dist/index78.cjs +1 -1
  182. package/dist/index78.js +8 -19
  183. package/dist/index79.cjs +1 -1
  184. package/dist/index79.js +9 -11
  185. package/dist/index8.cjs +1 -1
  186. package/dist/index8.js +2 -100
  187. package/dist/index80.cjs +1 -1
  188. package/dist/index80.js +11 -25
  189. package/dist/index81.cjs +1 -1
  190. package/dist/index81.js +13 -6
  191. package/dist/index82.cjs +1 -1
  192. package/dist/index82.js +18 -13
  193. package/dist/index83.cjs +1 -1
  194. package/dist/index83.js +6 -15
  195. package/dist/index84.cjs +1 -1
  196. package/dist/index84.js +42 -5
  197. package/dist/index85.cjs +1 -1
  198. package/dist/index85.js +78 -13
  199. package/dist/index86.cjs +1 -1
  200. package/dist/index86.js +14 -10
  201. package/dist/index87.cjs +1 -1
  202. package/dist/index87.js +18 -16
  203. package/dist/index88.cjs +1 -1
  204. package/dist/index88.js +182 -162
  205. package/dist/index89.cjs +1 -1
  206. package/dist/index89.js +62 -36
  207. package/dist/index9.cjs +1 -1
  208. package/dist/index9.js +105 -34
  209. package/dist/index91.cjs +1 -1
  210. package/dist/index91.js +2 -5
  211. package/dist/index92.cjs +1 -1
  212. package/dist/index92.js +6 -10
  213. package/dist/index93.cjs +1 -1
  214. package/dist/index93.js +12 -2
  215. package/dist/index94.cjs +5 -1
  216. package/dist/index94.js +49 -97
  217. package/dist/index95.cjs +2 -1
  218. package/dist/index95.js +33 -41
  219. package/dist/index96.cjs +1 -1
  220. package/dist/index96.js +5 -20
  221. package/dist/index97.cjs +1 -1
  222. package/dist/index97.js +3 -6
  223. package/dist/index98.cjs +1 -1
  224. package/dist/index98.js +7 -5
  225. package/dist/index99.cjs +1 -1
  226. package/dist/index99.js +30 -35
  227. package/dist/src/index.d.ts +1 -0
  228. package/dist/src/lib/auth/siwe/siwe.d.ts +3 -2
  229. package/dist/src/lib/digestKey/digestKey.d.ts +12 -0
  230. package/package.json +4 -1
package/dist/index52.js CHANGED
@@ -1,6 +1,27 @@
1
- async function n(e) {
2
- return new Promise((t) => setTimeout(t, e));
1
+ import { hexToNumber as b } from "./index35.js";
2
+ import { formatLog as d } from "./index93.js";
3
+ import { transactionType as m } from "./index50.js";
4
+ const f = {
5
+ "0x0": "reverted",
6
+ "0x1": "success"
7
+ };
8
+ function r(l) {
9
+ const u = {
10
+ ...l,
11
+ blockNumber: l.blockNumber ? BigInt(l.blockNumber) : null,
12
+ contractAddress: l.contractAddress ? l.contractAddress : null,
13
+ cumulativeGasUsed: l.cumulativeGasUsed ? BigInt(l.cumulativeGasUsed) : null,
14
+ effectiveGasPrice: l.effectiveGasPrice ? BigInt(l.effectiveGasPrice) : null,
15
+ gasUsed: l.gasUsed ? BigInt(l.gasUsed) : null,
16
+ logs: l.logs ? l.logs.map((s) => d(s)) : null,
17
+ to: l.to ? l.to : null,
18
+ transactionIndex: l.transactionIndex ? b(l.transactionIndex) : null,
19
+ status: l.status ? f[l.status] : null,
20
+ type: l.type ? m[l.type] || l.type : null
21
+ };
22
+ return l.blobGasPrice && (u.blobGasPrice = BigInt(l.blobGasPrice)), l.blobGasUsed && (u.blobGasUsed = BigInt(l.blobGasUsed)), u;
3
23
  }
4
24
  export {
5
- n as wait
25
+ r as formatTransactionReceipt,
26
+ f as receiptStatuses
6
27
  };
package/dist/index53.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index54.cjs"),f=require("./index55.cjs"),a=require("./index56.cjs"),l=require("./index57.cjs"),A=require("./index58.cjs"),o=new l.LruMap(8192);function u(s,t){if(o.has(`${s}.${t}`))return o.get(`${s}.${t}`);const c=s.substring(2).toLowerCase(),n=a.keccak256(f.stringToBytes(c),"bytes"),r=c.split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&r[e]&&(r[e]=r[e].toUpperCase()),(n[e>>1]&15)>=8&&r[e+1]&&(r[e+1]=r[e+1].toUpperCase());const i=`0x${r.join("")}`;return o.set(`${s}.${t}`,i),i}function g(s,t){if(!A.isAddress(s,{strict:!1}))throw new d.InvalidAddressError({address:s});return u(s,t)}exports.checksumAddress=u;exports.getAddress=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index35.cjs"),d=require("./index54.cjs"),y=require("./index55.cjs"),h=require("./index56.cjs"),B=require("./index57.cjs"),m=require("./index46.cjs");function q(t,{emitOnBegin:b=!1,emitMissed:l=!1,onBlockNumber:p,onError:a,poll:k,pollingInterval:i=t.pollingInterval}){const g=typeof k<"u"?k:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket");let r;return g?(()=>{const f=B.stringify(["watchBlockNumber",t.uid,b,l,i]);return y.observe(f,{onBlockNumber:p,onError:a},o=>h.poll(async()=>{var c;try{const e=await d.getAction(t,m.getBlockNumber,"getBlockNumber")({cacheTime:0});if(r){if(e===r)return;if(e-r>1&&l)for(let s=r+1n;s<e;s++)o.onBlockNumber(s,r),r=s}(!r||e>r)&&(o.onBlockNumber(e,r),r=e)}catch(e){(c=o.onError)==null||c.call(o,e)}},{emitOnBegin:b,interval:i}))})():(()=>{const f=B.stringify(["watchBlockNumber",t.uid,b,l]);return y.observe(f,{onBlockNumber:p,onError:a},o=>{let c=!0,e=()=>c=!1;return(async()=>{try{const s=(()=>{if(t.transport.type==="fallback"){const n=t.transport.transports.find(u=>u.config.type==="webSocket");return n?n.value:t.transport}return t.transport})(),{unsubscribe:v}=await s.subscribe({params:["newHeads"],onData(n){var N;if(!c)return;const u=w.hexToBigInt((N=n.result)==null?void 0:N.number);o.onBlockNumber(u,r),r=u},onError(n){var u;(u=o.onError)==null||u.call(o,n)}});e=v,c||e()}catch(s){a==null||a(s)}})(),()=>e()})})()}exports.watchBlockNumber=q;
package/dist/index53.js CHANGED
@@ -1,24 +1,78 @@
1
- import { InvalidAddressError as c } from "./index54.js";
2
- import { stringToBytes as m } from "./index55.js";
3
- import { keccak256 as p } from "./index56.js";
4
- import { LruMap as u } from "./index57.js";
5
- import { isAddress as $ } from "./index58.js";
6
- const s = /* @__PURE__ */ new u(8192);
7
- function h(t, o) {
8
- if (s.has(`${t}.${o}`))
9
- return s.get(`${t}.${o}`);
10
- const i = t.substring(2).toLowerCase(), n = p(m(i), "bytes"), e = i.split("");
11
- for (let r = 0; r < 40; r += 2)
12
- n[r >> 1] >> 4 >= 8 && e[r] && (e[r] = e[r].toUpperCase()), (n[r >> 1] & 15) >= 8 && e[r + 1] && (e[r + 1] = e[r + 1].toUpperCase());
13
- const f = `0x${e.join("")}`;
14
- return s.set(`${t}.${o}`, f), f;
15
- }
16
- function w(t, o) {
17
- if (!$(t, { strict: !1 }))
18
- throw new c({ address: t });
19
- return h(t, o);
1
+ import { hexToBigInt as h } from "./index35.js";
2
+ import { getAction as v } from "./index54.js";
3
+ import { observe as i } from "./index55.js";
4
+ import { poll as d } from "./index56.js";
5
+ import { stringify as y } from "./index57.js";
6
+ import { getBlockNumber as g } from "./index46.js";
7
+ function j(t, { emitOnBegin: b = !1, emitMissed: f = !1, onBlockNumber: p, onError: n, poll: k, pollingInterval: m = t.pollingInterval }) {
8
+ const B = typeof k < "u" ? k : !(t.transport.type === "webSocket" || t.transport.type === "fallback" && t.transport.transports[0].config.type === "webSocket");
9
+ let r;
10
+ return B ? (() => {
11
+ const l = y([
12
+ "watchBlockNumber",
13
+ t.uid,
14
+ b,
15
+ f,
16
+ m
17
+ ]);
18
+ return i(l, { onBlockNumber: p, onError: n }, (e) => d(async () => {
19
+ var a;
20
+ try {
21
+ const o = await v(t, g, "getBlockNumber")({ cacheTime: 0 });
22
+ if (r) {
23
+ if (o === r)
24
+ return;
25
+ if (o - r > 1 && f)
26
+ for (let s = r + 1n; s < o; s++)
27
+ e.onBlockNumber(s, r), r = s;
28
+ }
29
+ (!r || o > r) && (e.onBlockNumber(o, r), r = o);
30
+ } catch (o) {
31
+ (a = e.onError) == null || a.call(e, o);
32
+ }
33
+ }, {
34
+ emitOnBegin: b,
35
+ interval: m
36
+ }));
37
+ })() : (() => {
38
+ const l = y([
39
+ "watchBlockNumber",
40
+ t.uid,
41
+ b,
42
+ f
43
+ ]);
44
+ return i(l, { onBlockNumber: p, onError: n }, (e) => {
45
+ let a = !0, o = () => a = !1;
46
+ return (async () => {
47
+ try {
48
+ const s = (() => {
49
+ if (t.transport.type === "fallback") {
50
+ const c = t.transport.transports.find((u) => u.config.type === "webSocket");
51
+ return c ? c.value : t.transport;
52
+ }
53
+ return t.transport;
54
+ })(), { unsubscribe: w } = await s.subscribe({
55
+ params: ["newHeads"],
56
+ onData(c) {
57
+ var N;
58
+ if (!a)
59
+ return;
60
+ const u = h((N = c.result) == null ? void 0 : N.number);
61
+ e.onBlockNumber(u, r), r = u;
62
+ },
63
+ onError(c) {
64
+ var u;
65
+ (u = e.onError) == null || u.call(e, c);
66
+ }
67
+ });
68
+ o = w, a || o();
69
+ } catch (s) {
70
+ n == null || n(s);
71
+ }
72
+ })(), () => o();
73
+ });
74
+ })();
20
75
  }
21
76
  export {
22
- h as checksumAddress,
23
- w as getAddress
77
+ j as watchBlockNumber
24
78
  };
package/dist/index54.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index43.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(t,e,o){const i=t[e.name];if(typeof i=="function")return i;const n=t[o];return typeof n=="function"?n:c=>e(t,c)}exports.getAction=r;
package/dist/index54.js CHANGED
@@ -1,15 +1,10 @@
1
- import { BaseError as r } from "./index43.js";
2
- class d extends r {
3
- constructor({ address: s }) {
4
- super(`Address "${s}" is invalid.`, {
5
- metaMessages: [
6
- "- Address must be a hex value of 20 bytes (40 hex characters).",
7
- "- Address must match its checksum counterpart."
8
- ],
9
- name: "InvalidAddressError"
10
- });
11
- }
1
+ function f(t, n, c) {
2
+ const i = t[n.name];
3
+ if (typeof i == "function")
4
+ return i;
5
+ const o = t[c];
6
+ return typeof o == "function" ? o : (e) => n(t, e);
12
7
  }
13
8
  export {
14
- d as InvalidAddressError
9
+ f as getAction
15
10
  };
package/dist/index55.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index43.cjs"),l=require("./index69.cjs"),u=require("./index42.cjs"),f=require("./index34.cjs"),m=require("./index24.cjs"),h=new TextEncoder;function A(e,n={}){return typeof e=="number"||typeof e=="bigint"?B(e,n):typeof e=="boolean"?x(e,n):l.isHex(e)?c(e,n):T(e,n)}function x(e,n={}){const t=new Uint8Array(1);return t[0]=Number(e),typeof n.size=="number"?(f.assertSize(t,{size:n.size}),u.pad(t,{size:n.size})):t}const i={zero:48,nine:57,A:65,F:70,a:97,f:102};function g(e){if(e>=i.zero&&e<=i.nine)return e-i.zero;if(e>=i.A&&e<=i.F)return e-(i.A-10);if(e>=i.a&&e<=i.f)return e-(i.a-10)}function c(e,n={}){let t=e;n.size&&(f.assertSize(t,{size:n.size}),t=u.pad(t,{dir:"right",size:n.size}));let r=t.slice(2);r.length%2&&(r=`0${r}`);const d=r.length/2,y=new Uint8Array(d);for(let s=0,o=0;s<d;s++){const b=g(r.charCodeAt(o++)),z=g(r.charCodeAt(o++));if(b===void 0||z===void 0)throw new a.BaseError(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);y[s]=b*16+z}return y}function B(e,n){const t=m.numberToHex(e,n);return c(t)}function T(e,n={}){const t=h.encode(e);return typeof n.size=="number"?(f.assertSize(t,{size:n.size}),u.pad(t,{dir:"right",size:n.size})):t}exports.boolToBytes=x;exports.hexToBytes=c;exports.numberToBytes=B;exports.stringToBytes=T;exports.toBytes=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=new Map,r=new Map;let m=0;function w(n,u,C){const o=++m,s=()=>i.get(n)||[],y=()=>{const t=s();i.set(n,t.filter(e=>e.id!==o))},a=()=>{const t=s();if(!t.some(c=>c.id===o))return;const e=r.get(n);t.length===1&&e&&e(),y()},l=s();if(i.set(n,[...l,{id:o,fns:u}]),l&&l.length>0)return a;const f={};for(const t in u)f[t]=(...e)=>{var h,p;const c=s();if(c.length!==0)for(const b of c)(p=(h=b.fns)[t])==null||p.call(h,...e)};const g=C(f);return typeof g=="function"&&r.set(n,g),a}exports.cleanupCache=r;exports.listenersCache=i;exports.observe=w;
package/dist/index55.js CHANGED
@@ -1,58 +1,35 @@
1
- import { BaseError as g } from "./index43.js";
2
- import { isHex as x } from "./index69.js";
3
- import { pad as s } from "./index42.js";
4
- import { assertSize as u } from "./index34.js";
5
- import { numberToHex as h } from "./index24.js";
6
- const A = /* @__PURE__ */ new TextEncoder();
7
- function F(e, n = {}) {
8
- return typeof e == "number" || typeof e == "bigint" ? T(e, n) : typeof e == "boolean" ? B(e, n) : x(e) ? y(e, n) : l(e, n);
9
- }
10
- function B(e, n = {}) {
11
- const r = new Uint8Array(1);
12
- return r[0] = Number(e), typeof n.size == "number" ? (u(r, { size: n.size }), s(r, { size: n.size })) : r;
13
- }
14
- const t = {
15
- zero: 48,
16
- nine: 57,
17
- A: 65,
18
- F: 70,
19
- a: 97,
20
- f: 102
21
- };
22
- function m(e) {
23
- if (e >= t.zero && e <= t.nine)
24
- return e - t.zero;
25
- if (e >= t.A && e <= t.F)
26
- return e - (t.A - 10);
27
- if (e >= t.a && e <= t.f)
28
- return e - (t.a - 10);
29
- }
30
- function y(e, n = {}) {
31
- let r = e;
32
- n.size && (u(r, { size: n.size }), r = s(r, { dir: "right", size: n.size }));
33
- let i = r.slice(2);
34
- i.length % 2 && (i = `0${i}`);
35
- const z = i.length / 2, d = new Uint8Array(z);
36
- for (let f = 0, o = 0; f < z; f++) {
37
- const b = m(i.charCodeAt(o++)), c = m(i.charCodeAt(o++));
38
- if (b === void 0 || c === void 0)
39
- throw new g(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
40
- d[f] = b * 16 + c;
41
- }
42
- return d;
43
- }
44
- function T(e, n) {
45
- const r = h(e, n);
46
- return y(r);
47
- }
48
- function l(e, n = {}) {
49
- const r = A.encode(e);
50
- return typeof n.size == "number" ? (u(r, { size: n.size }), s(r, { dir: "right", size: n.size })) : r;
1
+ const l = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
2
+ let m = 0;
3
+ function y(e, f, w) {
4
+ const i = ++m, s = () => l.get(e) || [], C = () => {
5
+ const n = s();
6
+ l.set(e, n.filter((t) => t.id !== i));
7
+ }, r = () => {
8
+ const n = s();
9
+ if (!n.some((c) => c.id === i))
10
+ return;
11
+ const t = h.get(e);
12
+ n.length === 1 && t && t(), C();
13
+ }, o = s();
14
+ if (l.set(e, [
15
+ ...o,
16
+ { id: i, fns: f }
17
+ ]), o && o.length > 0)
18
+ return r;
19
+ const u = {};
20
+ for (const n in f)
21
+ u[n] = (...t) => {
22
+ var p, g;
23
+ const c = s();
24
+ if (c.length !== 0)
25
+ for (const k of c)
26
+ (g = (p = k.fns)[n]) == null || g.call(p, ...t);
27
+ };
28
+ const a = w(u);
29
+ return typeof a == "function" && h.set(e, a), r;
51
30
  }
52
31
  export {
53
- B as boolToBytes,
54
- y as hexToBytes,
55
- T as numberToBytes,
56
- l as stringToBytes,
57
- F as toBytes
32
+ h as cleanupCache,
33
+ l as listenersCache,
34
+ y as observe
58
35
  };
package/dist/index56.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index94.cjs"),o=require("./index69.cjs"),i=require("./index55.cjs"),n=require("./index24.cjs");function u(e,r){const s=r||"hex",t=c.keccak_256(o.isHex(e,{strict:!1})?i.toBytes(e):e);return s==="bytes"?t:n.toHex(t)}exports.keccak256=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index97.cjs");function s(o,{emitOnBegin:w,initialWaitTime:t,interval:c}){let e=!0;const a=()=>e=!1;return(async()=>{let n;w&&(n=await o({unpoll:a}));const r=await(t==null?void 0:t(n))??c;await u.wait(r);const l=async()=>{e&&(await o({unpoll:a}),await u.wait(c),l())};l()})(),a}exports.poll=s;
package/dist/index56.js CHANGED
@@ -1,11 +1,18 @@
1
- import { keccak_256 as c } from "./index94.js";
2
- import { isHex as i } from "./index69.js";
3
- import { toBytes as m } from "./index55.js";
4
- import { toHex as s } from "./index24.js";
5
- function x(t, r) {
6
- const e = r || "hex", o = c(i(t, { strict: !1 }) ? m(t) : t);
7
- return e === "bytes" ? o : s(o);
1
+ import { wait as l } from "./index97.js";
2
+ function f(o, { emitOnBegin: r, initialWaitTime: t, interval: c }) {
3
+ let n = !0;
4
+ const a = () => n = !1;
5
+ return (async () => {
6
+ let w;
7
+ r && (w = await o({ unpoll: a }));
8
+ const s = await (t == null ? void 0 : t(w)) ?? c;
9
+ await l(s);
10
+ const u = async () => {
11
+ n && (await o({ unpoll: a }), await l(c), u());
12
+ };
13
+ u();
14
+ })(), a;
8
15
  }
9
16
  export {
10
- x as keccak256
17
+ f as poll
11
18
  };
package/dist/index57.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}exports.LruMap=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(e,n,i)=>JSON.stringify(e,(o,t)=>typeof t=="bigint"?t.toString():t,i);exports.stringify=r;
package/dist/index57.js CHANGED
@@ -1,24 +1,4 @@
1
- class r extends Map {
2
- constructor(e) {
3
- super(), Object.defineProperty(this, "maxSize", {
4
- enumerable: !0,
5
- configurable: !0,
6
- writable: !0,
7
- value: void 0
8
- }), this.maxSize = e;
9
- }
10
- get(e) {
11
- const t = super.get(e);
12
- return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
13
- }
14
- set(e, t) {
15
- if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
16
- const s = this.keys().next().value;
17
- s && this.delete(s);
18
- }
19
- return this;
20
- }
21
- }
1
+ const g = (r, n, i) => JSON.stringify(r, (e, t) => typeof t == "bigint" ? t.toString() : t, i);
22
2
  export {
23
- r as LruMap
3
+ g as stringify
24
4
  };
package/dist/index58.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index57.cjs"),i=require("./index53.cjs"),o=/^0x[a-fA-F0-9]{40}$/,t=new c.LruMap(8192);function f(e,n){const{strict:s=!0}=n??{},r=`${e}.${s}`;if(t.has(r))return t.get(r);const u=o.test(e)?e.toLowerCase()===e?!0:s?i.checksumAddress(e)===e:!0:!1;return t.set(r,u),u}exports.isAddress=f;exports.isAddressCache=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}exports.withResolvers=i;
package/dist/index58.js CHANGED
@@ -1,14 +1,11 @@
1
- import { LruMap as u } from "./index57.js";
2
- import { checksumAddress as c } from "./index53.js";
3
- const i = /^0x[a-fA-F0-9]{40}$/, r = /* @__PURE__ */ new u(8192);
4
- function h(t, s) {
5
- const { strict: n = !0 } = s ?? {}, e = `${t}.${n}`;
6
- if (r.has(e))
7
- return r.get(e);
8
- const o = i.test(t) ? t.toLowerCase() === t ? !0 : n ? c(t) === t : !0 : !1;
9
- return r.set(e, o), o;
1
+ function i() {
2
+ let e = () => {
3
+ }, n = () => {
4
+ };
5
+ return { promise: new Promise((r, o) => {
6
+ e = r, n = o;
7
+ }), resolve: e, reject: n };
10
8
  }
11
9
  export {
12
- h as isAddress,
13
- r as isAddressCache
10
+ i as withResolvers
14
11
  };
package/dist/index59.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index55.cjs"),l=require("./index24.cjs");function c(o){const{kzg:s}=o,n=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),e=typeof o.blobs[0]=="string"?o.blobs.map(t=>i.hexToBytes(t)):o.blobs,b=[];for(const t of e)b.push(Uint8Array.from(s.blobToKzgCommitment(t)));return n==="bytes"?b:b.map(t=>l.bytesToHex(t))}exports.blobsToCommitments=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index97.cjs");function f(n,{delay:e=100,retryCount:o=2,shouldRetry:c=()=>!0}={}){return new Promise((s,y)=>{const a=async({count:r=0}={})=>{const w=async({error:t})=>{const i=typeof e=="function"?e({count:r,error:t}):e;i&&await u.wait(i),a({count:r+1})};try{const t=await n();s(t)}catch(t){if(r<o&&await c({count:r,error:t}))return w({error:t});y(t)}};a()})}exports.withRetry=f;
package/dist/index59.js CHANGED
@@ -1,11 +1,23 @@
1
- import { hexToBytes as i } from "./index55.js";
2
- import { bytesToHex as f } from "./index24.js";
3
- function y(o) {
4
- const { kzg: s } = o, n = o.to ?? (typeof o.blobs[0] == "string" ? "hex" : "bytes"), m = typeof o.blobs[0] == "string" ? o.blobs.map((t) => i(t)) : o.blobs, b = [];
5
- for (const t of m)
6
- b.push(Uint8Array.from(s.blobToKzgCommitment(t)));
7
- return n === "bytes" ? b : b.map((t) => f(t));
1
+ import { wait as w } from "./index97.js";
2
+ function p(n, { delay: e = 100, retryCount: o = 2, shouldRetry: c = () => !0 } = {}) {
3
+ return new Promise((s, y) => {
4
+ const a = async ({ count: r = 0 } = {}) => {
5
+ const f = async ({ error: t }) => {
6
+ const i = typeof e == "function" ? e({ count: r, error: t }) : e;
7
+ i && await w(i), a({ count: r + 1 });
8
+ };
9
+ try {
10
+ const t = await n();
11
+ s(t);
12
+ } catch (t) {
13
+ if (r < o && await c({ count: r, error: t }))
14
+ return f({ error: t });
15
+ y(t);
16
+ }
17
+ };
18
+ a();
19
+ });
8
20
  }
9
21
  export {
10
- y as blobsToCommitments
22
+ p as withRetry
11
23
  };
package/dist/index6.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r extends URL{constructor(t,e){super(t,e)}endpoint(t){t.startsWith("/")||(t=`/${t}`);const e=`${this.pathname!=="/"?this.pathname:""}${t}`;return new r(e,this)}socket(){if(this.protocol==="https:")return this.origin.replace("https","wss");if(this.protocol==="http:")return this.origin.replace("http","ws");throw new Error("Invalid protocol")}addSearchParams(t){const e=new URLSearchParams(this.search);for(const s in t)e.set(s,t[s]);return new r(`${this.pathname}?${e.toString()}`,this)}}exports.Url=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index17.cjs"),a=require("./index5.cjs"),s=require("@peculiar/webcrypto"),o=require("./index19.cjs");class e{constructor(t){if(!e.isValidDigestKey(t))throw new Error("Invalid digest key format");this._digestKey=t;const r=o.privateKeyToAccount("0x"+t);this._userId=r.address}static from(t){return t=n.trim0x(t),this.isValidDigestKey(t)?a.Ok(new e(t)):a.Err("Invalid digest key format")}static generateRandom(){const t=e.generateRandomDigestKey();return e.from(t)}static isValidDigestKey(t){return/^[0-9a-fA-F]{64}$/.test(t)&&this.isValidPrivateKey(t)}static isValidPrivateKey(t){const r=BigInt("0x"+t),i=1n,f=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");return r>=i&&r<f}static generateRandomDigestKey(){const t=new s.Crypto,r=new Uint8Array(32);t.getRandomValues(r);const i=n.trim0x(Buffer.from(r).toString("hex"));return e.isValidPrivateKey(i)?i:e.generateRandomDigestKey()}get digestKey(){return this._digestKey}get userId(){return this._userId}}exports.DigestKey=e;
package/dist/index6.js CHANGED
@@ -1,26 +1,44 @@
1
- class r extends URL {
2
- constructor(t, s) {
3
- super(t, s);
4
- }
5
- endpoint(t) {
6
- t.startsWith("/") || (t = `/${t}`);
7
- const s = `${this.pathname !== "/" ? this.pathname : ""}${t}`;
8
- return new r(s, this);
9
- }
10
- socket() {
11
- if (this.protocol === "https:")
12
- return this.origin.replace("https", "wss");
13
- if (this.protocol === "http:")
14
- return this.origin.replace("http", "ws");
15
- throw new Error("Invalid protocol");
16
- }
17
- addSearchParams(t) {
18
- const s = new URLSearchParams(this.search);
19
- for (const e in t)
20
- s.set(e, t[e]);
21
- return new r(`${this.pathname}?${s.toString()}`, this);
1
+ import { trim0x as a } from "./index17.js";
2
+ import { Err as n, Ok as o } from "./index5.js";
3
+ import { Crypto as s } from "@peculiar/webcrypto";
4
+ import { privateKeyToAccount as c } from "./index19.js";
5
+ class e {
6
+ constructor(t) {
7
+ if (!e.isValidDigestKey(t))
8
+ throw new Error("Invalid digest key format");
9
+ this._digestKey = t;
10
+ const r = c("0x" + t);
11
+ this._userId = r.address;
12
+ }
13
+ static from(t) {
14
+ return t = a(t), this.isValidDigestKey(t) ? o(new e(t)) : n("Invalid digest key format");
15
+ }
16
+ static generateRandom() {
17
+ const t = e.generateRandomDigestKey();
18
+ return e.from(t);
19
+ }
20
+ static isValidDigestKey(t) {
21
+ return /^[0-9a-fA-F]{64}$/.test(t) && this.isValidPrivateKey(t);
22
+ }
23
+ static isValidPrivateKey(t) {
24
+ const r = BigInt("0x" + t), f = 1n, i = BigInt(
25
+ "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
26
+ );
27
+ return r >= f && r < i;
28
+ }
29
+ static generateRandomDigestKey() {
30
+ const t = new s(), r = new Uint8Array(32);
31
+ t.getRandomValues(r);
32
+ const f = a(Buffer.from(r).toString("hex"));
33
+ return e.isValidPrivateKey(f) ? f : e.generateRandomDigestKey();
34
+ }
35
+ get digestKey() {
36
+ return this._digestKey;
37
+ }
38
+ get userId() {
39
+ return this._userId;
22
40
  }
23
41
  }
24
42
  export {
25
- r as Url
43
+ e as DigestKey
26
44
  };
package/dist/index60.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index55.cjs"),y=require("./index24.cjs");function f(t){const{kzg:c}=t,e=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>b.hexToBytes(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>b.hexToBytes(o)):t.commitments,s=[];for(let o=0;o<n.length;o++){const l=n[o],m=i[o];s.push(Uint8Array.from(c.computeBlobKzgProof(l,m)))}return e==="bytes"?s:s.map(o=>y.bytesToHex(o))}exports.blobsToProofs=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index71.cjs");class i extends n.BaseError{constructor({max:e,min:r,signed:s,size:t,value:a}){super(`Number "${a}" is not in safe ${t?`${t*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}class u extends n.BaseError{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}exports.IntegerOutOfRangeError=i;exports.SizeOverflowError=u;
package/dist/index60.js CHANGED
@@ -1,13 +1,15 @@
1
- import { hexToBytes as b } from "./index55.js";
2
- import { bytesToHex as y } from "./index24.js";
3
- function h(t) {
4
- const { kzg: m } = t, c = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), s = typeof t.blobs[0] == "string" ? t.blobs.map((o) => b(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => b(o)) : t.commitments, n = [];
5
- for (let o = 0; o < s.length; o++) {
6
- const f = s[o], l = i[o];
7
- n.push(Uint8Array.from(m.computeBlobKzgProof(f, l)));
1
+ import { BaseError as t } from "./index71.js";
2
+ class $ extends t {
3
+ constructor({ max: e, min: r, signed: s, size: n, value: a }) {
4
+ super(`Number "${a}" is not in safe ${n ? `${n * 8}-bit ${s ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" });
5
+ }
6
+ }
7
+ class c extends t {
8
+ constructor({ givenSize: e, maxSize: r }) {
9
+ super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
8
10
  }
9
- return c === "bytes" ? n : n.map((o) => y(o));
10
11
  }
11
12
  export {
12
- h as blobsToProofs
13
+ $ as IntegerOutOfRangeError,
14
+ c as SizeOverflowError
13
15
  };
package/dist/index61.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index62.cjs");function c(o){const{commitments:e,version:s}=o,n=o.to??(typeof e[0]=="string"?"hex":"bytes"),t=[];for(const m of e)t.push(i.commitmentToVersionedHash({commitment:m,to:n,version:s}));return t}exports.commitmentsToVersionedHashes=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index104.cjs");function p(e,{dir:n,size:t=32}={}){return typeof e=="string"?o(e,{dir:n,size:t}):l(e,{dir:n,size:t})}function o(e,{dir:n,size:t=32}={}){if(t===null)return e;const r=e.replace("0x","");if(r.length>t*2)throw new i.SizeExceedsPaddingSizeError({size:Math.ceil(r.length/2),targetSize:t,type:"hex"});return`0x${r[n==="right"?"padEnd":"padStart"](t*2,"0")}`}function l(e,{dir:n,size:t=32}={}){if(t===null)return e;if(e.length>t)throw new i.SizeExceedsPaddingSizeError({size:e.length,targetSize:t,type:"bytes"});const r=new Uint8Array(t);for(let a=0;a<t;a++){const d=n==="right";r[d?a:t-a-1]=e[d?a:e.length-a-1]}return r}exports.pad=p;exports.padBytes=l;exports.padHex=o;
package/dist/index61.js CHANGED
@@ -1,14 +1,37 @@
1
- import { commitmentToVersionedHash as i } from "./index62.js";
2
- function r(o) {
3
- const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
4
- for (const m of t)
5
- s.push(i({
6
- commitment: m,
7
- to: e,
8
- version: n
9
- }));
10
- return s;
1
+ import { SizeExceedsPaddingSizeError as d } from "./index104.js";
2
+ function f(n, { dir: r, size: t = 32 } = {}) {
3
+ return typeof n == "string" ? p(n, { dir: r, size: t }) : i(n, { dir: r, size: t });
4
+ }
5
+ function p(n, { dir: r, size: t = 32 } = {}) {
6
+ if (t === null)
7
+ return n;
8
+ const e = n.replace("0x", "");
9
+ if (e.length > t * 2)
10
+ throw new d({
11
+ size: Math.ceil(e.length / 2),
12
+ targetSize: t,
13
+ type: "hex"
14
+ });
15
+ return `0x${e[r === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
16
+ }
17
+ function i(n, { dir: r, size: t = 32 } = {}) {
18
+ if (t === null)
19
+ return n;
20
+ if (n.length > t)
21
+ throw new d({
22
+ size: n.length,
23
+ targetSize: t,
24
+ type: "bytes"
25
+ });
26
+ const e = new Uint8Array(t);
27
+ for (let a = 0; a < t; a++) {
28
+ const o = r === "right";
29
+ e[o ? a : t - a - 1] = n[o ? a : n.length - a - 1];
30
+ }
31
+ return e;
11
32
  }
12
33
  export {
13
- r as commitmentsToVersionedHashes
34
+ f as pad,
35
+ i as padBytes,
36
+ p as padHex
14
37
  };
package/dist/index62.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index24.cjs"),r=require("./index97.cjs");function c(t){const{commitment:o,version:s=1}=t,n=t.to??(typeof o=="string"?"hex":"bytes"),e=r.sha256(o);return e.set([s],0),n==="bytes"?e:i.bytesToHex(e)}exports.commitmentToVersionedHash=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index63.cjs"),c=require("./index64.cjs");class r extends c.Hash{constructor(t,i){super(),this.finished=!1,this.destroyed=!1,o.ahash(t);const h=c.toBytes(i);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,e=new Uint8Array(a);e.set(h.length>a?t.create().update(h).digest():h);for(let s=0;s<e.length;s++)e[s]^=54;this.iHash.update(e),this.oHash=t.create();for(let s=0;s<e.length;s++)e[s]^=106;this.oHash.update(e),e.fill(0)}update(t){return o.aexists(this),this.iHash.update(t),this}digestInto(t){o.aexists(this),o.abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:i,iHash:h,finished:a,destroyed:e,blockLen:s,outputLen:u}=this;return t=t,t.finished=a,t.destroyed=e,t.blockLen=s,t.outputLen=u,t.oHash=i._cloneInto(t.oHash),t.iHash=h._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const d=(n,t,i)=>new r(n,t).update(i).digest();d.create=(n,t)=>new r(n,t);exports.HMAC=r;exports.hmac=d;