@gardenfi/utils 2.1.3-beta.1 → 2.1.3-beta.10
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/index104.cjs +1 -1
- package/dist/index104.js +1 -1
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +71 -42
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +2 -2
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +1 -1
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +1 -1
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +1 -1
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +1 -1
- package/dist/index125.cjs +1 -1
- package/dist/index125.js +1 -1
- package/dist/index166.cjs +1 -1
- package/dist/index166.js +36 -34
- package/dist/index192.cjs +1 -1
- package/dist/index192.js +15 -18
- package/dist/index222.cjs +1 -1
- package/dist/index222.js +2 -2
- package/dist/index225.cjs +1 -1
- package/dist/index225.js +43 -43
- package/dist/index226.cjs +1 -1
- package/dist/index226.js +3 -113
- package/dist/index231.cjs +1 -1
- package/dist/index231.js +1 -1
- package/dist/index232.cjs +1 -1
- package/dist/index232.js +1 -1
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +2 -2
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +3 -3
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +3 -3
- package/dist/index247.cjs +1 -2
- package/dist/index247.js +13 -24
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +15 -13
- package/dist/index249.cjs +2 -1
- package/dist/index249.js +23 -14
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +1 -1
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +103 -16
- package/dist/index278.cjs +1 -1
- package/dist/index278.js +13 -220
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +214 -6
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +2 -2
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +7 -7
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +7 -27
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +26 -34
- package/dist/index283.cjs +1 -1
- package/dist/index283.js +13 -12
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +89 -51
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +3 -67
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +140 -3
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +143 -128
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +9 -155
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +111 -7
- package/dist/index290.cjs +2 -1
- package/dist/index290.js +116 -95
- package/dist/index291.cjs +1 -2
- package/dist/index291.js +8 -131
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +19 -40
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +43 -2
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +74 -202
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +2 -69
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +68 -11
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +656 -18
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +197 -633
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +78 -73
- package/dist/index300.cjs +2 -2
- package/dist/index300.js +7 -7
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +1 -1
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +2 -2
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +1 -1
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +2 -2
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +1 -1
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +1 -1
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +5 -105
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +2 -5
- package/dist/index313.cjs +1 -1
- package/dist/index313.js +22 -2
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +40 -21
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +24 -24
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +98 -97
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -1
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +53 -51
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +44 -42
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +15 -15
- package/package.json +1 -1
- package/dist/index314.cjs +0 -1
- package/dist/index314.js +0 -22
- package/dist/index315.cjs +0 -1
- package/dist/index315.js +0 -74
- package/dist/index316.cjs +0 -1
- package/dist/index316.js +0 -24
package/dist/index84.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { multicall3Abi as
|
|
2
|
-
import { AbiDecodingZeroDataError as
|
|
3
|
-
import { BaseError as
|
|
4
|
-
import { RawContractError as
|
|
5
|
-
import { decodeFunctionResult as
|
|
6
|
-
import { encodeFunctionData as
|
|
7
|
-
import { getChainContractAddress as
|
|
8
|
-
import { getContractError as
|
|
9
|
-
import { getAction as
|
|
10
|
-
import { readContract as
|
|
11
|
-
async function
|
|
12
|
-
var
|
|
13
|
-
const { allowFailure: u = !0, batchSize:
|
|
14
|
-
let
|
|
15
|
-
if (!
|
|
1
|
+
import { multicall3Abi as P } from "./index21.js";
|
|
2
|
+
import { AbiDecodingZeroDataError as _ } from "./index122.js";
|
|
3
|
+
import { BaseError as v } from "./index38.js";
|
|
4
|
+
import { RawContractError as q } from "./index127.js";
|
|
5
|
+
import { decodeFunctionResult as B } from "./index170.js";
|
|
6
|
+
import { encodeFunctionData as O } from "./index177.js";
|
|
7
|
+
import { getChainContractAddress as T } from "./index214.js";
|
|
8
|
+
import { getContractError as F } from "./index221.js";
|
|
9
|
+
import { getAction as Z } from "./index29.js";
|
|
10
|
+
import { readContract as G } from "./index33.js";
|
|
11
|
+
async function X(n, w) {
|
|
12
|
+
var D;
|
|
13
|
+
const { account: b, allowFailure: u = !0, batchSize: j, blockNumber: p, blockTag: y, multicallAddress: N, stateOverride: R } = w, d = w.contracts, C = j ?? (typeof ((D = n.batch) == null ? void 0 : D.multicall) == "object" && n.batch.multicall.batchSize || 1024);
|
|
14
|
+
let m = N;
|
|
15
|
+
if (!m) {
|
|
16
16
|
if (!n.chain)
|
|
17
17
|
throw new Error("client chain not configured. multicallAddress is required.");
|
|
18
|
-
|
|
19
|
-
blockNumber:
|
|
18
|
+
m = T({
|
|
19
|
+
blockNumber: p,
|
|
20
20
|
chain: n.chain,
|
|
21
21
|
contract: "multicall3"
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const e = [[]];
|
|
25
25
|
let a = 0, f = 0;
|
|
26
|
-
for (let t = 0; t <
|
|
27
|
-
const { abi: o, address: s, args: r, functionName: i } =
|
|
26
|
+
for (let t = 0; t < d.length; t++) {
|
|
27
|
+
const { abi: o, address: s, args: r, functionName: i } = d[t];
|
|
28
28
|
try {
|
|
29
|
-
const c =
|
|
29
|
+
const c = O({ abi: o, args: r, functionName: i });
|
|
30
30
|
f += (c.length - 2) / 2, // Check if batching is enabled.
|
|
31
|
-
|
|
32
|
-
f >
|
|
31
|
+
C > 0 && // Check if the current size of the batch exceeds the size limit.
|
|
32
|
+
f > C && // Check if the current chunk is not already empty.
|
|
33
33
|
e[a].length > 0 && (a++, f = (c.length - 2) / 2, e[a] = []), e[a] = [
|
|
34
34
|
...e[a],
|
|
35
35
|
{
|
|
@@ -39,12 +39,13 @@ async function W(n, w) {
|
|
|
39
39
|
}
|
|
40
40
|
];
|
|
41
41
|
} catch (c) {
|
|
42
|
-
const g =
|
|
42
|
+
const g = F(c, {
|
|
43
43
|
abi: o,
|
|
44
44
|
address: s,
|
|
45
45
|
args: r,
|
|
46
46
|
docsPath: "/docs/contract/multicall",
|
|
47
|
-
functionName: i
|
|
47
|
+
functionName: i,
|
|
48
|
+
sender: b
|
|
48
49
|
});
|
|
49
50
|
if (!u)
|
|
50
51
|
throw g;
|
|
@@ -58,17 +59,18 @@ async function W(n, w) {
|
|
|
58
59
|
];
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
const
|
|
62
|
-
abi:
|
|
63
|
-
|
|
62
|
+
const A = await Promise.allSettled(e.map((t) => Z(n, G, "readContract")({
|
|
63
|
+
abi: P,
|
|
64
|
+
account: b,
|
|
65
|
+
address: m,
|
|
64
66
|
args: [t],
|
|
65
|
-
blockNumber:
|
|
66
|
-
blockTag:
|
|
67
|
+
blockNumber: p,
|
|
68
|
+
blockTag: y,
|
|
67
69
|
functionName: "aggregate3",
|
|
68
|
-
stateOverride:
|
|
70
|
+
stateOverride: R
|
|
69
71
|
}))), l = [];
|
|
70
|
-
for (let t = 0; t <
|
|
71
|
-
const o =
|
|
72
|
+
for (let t = 0; t < A.length; t++) {
|
|
73
|
+
const o = A[t];
|
|
72
74
|
if (o.status === "rejected") {
|
|
73
75
|
if (!u)
|
|
74
76
|
throw o.reason;
|
|
@@ -82,37 +84,37 @@ async function W(n, w) {
|
|
|
82
84
|
}
|
|
83
85
|
const s = o.value;
|
|
84
86
|
for (let r = 0; r < s.length; r++) {
|
|
85
|
-
const { returnData: i, success: c } = s[r], { callData: g } = e[t][r], { abi:
|
|
87
|
+
const { returnData: i, success: c } = s[r], { callData: g } = e[t][r], { abi: S, address: x, functionName: k, args: z } = d[l.length];
|
|
86
88
|
try {
|
|
87
89
|
if (g === "0x")
|
|
88
|
-
throw new
|
|
90
|
+
throw new _();
|
|
89
91
|
if (!c)
|
|
90
|
-
throw new
|
|
91
|
-
const
|
|
92
|
-
abi:
|
|
93
|
-
args:
|
|
92
|
+
throw new q({ data: i });
|
|
93
|
+
const h = B({
|
|
94
|
+
abi: S,
|
|
95
|
+
args: z,
|
|
94
96
|
data: i,
|
|
95
|
-
functionName:
|
|
97
|
+
functionName: k
|
|
96
98
|
});
|
|
97
|
-
l.push(u ? { result:
|
|
98
|
-
} catch (
|
|
99
|
-
const
|
|
100
|
-
abi:
|
|
101
|
-
address:
|
|
102
|
-
args:
|
|
99
|
+
l.push(u ? { result: h, status: "success" } : h);
|
|
100
|
+
} catch (h) {
|
|
101
|
+
const E = F(h, {
|
|
102
|
+
abi: S,
|
|
103
|
+
address: x,
|
|
104
|
+
args: z,
|
|
103
105
|
docsPath: "/docs/contract/multicall",
|
|
104
|
-
functionName:
|
|
106
|
+
functionName: k
|
|
105
107
|
});
|
|
106
108
|
if (!u)
|
|
107
|
-
throw
|
|
108
|
-
l.push({ error:
|
|
109
|
+
throw E;
|
|
110
|
+
l.push({ error: E, result: void 0, status: "failure" });
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
|
-
if (l.length !==
|
|
113
|
-
throw new
|
|
114
|
+
if (l.length !== d.length)
|
|
115
|
+
throw new v("multicall results mismatch");
|
|
114
116
|
return l;
|
|
115
117
|
}
|
|
116
118
|
export {
|
|
117
|
-
|
|
119
|
+
X as multicall
|
|
118
120
|
};
|
package/dist/index90.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./index126.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./index126.cjs"),R=require("./index135.cjs"),g=require("./index29.cjs"),O=require("./index39.cjs"),S=require("./index41.cjs"),h=require("./index216.cjs"),$=require("./index42.cjs"),P=require("./index68.cjs"),W=require("./index81.cjs"),m=require("./index20.cjs"),x=require("./index91.cjs");async function z(n,{confirmations:c=1,hash:p,onReplaced:B,pollingInterval:F=n.pollingInterval,retryCount:N=6,retryDelay:v=({count:d})=>~~(1<<d)*200,timeout:y=18e4}){const d=$.stringify(["waitForTransactionReceipt",n.uid,p]);let a,o,e,i=!1,f,T;const{promise:A,resolve:j,reject:q}=S.withResolvers(),E=y?setTimeout(()=>{T(),f(),q(new R.WaitForTransactionReceiptTimeoutError({hash:p}))},y):void 0;return f=O.observe(d,{onReplaced:B,resolve:j,reject:q},r=>{T=g.getAction(n,x.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:F,async onBlockNumber(_){const u=b=>{clearTimeout(E),T(),b(),f()};let l=_;if(!i)try{if(e){if(c>1&&(!e.blockNumber||l-e.blockNumber+1n<c))return;u(()=>r.resolve(e));return}if(a||(i=!0,await h.withRetry(async()=>{a=await g.getAction(n,W.getTransaction,"getTransaction")({hash:p}),a.blockNumber&&(l=a.blockNumber)},{delay:v,retryCount:N}),i=!1),e=await g.getAction(n,m.getTransactionReceipt,"getTransactionReceipt")({hash:p}),c>1&&(!e.blockNumber||l-e.blockNumber+1n<c))return;u(()=>r.resolve(e))}catch(b){if(b instanceof R.TransactionNotFoundError||b instanceof R.TransactionReceiptNotFoundError){if(!a){i=!1;return}try{o=a,i=!0;const k=await h.withRetry(()=>g.getAction(n,P.getBlock,"getBlock")({blockNumber:l,includeTransactions:!0}),{delay:v,retryCount:N,shouldRetry:({error:s})=>s instanceof M.BlockNotFoundError});i=!1;const t=k.transactions.find(({from:s,nonce:I})=>s===o.from&&I===o.nonce);if(!t||(e=await g.getAction(n,m.getTransactionReceipt,"getTransactionReceipt")({hash:t.hash}),c>1&&(!e.blockNumber||l-e.blockNumber+1n<c)))return;let w="replaced";t.to===o.to&&t.value===o.value&&t.input===o.input?w="repriced":t.from===t.to&&t.value===0n&&(w="cancelled"),u(()=>{var s;(s=r.onReplaced)==null||s.call(r,{reason:w,replacedTransaction:o,transaction:t,transactionReceipt:e}),r.resolve(e)})}catch(k){u(()=>r.reject(k))}}else u(()=>r.reject(b))}}})}),A}exports.waitForTransactionReceipt=z;
|
package/dist/index90.js
CHANGED
|
@@ -3,51 +3,54 @@ import { WaitForTransactionReceiptTimeoutError as M, TransactionNotFoundError as
|
|
|
3
3
|
import { getAction as f } from "./index29.js";
|
|
4
4
|
import { observe as q } from "./index39.js";
|
|
5
5
|
import { withResolvers as z } from "./index41.js";
|
|
6
|
-
import { withRetry as
|
|
6
|
+
import { withRetry as y } from "./index216.js";
|
|
7
7
|
import { stringify as G } from "./index42.js";
|
|
8
8
|
import { getBlock as H } from "./index68.js";
|
|
9
9
|
import { getTransaction as J } from "./index81.js";
|
|
10
|
-
import { getTransactionReceipt as
|
|
10
|
+
import { getTransactionReceipt as B } from "./index20.js";
|
|
11
11
|
import { watchBlockNumber as K } from "./index91.js";
|
|
12
12
|
async function D(o, {
|
|
13
13
|
confirmations: a = 1,
|
|
14
14
|
hash: m,
|
|
15
|
-
onReplaced:
|
|
16
|
-
pollingInterval:
|
|
17
|
-
retryCount:
|
|
18
|
-
retryDelay:
|
|
15
|
+
onReplaced: h,
|
|
16
|
+
pollingInterval: F = o.pollingInterval,
|
|
17
|
+
retryCount: w = 6,
|
|
18
|
+
retryDelay: g = ({ count: b }) => ~~(1 << b) * 200,
|
|
19
19
|
// exponential backoff
|
|
20
|
-
timeout:
|
|
20
|
+
timeout: v = 18e4
|
|
21
21
|
}) {
|
|
22
22
|
const b = G(["waitForTransactionReceipt", o.uid, m]);
|
|
23
|
-
let c, n,
|
|
24
|
-
const { promise:
|
|
25
|
-
|
|
23
|
+
let c, n, e, i = !1, d, T;
|
|
24
|
+
const { promise: E, resolve: _, reject: R } = z(), j = v ? setTimeout(() => {
|
|
25
|
+
T(), d(), R(new M({ hash: m }));
|
|
26
|
+
}, v) : void 0;
|
|
27
|
+
return d = q(b, { onReplaced: h, resolve: _, reject: R }, (t) => {
|
|
28
|
+
T = f(o, K, "watchBlockNumber")({
|
|
26
29
|
emitMissed: !0,
|
|
27
30
|
emitOnBegin: !0,
|
|
28
31
|
poll: !0,
|
|
29
|
-
pollingInterval:
|
|
32
|
+
pollingInterval: F,
|
|
30
33
|
async onBlockNumber(I) {
|
|
31
|
-
const
|
|
32
|
-
clearTimeout(
|
|
34
|
+
const s = (p) => {
|
|
35
|
+
clearTimeout(j), T(), p(), d();
|
|
33
36
|
};
|
|
34
37
|
let u = I;
|
|
35
38
|
if (!i)
|
|
36
39
|
try {
|
|
37
|
-
if (
|
|
38
|
-
if (a > 1 && (!
|
|
40
|
+
if (e) {
|
|
41
|
+
if (a > 1 && (!e.blockNumber || u - e.blockNumber + 1n < a))
|
|
39
42
|
return;
|
|
40
|
-
|
|
43
|
+
s(() => t.resolve(e));
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
|
-
if (c || (i = !0, await
|
|
46
|
+
if (c || (i = !0, await y(async () => {
|
|
44
47
|
c = await f(o, J, "getTransaction")({ hash: m }), c.blockNumber && (u = c.blockNumber);
|
|
45
48
|
}, {
|
|
46
|
-
delay:
|
|
47
|
-
retryCount:
|
|
48
|
-
}), i = !1),
|
|
49
|
+
delay: g,
|
|
50
|
+
retryCount: w
|
|
51
|
+
}), i = !1), e = await f(o, B, "getTransactionReceipt")({ hash: m }), a > 1 && (!e.blockNumber || u - e.blockNumber + 1n < a))
|
|
49
52
|
return;
|
|
50
|
-
|
|
53
|
+
s(() => t.resolve(e));
|
|
51
54
|
} catch (p) {
|
|
52
55
|
if (p instanceof O || p instanceof W) {
|
|
53
56
|
if (!c) {
|
|
@@ -56,40 +59,39 @@ async function D(o, {
|
|
|
56
59
|
}
|
|
57
60
|
try {
|
|
58
61
|
n = c, i = !0;
|
|
59
|
-
const
|
|
62
|
+
const k = await y(() => f(o, H, "getBlock")({
|
|
60
63
|
blockNumber: u,
|
|
61
64
|
includeTransactions: !0
|
|
62
65
|
}), {
|
|
63
|
-
delay:
|
|
64
|
-
retryCount:
|
|
65
|
-
shouldRetry: ({ error:
|
|
66
|
+
delay: g,
|
|
67
|
+
retryCount: w,
|
|
68
|
+
shouldRetry: ({ error: l }) => l instanceof A
|
|
66
69
|
});
|
|
67
70
|
i = !1;
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
70
|
-
hash:
|
|
71
|
-
}), a > 1 && (!
|
|
71
|
+
const r = k.transactions.find(({ from: l, nonce: x }) => l === n.from && x === n.nonce);
|
|
72
|
+
if (!r || (e = await f(o, B, "getTransactionReceipt")({
|
|
73
|
+
hash: r.hash
|
|
74
|
+
}), a > 1 && (!e.blockNumber || u - e.blockNumber + 1n < a)))
|
|
72
75
|
return;
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
(
|
|
77
|
-
reason:
|
|
76
|
+
let N = "replaced";
|
|
77
|
+
r.to === n.to && r.value === n.value && r.input === n.input ? N = "repriced" : r.from === r.to && r.value === 0n && (N = "cancelled"), s(() => {
|
|
78
|
+
var l;
|
|
79
|
+
(l = t.onReplaced) == null || l.call(t, {
|
|
80
|
+
reason: N,
|
|
78
81
|
replacedTransaction: n,
|
|
79
|
-
transaction:
|
|
80
|
-
transactionReceipt:
|
|
81
|
-
}), t.resolve(
|
|
82
|
+
transaction: r,
|
|
83
|
+
transactionReceipt: e
|
|
84
|
+
}), t.resolve(e);
|
|
82
85
|
});
|
|
83
|
-
} catch (
|
|
84
|
-
|
|
86
|
+
} catch (k) {
|
|
87
|
+
s(() => t.reject(k));
|
|
85
88
|
}
|
|
86
89
|
} else
|
|
87
|
-
|
|
90
|
+
s(() => t.reject(p));
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
});
|
|
91
|
-
});
|
|
92
|
-
return h;
|
|
94
|
+
}), E;
|
|
93
95
|
}
|
|
94
96
|
export {
|
|
95
97
|
D as waitForTransactionReceipt
|
package/dist/index92.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index29.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index29.cjs"),B=require("./index39.cjs"),q=require("./index40.cjs"),A=require("./index42.cjs"),p=require("./index68.cjs");function S(r,{blockTag:b="latest",emitMissed:y=!1,emitOnBegin:g=!1,onBlock:k,onError:u,includeTransactions:m,poll:d,pollingInterval:w=r.pollingInterval}){const h=typeof d<"u"?d:!(r.transport.type==="webSocket"||r.transport.type==="fallback"&&r.transport.transports[0].config.type==="webSocket"),o=m??!1;let t;return h?(()=>{const c=A.stringify(["watchBlocks",r.uid,b,y,g,o,w]);return B.observe(c,{onBlock:k,onError:u},s=>q.poll(async()=>{var a;try{const e=await i.getAction(r,p.getBlock,"getBlock")({blockTag:b,includeTransactions:o});if(e.number!==null&&(t==null?void 0:t.number)!=null){if(e.number===t.number)return;if(e.number-t.number>1&&y)for(let l=(t==null?void 0:t.number)+1n;l<e.number;l++){const n=await i.getAction(r,p.getBlock,"getBlock")({blockNumber:l,includeTransactions:o});s.onBlock(n,t),t=n}}((t==null?void 0:t.number)==null||b==="pending"&&(e==null?void 0:e.number)==null||e.number!==null&&e.number>t.number)&&(s.onBlock(e,t),t=e)}catch(e){(a=s.onError)==null||a.call(s,e)}},{emitOnBegin:g,interval:w}))})():(()=>{let c=!0,s=!0,a=()=>c=!1;return(async()=>{try{g&&i.getAction(r,p.getBlock,"getBlock")({blockTag:b,includeTransactions:o}).then(n=>{c&&s&&(k(n,void 0),s=!1)}).catch(u);const e=(()=>{if(r.transport.type==="fallback"){const n=r.transport.transports.find(f=>f.config.type==="webSocket");return n?n.value:r.transport}return r.transport})(),{unsubscribe:l}=await e.subscribe({params:["newHeads"],async onData(n){if(!c)return;const f=await i.getAction(r,p.getBlock,"getBlock")({blockNumber:n.blockNumber,includeTransactions:o}).catch(()=>{});c&&(k(f,t),s=!1,t=f)},onError(n){u==null||u(n)}});a=l,c||a()}catch(e){u==null||u(e)}})(),()=>a()})()}exports.watchBlocks=S;
|
package/dist/index92.js
CHANGED
|
@@ -4,7 +4,7 @@ import { poll as N } from "./index40.js";
|
|
|
4
4
|
import { stringify as S } from "./index42.js";
|
|
5
5
|
import { getBlock as p } from "./index68.js";
|
|
6
6
|
function j(e, { blockTag: b = "latest", emitMissed: y = !1, emitOnBegin: m = !1, onBlock: k, onError: u, includeTransactions: h, poll: d, pollingInterval: w = e.pollingInterval }) {
|
|
7
|
-
const g = typeof d < "u" ? d : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket"),
|
|
7
|
+
const g = typeof d < "u" ? d : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket"), o = h ?? !1;
|
|
8
8
|
let t;
|
|
9
9
|
return g ? (() => {
|
|
10
10
|
const a = S([
|
|
@@ -13,24 +13,24 @@ function j(e, { blockTag: b = "latest", emitMissed: y = !1, emitOnBegin: m = !1,
|
|
|
13
13
|
b,
|
|
14
14
|
y,
|
|
15
15
|
m,
|
|
16
|
-
|
|
16
|
+
o,
|
|
17
17
|
w
|
|
18
18
|
]);
|
|
19
19
|
return B(a, { onBlock: k, onError: u }, (s) => N(async () => {
|
|
20
|
-
var
|
|
20
|
+
var c;
|
|
21
21
|
try {
|
|
22
22
|
const r = await i(e, p, "getBlock")({
|
|
23
23
|
blockTag: b,
|
|
24
|
-
includeTransactions:
|
|
24
|
+
includeTransactions: o
|
|
25
25
|
});
|
|
26
26
|
if (r.number !== null && (t == null ? void 0 : t.number) != null) {
|
|
27
27
|
if (r.number === t.number)
|
|
28
28
|
return;
|
|
29
29
|
if (r.number - t.number > 1 && y)
|
|
30
|
-
for (let
|
|
30
|
+
for (let f = (t == null ? void 0 : t.number) + 1n; f < r.number; f++) {
|
|
31
31
|
const n = await i(e, p, "getBlock")({
|
|
32
|
-
blockNumber:
|
|
33
|
-
includeTransactions:
|
|
32
|
+
blockNumber: f,
|
|
33
|
+
includeTransactions: o
|
|
34
34
|
});
|
|
35
35
|
s.onBlock(n, t), t = n;
|
|
36
36
|
}
|
|
@@ -41,36 +41,36 @@ function j(e, { blockTag: b = "latest", emitMissed: y = !1, emitOnBegin: m = !1,
|
|
|
41
41
|
// We don't want to emit blocks in the past.
|
|
42
42
|
r.number !== null && r.number > t.number) && (s.onBlock(r, t), t = r);
|
|
43
43
|
} catch (r) {
|
|
44
|
-
(
|
|
44
|
+
(c = s.onError) == null || c.call(s, r);
|
|
45
45
|
}
|
|
46
46
|
}, {
|
|
47
47
|
emitOnBegin: m,
|
|
48
48
|
interval: w
|
|
49
49
|
}));
|
|
50
50
|
})() : (() => {
|
|
51
|
-
let a = !0, s = !0,
|
|
51
|
+
let a = !0, s = !0, c = () => a = !1;
|
|
52
52
|
return (async () => {
|
|
53
53
|
try {
|
|
54
54
|
m && i(e, p, "getBlock")({
|
|
55
55
|
blockTag: b,
|
|
56
|
-
includeTransactions:
|
|
56
|
+
includeTransactions: o
|
|
57
57
|
}).then((n) => {
|
|
58
58
|
a && s && (k(n, void 0), s = !1);
|
|
59
|
-
});
|
|
59
|
+
}).catch(u);
|
|
60
60
|
const r = (() => {
|
|
61
61
|
if (e.transport.type === "fallback") {
|
|
62
62
|
const n = e.transport.transports.find((l) => l.config.type === "webSocket");
|
|
63
63
|
return n ? n.value : e.transport;
|
|
64
64
|
}
|
|
65
65
|
return e.transport;
|
|
66
|
-
})(), { unsubscribe:
|
|
66
|
+
})(), { unsubscribe: f } = await r.subscribe({
|
|
67
67
|
params: ["newHeads"],
|
|
68
68
|
async onData(n) {
|
|
69
69
|
if (!a)
|
|
70
70
|
return;
|
|
71
71
|
const l = await i(e, p, "getBlock")({
|
|
72
72
|
blockNumber: n.blockNumber,
|
|
73
|
-
includeTransactions:
|
|
73
|
+
includeTransactions: o
|
|
74
74
|
}).catch(() => {
|
|
75
75
|
});
|
|
76
76
|
a && (k(l, t), s = !1, t = l);
|
|
@@ -79,11 +79,11 @@ function j(e, { blockTag: b = "latest", emitMissed: y = !1, emitOnBegin: m = !1,
|
|
|
79
79
|
u == null || u(n);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
c = f, a || c();
|
|
83
83
|
} catch (r) {
|
|
84
84
|
u == null || u(r);
|
|
85
85
|
}
|
|
86
|
-
})(), () =>
|
|
86
|
+
})(), () => c();
|
|
87
87
|
})();
|
|
88
88
|
}
|
|
89
89
|
export {
|
package/package.json
CHANGED
package/dist/index314.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=BigInt(2**32-1),c=BigInt(32);function u(t,o=!1){return o?{h:Number(t&l),l:Number(t>>c&l)}:{h:Number(t>>c&l)|0,l:Number(t&l)|0}}function B(t,o=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let e=0;e<r;e++){const{h:f,l:s}=u(t[e],o);[n[e],i[e]]=[f,s]}return[n,i]}const g=(t,o,r)=>t<<r|o>>>32-r,m=(t,o,r)=>o<<r|t>>>32-r,S=(t,o,r)=>o<<r-32|t>>>64-r,a=(t,o,r)=>t<<r-32|o>>>64-r;exports.fromBig=u;exports.rotlBH=S;exports.rotlBL=a;exports.rotlSH=g;exports.rotlSL=m;exports.split=B;
|
package/dist/index314.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
|
|
2
|
-
function s(t, r = !1) {
|
|
3
|
-
return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
|
|
4
|
-
}
|
|
5
|
-
function h(t, r = !1) {
|
|
6
|
-
const n = t.length;
|
|
7
|
-
let l = new Uint32Array(n), c = new Uint32Array(n);
|
|
8
|
-
for (let e = 0; e < n; e++) {
|
|
9
|
-
const { h: u, l: f } = s(t[e], r);
|
|
10
|
-
[l[e], c[e]] = [u, f];
|
|
11
|
-
}
|
|
12
|
-
return [l, c];
|
|
13
|
-
}
|
|
14
|
-
const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
|
|
15
|
-
export {
|
|
16
|
-
s as fromBig,
|
|
17
|
-
B as rotlBH,
|
|
18
|
-
a as rotlBL,
|
|
19
|
-
m as rotlSH,
|
|
20
|
-
A as rotlSL,
|
|
21
|
-
h as split
|
|
22
|
-
};
|
package/dist/index315.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function o(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function y(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function r(e,...t){if(!o(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function l(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function h(e,t){r(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function p(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function w(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const i=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function f(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function u(e){for(let t=0;t<e.length;t++)e[t]=f(e[t]);return e}const g=i?e=>e:u;function s(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function c(e){return typeof e=="string"&&(e=s(e)),r(e),e}class b{}function x(e){const t=a=>e().update(c(a)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}exports.Hash=b;exports.abytes=r;exports.aexists=l;exports.anumber=y;exports.aoutput=h;exports.byteSwap=f;exports.byteSwap32=u;exports.clean=w;exports.createHasher=x;exports.isBytes=o;exports.isLE=i;exports.swap32IfBE=g;exports.toBytes=c;exports.u32=p;exports.utf8ToBytes=s;
|
package/dist/index315.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
-
function f(e) {
|
|
3
|
-
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
4
|
-
}
|
|
5
|
-
function l(e) {
|
|
6
|
-
if (!Number.isSafeInteger(e) || e < 0)
|
|
7
|
-
throw new Error("positive integer expected, got " + e);
|
|
8
|
-
}
|
|
9
|
-
function r(e, ...t) {
|
|
10
|
-
if (!f(e))
|
|
11
|
-
throw new Error("Uint8Array expected");
|
|
12
|
-
if (t.length > 0 && !t.includes(e.length))
|
|
13
|
-
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
14
|
-
}
|
|
15
|
-
function y(e, t = !0) {
|
|
16
|
-
if (e.destroyed)
|
|
17
|
-
throw new Error("Hash instance has been destroyed");
|
|
18
|
-
if (t && e.finished)
|
|
19
|
-
throw new Error("Hash#digest() has already been called");
|
|
20
|
-
}
|
|
21
|
-
function w(e, t) {
|
|
22
|
-
r(e);
|
|
23
|
-
const n = t.outputLen;
|
|
24
|
-
if (e.length < n)
|
|
25
|
-
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
26
|
-
}
|
|
27
|
-
function p(e) {
|
|
28
|
-
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
29
|
-
}
|
|
30
|
-
function a(...e) {
|
|
31
|
-
for (let t = 0; t < e.length; t++)
|
|
32
|
-
e[t].fill(0);
|
|
33
|
-
}
|
|
34
|
-
const i = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
35
|
-
function u(e) {
|
|
36
|
-
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
37
|
-
}
|
|
38
|
-
function c(e) {
|
|
39
|
-
for (let t = 0; t < e.length; t++)
|
|
40
|
-
e[t] = u(e[t]);
|
|
41
|
-
return e;
|
|
42
|
-
}
|
|
43
|
-
const g = i ? (e) => e : c;
|
|
44
|
-
function s(e) {
|
|
45
|
-
if (typeof e != "string")
|
|
46
|
-
throw new Error("string expected");
|
|
47
|
-
return new Uint8Array(new TextEncoder().encode(e));
|
|
48
|
-
}
|
|
49
|
-
function h(e) {
|
|
50
|
-
return typeof e == "string" && (e = s(e)), r(e), e;
|
|
51
|
-
}
|
|
52
|
-
class x {
|
|
53
|
-
}
|
|
54
|
-
function b(e) {
|
|
55
|
-
const t = (o) => e().update(h(o)).digest(), n = e();
|
|
56
|
-
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
x as Hash,
|
|
60
|
-
r as abytes,
|
|
61
|
-
y as aexists,
|
|
62
|
-
l as anumber,
|
|
63
|
-
w as aoutput,
|
|
64
|
-
u as byteSwap,
|
|
65
|
-
c as byteSwap32,
|
|
66
|
-
a as clean,
|
|
67
|
-
b as createHasher,
|
|
68
|
-
f as isBytes,
|
|
69
|
-
i as isLE,
|
|
70
|
-
g as swap32IfBE,
|
|
71
|
-
h as toBytes,
|
|
72
|
-
p as u32,
|
|
73
|
-
s as utf8ToBytes
|
|
74
|
-
};
|
package/dist/index316.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}exports.LruMap=i;
|
package/dist/index316.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class r extends Map {
|
|
2
|
-
constructor(e) {
|
|
3
|
-
super(), Object.defineProperty(this, "maxSize", {
|
|
4
|
-
enumerable: !0,
|
|
5
|
-
configurable: !0,
|
|
6
|
-
writable: !0,
|
|
7
|
-
value: void 0
|
|
8
|
-
}), this.maxSize = e;
|
|
9
|
-
}
|
|
10
|
-
get(e) {
|
|
11
|
-
const t = super.get(e);
|
|
12
|
-
return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
|
|
13
|
-
}
|
|
14
|
-
set(e, t) {
|
|
15
|
-
if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
|
|
16
|
-
const s = this.keys().next().value;
|
|
17
|
-
s && this.delete(s);
|
|
18
|
-
}
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
r as LruMap
|
|
24
|
-
};
|