@gardenfi/utils 2.0.6-beta.1 → 2.0.6-beta.3
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/index.cjs +1 -1
- package/dist/index.js +20 -22
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +19 -37
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +128 -2
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +113 -5
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +78 -10
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +2 -21
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +17 -6
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +19 -5
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +15 -36
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +222 -126
- package/dist/index108.cjs +2 -1
- package/dist/index108.js +3 -2
- package/dist/index109.cjs +1 -2
- package/dist/index109.js +35 -3
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +134 -19
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +16 -65
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +2 -2
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +68 -2
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +2 -35
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +1 -1
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +1 -1
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +1 -1
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +10 -136
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +2 -15
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +34 -2
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +17 -32
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +183 -14
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +92 -187
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +34 -92
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +32 -36
- package/dist/index20.cjs +16 -1
- package/dist/index20.js +112 -30
- package/dist/index21.cjs +1 -16
- package/dist/index21.js +30 -113
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +18 -31
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +7 -17
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +44 -6
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +21 -45
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +8 -21
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +31 -8
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +26 -31
- package/dist/index29.cjs +2 -1
- package/dist/index29.js +64 -25
- package/dist/index30.cjs +1 -2
- package/dist/index30.js +50 -64
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +12 -51
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +24 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +75 -24
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +22 -74
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +7 -23
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +32 -7
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +14 -31
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +2 -16
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +9 -2
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +20 -8
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +12 -20
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +33 -40
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +6 -25
- package/dist/index44.cjs +2 -1
- package/dist/index44.js +59 -6
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +2 -14
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +6 -15
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +4 -5
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +11 -13
- package/dist/index49.cjs +5 -1
- package/dist/index49.js +56 -10
- package/dist/index50.cjs +2 -1
- package/dist/index50.js +32 -10
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +5 -11
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +3 -13
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +20 -54
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +12 -16
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +55 -5
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +3 -3
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +19 -169
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +11 -103
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +8 -21
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +22 -45
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +9 -11
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +11 -34
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +6 -6
- package/dist/index63.cjs +1 -2
- package/dist/index63.js +13 -59
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +33 -2
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +14 -6
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +64 -4
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +27 -11
- package/dist/index68.cjs +1 -5
- package/dist/index68.js +3 -57
- package/dist/index69.cjs +1 -2
- package/dist/index69.js +3 -34
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +2 -24
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +13 -5
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +41 -3
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +5 -21
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +8 -8
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +102 -9
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +190 -10
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +17 -5
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +10 -12
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +19 -32
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +25 -14
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +100 -2
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +6 -64
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +13 -27
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +16 -3
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +5 -191
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +13 -18
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +10 -3
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +16 -8
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +169 -110
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +6 -14
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +9 -220
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +34 -90
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +34 -38
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +2 -2
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +5 -18
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +10 -78
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +2 -19
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +40 -6
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +16 -8
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +6 -11
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +5 -20
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +33 -34
- package/dist/src/index.d.ts +0 -1
- package/dist/src/lib/auth/siwe/siwe.d.ts +1 -2
- package/package.json +2 -3
- package/dist/index118.cjs +0 -1
- package/dist/index118.js +0 -21
- package/dist/src/lib/digestKey/digestKey.d.ts +0 -12
package/dist/index17.js
CHANGED
|
@@ -1,191 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Asynchronously sends a POST request to multiple URLs with fallback mechanism.
|
|
92
|
-
*
|
|
93
|
-
* @param {string[]} input - An array of URLs to retrieve data from.
|
|
94
|
-
* @param {RequestInit} [init] - Optional request options.
|
|
95
|
-
* @return {Promise<T>} A promise that resolves to the retrieved data.
|
|
96
|
-
*/
|
|
97
|
-
static async getWithFallback(t, a) {
|
|
98
|
-
return await n(a).retry(
|
|
99
|
-
() => this._getWithFallback(t, a)
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
static async _get(t, a) {
|
|
103
|
-
return await this.parse(await fetch(t, a));
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Asynchronously retrieves data of type T from the specified URL or RequestInfo, with optional initialization options.
|
|
107
|
-
*
|
|
108
|
-
* @param {RequestInfo | URL} input - The URL or RequestInfo to fetch data from
|
|
109
|
-
* @param {RequestInit} init - Optional initialization options for the fetch request
|
|
110
|
-
* @return {Promise<T>} The retrieved data of type T
|
|
111
|
-
*/
|
|
112
|
-
static async get(t, a) {
|
|
113
|
-
return await n(a).retry(() => this._get(t, a));
|
|
114
|
-
}
|
|
115
|
-
static async _post(t, a) {
|
|
116
|
-
return await this.parse(
|
|
117
|
-
await fetch(t, {
|
|
118
|
-
method: "POST",
|
|
119
|
-
...a
|
|
120
|
-
})
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Asynchronously sends a POST request to the specified URL or RequestInfo, with optional initialization options.
|
|
125
|
-
*/
|
|
126
|
-
static async post(t, a) {
|
|
127
|
-
return await n(a).retry(() => this._post(t, a));
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Parses the response and returns the result as the specified type.
|
|
131
|
-
*
|
|
132
|
-
* @param {Response} res - the response object to be parsed
|
|
133
|
-
* @return {Promise<T>} the parsed result of type T
|
|
134
|
-
*/
|
|
135
|
-
static async parse(t) {
|
|
136
|
-
const a = await t.text();
|
|
137
|
-
if (t.status >= 200 && t.status < 300)
|
|
138
|
-
return m(a);
|
|
139
|
-
throw new Error(a);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function y(e) {
|
|
143
|
-
return (e == null ? void 0 : e.message) || (e == null ? void 0 : e.toString()) || "unknown error";
|
|
144
|
-
}
|
|
145
|
-
const n = (e) => new g((e == null ? void 0 : e.retryCount) ?? 2, (e == null ? void 0 : e.retryDelay) ?? 1e3), k = (e) => e.startsWith("0x") ? e.slice(2) : e;
|
|
146
|
-
var o, c, l;
|
|
147
|
-
class f {
|
|
148
|
-
constructor(t, a, r = void 0) {
|
|
149
|
-
u(this, o, void 0), u(this, c, void 0), u(this, l, void 0), w(this, o, t), w(this, l, r), w(this, c, a);
|
|
150
|
-
}
|
|
151
|
-
get ok() {
|
|
152
|
-
return h(this, o);
|
|
153
|
-
}
|
|
154
|
-
get error() {
|
|
155
|
-
return h(this, l);
|
|
156
|
-
}
|
|
157
|
-
get val() {
|
|
158
|
-
return h(this, c);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
o = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
|
|
162
|
-
const W = (e) => new f(!0, e), x = (e, ...t) => {
|
|
163
|
-
if (typeof e == "string" && t && t.length > 0) {
|
|
164
|
-
let a = [e, ...t].map((r) => {
|
|
165
|
-
if (r) {
|
|
166
|
-
if (r instanceof Error)
|
|
167
|
-
return r.message;
|
|
168
|
-
if (typeof r == "string")
|
|
169
|
-
return r;
|
|
170
|
-
if (r != null && r.toString)
|
|
171
|
-
return r.toString();
|
|
1
|
+
import { BlockNotFoundError as A } from "./index23.js";
|
|
2
|
+
import { WaitForTransactionReceiptTimeoutError as M, TransactionNotFoundError as O, TransactionReceiptNotFoundError as W } from "./index29.js";
|
|
3
|
+
import { getAction as f } from "./index35.js";
|
|
4
|
+
import { observe as q } from "./index36.js";
|
|
5
|
+
import { withResolvers as z } from "./index39.js";
|
|
6
|
+
import { withRetry as v } from "./index40.js";
|
|
7
|
+
import { stringify as G } from "./index38.js";
|
|
8
|
+
import { getBlock as H } from "./index22.js";
|
|
9
|
+
import { getTransaction as J } from "./index28.js";
|
|
10
|
+
import { getTransactionReceipt as R } from "./index31.js";
|
|
11
|
+
import { watchBlockNumber as K } from "./index33.js";
|
|
12
|
+
async function D(o, {
|
|
13
|
+
confirmations: a = 1,
|
|
14
|
+
hash: m,
|
|
15
|
+
onReplaced: y,
|
|
16
|
+
pollingInterval: B = o.pollingInterval,
|
|
17
|
+
retryCount: k = 6,
|
|
18
|
+
retryDelay: N = ({ count: b }) => ~~(1 << b) * 200,
|
|
19
|
+
// exponential backoff
|
|
20
|
+
timeout: w = 18e4
|
|
21
|
+
}) {
|
|
22
|
+
const b = G(["waitForTransactionReceipt", o.uid, m]);
|
|
23
|
+
let c, n, r, i = !1;
|
|
24
|
+
const { promise: h, resolve: F, reject: g } = z(), E = w ? setTimeout(() => g(new M({ hash: m })), w) : void 0, _ = q(b, { onReplaced: y, resolve: F, reject: g }, (t) => {
|
|
25
|
+
const j = f(o, K, "watchBlockNumber")({
|
|
26
|
+
emitMissed: !0,
|
|
27
|
+
emitOnBegin: !0,
|
|
28
|
+
poll: !0,
|
|
29
|
+
pollingInterval: B,
|
|
30
|
+
async onBlockNumber(I) {
|
|
31
|
+
const l = (p) => {
|
|
32
|
+
clearTimeout(E), j(), p(), _();
|
|
33
|
+
};
|
|
34
|
+
let u = I;
|
|
35
|
+
if (!i)
|
|
36
|
+
try {
|
|
37
|
+
if (r) {
|
|
38
|
+
if (a > 1 && (!r.blockNumber || u - r.blockNumber + 1n < a))
|
|
39
|
+
return;
|
|
40
|
+
l(() => t.resolve(r));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (c || (i = !0, await v(async () => {
|
|
44
|
+
c = await f(o, J, "getTransaction")({ hash: m }), c.blockNumber && (u = c.blockNumber);
|
|
45
|
+
}, {
|
|
46
|
+
delay: N,
|
|
47
|
+
retryCount: k
|
|
48
|
+
}), i = !1), r = await f(o, R, "getTransactionReceipt")({ hash: m }), a > 1 && (!r.blockNumber || u - r.blockNumber + 1n < a))
|
|
49
|
+
return;
|
|
50
|
+
l(() => t.resolve(r));
|
|
51
|
+
} catch (p) {
|
|
52
|
+
if (p instanceof O || p instanceof W) {
|
|
53
|
+
if (!c) {
|
|
54
|
+
i = !1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
n = c, i = !0;
|
|
59
|
+
const d = await v(() => f(o, H, "getBlock")({
|
|
60
|
+
blockNumber: u,
|
|
61
|
+
includeTransactions: !0
|
|
62
|
+
}), {
|
|
63
|
+
delay: N,
|
|
64
|
+
retryCount: k,
|
|
65
|
+
shouldRetry: ({ error: s }) => s instanceof A
|
|
66
|
+
});
|
|
67
|
+
i = !1;
|
|
68
|
+
const e = d.transactions.find(({ from: s, nonce: x }) => s === n.from && x === n.nonce);
|
|
69
|
+
if (!e || (r = await f(o, R, "getTransactionReceipt")({
|
|
70
|
+
hash: e.hash
|
|
71
|
+
}), a > 1 && (!r.blockNumber || u - r.blockNumber + 1n < a)))
|
|
72
|
+
return;
|
|
73
|
+
let T = "replaced";
|
|
74
|
+
e.to === n.to && e.value === n.value && e.input === n.input ? T = "repriced" : e.from === e.to && e.value === 0n && (T = "cancelled"), l(() => {
|
|
75
|
+
var s;
|
|
76
|
+
(s = t.onReplaced) == null || s.call(t, {
|
|
77
|
+
reason: T,
|
|
78
|
+
replacedTransaction: n,
|
|
79
|
+
transaction: e,
|
|
80
|
+
transactionReceipt: r
|
|
81
|
+
}), t.resolve(r);
|
|
82
|
+
});
|
|
83
|
+
} catch (d) {
|
|
84
|
+
l(() => t.reject(d));
|
|
85
|
+
}
|
|
86
|
+
} else
|
|
87
|
+
l(() => t.reject(p));
|
|
88
|
+
}
|
|
172
89
|
}
|
|
173
90
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
a.filter((r) => r !== void 0).join(" ")
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
return new f(!1, null, e);
|
|
181
|
-
};
|
|
91
|
+
});
|
|
92
|
+
return h;
|
|
93
|
+
}
|
|
182
94
|
export {
|
|
183
|
-
|
|
184
|
-
v as Fetcher,
|
|
185
|
-
W as Ok,
|
|
186
|
-
f as Result,
|
|
187
|
-
g as Retry,
|
|
188
|
-
m as safeParseJson,
|
|
189
|
-
d as sleep,
|
|
190
|
-
k as trim0x
|
|
95
|
+
D as waitForTransactionReceipt
|
|
191
96
|
};
|
package/dist/index18.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 i=require("./index71.cjs"),u=require("./index24.cjs"),a=require("./index79.cjs"),g=require("./index80.cjs"),y=require("./index81.cjs"),d=require("./index82.cjs"),l=require("./index83.cjs"),T=require("./index84.cjs"),p=require("./index85.cjs");function q(e,t={}){const{nonceManager:c}=t,s=u.toHex(i.secp256k1.getPublicKey(e.slice(2),!1)),r=g.publicKeyToAddress(s);return{...a.toAccount({address:r,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:e,to:"hex"})},async experimental_signAuthorization(n){return d.experimental_signAuthorization({...n,privateKey:e})},async signMessage({message:n}){return l.signMessage({message:n,privateKey:e})},async signTransaction(n,{serializer:o}={}){return T.signTransaction({privateKey:e,transaction:n,serializer:o})},async signTypedData(n){return p.signTypedData({...n,privateKey:e})}}),publicKey:s,source:"privateKey"}}exports.privateKeyToAccount=q;
|
package/dist/index18.js
CHANGED
|
@@ -1,96 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
async onBlockNumber(I) {
|
|
31
|
-
const l = (p) => {
|
|
32
|
-
clearTimeout(E), j(), p(), _();
|
|
33
|
-
};
|
|
34
|
-
let u = I;
|
|
35
|
-
if (!i)
|
|
36
|
-
try {
|
|
37
|
-
if (r) {
|
|
38
|
-
if (a > 1 && (!r.blockNumber || u - r.blockNumber + 1n < a))
|
|
39
|
-
return;
|
|
40
|
-
l(() => t.resolve(r));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (c || (i = !0, await v(async () => {
|
|
44
|
-
c = await f(o, J, "getTransaction")({ hash: m }), c.blockNumber && (u = c.blockNumber);
|
|
45
|
-
}, {
|
|
46
|
-
delay: N,
|
|
47
|
-
retryCount: k
|
|
48
|
-
}), i = !1), r = await f(o, R, "getTransactionReceipt")({ hash: m }), a > 1 && (!r.blockNumber || u - r.blockNumber + 1n < a))
|
|
49
|
-
return;
|
|
50
|
-
l(() => t.resolve(r));
|
|
51
|
-
} catch (p) {
|
|
52
|
-
if (p instanceof O || p instanceof W) {
|
|
53
|
-
if (!c) {
|
|
54
|
-
i = !1;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
n = c, i = !0;
|
|
59
|
-
const d = await v(() => f(o, H, "getBlock")({
|
|
60
|
-
blockNumber: u,
|
|
61
|
-
includeTransactions: !0
|
|
62
|
-
}), {
|
|
63
|
-
delay: N,
|
|
64
|
-
retryCount: k,
|
|
65
|
-
shouldRetry: ({ error: s }) => s instanceof A
|
|
66
|
-
});
|
|
67
|
-
i = !1;
|
|
68
|
-
const e = d.transactions.find(({ from: s, nonce: x }) => s === n.from && x === n.nonce);
|
|
69
|
-
if (!e || (r = await f(o, R, "getTransactionReceipt")({
|
|
70
|
-
hash: e.hash
|
|
71
|
-
}), a > 1 && (!r.blockNumber || u - r.blockNumber + 1n < a)))
|
|
72
|
-
return;
|
|
73
|
-
let T = "replaced";
|
|
74
|
-
e.to === n.to && e.value === n.value && e.input === n.input ? T = "repriced" : e.from === e.to && e.value === 0n && (T = "cancelled"), l(() => {
|
|
75
|
-
var s;
|
|
76
|
-
(s = t.onReplaced) == null || s.call(t, {
|
|
77
|
-
reason: T,
|
|
78
|
-
replacedTransaction: n,
|
|
79
|
-
transaction: e,
|
|
80
|
-
transactionReceipt: r
|
|
81
|
-
}), t.resolve(r);
|
|
82
|
-
});
|
|
83
|
-
} catch (d) {
|
|
84
|
-
l(() => t.reject(d));
|
|
85
|
-
}
|
|
86
|
-
} else
|
|
87
|
-
l(() => t.reject(p));
|
|
88
|
-
}
|
|
1
|
+
import { secp256k1 as e } from "./index71.js";
|
|
2
|
+
import { toHex as a } from "./index24.js";
|
|
3
|
+
import { toAccount as m } from "./index79.js";
|
|
4
|
+
import { publicKeyToAddress as u } from "./index80.js";
|
|
5
|
+
import { sign as g } from "./index81.js";
|
|
6
|
+
import { experimental_signAuthorization as p } from "./index82.js";
|
|
7
|
+
import { signMessage as f } from "./index83.js";
|
|
8
|
+
import { signTransaction as l } from "./index84.js";
|
|
9
|
+
import { signTypedData as y } from "./index85.js";
|
|
10
|
+
function k(o, t = {}) {
|
|
11
|
+
const { nonceManager: s } = t, r = a(e.getPublicKey(o.slice(2), !1)), i = u(r);
|
|
12
|
+
return {
|
|
13
|
+
...m({
|
|
14
|
+
address: i,
|
|
15
|
+
nonceManager: s,
|
|
16
|
+
async sign({ hash: n }) {
|
|
17
|
+
return g({ hash: n, privateKey: o, to: "hex" });
|
|
18
|
+
},
|
|
19
|
+
async experimental_signAuthorization(n) {
|
|
20
|
+
return p({ ...n, privateKey: o });
|
|
21
|
+
},
|
|
22
|
+
async signMessage({ message: n }) {
|
|
23
|
+
return f({ message: n, privateKey: o });
|
|
24
|
+
},
|
|
25
|
+
async signTransaction(n, { serializer: c } = {}) {
|
|
26
|
+
return l({ privateKey: o, transaction: n, serializer: c });
|
|
27
|
+
},
|
|
28
|
+
async signTypedData(n) {
|
|
29
|
+
return y({ ...n, privateKey: o });
|
|
89
30
|
}
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
31
|
+
}),
|
|
32
|
+
publicKey: r,
|
|
33
|
+
source: "privateKey"
|
|
34
|
+
};
|
|
93
35
|
}
|
|
94
36
|
export {
|
|
95
|
-
|
|
37
|
+
k as privateKeyToAccount
|
|
96
38
|
};
|
package/dist/index19.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 e=require("./index88.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/index19.js
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
publicKey: r,
|
|
33
|
-
source: "privateKey"
|
|
34
|
-
};
|
|
35
|
-
}
|
|
1
|
+
import { defineChain as e } from "./index88.js";
|
|
2
|
+
const t = /* @__PURE__ */ e({
|
|
3
|
+
id: 1,
|
|
4
|
+
name: "Ethereum",
|
|
5
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
6
|
+
rpcUrls: {
|
|
7
|
+
default: {
|
|
8
|
+
http: ["https://eth.merkle.io"]
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
blockExplorers: {
|
|
12
|
+
default: {
|
|
13
|
+
name: "Etherscan",
|
|
14
|
+
url: "https://etherscan.io",
|
|
15
|
+
apiUrl: "https://api.etherscan.io/api"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
contracts: {
|
|
19
|
+
ensRegistry: {
|
|
20
|
+
address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
|
|
21
|
+
},
|
|
22
|
+
ensUniversalResolver: {
|
|
23
|
+
address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
|
|
24
|
+
blockCreated: 19258213
|
|
25
|
+
},
|
|
26
|
+
multicall3: {
|
|
27
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
28
|
+
blockCreated: 14353601
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
36
32
|
export {
|
|
37
|
-
|
|
33
|
+
t as mainnet
|
|
38
34
|
};
|
package/dist/index20.cjs
CHANGED
|
@@ -1 +1,16 @@
|
|
|
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("./index77.cjs"),M=require("./index53.cjs"),h=require("./index78.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
|
+
`))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
|
+
`:"",S=`${v} wants you to sign in with your Ethereum account:
|
|
4
|
+
${$}
|
|
5
|
+
|
|
6
|
+
${I}`;let n=`URI: ${c}
|
|
7
|
+
Version: ${d}
|
|
8
|
+
Chain ID: ${o}
|
|
9
|
+
Nonce: ${a}
|
|
10
|
+
Issued At: ${m.toISOString()}`;if(l&&(n+=`
|
|
11
|
+
Expiration Time: ${l.toISOString()}`),f&&(n+=`
|
|
12
|
+
Not Before: ${f.toISOString()}`),w&&(n+=`
|
|
13
|
+
Request ID: ${w}`),g){let t=`
|
|
14
|
+
Resources:`;for(const u of g){if(!h.isUri(u))throw new e.SiweInvalidMessageFieldError({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${u}`]});t+=`
|
|
15
|
+
- ${u}`}n+=t}return`${S}
|
|
16
|
+
${n}`}const E=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,F=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,b=/^localhost(:[0-9]{1,5})?$/,A=/^[a-zA-Z0-9]{8,}$/,P=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/;exports.createSiweMessage=R;
|