@gardenfi/utils 2.2.1-beta.5 → 2.3.0

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 (87) hide show
  1. package/dist/index119.cjs +1 -1
  2. package/dist/index119.js +1 -1
  3. package/dist/index195.cjs +1 -1
  4. package/dist/index195.js +3 -3
  5. package/dist/index225.cjs +1 -1
  6. package/dist/index225.js +2 -2
  7. package/dist/index229.cjs +1 -1
  8. package/dist/index229.js +1 -1
  9. package/dist/index241.cjs +1 -1
  10. package/dist/index241.js +3 -3
  11. package/dist/index26.cjs +1 -1
  12. package/dist/index26.js +2 -2
  13. package/dist/index261.cjs +2 -1
  14. package/dist/index261.js +40 -102
  15. package/dist/index262.cjs +1 -1
  16. package/dist/index262.js +2 -7
  17. package/dist/index263.cjs +1 -1
  18. package/dist/index263.js +5 -224
  19. package/dist/index264.cjs +1 -1
  20. package/dist/index264.js +10 -6
  21. package/dist/index265.cjs +1 -1
  22. package/dist/index265.js +20 -7
  23. package/dist/index266.cjs +1 -2
  24. package/dist/index266.js +8 -41
  25. package/dist/index267.cjs +1 -1
  26. package/dist/index267.js +67 -2
  27. package/dist/index268.cjs +1 -1
  28. package/dist/index268.js +65 -5
  29. package/dist/index269.cjs +1 -1
  30. package/dist/index269.js +185 -9
  31. package/dist/index270.cjs +1 -1
  32. package/dist/index270.js +20 -17
  33. package/dist/index271.cjs +1 -1
  34. package/dist/index271.js +42 -8
  35. package/dist/index272.cjs +1 -1
  36. package/dist/index272.js +72 -62
  37. package/dist/index273.cjs +1 -1
  38. package/dist/index273.js +36 -61
  39. package/dist/index274.cjs +1 -1
  40. package/dist/index274.js +15 -185
  41. package/dist/index275.cjs +1 -1
  42. package/dist/index275.js +12 -21
  43. package/dist/index276.cjs +1 -1
  44. package/dist/index276.js +12 -42
  45. package/dist/index277.cjs +2 -1
  46. package/dist/index277.js +18 -76
  47. package/dist/index278.cjs +1 -1
  48. package/dist/index278.js +13 -39
  49. package/dist/index279.cjs +1 -1
  50. package/dist/index279.js +11 -16
  51. package/dist/index280.cjs +1 -1
  52. package/dist/index280.js +102 -12
  53. package/dist/index281.cjs +1 -1
  54. package/dist/index281.js +6 -12
  55. package/dist/index282.cjs +1 -2
  56. package/dist/index282.js +223 -17
  57. package/dist/index283.cjs +1 -1
  58. package/dist/index283.js +6 -14
  59. package/dist/index284.cjs +1 -1
  60. package/dist/index284.js +7 -12
  61. package/dist/index287.cjs +1 -1
  62. package/dist/index287.js +1 -1
  63. package/dist/index292.cjs +1 -1
  64. package/dist/index292.js +2 -2
  65. package/dist/index294.cjs +1 -1
  66. package/dist/index294.js +138 -10
  67. package/dist/index295.cjs +1 -1
  68. package/dist/index295.js +42 -19
  69. package/dist/index296.cjs +1 -1
  70. package/dist/index296.js +73 -134
  71. package/dist/index297.cjs +1 -1
  72. package/dist/index297.js +2 -43
  73. package/dist/index298.cjs +1 -1
  74. package/dist/index298.js +10 -77
  75. package/dist/index299.cjs +1 -1
  76. package/dist/index299.js +20 -2
  77. package/dist/index300.cjs +1 -1
  78. package/dist/index300.js +68 -698
  79. package/dist/index301.cjs +1 -1
  80. package/dist/index301.js +675 -178
  81. package/dist/index302.cjs +1 -1
  82. package/dist/index302.js +200 -67
  83. package/dist/index53.cjs +1 -1
  84. package/dist/index53.js +1 -1
  85. package/dist/index98.cjs +1 -1
  86. package/dist/index98.js +2 -2
  87. package/package.json +1 -1
