@gardenfi/utils 2.1.2-beta.6 → 2.1.2-beta.8
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.
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +5 -5
- package/dist/index101.cjs +2 -1
- package/dist/index101.js +3 -11
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +16 -18
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +643 -6
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +173 -5
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +2 -2
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +9 -9
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +3 -3
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +2 -1
- package/dist/index23.js +49 -40
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +24 -45
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +41 -25
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +45 -6
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +24 -12
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +6 -15
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +13 -5
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +14 -12
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +5 -10
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +13 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +10 -11
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +12 -13
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +11 -23
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +13 -55
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +23 -16
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +55 -5
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +16 -8
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +5 -171
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +8 -103
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +170 -20
- package/dist/index43.cjs +1 -2
- package/dist/index43.js +97 -44
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +21 -24
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +10 -38
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +32 -32
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +6 -69
- package/dist/index48.cjs +2 -1
- package/dist/index48.js +57 -110
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +2 -68
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +7 -2
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +4 -16
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +10 -222
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +7 -231
- package/dist/index54.cjs +5 -1
- package/dist/index54.js +53 -9
- package/dist/index55.cjs +2 -1
- package/dist/index55.js +30 -30
- package/dist/index56.cjs +1 -2
- package/dist/index56.js +5 -59
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -22
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +18 -101
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +8 -3
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +9 -16
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +11 -8
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +6 -10
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +13 -11
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +31 -12
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +14 -18
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +64 -6
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +25 -40
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +3 -79
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +3 -14
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +8 -18
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +191 -8
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +17 -3
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +41 -192
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +32 -62
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +70 -2
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +111 -5
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +67 -11
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +2 -8
- package/dist/index79.cjs +1 -5
- package/dist/index79.js +15 -55
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +224 -2
- package/dist/index81.cjs +1 -2
- package/dist/index81.js +228 -31
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +42 -5
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +104 -6
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +16 -31
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +75 -24
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +19 -3
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +8 -11
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +11 -19
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +19 -8
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +10 -16
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +33 -638
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +2 -173
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +5 -13
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +10 -127
- package/dist/index95.cjs +1 -2
- package/dist/index95.js +128 -3
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +7 -2
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +2 -2
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +2 -2
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +17 -35
- package/package.json +1 -1
package/dist/index104.js
CHANGED
|
@@ -1,7 +1,175 @@
|
|
|
1
|
-
|
|
1
|
+
import { validateField as z, nLength as F } from "./index80.js";
|
|
2
|
+
import { validateObject as x, bitLen as O } from "./index81.js";
|
|
3
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4
|
+
const I = BigInt(0), p = BigInt(1);
|
|
5
|
+
function m(e, r) {
|
|
6
|
+
const t = r.negate();
|
|
7
|
+
return e ? t : r;
|
|
8
|
+
}
|
|
9
|
+
function A(e, r) {
|
|
10
|
+
if (!Number.isSafeInteger(e) || e <= 0 || e > r)
|
|
11
|
+
throw new Error("invalid window size, expected [1.." + r + "], got W=" + e);
|
|
12
|
+
}
|
|
13
|
+
function b(e, r) {
|
|
14
|
+
A(e, r);
|
|
15
|
+
const t = Math.ceil(r / e) + 1, n = 2 ** (e - 1);
|
|
16
|
+
return { windows: t, windowSize: n };
|
|
17
|
+
}
|
|
18
|
+
function L(e, r) {
|
|
19
|
+
if (!Array.isArray(e))
|
|
20
|
+
throw new Error("array expected");
|
|
21
|
+
e.forEach((t, n) => {
|
|
22
|
+
if (!(t instanceof r))
|
|
23
|
+
throw new Error("invalid point at index " + n);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function k(e, r) {
|
|
27
|
+
if (!Array.isArray(e))
|
|
28
|
+
throw new Error("array of scalars expected");
|
|
29
|
+
e.forEach((t, n) => {
|
|
30
|
+
if (!r.isValid(t))
|
|
31
|
+
throw new Error("invalid scalar at index " + n);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const B = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
function S(e) {
|
|
36
|
+
return E.get(e) || 1;
|
|
37
|
+
}
|
|
38
|
+
function v(e, r) {
|
|
39
|
+
return {
|
|
40
|
+
constTimeNegate: m,
|
|
41
|
+
hasPrecomputes(t) {
|
|
42
|
+
return S(t) !== 1;
|
|
43
|
+
},
|
|
44
|
+
// non-const time multiplication ladder
|
|
45
|
+
unsafeLadder(t, n, i = e.ZERO) {
|
|
46
|
+
let o = t;
|
|
47
|
+
for (; n > I; )
|
|
48
|
+
n & p && (i = i.add(o)), o = o.double(), n >>= p;
|
|
49
|
+
return i;
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Creates a wNAF precomputation window. Used for caching.
|
|
53
|
+
* Default window size is set by `utils.precompute()` and is equal to 8.
|
|
54
|
+
* Number of precomputed points depends on the curve size:
|
|
55
|
+
* 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
|
|
56
|
+
* - 𝑊 is the window size
|
|
57
|
+
* - 𝑛 is the bitlength of the curve order.
|
|
58
|
+
* For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
|
|
59
|
+
* @param elm Point instance
|
|
60
|
+
* @param W window size
|
|
61
|
+
* @returns precomputed point tables flattened to a single array
|
|
62
|
+
*/
|
|
63
|
+
precomputeWindow(t, n) {
|
|
64
|
+
const { windows: i, windowSize: o } = b(n, r), a = [];
|
|
65
|
+
let c = t, d = c;
|
|
66
|
+
for (let h = 0; h < i; h++) {
|
|
67
|
+
d = c, a.push(d);
|
|
68
|
+
for (let w = 1; w < o; w++)
|
|
69
|
+
d = d.add(c), a.push(d);
|
|
70
|
+
c = d.double();
|
|
71
|
+
}
|
|
72
|
+
return a;
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
|
|
76
|
+
* @param W window size
|
|
77
|
+
* @param precomputes precomputed tables
|
|
78
|
+
* @param n scalar (we don't check here, but should be less than curve order)
|
|
79
|
+
* @returns real and fake (for const-time) points
|
|
80
|
+
*/
|
|
81
|
+
wNAF(t, n, i) {
|
|
82
|
+
const { windows: o, windowSize: a } = b(t, r);
|
|
83
|
+
let c = e.ZERO, d = e.BASE;
|
|
84
|
+
const h = BigInt(2 ** t - 1), w = 2 ** t, l = BigInt(t);
|
|
85
|
+
for (let u = 0; u < o; u++) {
|
|
86
|
+
const s = u * a;
|
|
87
|
+
let f = Number(i & h);
|
|
88
|
+
i >>= l, f > a && (f -= w, i += p);
|
|
89
|
+
const g = s, N = s + Math.abs(f) - 1, y = u % 2 !== 0, M = f < 0;
|
|
90
|
+
f === 0 ? d = d.add(m(y, n[g])) : c = c.add(m(M, n[N]));
|
|
91
|
+
}
|
|
92
|
+
return { p: c, f: d };
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
|
|
96
|
+
* @param W window size
|
|
97
|
+
* @param precomputes precomputed tables
|
|
98
|
+
* @param n scalar (we don't check here, but should be less than curve order)
|
|
99
|
+
* @param acc accumulator point to add result of multiplication
|
|
100
|
+
* @returns point
|
|
101
|
+
*/
|
|
102
|
+
wNAFUnsafe(t, n, i, o = e.ZERO) {
|
|
103
|
+
const { windows: a, windowSize: c } = b(t, r), d = BigInt(2 ** t - 1), h = 2 ** t, w = BigInt(t);
|
|
104
|
+
for (let l = 0; l < a; l++) {
|
|
105
|
+
const u = l * c;
|
|
106
|
+
if (i === I)
|
|
107
|
+
break;
|
|
108
|
+
let s = Number(i & d);
|
|
109
|
+
if (i >>= w, s > c && (s -= h, i += p), s === 0)
|
|
110
|
+
continue;
|
|
111
|
+
let f = n[u + Math.abs(s) - 1];
|
|
112
|
+
s < 0 && (f = f.negate()), o = o.add(f);
|
|
113
|
+
}
|
|
114
|
+
return o;
|
|
115
|
+
},
|
|
116
|
+
getPrecomputes(t, n, i) {
|
|
117
|
+
let o = B.get(n);
|
|
118
|
+
return o || (o = this.precomputeWindow(n, t), t !== 1 && B.set(n, i(o))), o;
|
|
119
|
+
},
|
|
120
|
+
wNAFCached(t, n, i) {
|
|
121
|
+
const o = S(t);
|
|
122
|
+
return this.wNAF(o, this.getPrecomputes(o, t, i), n);
|
|
123
|
+
},
|
|
124
|
+
wNAFCachedUnsafe(t, n, i, o) {
|
|
125
|
+
const a = S(t);
|
|
126
|
+
return a === 1 ? this.unsafeLadder(t, n, o) : this.wNAFUnsafe(a, this.getPrecomputes(a, t, i), n, o);
|
|
127
|
+
},
|
|
128
|
+
// We calculate precomputes for elliptic curve point multiplication
|
|
129
|
+
// using windowed method. This specifies window size and
|
|
130
|
+
// stores precomputed values. Usually only base point would be precomputed.
|
|
131
|
+
setWindowSize(t, n) {
|
|
132
|
+
A(n, r), E.set(t, n), B.delete(t);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function Z(e, r, t, n) {
|
|
137
|
+
if (L(t, e), k(n, r), t.length !== n.length)
|
|
138
|
+
throw new Error("arrays of points and scalars must have equal length");
|
|
139
|
+
const i = e.ZERO, o = O(BigInt(t.length)), a = o > 12 ? o - 3 : o > 4 ? o - 2 : o ? 2 : 1, c = (1 << a) - 1, d = new Array(c + 1).fill(i), h = Math.floor((r.BITS - 1) / a) * a;
|
|
140
|
+
let w = i;
|
|
141
|
+
for (let l = h; l >= 0; l -= a) {
|
|
142
|
+
d.fill(i);
|
|
143
|
+
for (let s = 0; s < n.length; s++) {
|
|
144
|
+
const f = n[s], g = Number(f >> BigInt(l) & BigInt(c));
|
|
145
|
+
d[g] = d[g].add(t[s]);
|
|
146
|
+
}
|
|
147
|
+
let u = i;
|
|
148
|
+
for (let s = d.length - 1, f = i; s > 0; s--)
|
|
149
|
+
f = f.add(d[s]), u = u.add(f);
|
|
150
|
+
if (w = w.add(u), l !== 0)
|
|
151
|
+
for (let s = 0; s < a; s++)
|
|
152
|
+
w = w.double();
|
|
153
|
+
}
|
|
154
|
+
return w;
|
|
155
|
+
}
|
|
156
|
+
function U(e) {
|
|
157
|
+
return z(e.Fp), x(e, {
|
|
158
|
+
n: "bigint",
|
|
159
|
+
h: "bigint",
|
|
160
|
+
Gx: "field",
|
|
161
|
+
Gy: "field"
|
|
162
|
+
}, {
|
|
163
|
+
nBitLength: "isSafeInteger",
|
|
164
|
+
nByteLength: "isSafeInteger"
|
|
165
|
+
}), Object.freeze({
|
|
166
|
+
...F(e.n, e.nBitLength),
|
|
167
|
+
...e,
|
|
168
|
+
p: e.Fp.ORDER
|
|
169
|
+
});
|
|
170
|
+
}
|
|
2
171
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
l as maxBytesPerTransaction
|
|
172
|
+
Z as pippenger,
|
|
173
|
+
U as validateBasic,
|
|
174
|
+
v as wNAF
|
|
7
175
|
};
|
package/dist/index18.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index23.cjs"),i=require("./index24.cjs");async function s(t,{hash:e}){var a,n,o;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!r)throw new c.TransactionReceiptNotFoundError({hash:e});return(((o=(n=(a=t.chain)==null?void 0:a.formatters)==null?void 0:n.transactionReceipt)==null?void 0:o.format)||i.formatTransactionReceipt)(r)}exports.getTransactionReceipt=s;
|
package/dist/index18.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransactionReceiptNotFoundError as i } from "./
|
|
2
|
-
import { formatTransactionReceipt as c } from "./
|
|
1
|
+
import { TransactionReceiptNotFoundError as i } from "./index23.js";
|
|
2
|
+
import { formatTransactionReceipt as c } from "./index24.js";
|
|
3
3
|
async function f(t, { hash: r }) {
|
|
4
4
|
var o, a, n;
|
|
5
5
|
const e = await t.request({
|
package/dist/index19.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index25.cjs"),u=require("./index26.cjs"),a=require("./index27.cjs"),g=require("./index28.cjs"),y=require("./index29.cjs"),d=require("./index30.cjs"),T=require("./index31.cjs"),l=require("./index32.cjs"),q=require("./index33.cjs");function A(s,t={}){const{nonceManager:c}=t,e=u.toHex(i.secp256k1.getPublicKey(s.slice(2),!1)),o=g.publicKeyToAddress(e);return{...a.toAccount({address:o,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:s,to:"hex"})},async signAuthorization(n){return d.signAuthorization({...n,privateKey:s})},async signMessage({message:n}){return T.signMessage({message:n,privateKey:s})},async signTransaction(n,{serializer:r}={}){return l.signTransaction({privateKey:s,transaction:n,serializer:r})},async signTypedData(n){return q.signTypedData({...n,privateKey:s})}}),publicKey:e,source:"privateKey"}}exports.privateKeyToAccount=A;
|
package/dist/index19.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { secp256k1 as e } from "./
|
|
2
|
-
import { toHex as a } from "./
|
|
3
|
-
import { toAccount as m } from "./
|
|
4
|
-
import { publicKeyToAddress as u } from "./
|
|
5
|
-
import { sign as g } from "./
|
|
6
|
-
import { signAuthorization as p } from "./
|
|
7
|
-
import { signMessage as f } from "./
|
|
8
|
-
import { signTransaction as y } from "./
|
|
9
|
-
import { signTypedData as d } from "./
|
|
1
|
+
import { secp256k1 as e } from "./index25.js";
|
|
2
|
+
import { toHex as a } from "./index26.js";
|
|
3
|
+
import { toAccount as m } from "./index27.js";
|
|
4
|
+
import { publicKeyToAddress as u } from "./index28.js";
|
|
5
|
+
import { sign as g } from "./index29.js";
|
|
6
|
+
import { signAuthorization as p } from "./index30.js";
|
|
7
|
+
import { signMessage as f } from "./index31.js";
|
|
8
|
+
import { signTransaction as y } from "./index32.js";
|
|
9
|
+
import { signTypedData as d } from "./index33.js";
|
|
10
10
|
function H(n, t = {}) {
|
|
11
11
|
const { nonceManager: s } = t, r = a(e.getPublicKey(n.slice(2), !1)), c = u(r);
|
|
12
12
|
return {
|
package/dist/index20.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs"),t=e.defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});exports.mainnet=t;
|
package/dist/index20.js
CHANGED
package/dist/index21.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index88.cjs"),M=require("./index44.cjs"),h=require("./index89.cjs");function R(r){const{chainId:o,domain:s,expirationTime:l,issuedAt:m=new Date,nonce:a,notBefore:f,requestId:w,resources:g,scheme:i,uri:c,version:d}=r;{if(o!==Math.floor(o))throw new e.SiweInvalidMessageFieldError({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${o}`]});if(!(E.test(s)||F.test(s)||b.test(s)))throw new e.SiweInvalidMessageFieldError({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${s}`]});if(!A.test(a))throw new e.SiweInvalidMessageFieldError({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${a}`]});if(!h.isUri(c))throw new e.SiweInvalidMessageFieldError({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${c}`]});if(d!=="1")throw new e.SiweInvalidMessageFieldError({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${d}`]});if(i&&!P.test(i))throw new e.SiweInvalidMessageFieldError({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${i}`]});const t=r.statement;if(t!=null&&t.includes(`
|
|
2
2
|
`))throw new e.SiweInvalidMessageFieldError({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${t}`]})}const $=M.getAddress(r.address),v=i?`${i}://${s}`:s,I=r.statement?`${r.statement}
|
|
3
3
|
`:"",S=`${v} wants you to sign in with your Ethereum account:
|
|
4
4
|
${$}
|
package/dist/index21.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SiweInvalidMessageFieldError as e } from "./
|
|
2
|
-
import { getAddress as S } from "./
|
|
3
|
-
import { isUri as $ } from "./
|
|
1
|
+
import { SiweInvalidMessageFieldError as e } from "./index88.js";
|
|
2
|
+
import { getAddress as S } from "./index44.js";
|
|
3
|
+
import { isUri as $ } from "./index89.js";
|
|
4
4
|
function C(n) {
|
|
5
5
|
const { chainId: i, domain: s, expirationTime: u, issuedAt: g = /* @__PURE__ */ new Date(), nonce: a, notBefore: m, requestId: h, resources: w, scheme: o, uri: c, version: f } = n;
|
|
6
6
|
{
|
package/dist/index22.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.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/index22.js
CHANGED
package/dist/index23.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index48.cjs");function o(a){const r=Object.entries(a).map(([n,e])=>e===void 0||e===!1?null:[n,e]).filter(Boolean),i=r.reduce((n,[e])=>Math.max(n,e.length),0);return r.map(([n,e])=>` ${`${n}:`.padEnd(i+1)} ${e}`).join(`
|
|
2
|
+
`)}class s extends t.BaseError{constructor({v:r}){super(`Invalid \`v\` value "${r}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class c extends t.BaseError{constructor({transaction:r}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",o(r),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class d extends t.BaseError{constructor({storageKey:r}){super(`Size for storage key "${r}" is invalid. Expected 32 bytes. Got ${Math.floor((r.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class l extends t.BaseError{constructor({hash:r}){super(`Transaction receipt with hash "${r}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}exports.InvalidLegacyVError=s;exports.InvalidSerializableTransactionError=c;exports.InvalidStorageKeySizeError=d;exports.TransactionReceiptNotFoundError=l;exports.prettyPrint=o;
|
package/dist/index23.js
CHANGED
|
@@ -1,44 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function M(n) {
|
|
7
|
-
const f = q, e = BigInt(3), r = BigInt(6), I = BigInt(11), a = BigInt(22), s = BigInt(23), i = BigInt(44), g = BigInt(88), o = n * n * n % f, c = o * o * n % f, d = t(c, e, f) * c % f, B = t(d, e, f) * c % f, m = t(B, _, f) * o % f, b = t(m, I, f) * m % f, p = t(b, a, f) * b % f, x = t(p, i, f) * p % f, P = t(x, g, f) * x % f, v = t(P, i, f) * p % f, E = t(v, e, f) * c % f, F = t(E, s, f) * b % f, S = t(F, r, f) * o % f, u = t(S, _, f);
|
|
8
|
-
if (!l.eql(l.sqr(u), n))
|
|
9
|
-
throw new Error("Cannot find square root");
|
|
10
|
-
return u;
|
|
1
|
+
import { BaseError as t } from "./index48.js";
|
|
2
|
+
function i(a) {
|
|
3
|
+
const r = Object.entries(a).map(([n, e]) => e === void 0 || e === !1 ? null : [n, e]).filter(Boolean), o = r.reduce((n, [e]) => Math.max(n, e.length), 0);
|
|
4
|
+
return r.map(([n, e]) => ` ${`${n}:`.padEnd(o + 1)} ${e}`).join(`
|
|
5
|
+
`);
|
|
11
6
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n
|
|
18
|
-
n: w,
|
|
19
|
-
// Curve order, total count of valid points in the field
|
|
20
|
-
// Base point (x, y) aka generator point
|
|
21
|
-
Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
|
|
22
|
-
Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
|
|
23
|
-
h: BigInt(1),
|
|
24
|
-
// Cofactor
|
|
25
|
-
lowS: !0,
|
|
26
|
-
// Allow only low-S signatures by default in sign() and verify()
|
|
27
|
-
endo: {
|
|
28
|
-
// Endomorphism, see above
|
|
29
|
-
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
30
|
-
splitScalar: (n) => {
|
|
31
|
-
const f = w, e = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -j * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), I = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), a = e, s = BigInt("0x100000000000000000000000000000000"), i = h(a * n, f), g = h(-r * n, f);
|
|
32
|
-
let o = k(n - i * e - g * I, f), c = k(-i * r - g * a, f);
|
|
33
|
-
const d = o > s, B = c > s;
|
|
34
|
-
if (d && (o = f - o), B && (c = f - c), o > s || c > s)
|
|
35
|
-
throw new Error("splitScalar: Endomorphism failed, k=" + n);
|
|
36
|
-
return { k1neg: d, k1: o, k2neg: B, k2: c };
|
|
37
|
-
}
|
|
7
|
+
class c extends t {
|
|
8
|
+
constructor({ v: r }) {
|
|
9
|
+
super(`Invalid \`v\` value "${r}". Expected 27 or 28.`, {
|
|
10
|
+
name: "InvalidLegacyVError"
|
|
11
|
+
});
|
|
38
12
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
}
|
|
14
|
+
class d extends t {
|
|
15
|
+
constructor({ transaction: r }) {
|
|
16
|
+
super("Cannot infer a transaction type from provided transaction.", {
|
|
17
|
+
metaMessages: [
|
|
18
|
+
"Provided Transaction:",
|
|
19
|
+
"{",
|
|
20
|
+
i(r),
|
|
21
|
+
"}",
|
|
22
|
+
"",
|
|
23
|
+
"To infer the type, either provide:",
|
|
24
|
+
"- a `type` to the Transaction, or",
|
|
25
|
+
"- an EIP-1559 Transaction with `maxFeePerGas`, or",
|
|
26
|
+
"- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
|
|
27
|
+
"- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
|
|
28
|
+
"- an EIP-7702 Transaction with `authorizationList`, or",
|
|
29
|
+
"- a Legacy Transaction with `gasPrice`"
|
|
30
|
+
],
|
|
31
|
+
name: "InvalidSerializableTransactionError"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class l extends t {
|
|
36
|
+
constructor({ storageKey: r }) {
|
|
37
|
+
super(`Size for storage key "${r}" is invalid. Expected 32 bytes. Got ${Math.floor((r.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class p extends t {
|
|
41
|
+
constructor({ hash: r }) {
|
|
42
|
+
super(`Transaction receipt with hash "${r}" could not be found. The Transaction may not be processed on a block yet.`, {
|
|
43
|
+
name: "TransactionReceiptNotFoundError"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
42
47
|
export {
|
|
43
|
-
|
|
48
|
+
c as InvalidLegacyVError,
|
|
49
|
+
d as InvalidSerializableTransactionError,
|
|
50
|
+
l as InvalidStorageKeySizeError,
|
|
51
|
+
p as TransactionReceiptNotFoundError,
|
|
52
|
+
i as prettyPrint
|
|
44
53
|
};
|
package/dist/index24.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index37.cjs"),d=require("./index52.cjs"),r=require("./index53.cjs"),u={"0x0":"reverted","0x1":"success"};function o(l){const s={...l,blockNumber:l.blockNumber?BigInt(l.blockNumber):null,contractAddress:l.contractAddress?l.contractAddress:null,cumulativeGasUsed:l.cumulativeGasUsed?BigInt(l.cumulativeGasUsed):null,effectiveGasPrice:l.effectiveGasPrice?BigInt(l.effectiveGasPrice):null,gasUsed:l.gasUsed?BigInt(l.gasUsed):null,logs:l.logs?l.logs.map(e=>d.formatLog(e)):null,to:l.to?l.to:null,transactionIndex:l.transactionIndex?b.hexToNumber(l.transactionIndex):null,status:l.status?u[l.status]:null,type:l.type?r.transactionType[l.type]||l.type:null};return l.blobGasPrice&&(s.blobGasPrice=BigInt(l.blobGasPrice)),l.blobGasUsed&&(s.blobGasUsed=BigInt(l.blobGasUsed)),s}exports.formatTransactionReceipt=o;exports.receiptStatuses=u;
|
package/dist/index24.js
CHANGED
|
@@ -1,48 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const g = typeof o == "bigint" && t ? -o - 1n : 0;
|
|
24
|
-
if (o && i > o || i < g) {
|
|
25
|
-
const f = typeof n == "bigint" ? "n" : "";
|
|
26
|
-
throw new x({
|
|
27
|
-
max: o ? `${o}${f}` : void 0,
|
|
28
|
-
min: `${g}${f}`,
|
|
29
|
-
signed: t,
|
|
30
|
-
size: r,
|
|
31
|
-
value: `${n}${f}`
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
|
|
35
|
-
return r ? s(u, { size: r }) : u;
|
|
36
|
-
}
|
|
37
|
-
const d = /* @__PURE__ */ new TextEncoder();
|
|
38
|
-
function $(n, e = {}) {
|
|
39
|
-
const t = d.encode(n);
|
|
40
|
-
return m(t, e);
|
|
1
|
+
import { hexToNumber as b } from "./index37.js";
|
|
2
|
+
import { formatLog as d } from "./index52.js";
|
|
3
|
+
import { transactionType as m } from "./index53.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;
|
|
41
23
|
}
|
|
42
24
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
y as numberToHex,
|
|
46
|
-
$ as stringToHex,
|
|
47
|
-
B as toHex
|
|
25
|
+
r as formatTransactionReceipt,
|
|
26
|
+
f as receiptStatuses
|
|
48
27
|
};
|
package/dist/index25.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index76.cjs"),C=require("./index79.cjs"),n=require("./index80.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const k=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),x=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),G=BigInt(1),w=BigInt(2),h=(t,f)=>(t+f/w)/f;function M(t){const f=k,e=BigInt(3),r=BigInt(6),p=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),d=BigInt(88),o=t*t*t%f,c=o*o*t%f,g=n.pow2(c,e,f)*c%f,b=n.pow2(g,e,f)*c%f,l=n.pow2(b,w,f)*o%f,B=n.pow2(l,p,f)*l%f,I=n.pow2(B,a,f)*B%f,_=n.pow2(I,i,f)*I%f,P=n.pow2(_,d,f)*_%f,S=n.pow2(P,i,f)*I%f,v=n.pow2(S,e,f)*c%f,E=n.pow2(v,s,f)*B%f,F=n.pow2(E,r,f)*o%f,q=n.pow2(F,w,f);if(!u.eql(u.sqr(q),t))throw new Error("Cannot find square root");return q}const u=n.Field(k,void 0,void 0,{sqrt:M}),m=C.createCurve({a:BigInt(0),b:BigInt(7),Fp:u,n:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const f=x,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-G*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),p=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=e,s=BigInt("0x100000000000000000000000000000000"),i=h(a*t,f),d=h(-r*t,f);let o=n.mod(t-i*e-d*p,f),c=n.mod(-i*r-d*a,f);const g=o>s,b=c>s;if(g&&(o=f-o),b&&(c=f-c),o>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:o,k2neg:b,k2:c}}}},j.sha256);BigInt(0);m.ProjectivePoint;exports.secp256k1=m;
|
package/dist/index25.js
CHANGED
|
@@ -1,28 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
if (!a(n.address, { strict: !1 }))
|
|
13
|
-
throw new s({ address: n.address });
|
|
14
|
-
return {
|
|
15
|
-
address: n.address,
|
|
16
|
-
nonceManager: n.nonceManager,
|
|
17
|
-
sign: n.sign,
|
|
18
|
-
signAuthorization: n.signAuthorization,
|
|
19
|
-
signMessage: n.signMessage,
|
|
20
|
-
signTransaction: n.signTransaction,
|
|
21
|
-
signTypedData: n.signTypedData,
|
|
22
|
-
source: "custom",
|
|
23
|
-
type: "local"
|
|
24
|
-
};
|
|
1
|
+
import { sha256 as C } from "./index76.js";
|
|
2
|
+
import { createCurve as G } from "./index79.js";
|
|
3
|
+
import { Field as N, mod as k, pow2 as t } from "./index80.js";
|
|
4
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5
|
+
const q = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), w = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), j = BigInt(1), _ = BigInt(2), h = (n, f) => (n + f / _) / f;
|
|
6
|
+
function M(n) {
|
|
7
|
+
const f = q, e = BigInt(3), r = BigInt(6), I = BigInt(11), a = BigInt(22), s = BigInt(23), i = BigInt(44), g = BigInt(88), o = n * n * n % f, c = o * o * n % f, d = t(c, e, f) * c % f, B = t(d, e, f) * c % f, m = t(B, _, f) * o % f, b = t(m, I, f) * m % f, p = t(b, a, f) * b % f, x = t(p, i, f) * p % f, P = t(x, g, f) * x % f, v = t(P, i, f) * p % f, E = t(v, e, f) * c % f, F = t(E, s, f) * b % f, S = t(F, r, f) * o % f, u = t(S, _, f);
|
|
8
|
+
if (!l.eql(l.sqr(u), n))
|
|
9
|
+
throw new Error("Cannot find square root");
|
|
10
|
+
return u;
|
|
25
11
|
}
|
|
12
|
+
const l = N(q, void 0, void 0, { sqrt: M }), O = G({
|
|
13
|
+
a: BigInt(0),
|
|
14
|
+
// equation params: a, b
|
|
15
|
+
b: BigInt(7),
|
|
16
|
+
Fp: l,
|
|
17
|
+
// Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n
|
|
18
|
+
n: w,
|
|
19
|
+
// Curve order, total count of valid points in the field
|
|
20
|
+
// Base point (x, y) aka generator point
|
|
21
|
+
Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
|
|
22
|
+
Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
|
|
23
|
+
h: BigInt(1),
|
|
24
|
+
// Cofactor
|
|
25
|
+
lowS: !0,
|
|
26
|
+
// Allow only low-S signatures by default in sign() and verify()
|
|
27
|
+
endo: {
|
|
28
|
+
// Endomorphism, see above
|
|
29
|
+
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
30
|
+
splitScalar: (n) => {
|
|
31
|
+
const f = w, e = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -j * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), I = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), a = e, s = BigInt("0x100000000000000000000000000000000"), i = h(a * n, f), g = h(-r * n, f);
|
|
32
|
+
let o = k(n - i * e - g * I, f), c = k(-i * r - g * a, f);
|
|
33
|
+
const d = o > s, B = c > s;
|
|
34
|
+
if (d && (o = f - o), B && (c = f - c), o > s || c > s)
|
|
35
|
+
throw new Error("splitScalar: Endomorphism failed, k=" + n);
|
|
36
|
+
return { k1neg: d, k1: o, k2neg: B, k2: c };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, C);
|
|
40
|
+
BigInt(0);
|
|
41
|
+
O.ProjectivePoint;
|
|
26
42
|
export {
|
|
27
|
-
|
|
43
|
+
O as secp256k1
|
|
28
44
|
};
|
package/dist/index26.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index45.cjs"),f=require("./index46.cjs"),x=require("./index37.cjs"),z=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function H(e,n={}){return typeof e=="number"||typeof e=="bigint"?d(e,n):typeof e=="string"?m(e,n):typeof e=="boolean"?b(e,n):u(e,n)}function b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(x.assertSize(t,{size:n.size}),f.pad(t,{size:n.size})):t}function u(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=z[e[i]];const r=`0x${t}`;return typeof n.size=="number"?(x.assertSize(r,{size:n.size}),f.pad(r,{dir:"right",size:n.size})):r}function d(e,n={}){const{signed:t,size:r}=n,i=BigInt(e);let o;r?t?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof o=="bigint"&&t?-o-1n:0;if(o&&i>o||i<c){const s=typeof e=="bigint"?"n":"";throw new y.IntegerOutOfRangeError({max:o?`${o}${s}`:void 0,min:`${c}${s}`,signed:t,size:r,value:`${e}${s}`})}const g=`0x${(t&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?f.pad(g,{size:r}):g}const T=new TextEncoder;function m(e,n={}){const t=T.encode(e);return u(t,n)}exports.boolToHex=b;exports.bytesToHex=u;exports.numberToHex=d;exports.stringToHex=m;exports.toHex=H;
|
package/dist/index26.js
CHANGED
|
@@ -1,9 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { IntegerOutOfRangeError as x } from "./index45.js";
|
|
2
|
+
import { pad as s } from "./index46.js";
|
|
3
|
+
import { assertSize as c } from "./index37.js";
|
|
4
|
+
const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
|
|
5
|
+
function B(n, e = {}) {
|
|
6
|
+
return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
|
|
7
|
+
}
|
|
8
|
+
function z(n, e = {}) {
|
|
9
|
+
const t = `0x${Number(n)}`;
|
|
10
|
+
return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
|
|
11
|
+
}
|
|
12
|
+
function m(n, e = {}) {
|
|
13
|
+
let t = "";
|
|
14
|
+
for (let i = 0; i < n.length; i++)
|
|
15
|
+
t += b[n[i]];
|
|
16
|
+
const r = `0x${t}`;
|
|
17
|
+
return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
|
|
18
|
+
}
|
|
19
|
+
function y(n, e = {}) {
|
|
20
|
+
const { signed: t, size: r } = e, i = BigInt(n);
|
|
21
|
+
let o;
|
|
22
|
+
r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
|
|
23
|
+
const g = typeof o == "bigint" && t ? -o - 1n : 0;
|
|
24
|
+
if (o && i > o || i < g) {
|
|
25
|
+
const f = typeof n == "bigint" ? "n" : "";
|
|
26
|
+
throw new x({
|
|
27
|
+
max: o ? `${o}${f}` : void 0,
|
|
28
|
+
min: `${g}${f}`,
|
|
29
|
+
signed: t,
|
|
30
|
+
size: r,
|
|
31
|
+
value: `${n}${f}`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
|
|
35
|
+
return r ? s(u, { size: r }) : u;
|
|
36
|
+
}
|
|
37
|
+
const d = /* @__PURE__ */ new TextEncoder();
|
|
38
|
+
function $(n, e = {}) {
|
|
39
|
+
const t = d.encode(n);
|
|
40
|
+
return m(t, e);
|
|
6
41
|
}
|
|
7
42
|
export {
|
|
8
|
-
|
|
43
|
+
z as boolToHex,
|
|
44
|
+
m as bytesToHex,
|
|
45
|
+
y as numberToHex,
|
|
46
|
+
$ as stringToHex,
|
|
47
|
+
B as toHex
|
|
9
48
|
};
|
package/dist/index27.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index34.cjs"),t=require("./index35.cjs");function i(s){if(typeof s=="string"){if(!t.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!t.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,signAuthorization:s.signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=i;
|