@gardenfi/utils 2.4.6-beta.1 → 2.4.6-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 (105) hide show
  1. package/dist/index100.cjs +1 -1
  2. package/dist/index100.js +2 -2
  3. package/dist/index121.cjs +1 -1
  4. package/dist/index121.js +1 -1
  5. package/dist/index16.cjs +1 -1
  6. package/dist/index16.js +2 -2
  7. package/dist/index18.cjs +1 -1
  8. package/dist/index18.js +2 -2
  9. package/dist/index197.cjs +1 -1
  10. package/dist/index197.js +3 -3
  11. package/dist/index226.cjs +1 -1
  12. package/dist/index226.js +2 -2
  13. package/dist/index229.cjs +1 -1
  14. package/dist/index229.js +2 -2
  15. package/dist/index230.cjs +1 -1
  16. package/dist/index230.js +1 -1
  17. package/dist/index242.cjs +1 -1
  18. package/dist/index242.js +3 -3
  19. package/dist/index26.cjs +1 -1
  20. package/dist/index26.js +2 -2
  21. package/dist/index262.cjs +2 -1
  22. package/dist/index262.js +40 -102
  23. package/dist/index263.cjs +1 -1
  24. package/dist/index263.js +2 -7
  25. package/dist/index264.cjs +1 -1
  26. package/dist/index264.js +5 -224
  27. package/dist/index265.cjs +1 -1
  28. package/dist/index265.js +10 -6
  29. package/dist/index266.cjs +1 -1
  30. package/dist/index266.js +20 -7
  31. package/dist/index267.cjs +1 -1
  32. package/dist/index267.js +8 -26
  33. package/dist/index268.cjs +1 -1
  34. package/dist/index268.js +66 -5
  35. package/dist/index269.cjs +1 -2
  36. package/dist/index269.js +64 -40
  37. package/dist/index270.cjs +1 -1
  38. package/dist/index270.js +187 -2
  39. package/dist/index271.cjs +1 -1
  40. package/dist/index271.js +20 -8
  41. package/dist/index272.cjs +1 -1
  42. package/dist/index272.js +40 -17
  43. package/dist/index273.cjs +1 -1
  44. package/dist/index273.js +76 -8
  45. package/dist/index274.cjs +1 -1
  46. package/dist/index274.js +40 -66
  47. package/dist/index275.cjs +1 -1
  48. package/dist/index275.js +15 -64
  49. package/dist/index276.cjs +1 -1
  50. package/dist/index276.js +12 -185
  51. package/dist/index277.cjs +1 -1
  52. package/dist/index277.js +11 -21
  53. package/dist/index278.cjs +2 -1
  54. package/dist/index278.js +18 -42
  55. package/dist/index279.cjs +1 -1
  56. package/dist/index279.js +13 -75
  57. package/dist/index28.cjs +1 -1
  58. package/dist/index28.js +31 -27
  59. package/dist/index280.cjs +1 -1
  60. package/dist/index280.js +11 -40
  61. package/dist/index281.cjs +1 -1
  62. package/dist/index281.js +6 -16
  63. package/dist/index282.cjs +1 -1
  64. package/dist/index282.js +7 -14
  65. package/dist/index283.cjs +1 -1
  66. package/dist/index283.js +25 -11
  67. package/dist/index284.cjs +1 -2
  68. package/dist/index284.js +19 -18
  69. package/dist/index285.cjs +1 -1
  70. package/dist/index285.js +145 -13
  71. package/dist/index286.cjs +1 -1
  72. package/dist/index286.js +103 -11
  73. package/dist/index287.cjs +1 -1
  74. package/dist/index287.js +6 -19
  75. package/dist/index288.cjs +1 -1
  76. package/dist/index288.js +219 -141
  77. package/dist/index29.cjs +1 -1
  78. package/dist/index29.js +12 -8
  79. package/dist/index293.cjs +1 -1
  80. package/dist/index293.js +2 -2
  81. package/dist/index295.cjs +1 -1
  82. package/dist/index295.js +41 -10
  83. package/dist/index296.cjs +1 -1
  84. package/dist/index296.js +77 -18
  85. package/dist/index297.cjs +1 -1
  86. package/dist/index297.js +2 -43
  87. package/dist/index298.cjs +1 -1
  88. package/dist/index298.js +10 -77
  89. package/dist/index299.cjs +1 -1
  90. package/dist/index299.js +20 -2
  91. package/dist/index30.cjs +1 -1
  92. package/dist/index30.js +27 -31
  93. package/dist/index300.cjs +1 -1
  94. package/dist/index300.js +68 -698
  95. package/dist/index301.cjs +1 -1
  96. package/dist/index301.js +685 -126
  97. package/dist/index302.cjs +1 -1
  98. package/dist/index302.js +124 -186
  99. package/dist/index303.cjs +1 -1
  100. package/dist/index303.js +200 -67
  101. package/dist/index31.cjs +1 -1
  102. package/dist/index31.js +8 -12
  103. package/dist/index55.cjs +1 -1
  104. package/dist/index55.js +1 -1
  105. package/package.json +1 -1