package/dist/index302.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(n,a,y){let i="";if(y)for(const e of Object.entries(y)){if(!e)continue;let s="";for(const t of e[1])s+=`[${t.type}${t.name?`:${t.name}`:""}]`;i+=`(${e[0]}{${s}})`}return a?`${a}:${n}${i}`:n}const d=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);exports.getParameterCacheKey=r;exports.parameterCache=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index294.cjs"),v=require("./index282.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const m=BigInt(0),h=BigInt(1);function b(t,r){const e=r.negate();return t?e:r}function B(t,r,e){const n=s=>s.pz,i=v.FpInvertBatch(t.Fp,e.map(n));return e.map((s,a)=>s.toAffine(i[a])).map(t.fromAffine)}function I(t,r){if(!Number.isSafeInteger(t)||t<=0||t>r)throw new Error("invalid window size, expected [1.."+r+"], got W="+t)}function E(t,r){I(t,r);const e=Math.ceil(r/t)+1,n=2**(t-1),i=2**t,o=y.bitMask(t),s=BigInt(t);return{windows:e,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function M(t,r,e){const{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=e;let a=Number(t&i),f=t>>s;a>n&&(a-=o,f+=h);const d=r*n,c=d+Math.abs(a)-1,p=a===0,l=a<0,w=r%2!==0;return{nextN:f,offset:c,isZero:p,isNeg:l,isNegF:w,offsetF:d}}function O(t,r){if(!Array.isArray(t))throw new Error("array expected");t.forEach((e,n)=>{if(!(e instanceof r))throw new Error("invalid point at index "+n)})}function R(t,r){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((e,n)=>{if(!r.isValid(e))throw new Error("invalid scalar at index "+n)})}const N=new WeakMap,Z=new WeakMap;function A(t){return Z.get(t)||1}function x(t){if(t!==m)throw new Error("invalid wNAF")}function j(t,r){return{constTimeNegate:b,hasPrecomputes(e){return A(e)!==1},unsafeLadder(e,n,i=t.ZERO){let o=e;for(;n>m;)n&h&&(i=i.add(o)),o=o.double(),n>>=h;return i},precomputeWindow(e,n){const{windows:i,windowSize:o}=E(n,r),s=[];let a=e,f=a;for(let d=0;d<i;d++){f=a,s.push(f);for(let c=1;c<o;c++)f=f.add(a),s.push(f);a=f.double()}return s},wNAF(e,n,i){let o=t.ZERO,s=t.BASE;const a=E(e,r);for(let f=0;f<a.windows;f++){const{nextN:d,offset:c,isZero:p,isNeg:l,isNegF:w,offsetF:g}=M(i,f,a);i=d,p?s=s.add(b(w,n[g])):o=o.add(b(l,n[c]))}return x(i),{p:o,f:s}},wNAFUnsafe(e,n,i,o=t.ZERO){const s=E(e,r);for(let a=0;a<s.windows&&i!==m;a++){const{nextN:f,offset:d,isZero:c,isNeg:p}=M(i,a,s);if(i=f,!c){const l=n[d];o=o.add(p?l.negate():l)}}return x(i),o},getPrecomputes(e,n,i){let o=N.get(n);return o||(o=this.precomputeWindow(n,e),e!==1&&(typeof i=="function"&&(o=i(o)),N.set(n,o))),o},wNAFCached(e,n,i){const o=A(e);return this.wNAF(o,this.getPrecomputes(o,e,i),n)},wNAFCachedUnsafe(e,n,i,o){const s=A(e);return s===1?this.unsafeLadder(e,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,e,i),n,o)},setWindowSize(e,n){I(n,r),Z.set(e,n),N.delete(e)}}}function _(t,r,e,n){let i=r,o=t.ZERO,s=t.ZERO;for(;e>m||n>m;)e&h&&(o=o.add(i)),n&h&&(s=s.add(i)),i=i.double(),e>>=h,n>>=h;return{p1:o,p2:s}}function C(t,r,e,n){O(e,t),R(n,r);const i=e.length,o=n.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,a=y.bitLen(BigInt(i));let f=1;a>12?f=a-3:a>4?f=a-2:a>0&&(f=2);const d=y.bitMask(f),c=new Array(Number(d)+1).fill(s),p=Math.floor((r.BITS-1)/f)*f;let l=s;for(let w=p;w>=0;w-=f){c.fill(s);for(let u=0;u<o;u++){const F=n[u],S=Number(F>>BigInt(w)&d);c[S]=c[S].add(e[u])}let g=s;for(let u=c.length-1,F=s;u>0;u--)F=F.add(c[u]),g=g.add(F);if(l=l.add(g),w!==0)for(let u=0;u<f;u++)l=l.double()}return l}function z(t,r){if(r){if(r.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return v.validateField(r),r}else return v.Field(t)}function k(t,r,e={}){if(!r||typeof r!="object")throw new Error(`expected valid ${t} CURVE object`);for(const a of["p","n","h"]){const f=r[a];if(!(typeof f=="bigint"&&f>m))throw new Error(`CURVE.${a} must be positive bigint`)}const n=z(r.p,e.Fp),i=z(r.n,e.Fn),s=["Gx","Gy","a","b"];for(const a of s)if(!n.isValid(r[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}exports._createCurveFields=k;exports.mulEndoUnsafe=_;exports.negateCt=b;exports.normalizeZ=B;exports.pippenger=C;exports.wNAF=j;
package/dist/index302.js CHANGED
@@ -1,71 +1,204 @@
1
- function d(n, y, i) {
2
- let a = "";
3
- if (i)
4
- for (const e of Object.entries(i)) {
5
- if (!e)
6
- continue;
7
- let s = "";
8
- for (const t of e[1])
9
- s += `[${t.type}${t.name ? `:${t.name}` : ""}]`;
10
- a += `(${e[0]}{${s}})`;
1
+ import { bitLen as B, bitMask as z } from "./index294.js";
2
+ import { validateField as Z, Field as O, FpInvertBatch as R } from "./index282.js";
3
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4
+ const g = BigInt(0), h = BigInt(1);
5
+ function b(t, r) {
6
+ const e = r.negate();
7
+ return t ? e : r;
8
+ }
9
+ function L(t, r, e) {
10
+ const n = (s) => s.pz, i = R(t.Fp, e.map(n));
11
+ return e.map((s, f) => s.toAffine(i[f])).map(t.fromAffine);
12
+ }
13
+ function I(t, r) {
14
+ if (!Number.isSafeInteger(t) || t <= 0 || t > r)
15
+ throw new Error("invalid window size, expected [1.." + r + "], got W=" + t);
16
+ }
17
+ function E(t, r) {
18
+ I(t, r);
19
+ const e = Math.ceil(r / t) + 1, n = 2 ** (t - 1), i = 2 ** t, o = z(t), s = BigInt(t);
20
+ return { windows: e, windowSize: n, mask: o, maxNumber: i, shiftBy: s };
21
+ }
22
+ function v(t, r, e) {
23
+ const { windowSize: n, mask: i, maxNumber: o, shiftBy: s } = e;
24
+ let f = Number(t & i), a = t >> s;
25
+ f > n && (f -= o, a += h);
26
+ const d = r * n, c = d + Math.abs(f) - 1, p = f === 0, l = f < 0, u = r % 2 !== 0;
27
+ return { nextN: a, offset: c, isZero: p, isNeg: l, isNegF: u, offsetF: d };
28
+ }
29
+ function j(t, r) {
30
+ if (!Array.isArray(t))
31
+ throw new Error("array expected");
32
+ t.forEach((e, n) => {
33
+ if (!(e instanceof r))
34
+ throw new Error("invalid point at index " + n);
35
+ });
36
+ }
37
+ function _(t, r) {
38
+ if (!Array.isArray(t))
39
+ throw new Error("array of scalars expected");
40
+ t.forEach((e, n) => {
41
+ if (!r.isValid(e))
42
+ throw new Error("invalid scalar at index " + n);
43
+ });
44
+ }
45
+ const N = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap();
46
+ function A(t) {
47
+ return M.get(t) || 1;
48
+ }
49
+ function S(t) {
50
+ if (t !== g)
51
+ throw new Error("invalid wNAF");
52
+ }
53
+ function U(t, r) {
54
+ return {
55
+ constTimeNegate: b,
56
+ hasPrecomputes(e) {
57
+ return A(e) !== 1;
58
+ },
59
+ // non-const time multiplication ladder
60
+ unsafeLadder(e, n, i = t.ZERO) {
61
+ let o = e;
62
+ for (; n > g; )
63
+ n & h && (i = i.add(o)), o = o.double(), n >>= h;
64
+ return i;
65
+ },
66
+ /**
67
+ * Creates a wNAF precomputation window. Used for caching.
68
+ * Default window size is set by `utils.precompute()` and is equal to 8.
69
+ * Number of precomputed points depends on the curve size:
70
+ * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
71
+ * - 𝑊 is the window size
72
+ * - 𝑛 is the bitlength of the curve order.
73
+ * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
74
+ * @param elm Point instance
75
+ * @param W window size
76
+ * @returns precomputed point tables flattened to a single array
77
+ */
78
+ precomputeWindow(e, n) {
79
+ const { windows: i, windowSize: o } = E(n, r), s = [];
80
+ let f = e, a = f;
81
+ for (let d = 0; d < i; d++) {
82
+ a = f, s.push(a);
83
+ for (let c = 1; c < o; c++)
84
+ a = a.add(f), s.push(a);
85
+ f = a.double();
86
+ }
87
+ return s;
88
+ },
89
+ /**
90
+ * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
91
+ * @param W window size
92
+ * @param precomputes precomputed tables
93
+ * @param n scalar (we don't check here, but should be less than curve order)
94
+ * @returns real and fake (for const-time) points
95
+ */
96
+ wNAF(e, n, i) {
97
+ let o = t.ZERO, s = t.BASE;
98
+ const f = E(e, r);
99
+ for (let a = 0; a < f.windows; a++) {
100
+ const { nextN: d, offset: c, isZero: p, isNeg: l, isNegF: u, offsetF: m } = v(i, a, f);
101
+ i = d, p ? s = s.add(b(u, n[m])) : o = o.add(b(l, n[c]));
102
+ }
103
+ return S(i), { p: o, f: s };
104
+ },
105
+ /**
106
+ * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
107
+ * @param W window size
108
+ * @param precomputes precomputed tables
109
+ * @param n scalar (we don't check here, but should be less than curve order)
110
+ * @param acc accumulator point to add result of multiplication
111
+ * @returns point
112
+ */
113
+ wNAFUnsafe(e, n, i, o = t.ZERO) {
114
+ const s = E(e, r);
115
+ for (let f = 0; f < s.windows && i !== g; f++) {
116
+ const { nextN: a, offset: d, isZero: c, isNeg: p } = v(i, f, s);
117
+ if (i = a, !c) {
118
+ const l = n[d];
119
+ o = o.add(p ? l.negate() : l);
120
+ }
121
+ }
122
+ return S(i), o;
123
+ },
124
+ getPrecomputes(e, n, i) {
125
+ let o = N.get(n);
126
+ return o || (o = this.precomputeWindow(n, e), e !== 1 && (typeof i == "function" && (o = i(o)), N.set(n, o))), o;
127
+ },
128
+ wNAFCached(e, n, i) {
129
+ const o = A(e);
130
+ return this.wNAF(o, this.getPrecomputes(o, e, i), n);
131
+ },
132
+ wNAFCachedUnsafe(e, n, i, o) {
133
+ const s = A(e);
134
+ return s === 1 ? this.unsafeLadder(e, n, o) : this.wNAFUnsafe(s, this.getPrecomputes(s, e, i), n, o);
135
+ },
136
+ // We calculate precomputes for elliptic curve point multiplication
137
+ // using windowed method. This specifies window size and
138
+ // stores precomputed values. Usually only base point would be precomputed.
139
+ setWindowSize(e, n) {
140
+ I(n, r), M.set(e, n), N.delete(e);
11
141
  }
12
- return y ? `${y}:${n}${a}` : n;
142
+ };
143
+ }
144
+ function $(t, r, e, n) {
145
+ let i = r, o = t.ZERO, s = t.ZERO;
146
+ for (; e > g || n > g; )
147
+ e & h && (o = o.add(i)), n & h && (s = s.add(i)), i = i.double(), e >>= h, n >>= h;
148
+ return { p1: o, p2: s };
149
+ }
150
+ function D(t, r, e, n) {
151
+ j(e, t), _(n, r);
152
+ const i = e.length, o = n.length;
153
+ if (i !== o)
154
+ throw new Error("arrays of points and scalars must have equal length");
155
+ const s = t.ZERO, f = B(BigInt(i));
156
+ let a = 1;
157
+ f > 12 ? a = f - 3 : f > 4 ? a = f - 2 : f > 0 && (a = 2);
158
+ const d = z(a), c = new Array(Number(d) + 1).fill(s), p = Math.floor((r.BITS - 1) / a) * a;
159
+ let l = s;
160
+ for (let u = p; u >= 0; u -= a) {
161
+ c.fill(s);
162
+ for (let w = 0; w < o; w++) {
163
+ const F = n[w], y = Number(F >> BigInt(u) & d);
164
+ c[y] = c[y].add(e[w]);
165
+ }
166
+ let m = s;
167
+ for (let w = c.length - 1, F = s; w > 0; w--)
168
+ F = F.add(c[w]), m = m.add(F);
169
+ if (l = l.add(m), u !== 0)
170
+ for (let w = 0; w < a; w++)
171
+ l = l.double();
172
+ }
173
+ return l;
174
+ }
175
+ function x(t, r) {
176
+ if (r) {
177
+ if (r.ORDER !== t)
178
+ throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
179
+ return Z(r), r;
180
+ } else
181
+ return O(t);
182
+ }
183
+ function G(t, r, e = {}) {
184
+ if (!r || typeof r != "object")
185
+ throw new Error(`expected valid ${t} CURVE object`);
186
+ for (const f of ["p", "n", "h"]) {
187
+ const a = r[f];
188
+ if (!(typeof a == "bigint" && a > g))
189
+ throw new Error(`CURVE.${f} must be positive bigint`);
190
+ }
191
+ const n = x(r.p, e.Fp), i = x(r.n, e.Fn), s = ["Gx", "Gy", "a", "b"];
192
+ for (const f of s)
193
+ if (!n.isValid(r[f]))
194
+ throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);
195
+ return { Fp: n, Fn: i };
13
196
  }
14
- const p = /* @__PURE__ */ new Map([
15
- // Unnamed
16
- ["address", { type: "address" }],
17
- ["bool", { type: "bool" }],
18
- ["bytes", { type: "bytes" }],
19
- ["bytes32", { type: "bytes32" }],
20
- ["int", { type: "int256" }],
21
- ["int256", { type: "int256" }],
22
- ["string", { type: "string" }],
23
- ["uint", { type: "uint256" }],
24
- ["uint8", { type: "uint8" }],
25
- ["uint16", { type: "uint16" }],
26
- ["uint24", { type: "uint24" }],
27
- ["uint32", { type: "uint32" }],
28
- ["uint64", { type: "uint64" }],
29
- ["uint96", { type: "uint96" }],
30
- ["uint112", { type: "uint112" }],
31
- ["uint160", { type: "uint160" }],
32
- ["uint192", { type: "uint192" }],
33
- ["uint256", { type: "uint256" }],
34
- // Named
35
- ["address owner", { type: "address", name: "owner" }],
36
- ["address to", { type: "address", name: "to" }],
37
- ["bool approved", { type: "bool", name: "approved" }],
38
- ["bytes _data", { type: "bytes", name: "_data" }],
39
- ["bytes data", { type: "bytes", name: "data" }],
40
- ["bytes signature", { type: "bytes", name: "signature" }],
41
- ["bytes32 hash", { type: "bytes32", name: "hash" }],
42
- ["bytes32 r", { type: "bytes32", name: "r" }],
43
- ["bytes32 root", { type: "bytes32", name: "root" }],
44
- ["bytes32 s", { type: "bytes32", name: "s" }],
45
- ["string name", { type: "string", name: "name" }],
46
- ["string symbol", { type: "string", name: "symbol" }],
47
- ["string tokenURI", { type: "string", name: "tokenURI" }],
48
- ["uint tokenId", { type: "uint256", name: "tokenId" }],
49
- ["uint8 v", { type: "uint8", name: "v" }],
50
- ["uint256 balance", { type: "uint256", name: "balance" }],
51
- ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
52
- ["uint256 value", { type: "uint256", name: "value" }],
53
- // Indexed
54
- [
55
- "event:address indexed from",
56
- { type: "address", name: "from", indexed: !0 }
57
- ],
58
- ["event:address indexed to", { type: "address", name: "to", indexed: !0 }],
59
- [
60
- "event:uint indexed tokenId",
61
- { type: "uint256", name: "tokenId", indexed: !0 }
62
- ],
63
- [
64
- "event:uint256 indexed tokenId",
65
- { type: "uint256", name: "tokenId", indexed: !0 }
66
- ]
67
- ]);
68
197
  export {
69
- d as getParameterCacheKey,
70
- p as parameterCache
198
+ G as _createCurveFields,
199
+ $ as mulEndoUnsafe,
200
+ b as negateCt,
201
+ L as normalizeZ,
202
+ D as pippenger,
203
+ U as wNAF
71
204
  };
package/dist/index53.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index50.cjs"),j=require("./index221.cjs"),u=require("./index45.cjs"),l=require("./index281.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index50.cjs"),j=require("./index221.cjs"),u=require("./index45.cjs"),l=require("./index276.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
package/dist/index53.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TimeoutError as g, HttpRequestError as c } from "./index50.js";
2
2
  import { withTimeout as k } from "./index221.js";
3
3
  import { stringify as p } from "./index45.js";
4
- import { idCache as l } from "./index281.js";
4
+ import { idCache as l } from "./index276.js";
5
5
  function H(s, o = {}) {
6
6
  return {
7
7
  async request(h) {
package/dist/index98.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index226.cjs"),f=require("./index282.cjs"),h=require("./index283.cjs"),M=require("./index253.cjs");async function S(a,r){const{address:i,domain:t,message:s,nonce:n,scheme:d,signature:c,time:o=new Date,...g}=r,e=f.parseSiweMessage(s);if(!e.address||!h.validateSiweMessage({address:i,domain:t,message:e,nonce:n,scheme:d,time:o}))return!1;const u=l.hashMessage(s);return M.verifyHash(a,{address:e.address,hash:u,signature:c,...g})}exports.verifySiweMessage=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index226.cjs"),f=require("./index277.cjs"),h=require("./index278.cjs"),M=require("./index253.cjs");async function S(a,r){const{address:i,domain:t,message:s,nonce:n,scheme:d,signature:c,time:o=new Date,...g}=r,e=f.parseSiweMessage(s);if(!e.address||!h.validateSiweMessage({address:i,domain:t,message:e,nonce:n,scheme:d,time:o}))return!1;const u=l.hashMessage(s);return M.verifyHash(a,{address:e.address,hash:u,signature:c,...g})}exports.verifySiweMessage=S;
package/dist/index98.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { hashMessage as g } from "./index226.js";
2
- import { parseSiweMessage as l } from "./index282.js";
3
- import { validateSiweMessage as p } from "./index283.js";
2
+ import { parseSiweMessage as l } from "./index277.js";
3
+ import { validateSiweMessage as p } from "./index278.js";
4
4
  import { verifyHash as h } from "./index253.js";
5
5
  async function S(a, r) {
6
6
  const { address: i, domain: t, message: s, nonce: o, scheme: n, signature: d, time: m = /* @__PURE__ */ new Date(), ...f } = r, e = l(s);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/utils",
3
- "version": "2.2.1-beta.5",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",