package/dist/index279.js CHANGED
@@ -1,79 +1,17 @@
1
- import { BaseError as t } from "./index269.js";
2
- class n extends t {
3
- constructor({ param: e }) {
4
- super("Invalid ABI parameter.", {
5
- details: e
6
- }), Object.defineProperty(this, "name", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: "InvalidParameterError"
11
- });
12
- }
13
- }
14
- class s extends t {
15
- constructor({ param: e, name: r }) {
16
- super("Invalid ABI parameter.", {
17
- details: e,
18
- metaMessages: [
19
- `"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
20
- ]
21
- }), Object.defineProperty(this, "name", {
22
- enumerable: !0,
23
- configurable: !0,
24
- writable: !0,
25
- value: "SolidityProtectedKeywordError"
26
- });
27
- }
28
- }
29
- class l extends t {
30
- constructor({ param: e, type: r, modifier: i }) {
31
- super("Invalid ABI parameter.", {
32
- details: e,
33
- metaMessages: [
34
- `Modifier "${i}" not allowed${r ? ` in "${r}" type` : ""}.`
35
- ]
36
- }), Object.defineProperty(this, "name", {
37
- enumerable: !0,
38
- configurable: !0,
39
- writable: !0,
40
- value: "InvalidModifierError"
41
- });
42
- }
43
- }
44
- class d extends t {
45
- constructor({ param: e, type: r, modifier: i }) {
46
- super("Invalid ABI parameter.", {
47
- details: e,
48
- metaMessages: [
49
- `Modifier "${i}" not allowed${r ? ` in "${r}" type` : ""}.`,
50
- `Data location can only be specified for array, struct, or mapping types, but "${i}" was given.`
51
- ]
52
- }), Object.defineProperty(this, "name", {
53
- enumerable: !0,
54
- configurable: !0,
55
- writable: !0,
56
- value: "InvalidFunctionModifierError"
57
- });
58
- }
59
- }
60
- class u extends t {
61
- constructor({ abiParameter: e }) {
62
- super("Invalid ABI parameter.", {
63
- details: JSON.stringify(e, null, 2),
64
- metaMessages: ["ABI parameter type is invalid."]
65
- }), Object.defineProperty(this, "name", {
66
- enumerable: !0,
67
- configurable: !0,
68
- writable: !0,
69
- value: "InvalidAbiTypeParameterError"
70
- });
1
+ import { isAddress as f } from "./index176.js";
2
+ import { isAddressEqual as o } from "./index186.js";
3
+ function l(n) {
4
+ const { address: r, domain: s, message: e, nonce: t, scheme: a, time: i = /* @__PURE__ */ new Date() } = n;
5
+ if (s && e.domain !== s || t && e.nonce !== t || a && e.scheme !== a || e.expirationTime && i >= e.expirationTime || e.notBefore && i < e.notBefore)
6
+ return !1;
7
+ try {
8
+ if (!e.address || !f(e.address, { strict: !1 }) || r && !o(e.address, r))
9
+ return !1;
10
+ } catch {
11
+ return !1;
71
12
  }
13
+ return !0;
72
14
  }
73
15
  export {
74
- u as InvalidAbiTypeParameterError,
75
- d as InvalidFunctionModifierError,
76
- l as InvalidModifierError,
77
- n as InvalidParameterError,
78
- s as SolidityProtectedKeywordError
16
+ l as validateSiweMessage
79
17
  };
package/dist/index28.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index3.cjs");class i{constructor(e,t){this.maxRetries=Math.max(e,0),this.delay=t}async retry(e){let t=0,r;for(;t<this.maxRetries+1;)try{return await e()}catch(s){t++,r=s,await a.sleep(this.delay*t)}throw r}}exports.Retry=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index218.cjs"),a=e.defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.drpc.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0});exports.sepolia=a;
package/dist/index28.js CHANGED
@@ -1,29 +1,33 @@
1
- import { sleep as s } from "./index3.js";
2
- class l {
3
- /**
4
- * @param {number} maxRetries - The maximum number of retries, if less < 0 then it is set to 0
5
- * @param {number} delay - The delay between retries
6
- */
7
- constructor(e, t) {
8
- this.maxRetries = Math.max(e, 0), this.delay = t;
9
- }
10
- /**
11
- * Retries a function until it succeeds or the max number of retries is reached
12
- *
13
- * @param {() => Promise<T>} fn - The function to retry
14
- * @return {Promise<T>} a Promise that resolves to the result of the function
15
- */
16
- async retry(e) {
17
- let t = 0, r;
18
- for (; t < this.maxRetries + 1; )
19
- try {
20
- return await e();
21
- } catch (a) {
22
- t++, r = a, await s(this.delay * t);
23
- }
24
- throw r;
25
- }
26
- }
1
+ import { defineChain as e } from "./index218.js";
2
+ const s = /* @__PURE__ */ e({
3
+ id: 11155111,
4
+ name: "Sepolia",
5
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
6
+ rpcUrls: {
7
+ default: {
8
+ http: ["https://sepolia.drpc.org"]
9
+ }
10
+ },
11
+ blockExplorers: {
12
+ default: {
13
+ name: "Etherscan",
14
+ url: "https://sepolia.etherscan.io",
15
+ apiUrl: "https://api-sepolia.etherscan.io/api"
16
+ }
17
+ },
18
+ contracts: {
19
+ multicall3: {
20
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
21
+ blockCreated: 751532
22
+ },
23
+ ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
24
+ ensUniversalResolver: {
25
+ address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
26
+ blockCreated: 5317080
27
+ }
28
+ },
29
+ testnet: !0
30
+ });
27
31
  export {
28
- l as Retry
32
+ s as sepolia
29
33
  };
package/dist/index280.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index269.cjs");class a extends e.BaseError{constructor({signature:r,type:n}){super(`Invalid ${n} signature.`,{details:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class u extends e.BaseError{constructor({signature:r}){super("Unknown signature.",{details:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class i extends e.BaseError{constructor({signature:r}){super("Invalid struct signature.",{details:r,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}exports.InvalidSignatureError=a;exports.InvalidStructSignatureError=i;exports.UnknownSignatureError=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index224.cjs"),t=new o.LruMap(8192);function i(r,{enabled:n=!0,id:e}){if(!n||!e)return r();if(t.get(e))return t.get(e);const u=r().finally(()=>t.delete(e));return t.set(e,u),u}exports.promiseCache=t;exports.withDedupe=i;
package/dist/index280.js CHANGED
@@ -1,43 +1,14 @@
1
- import { BaseError as r } from "./index269.js";
2
- class u extends r {
3
- constructor({ signature: e, type: n }) {
4
- super(`Invalid ${n} signature.`, {
5
- details: e
6
- }), Object.defineProperty(this, "name", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: "InvalidSignatureError"
11
- });
12
- }
13
- }
14
- class i extends r {
15
- constructor({ signature: e }) {
16
- super("Unknown signature.", {
17
- details: e
18
- }), Object.defineProperty(this, "name", {
19
- enumerable: !0,
20
- configurable: !0,
21
- writable: !0,
22
- value: "UnknownSignatureError"
23
- });
24
- }
25
- }
26
- class s extends r {
27
- constructor({ signature: e }) {
28
- super("Invalid struct signature.", {
29
- details: e,
30
- metaMessages: ["No properties exist."]
31
- }), Object.defineProperty(this, "name", {
32
- enumerable: !0,
33
- configurable: !0,
34
- writable: !0,
35
- value: "InvalidStructSignatureError"
36
- });
37
- }
1
+ import { LruMap as u } from "./index224.js";
2
+ const t = /* @__PURE__ */ new u(8192);
3
+ function s(r, { enabled: o = !0, id: e }) {
4
+ if (!o || !e)
5
+ return r();
6
+ if (t.get(e))
7
+ return t.get(e);
8
+ const n = r().finally(() => t.delete(e));
9
+ return t.set(e, n), n;
38
10
  }
39
11
  export {
40
- u as InvalidSignatureError,
41
- s as InvalidStructSignatureError,
42
- i as UnknownSignatureError
12
+ t as promiseCache,
13
+ s as withDedupe
43
14
  };
package/dist/index281.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index269.cjs");class t extends s.BaseError{constructor({current:r,depth:e}){super("Unbalanced parentheses.",{metaMessages:[`"${r.trim()}" has too many ${e>0?"opening":"closing"} parentheses.`],details:`Depth "${e}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}exports.InvalidParenthesisError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index154.cjs"),r=require("./index156.cjs"),c=e=>r.keccak256(t.toBytes(e));function n(e){return c(e)}exports.hashSignature=n;
package/dist/index281.js CHANGED
@@ -1,19 +1,9 @@
1
- import { BaseError as s } from "./index269.js";
2
- class n extends s {
3
- constructor({ current: r, depth: e }) {
4
- super("Unbalanced parentheses.", {
5
- metaMessages: [
6
- `"${r.trim()}" has too many ${e > 0 ? "opening" : "closing"} parentheses.`
7
- ],
8
- details: `Depth "${e}"`
9
- }), Object.defineProperty(this, "name", {
10
- enumerable: !0,
11
- configurable: !0,
12
- writable: !0,
13
- value: "InvalidParenthesisError"
14
- });
15
- }
1
+ import { toBytes as o } from "./index154.js";
2
+ import { keccak256 as r } from "./index156.js";
3
+ const e = (t) => r(o(t));
4
+ function c(t) {
5
+ return e(t);
16
6
  }
17
7
  export {
18
- n as InvalidParenthesisError
8
+ c as hashSignature
19
9
  };
package/dist/index282.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index269.cjs");class t extends r.BaseError{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}exports.CircularReferenceError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index283.cjs"),n=require("./index264.cjs"),i=t=>{const r=typeof t=="string"?t:n.formatAbiItem(t);return e.normalizeSignature(r)};exports.toSignature=i;
package/dist/index282.js CHANGED
@@ -1,16 +1,9 @@
1
- import { BaseError as r } from "./index269.js";
2
- class a extends r {
3
- constructor({ type: e }) {
4
- super("Circular reference detected.", {
5
- metaMessages: [`Struct "${e}" is a circular reference.`]
6
- }), Object.defineProperty(this, "name", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: "CircularReferenceError"
11
- });
12
- }
13
- }
1
+ import { normalizeSignature as o } from "./index283.js";
2
+ import { formatAbiItem as n } from "./index264.js";
3
+ const m = (r) => {
4
+ const t = typeof r == "string" ? r : n(r);
5
+ return o(t);
6
+ };
14
7
  export {
15
- a as CircularReferenceError
8
+ m as toSignature
16
9
  };
package/dist/index283.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const t=e();exports.idCache=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index41.cjs");function a(r){let l=!0,i="",o=0,t="",u=!1;for(let n=0;n<r.length;n++){const e=r[n];if(["(",")",","].includes(e)&&(l=!0),e==="("&&o++,e===")"&&o--,!!l){if(o===0){if(e===" "&&["event","function",""].includes(t))t="";else if(t+=e,e===")"){u=!0;break}continue}if(e===" "){r[n-1]!==","&&i!==","&&i!==",("&&(i="",l=!1);continue}t+=e,i+=e}}if(!u)throw new f.BaseError("Unable to normalize signature.");return t}exports.normalizeSignature=a;
package/dist/index283.js CHANGED
@@ -1,15 +1,29 @@
1
- function r() {
2
- return {
3
- current: 0,
4
- take() {
5
- return this.current++;
6
- },
7
- reset() {
8
- this.current = 0;
1
+ import { BaseError as u } from "./index41.js";
2
+ function a(r) {
3
+ let l = !0, i = "", f = 0, t = "", o = !1;
4
+ for (let n = 0; n < r.length; n++) {
5
+ const e = r[n];
6
+ if (["(", ")", ","].includes(e) && (l = !0), e === "(" && f++, e === ")" && f--, !!l) {
7
+ if (f === 0) {
8
+ if (e === " " && ["event", "function", ""].includes(t))
9
+ t = "";
10
+ else if (t += e, e === ")") {
11
+ o = !0;
12
+ break;
13
+ }
14
+ continue;
15
+ }
16
+ if (e === " ") {
17
+ r[n - 1] !== "," && i !== "," && i !== ",(" && (i = "", l = !1);
18
+ continue;
19
+ }
20
+ t += e, i += e;
9
21
  }
10
- };
22
+ }
23
+ if (!o)
24
+ throw new u("Unable to normalize signature.");
25
+ return t;
11
26
  }
12
- const t = /* @__PURE__ */ r();
13
27
  export {
14
- t as idCache
28
+ a as normalizeSignature
15
29
  };
package/dist/index284.cjs CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function x(e){var c,d,f;const{scheme:n,statement:t,...p}=((c=e.match(h))==null?void 0:c.groups)??{},{chainId:s,expirationTime:i,issuedAt:o,notBefore:r,requestId:a,...m}=((d=e.match(A))==null?void 0:d.groups)??{},u=(f=e.split("Resources:")[1])==null?void 0:f.split(`
2
- - `).slice(1);return{...p,...m,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...o?{issuedAt:new Date(o)}:{},...r?{notBefore:new Date(r)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...n?{scheme:n}:{},...t?{statement:t}:{}}}const h=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,A=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;exports.parseSiweMessage=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=BigInt(2**32-1),c=BigInt(32);function u(t,o=!1){return o?{h:Number(t&l),l:Number(t>>c&l)}:{h:Number(t>>c&l)|0,l:Number(t&l)|0}}function B(t,o=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let e=0;e<r;e++){const{h:f,l:s}=u(t[e],o);[n[e],i[e]]=[f,s]}return[n,i]}const g=(t,o,r)=>t<<r|o>>>32-r,m=(t,o,r)=>o<<r|t>>>32-r,S=(t,o,r)=>o<<r-32|t>>>64-r,a=(t,o,r)=>t<<r-32|o>>>64-r;exports.fromBig=u;exports.rotlBH=S;exports.rotlBL=a;exports.rotlSH=g;exports.rotlSL=m;exports.split=B;
package/dist/index284.js CHANGED
@@ -1,21 +1,22 @@
1
- function A(e) {
2
- var c, d, f;
3
- const { scheme: n, statement: t, ...p } = ((c = e.match(m)) == null ? void 0 : c.groups) ?? {}, { chainId: s, expirationTime: i, issuedAt: o, notBefore: r, requestId: a, ...x } = ((d = e.match(h)) == null ? void 0 : d.groups) ?? {}, u = (f = e.split("Resources:")[1]) == null ? void 0 : f.split(`
4
- - `).slice(1);
5
- return {
6
- ...p,
7
- ...x,
8
- ...s ? { chainId: Number(s) } : {},
9
- ...i ? { expirationTime: new Date(i) } : {},
10
- ...o ? { issuedAt: new Date(o) } : {},
11
- ...r ? { notBefore: new Date(r) } : {},
12
- ...a ? { requestId: a } : {},
13
- ...u ? { resources: u } : {},
14
- ...n ? { scheme: n } : {},
15
- ...t ? { statement: t } : {}
16
- };
1
+ const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
2
+ function s(t, r = !1) {
3
+ return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
17
4
  }
18
- const m = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/, h = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
5
+ function h(t, r = !1) {
6
+ const n = t.length;
7
+ let l = new Uint32Array(n), c = new Uint32Array(n);
8
+ for (let e = 0; e < n; e++) {
9
+ const { h: u, l: f } = s(t[e], r);
10
+ [l[e], c[e]] = [u, f];
11
+ }
12
+ return [l, c];
13
+ }
14
+ const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
19
15
  export {
20
- A as parseSiweMessage
16
+ s as fromBig,
17
+ B as rotlBH,
18
+ a as rotlBL,
19
+ m as rotlSH,
20
+ A as rotlSL,
21
+ h as split
21
22
  };
package/dist/index285.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index176.cjs"),f=require("./index186.cjs");function u(n){const{address:s,domain:r,message:e,nonce:t,scheme:i,time:a=new Date}=n;if(r&&e.domain!==r||t&&e.nonce!==t||i&&e.scheme!==i||e.expirationTime&&a>=e.expirationTime||e.notBefore&&a<e.notBefore)return!1;try{if(!e.address||!d.isAddress(e.address,{strict:!1})||s&&!f.isAddressEqual(e.address,s))return!1}catch{return!1}return!0}exports.validateSiweMessage=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index297.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function p(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function s(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function c(t,...e){if(!p(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function m(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");s(t.outputLen),s(t.blockLen)}function B(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function E(t,e){c(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function H(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function U(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function L(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function S(t,e){return t<<32-e|t>>>e}const h=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function w(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function g(t){for(let e=0;e<t.length;e++)t[e]=w(t[e]);return t}const T=h?t=>t:g,d=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",V=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function _(t){if(c(t),d)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=V[t[n]];return e}const f={_0:48,_9:57,A:65,F:70,a:97,f:102};function l(t){if(t>=f._0&&t<=f._9)return t-f._0;if(t>=f.A&&t<=f.F)return t-(f.A-10);if(t>=f.a&&t<=f.f)return t-(f.a-10)}function I(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(d)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let o=0,i=0;o<n;o++,i+=2){const a=l(t.charCodeAt(i)),y=l(t.charCodeAt(i+1));if(a===void 0||y===void 0){const A=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+A+'" at index '+i)}r[o]=a*16+y}return r}function x(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function b(t){return typeof t=="string"&&(t=x(t)),c(t),t}function k(...t){let e=0;for(let r=0;r<t.length;r++){const o=t[r];c(o),e+=o.length}const n=new Uint8Array(e);for(let r=0,o=0;r<t.length;r++){const i=t[r];n.set(i,o),o+=i.length}return n}class O{}function R(t){const e=r=>t().update(b(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function v(t=32){if(u.crypto&&typeof u.crypto.getRandomValues=="function")return u.crypto.getRandomValues(new Uint8Array(t));if(u.crypto&&typeof u.crypto.randomBytes=="function")return Uint8Array.from(u.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}exports.Hash=O;exports.abytes=c;exports.aexists=B;exports.ahash=m;exports.anumber=s;exports.aoutput=E;exports.byteSwap=w;exports.byteSwap32=g;exports.bytesToHex=_;exports.clean=U;exports.concatBytes=k;exports.createHasher=R;exports.createView=L;exports.hexToBytes=I;exports.isBytes=p;exports.isLE=h;exports.randomBytes=v;exports.rotr=S;exports.swap32IfBE=T;exports.toBytes=b;exports.u32=H;exports.utf8ToBytes=x;
package/dist/index285.js CHANGED
@@ -1,17 +1,149 @@
1
- import { isAddress as f } from "./index176.js";
2
- import { isAddressEqual as o } from "./index186.js";
3
- function l(n) {
4
- const { address: r, domain: s, message: e, nonce: t, scheme: a, time: i = /* @__PURE__ */ new Date() } = n;
5
- if (s && e.domain !== s || t && e.nonce !== t || a && e.scheme !== a || e.expirationTime && i >= e.expirationTime || e.notBefore && i < e.notBefore)
6
- return !1;
7
- try {
8
- if (!e.address || !f(e.address, { strict: !1 }) || r && !o(e.address, r))
9
- return !1;
10
- } catch {
11
- return !1;
1
+ import { crypto as u } from "./index297.js";
2
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
+ function w(t) {
4
+ return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
5
+ }
6
+ function l(t) {
7
+ if (!Number.isSafeInteger(t) || t < 0)
8
+ throw new Error("positive integer expected, got " + t);
9
+ }
10
+ function c(t, ...e) {
11
+ if (!w(t))
12
+ throw new Error("Uint8Array expected");
13
+ if (e.length > 0 && !e.includes(t.length))
14
+ throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
15
+ }
16
+ function U(t) {
17
+ if (typeof t != "function" || typeof t.create != "function")
18
+ throw new Error("Hash should be wrapped by utils.createHasher");
19
+ l(t.outputLen), l(t.blockLen);
20
+ }
21
+ function B(t, e = !0) {
22
+ if (t.destroyed)
23
+ throw new Error("Hash instance has been destroyed");
24
+ if (e && t.finished)
25
+ throw new Error("Hash#digest() has already been called");
26
+ }
27
+ function H(t, e) {
28
+ c(t);
29
+ const n = e.outputLen;
30
+ if (t.length < n)
31
+ throw new Error("digestInto() expects output buffer of length at least " + n);
32
+ }
33
+ function L(t) {
34
+ return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
35
+ }
36
+ function V(...t) {
37
+ for (let e = 0; e < t.length; e++)
38
+ t[e].fill(0);
39
+ }
40
+ function _(t) {
41
+ return new DataView(t.buffer, t.byteOffset, t.byteLength);
42
+ }
43
+ function S(t, e) {
44
+ return t << 32 - e | t >>> e;
45
+ }
46
+ const d = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
47
+ function h(t) {
48
+ return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
49
+ }
50
+ function x(t) {
51
+ for (let e = 0; e < t.length; e++)
52
+ t[e] = h(t[e]);
53
+ return t;
54
+ }
55
+ const T = d ? (t) => t : x, p = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", A = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
56
+ function k(t) {
57
+ if (c(t), p)
58
+ return t.toHex();
59
+ let e = "";
60
+ for (let n = 0; n < t.length; n++)
61
+ e += A[t[n]];
62
+ return e;
63
+ }
64
+ const f = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
65
+ function y(t) {
66
+ if (t >= f._0 && t <= f._9)
67
+ return t - f._0;
68
+ if (t >= f.A && t <= f.F)
69
+ return t - (f.A - 10);
70
+ if (t >= f.a && t <= f.f)
71
+ return t - (f.a - 10);
72
+ }
73
+ function I(t) {
74
+ if (typeof t != "string")
75
+ throw new Error("hex string expected, got " + typeof t);
76
+ if (p)
77
+ return Uint8Array.fromHex(t);
78
+ const e = t.length, n = e / 2;
79
+ if (e % 2)
80
+ throw new Error("hex string expected, got unpadded hex of length " + e);
81
+ const r = new Uint8Array(n);
82
+ for (let o = 0, i = 0; o < n; o++, i += 2) {
83
+ const s = y(t.charCodeAt(i)), a = y(t.charCodeAt(i + 1));
84
+ if (s === void 0 || a === void 0) {
85
+ const g = t[i] + t[i + 1];
86
+ throw new Error('hex string expected, got non-hex character "' + g + '" at index ' + i);
87
+ }
88
+ r[o] = s * 16 + a;
12
89
  }
13
- return !0;
90
+ return r;
91
+ }
92
+ function m(t) {
93
+ if (typeof t != "string")
94
+ throw new Error("string expected");
95
+ return new Uint8Array(new TextEncoder().encode(t));
96
+ }
97
+ function b(t) {
98
+ return typeof t == "string" && (t = m(t)), c(t), t;
99
+ }
100
+ function R(...t) {
101
+ let e = 0;
102
+ for (let r = 0; r < t.length; r++) {
103
+ const o = t[r];
104
+ c(o), e += o.length;
105
+ }
106
+ const n = new Uint8Array(e);
107
+ for (let r = 0, o = 0; r < t.length; r++) {
108
+ const i = t[r];
109
+ n.set(i, o), o += i.length;
110
+ }
111
+ return n;
112
+ }
113
+ class F {
114
+ }
115
+ function O(t) {
116
+ const e = (r) => t().update(b(r)).digest(), n = t();
117
+ return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
118
+ }
119
+ function v(t = 32) {
120
+ if (u && typeof u.getRandomValues == "function")
121
+ return u.getRandomValues(new Uint8Array(t));
122
+ if (u && typeof u.randomBytes == "function")
123
+ return Uint8Array.from(u.randomBytes(t));
124
+ throw new Error("crypto.getRandomValues must be defined");
14
125
  }
15
126
  export {
16
- l as validateSiweMessage
127
+ F as Hash,
128
+ c as abytes,
129
+ B as aexists,
130
+ U as ahash,
131
+ l as anumber,
132
+ H as aoutput,
133
+ h as byteSwap,
134
+ x as byteSwap32,
135
+ k as bytesToHex,
136
+ V as clean,
137
+ R as concatBytes,
138
+ O as createHasher,
139
+ _ as createView,
140
+ I as hexToBytes,
141
+ w as isBytes,
142
+ d as isLE,
143
+ v as randomBytes,
144
+ S as rotr,
145
+ T as swap32IfBE,
146
+ b as toBytes,
147
+ L as u32,
148
+ m as utf8ToBytes
17
149
  };
package/dist/index286.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index224.cjs"),t=new o.LruMap(8192);function i(r,{enabled:n=!0,id:e}){if(!n||!e)return r();if(t.get(e))return t.get(e);const u=r().finally(()=>t.delete(e));return t.set(e,u),u}exports.promiseCache=t;exports.withDedupe=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index296.cjs"),x=require("./index285.cjs"),_=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array(64);class u extends e.HashMD{constructor(o=32){super(64,o,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:o,B:h,C:s,D:a,E:r,F:b,G:c,H:i}=this;return[o,h,s,a,r,b,c,i]}set(o,h,s,a,r,b,c,i){this.A=o|0,this.B=h|0,this.C=s|0,this.D=a|0,this.E=r|0,this.F=b|0,this.G=c|0,this.H=i|0}process(o,h){for(let t=0;t<16;t++,h+=4)f[t]=o.getUint32(h,!1);for(let t=16;t<64;t++){const H=f[t-15],d=f[t-2],S=x.rotr(H,7)^x.rotr(H,18)^H>>>3,l=x.rotr(d,17)^x.rotr(d,19)^d>>>10;f[t]=l+f[t-7]+S+f[t-16]|0}let{A:s,B:a,C:r,D:b,E:c,F:i,G:n,H:A}=this;for(let t=0;t<64;t++){const H=x.rotr(c,6)^x.rotr(c,11)^x.rotr(c,25),d=A+H+e.Chi(c,i,n)+_[t]+f[t]|0,l=(x.rotr(s,2)^x.rotr(s,13)^x.rotr(s,22))+e.Maj(s,a,r)|0;A=n,n=i,i=c,c=b+d|0,b=r,r=a,a=s,s=d+l|0}s=s+this.A|0,a=a+this.B|0,r=r+this.C|0,b=b+this.D|0,c=c+this.E|0,i=i+this.F|0,n=n+this.G|0,A=A+this.H|0,this.set(s,a,r,b,c,i,n,A)}roundClean(){x.clean(f)}destroy(){this.set(0,0,0,0,0,0,0,0),x.clean(this.buffer)}}const I=x.createHasher(()=>new u);exports.SHA256=u;exports.sha256=I;