@coinbase/cdp-core 0.0.23 → 0.0.25
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/README.md +12 -12
- package/dist/esm/index.js +17 -15
- package/dist/esm/index10.js +20 -14
- package/dist/esm/index100.js +6 -9
- package/dist/esm/index101.js +11 -13
- package/dist/esm/index102.js +11 -8
- package/dist/esm/index103.js +7 -14
- package/dist/esm/index104.js +16 -80
- package/dist/esm/index105.js +72 -70
- package/dist/esm/index106.js +81 -0
- package/dist/esm/index11.js +13 -117
- package/dist/esm/index12.js +116 -11
- package/dist/esm/index13.js +14 -22
- package/dist/esm/index14.js +42 -20
- package/dist/esm/index15.js +20 -172
- package/dist/esm/index16.js +170 -24
- package/dist/esm/index17.js +22 -156
- package/dist/esm/index18.js +157 -45
- package/dist/esm/index19.js +44 -149
- package/dist/esm/index2.js +10 -10
- package/dist/esm/index20.js +247 -53
- package/dist/esm/index21.js +56 -41
- package/dist/esm/index22.js +40 -16
- package/dist/esm/index23.js +16 -4
- package/dist/esm/index24.js +5 -5
- package/dist/esm/index25.js +5 -9
- package/dist/esm/index26.js +8 -17
- package/dist/esm/index27.js +16 -44
- package/dist/esm/index28.js +45 -13
- package/dist/esm/index29.js +13 -55
- package/dist/esm/index3.js +66 -60
- package/dist/esm/index30.js +55 -6
- package/dist/esm/index31.js +6 -21
- package/dist/esm/index32.js +21 -11
- package/dist/esm/index33.js +11 -3
- package/dist/esm/index34.js +3 -3
- package/dist/esm/index35.js +3 -34
- package/dist/esm/index36.js +32 -10
- package/dist/esm/index37.js +12 -4
- package/dist/esm/index38.js +4 -28
- package/dist/esm/index39.js +28 -6
- package/dist/esm/index4.js +48 -35
- package/dist/esm/index40.js +6 -24
- package/dist/esm/index41.js +24 -16
- package/dist/esm/index42.js +16 -54
- package/dist/esm/index43.js +53 -22
- package/dist/esm/index44.js +23 -11
- package/dist/esm/index45.js +10 -26
- package/dist/esm/index46.js +26 -41
- package/dist/esm/index47.js +41 -54
- package/dist/esm/index48.js +54 -126
- package/dist/esm/index49.js +126 -11
- package/dist/esm/index5.js +1 -1
- package/dist/esm/index50.js +9 -101
- package/dist/esm/index51.js +104 -6
- package/dist/esm/index52.js +7 -3
- package/dist/esm/index53.js +3 -15
- package/dist/esm/index54.js +14 -42
- package/dist/esm/index55.js +38 -74
- package/dist/esm/index56.js +79 -2
- package/dist/esm/index57.js +2 -2
- package/dist/esm/index58.js +2 -13
- package/dist/esm/index59.js +8 -33
- package/dist/esm/index6.js +13 -183
- package/dist/esm/index60.js +36 -5
- package/dist/esm/index61.js +5 -33
- package/dist/esm/index62.js +34 -8
- package/dist/esm/index63.js +8 -10
- package/dist/esm/index64.js +10 -11
- package/dist/esm/index65.js +11 -13
- package/dist/esm/index66.js +13 -18
- package/dist/esm/index67.js +18 -5
- package/dist/esm/index68.js +6 -5
- package/dist/esm/index69.js +5 -11
- package/dist/esm/index7.js +192 -15
- package/dist/esm/index70.js +10 -16
- package/dist/esm/index71.js +15 -21
- package/dist/esm/index72.js +21 -49
- package/dist/esm/index73.js +51 -2
- package/dist/esm/index74.js +1 -1
- package/dist/esm/index75.js +2 -20
- package/dist/esm/index76.js +20 -80
- package/dist/esm/index77.js +79 -103
- package/dist/esm/index78.js +101 -30
- package/dist/esm/index79.js +32 -6
- package/dist/esm/index8.js +14 -15
- package/dist/esm/index80.js +6 -78
- package/dist/esm/index81.js +79 -10
- package/dist/esm/index82.js +10 -55
- package/dist/esm/index83.js +54 -10
- package/dist/esm/index84.js +11 -2
- package/dist/esm/index85.js +2 -45
- package/dist/esm/index86.js +44 -13
- package/dist/esm/index87.js +14 -5
- package/dist/esm/index88.js +5 -13
- package/dist/esm/index89.js +12 -35
- package/dist/esm/index9.js +15 -20
- package/dist/esm/index90.js +35 -41
- package/dist/esm/index91.js +40 -19
- package/dist/esm/index92.js +21 -10
- package/dist/esm/index93.js +9 -19
- package/dist/esm/index94.js +15 -89
- package/dist/esm/index95.js +92 -19
- package/dist/esm/index96.js +18 -115
- package/dist/esm/index97.js +118 -18
- package/dist/esm/index98.js +18 -28
- package/dist/esm/index99.js +26 -6
- package/dist/types/index.d.ts +36 -1
- package/package.json +2 -2
package/dist/esm/index33.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { LruMap as u } from "./index32.js";
|
|
2
|
+
import { checksumAddress as c } from "./index29.js";
|
|
3
|
+
const i = /^0x[a-fA-F0-9]{40}$/, r = /* @__PURE__ */ new u(8192);
|
|
4
|
+
function h(t, s) {
|
|
5
|
+
const { strict: n = !0 } = s ?? {}, e = `${t}.${n}`;
|
|
6
|
+
if (r.has(e))
|
|
7
|
+
return r.get(e);
|
|
8
|
+
const o = i.test(t) ? t.toLowerCase() === t ? !0 : n ? c(t) === t : !0 : !1;
|
|
9
|
+
return r.set(e, o), o;
|
|
3
10
|
}
|
|
4
11
|
export {
|
|
5
|
-
|
|
12
|
+
h as isAddress,
|
|
13
|
+
r as isAddressCache
|
|
6
14
|
};
|
package/dist/esm/index34.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function e
|
|
2
|
-
return
|
|
1
|
+
function n(e) {
|
|
2
|
+
return `0x${e.reduce((c, r) => c + r.replace("0x", ""), "")}`;
|
|
3
3
|
}
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
n as concatHex
|
|
6
6
|
};
|
package/dist/esm/index35.js
CHANGED
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return typeof n == "string" ? p(n, { dir: r, size: t }) : i(n, { dir: r, size: t });
|
|
4
|
-
}
|
|
5
|
-
function p(n, { dir: r, size: t = 32 } = {}) {
|
|
6
|
-
if (t === null)
|
|
7
|
-
return n;
|
|
8
|
-
const e = n.replace("0x", "");
|
|
9
|
-
if (e.length > t * 2)
|
|
10
|
-
throw new d({
|
|
11
|
-
size: Math.ceil(e.length / 2),
|
|
12
|
-
targetSize: t,
|
|
13
|
-
type: "hex"
|
|
14
|
-
});
|
|
15
|
-
return `0x${e[r === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
|
|
16
|
-
}
|
|
17
|
-
function i(n, { dir: r, size: t = 32 } = {}) {
|
|
18
|
-
if (t === null)
|
|
19
|
-
return n;
|
|
20
|
-
if (n.length > t)
|
|
21
|
-
throw new d({
|
|
22
|
-
size: n.length,
|
|
23
|
-
targetSize: t,
|
|
24
|
-
type: "bytes"
|
|
25
|
-
});
|
|
26
|
-
const e = new Uint8Array(t);
|
|
27
|
-
for (let a = 0; a < t; a++) {
|
|
28
|
-
const o = r === "right";
|
|
29
|
-
e[o ? a : t - a - 1] = n[o ? a : n.length - a - 1];
|
|
30
|
-
}
|
|
31
|
-
return e;
|
|
1
|
+
function e(t, { strict: r = !0 } = {}) {
|
|
2
|
+
return !t || typeof t != "string" ? !1 : r ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x");
|
|
32
3
|
}
|
|
33
4
|
export {
|
|
34
|
-
|
|
35
|
-
i as padBytes,
|
|
36
|
-
p as padHex
|
|
5
|
+
e as isHex
|
|
37
6
|
};
|
package/dist/esm/index36.js
CHANGED
|
@@ -1,15 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { SizeExceedsPaddingSizeError as d } from "./index37.js";
|
|
2
|
+
function f(n, { dir: r, size: t = 32 } = {}) {
|
|
3
|
+
return typeof n == "string" ? p(n, { dir: r, size: t }) : i(n, { dir: r, size: t });
|
|
4
|
+
}
|
|
5
|
+
function p(n, { dir: r, size: t = 32 } = {}) {
|
|
6
|
+
if (t === null)
|
|
7
|
+
return n;
|
|
8
|
+
const e = n.replace("0x", "");
|
|
9
|
+
if (e.length > t * 2)
|
|
10
|
+
throw new d({
|
|
11
|
+
size: Math.ceil(e.length / 2),
|
|
12
|
+
targetSize: t,
|
|
13
|
+
type: "hex"
|
|
14
|
+
});
|
|
15
|
+
return `0x${e[r === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
|
|
6
16
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
function i(n, { dir: r, size: t = 32 } = {}) {
|
|
18
|
+
if (t === null)
|
|
19
|
+
return n;
|
|
20
|
+
if (n.length > t)
|
|
21
|
+
throw new d({
|
|
22
|
+
size: n.length,
|
|
23
|
+
targetSize: t,
|
|
24
|
+
type: "bytes"
|
|
25
|
+
});
|
|
26
|
+
const e = new Uint8Array(t);
|
|
27
|
+
for (let a = 0; a < t; a++) {
|
|
28
|
+
const o = r === "right";
|
|
29
|
+
e[o ? a : t - a - 1] = n[o ? a : n.length - a - 1];
|
|
10
30
|
}
|
|
31
|
+
return e;
|
|
11
32
|
}
|
|
12
33
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
34
|
+
f as pad,
|
|
35
|
+
i as padBytes,
|
|
36
|
+
p as padHex
|
|
15
37
|
};
|
package/dist/esm/index37.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { BaseError as o } from "./index48.js";
|
|
2
|
+
class d extends o {
|
|
3
|
+
constructor({ offset: r, position: s, size: e }) {
|
|
4
|
+
super(`Slice ${s === "start" ? "starting" : "ending"} at offset "${r}" is out-of-bounds (size: ${e}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class n extends o {
|
|
8
|
+
constructor({ size: r, targetSize: s, type: e }) {
|
|
9
|
+
super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (${r}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
10
|
+
}
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
|
-
|
|
13
|
+
n as SizeExceedsPaddingSizeError,
|
|
14
|
+
d as SliceOffsetOutOfBoundsError
|
|
7
15
|
};
|
package/dist/esm/index38.js
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function O(e, f, i, { strict: o } = {}) {
|
|
5
|
-
return c(e, { strict: !1 }) ? l(e, f, i, {
|
|
6
|
-
strict: o
|
|
7
|
-
}) : u(e, f, i, {
|
|
8
|
-
strict: o
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
function t(e, f, i) {
|
|
12
|
-
if (s(e) !== i - f)
|
|
13
|
-
throw new n({
|
|
14
|
-
offset: i,
|
|
15
|
-
position: "end",
|
|
16
|
-
size: s(e)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function u(e, f, i, { strict: o } = {}) {
|
|
20
|
-
const r = e.slice(f, i);
|
|
21
|
-
return o && t(r, f, i), r;
|
|
22
|
-
}
|
|
23
|
-
function l(e, f, i, { strict: o } = {}) {
|
|
24
|
-
const r = `0x${e.replace("0x", "").slice(f * 2, i * 2)}`;
|
|
25
|
-
return o && t(r, f, i), r;
|
|
1
|
+
import { isHex as r } from "./index35.js";
|
|
2
|
+
function i(t) {
|
|
3
|
+
return r(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
|
|
26
4
|
}
|
|
27
5
|
export {
|
|
28
|
-
|
|
29
|
-
u as sliceBytes,
|
|
30
|
-
l as sliceHex
|
|
6
|
+
i as size
|
|
31
7
|
};
|
package/dist/esm/index39.js
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
import { SliceOffsetOutOfBoundsError as n } from "./index37.js";
|
|
2
|
+
import { isHex as c } from "./index35.js";
|
|
3
|
+
import { size as s } from "./index38.js";
|
|
4
|
+
function O(e, f, i, { strict: o } = {}) {
|
|
5
|
+
return c(e, { strict: !1 }) ? l(e, f, i, {
|
|
6
|
+
strict: o
|
|
7
|
+
}) : u(e, f, i, {
|
|
8
|
+
strict: o
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function t(e, f, i) {
|
|
12
|
+
if (s(e) !== i - f)
|
|
13
|
+
throw new n({
|
|
14
|
+
offset: i,
|
|
15
|
+
position: "end",
|
|
16
|
+
size: s(e)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function u(e, f, i, { strict: o } = {}) {
|
|
20
|
+
const r = e.slice(f, i);
|
|
21
|
+
return o && t(r, f, i), r;
|
|
22
|
+
}
|
|
23
|
+
function l(e, f, i, { strict: o } = {}) {
|
|
24
|
+
const r = `0x${e.replace("0x", "").slice(f * 2, i * 2)}`;
|
|
25
|
+
return o && t(r, f, i), r;
|
|
6
26
|
}
|
|
7
27
|
export {
|
|
8
|
-
|
|
28
|
+
O as slice,
|
|
29
|
+
u as sliceBytes,
|
|
30
|
+
l as sliceHex
|
|
9
31
|
};
|
package/dist/esm/index4.js
CHANGED
|
@@ -4,7 +4,7 @@ import "zustand";
|
|
|
4
4
|
import "@coinbase/cdp-api-client";
|
|
5
5
|
import { getCurrentUser as u } from "./index2.js";
|
|
6
6
|
import "./index3.js";
|
|
7
|
-
const
|
|
7
|
+
const r = {
|
|
8
8
|
rpc: {
|
|
9
9
|
invalidInput: -32e3,
|
|
10
10
|
resourceNotFound: -32001,
|
|
@@ -38,11 +38,11 @@ class o extends Error {
|
|
|
38
38
|
* @param code - The error code from EIP1193ErrorCode enum.
|
|
39
39
|
* @param message - The error message.
|
|
40
40
|
*/
|
|
41
|
-
constructor(t,
|
|
42
|
-
super(
|
|
41
|
+
constructor(t, n) {
|
|
42
|
+
super(n), this.code = t;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
class
|
|
45
|
+
class c extends Error {
|
|
46
46
|
/**
|
|
47
47
|
* The error code from RPCErrorCode type.
|
|
48
48
|
*/
|
|
@@ -53,8 +53,8 @@ class a extends Error {
|
|
|
53
53
|
* @param code - The error code from RPCErrorCode type.
|
|
54
54
|
* @param message - The error message.
|
|
55
55
|
*/
|
|
56
|
-
constructor(t,
|
|
57
|
-
super(
|
|
56
|
+
constructor(t, n) {
|
|
57
|
+
super(n), this.code = t;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const p = /* @__PURE__ */ new Set([
|
|
@@ -66,65 +66,78 @@ const p = /* @__PURE__ */ new Set([
|
|
|
66
66
|
"eth_chainId",
|
|
67
67
|
"eth_sign",
|
|
68
68
|
"wallet_disconnect",
|
|
69
|
-
"wallet_switchEthereumChain"
|
|
69
|
+
"wallet_switchEthereumChain",
|
|
70
|
+
"wallet_sendCalls",
|
|
71
|
+
"wallet_getCallsStatus",
|
|
72
|
+
"wallet_getCapabilities"
|
|
70
73
|
]);
|
|
71
|
-
function
|
|
72
|
-
const { method:
|
|
73
|
-
if (typeof
|
|
74
|
-
throw new
|
|
75
|
-
|
|
74
|
+
function _(e, { chains: t }) {
|
|
75
|
+
const { method: n, params: a } = e;
|
|
76
|
+
if (typeof n != "string" || n.length === 0)
|
|
77
|
+
throw new c(
|
|
78
|
+
r.rpc.invalidParams,
|
|
76
79
|
"'method' must be a non-empty string."
|
|
77
80
|
);
|
|
78
|
-
const
|
|
79
|
-
if (typeof
|
|
81
|
+
const s = (a ?? [])[0]?.chainId;
|
|
82
|
+
if (typeof s == "string" && !t.some((d) => d.id === Number.parseInt(s, 16)))
|
|
80
83
|
throw new o(
|
|
81
|
-
|
|
82
|
-
`Chain ${
|
|
84
|
+
r.provider.unsupportedChain,
|
|
85
|
+
`Chain ${s} not supported - make sure the provider is configured with the correct chains.`
|
|
83
86
|
);
|
|
84
|
-
if (
|
|
85
|
-
throw new
|
|
86
|
-
|
|
87
|
+
if (a !== void 0 && !Array.isArray(a))
|
|
88
|
+
throw new c(
|
|
89
|
+
r.rpc.invalidParams,
|
|
87
90
|
"'params' must be an array if provided."
|
|
88
91
|
);
|
|
89
|
-
if (!p.has(
|
|
92
|
+
if (!p.has(n))
|
|
90
93
|
throw new o(
|
|
91
|
-
|
|
94
|
+
r.provider.unsupportedMethod,
|
|
92
95
|
`Method ${e.method} not supported`
|
|
93
96
|
);
|
|
94
97
|
}
|
|
95
|
-
async function
|
|
98
|
+
async function i() {
|
|
96
99
|
const e = await u();
|
|
97
100
|
if (!e)
|
|
98
101
|
throw new o(
|
|
99
|
-
|
|
102
|
+
r.provider.unauthorized,
|
|
100
103
|
"User not connected"
|
|
101
104
|
);
|
|
102
105
|
return e;
|
|
103
106
|
}
|
|
104
|
-
async function
|
|
105
|
-
const t = await
|
|
107
|
+
async function E(e) {
|
|
108
|
+
const t = await i();
|
|
106
109
|
if (!t.evmAccounts?.includes(e))
|
|
107
110
|
throw new o(
|
|
108
|
-
|
|
111
|
+
r.provider.unauthorized,
|
|
109
112
|
"Address not owned by user"
|
|
110
113
|
);
|
|
111
114
|
return t;
|
|
112
115
|
}
|
|
113
|
-
async function
|
|
114
|
-
const e = await
|
|
116
|
+
async function y() {
|
|
117
|
+
const e = await i();
|
|
115
118
|
if (!e.evmAccounts?.[0])
|
|
116
119
|
throw new o(
|
|
117
|
-
|
|
120
|
+
r.provider.unauthorized,
|
|
118
121
|
"No EVM accounts available"
|
|
119
122
|
);
|
|
120
123
|
return e;
|
|
121
124
|
}
|
|
125
|
+
async function A() {
|
|
126
|
+
const e = await i();
|
|
127
|
+
if (!e.evmSmartAccounts?.[0])
|
|
128
|
+
throw new o(
|
|
129
|
+
r.provider.unauthorized,
|
|
130
|
+
"No EVM smart accounts available"
|
|
131
|
+
);
|
|
132
|
+
return e;
|
|
133
|
+
}
|
|
122
134
|
export {
|
|
123
135
|
o as EIP1193ProviderError,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
c as RPCRequestError,
|
|
137
|
+
r as STANDARD_ERROR_CODES,
|
|
138
|
+
_ as validateRequest,
|
|
139
|
+
i as validateUserConnected,
|
|
140
|
+
y as validateUserHasEvmAccount,
|
|
141
|
+
A as validateUserHasEvmSmartAccount,
|
|
142
|
+
E as validateUserOwnsAddress
|
|
130
143
|
};
|
package/dist/esm/index40.js
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return {
|
|
6
|
-
...e,
|
|
7
|
-
baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
|
|
8
|
-
blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
|
|
9
|
-
difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
|
|
10
|
-
excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
|
|
11
|
-
gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
|
|
12
|
-
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
|
|
13
|
-
hash: e.hash ? e.hash : null,
|
|
14
|
-
logsBloom: e.logsBloom ? e.logsBloom : null,
|
|
15
|
-
nonce: e.nonce ? e.nonce : null,
|
|
16
|
-
number: e.number ? BigInt(e.number) : null,
|
|
17
|
-
size: e.size ? BigInt(e.size) : void 0,
|
|
18
|
-
timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
|
|
19
|
-
transactions: i,
|
|
20
|
-
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
21
|
-
};
|
|
1
|
+
function f(e, { dir: n = "left" } = {}) {
|
|
2
|
+
let t = typeof e == "string" ? e.replace("0x", "") : e, i = 0;
|
|
3
|
+
for (let l = 0; l < t.length - 1 && t[n === "left" ? l : t.length - l - 1].toString() === "0"; l++)
|
|
4
|
+
i++;
|
|
5
|
+
return t = n === "left" ? t.slice(i) : t.slice(0, t.length - i), typeof e == "string" ? (t.length === 1 && n === "right" && (t = `${t}0`), `0x${t.length % 2 === 1 ? `0${t}` : t}`) : t;
|
|
22
6
|
}
|
|
23
|
-
const d = /* @__PURE__ */ s("block", a);
|
|
24
7
|
export {
|
|
25
|
-
|
|
26
|
-
a as formatBlock
|
|
8
|
+
f as trim
|
|
27
9
|
};
|
package/dist/esm/index41.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { defineFormatter as s } from "./index42.js";
|
|
2
|
+
import { formatTransaction as t } from "./index43.js";
|
|
3
|
+
function a(e) {
|
|
4
|
+
const i = (e.transactions ?? []).map((n) => typeof n == "string" ? n : t(n));
|
|
5
|
+
return {
|
|
6
|
+
...e,
|
|
7
|
+
baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
|
|
8
|
+
blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
|
|
9
|
+
difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
|
|
10
|
+
excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
|
|
11
|
+
gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
|
|
12
|
+
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
|
|
13
|
+
hash: e.hash ? e.hash : null,
|
|
14
|
+
logsBloom: e.logsBloom ? e.logsBloom : null,
|
|
15
|
+
nonce: e.nonce ? e.nonce : null,
|
|
16
|
+
number: e.number ? BigInt(e.number) : null,
|
|
17
|
+
size: e.size ? BigInt(e.size) : void 0,
|
|
18
|
+
timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
|
|
19
|
+
transactions: i,
|
|
20
|
+
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
21
|
+
};
|
|
16
22
|
}
|
|
23
|
+
const d = /* @__PURE__ */ s("block", a);
|
|
17
24
|
export {
|
|
18
|
-
|
|
25
|
+
d as defineBlock,
|
|
26
|
+
a as formatBlock
|
|
19
27
|
};
|
package/dist/esm/index42.js
CHANGED
|
@@ -1,57 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
17
|
-
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
18
|
-
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
19
|
-
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
20
|
-
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
21
|
-
nonce: e.nonce ? i(e.nonce) : void 0,
|
|
22
|
-
to: e.to ? e.to : null,
|
|
23
|
-
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
24
|
-
type: e.type ? u[e.type] : void 0,
|
|
25
|
-
typeHex: e.type ? e.type : void 0,
|
|
26
|
-
value: e.value ? BigInt(e.value) : void 0,
|
|
27
|
-
v: e.v ? BigInt(e.v) : void 0
|
|
28
|
-
};
|
|
29
|
-
return e.authorizationList && (d.authorizationList = m(e.authorizationList)), d.yParity = (() => {
|
|
30
|
-
if (e.yParity)
|
|
31
|
-
return Number(e.yParity);
|
|
32
|
-
if (typeof d.v == "bigint") {
|
|
33
|
-
if (d.v === 0n || d.v === 27n)
|
|
34
|
-
return 0;
|
|
35
|
-
if (d.v === 1n || d.v === 28n)
|
|
36
|
-
return 1;
|
|
37
|
-
if (d.v >= 35n)
|
|
38
|
-
return d.v % 2n === 0n ? 1 : 0;
|
|
39
|
-
}
|
|
40
|
-
})(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
|
|
41
|
-
}
|
|
42
|
-
const P = /* @__PURE__ */ r("transaction", l);
|
|
43
|
-
function m(e) {
|
|
44
|
-
return e.map((d) => ({
|
|
45
|
-
address: d.address,
|
|
46
|
-
chainId: Number(d.chainId),
|
|
47
|
-
nonce: Number(d.nonce),
|
|
48
|
-
r: d.r,
|
|
49
|
-
s: d.s,
|
|
50
|
-
yParity: Number(d.yParity)
|
|
51
|
-
}));
|
|
1
|
+
function a(e, f) {
|
|
2
|
+
return ({ exclude: t, format: n }) => ({
|
|
3
|
+
exclude: t,
|
|
4
|
+
format: (r) => {
|
|
5
|
+
const o = f(r);
|
|
6
|
+
if (t)
|
|
7
|
+
for (const m of t)
|
|
8
|
+
delete o[m];
|
|
9
|
+
return {
|
|
10
|
+
...o,
|
|
11
|
+
...n(r)
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
type: e
|
|
15
|
+
});
|
|
52
16
|
}
|
|
53
17
|
export {
|
|
54
|
-
|
|
55
|
-
l as formatTransaction,
|
|
56
|
-
u as transactionType
|
|
18
|
+
a as defineFormatter
|
|
57
19
|
};
|
package/dist/esm/index43.js
CHANGED
|
@@ -1,26 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { hexToNumber as i } from "./index44.js";
|
|
2
|
+
import { defineFormatter as r } from "./index42.js";
|
|
3
|
+
const u = {
|
|
4
|
+
"0x0": "legacy",
|
|
5
|
+
"0x1": "eip2930",
|
|
6
|
+
"0x2": "eip1559",
|
|
7
|
+
"0x3": "eip4844",
|
|
8
|
+
"0x4": "eip7702"
|
|
9
|
+
};
|
|
10
|
+
function l(e) {
|
|
11
|
+
const d = {
|
|
12
|
+
...e,
|
|
13
|
+
blockHash: e.blockHash ? e.blockHash : null,
|
|
14
|
+
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
15
|
+
chainId: e.chainId ? i(e.chainId) : void 0,
|
|
16
|
+
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
17
|
+
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
18
|
+
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
19
|
+
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
20
|
+
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
21
|
+
nonce: e.nonce ? i(e.nonce) : void 0,
|
|
22
|
+
to: e.to ? e.to : null,
|
|
23
|
+
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
24
|
+
type: e.type ? u[e.type] : void 0,
|
|
25
|
+
typeHex: e.type ? e.type : void 0,
|
|
26
|
+
value: e.value ? BigInt(e.value) : void 0,
|
|
27
|
+
v: e.v ? BigInt(e.v) : void 0
|
|
28
|
+
};
|
|
29
|
+
return e.authorizationList && (d.authorizationList = m(e.authorizationList)), d.yParity = (() => {
|
|
30
|
+
if (e.yParity)
|
|
31
|
+
return Number(e.yParity);
|
|
32
|
+
if (typeof d.v == "bigint") {
|
|
33
|
+
if (d.v === 0n || d.v === 27n)
|
|
34
|
+
return 0;
|
|
35
|
+
if (d.v === 1n || d.v === 28n)
|
|
36
|
+
return 1;
|
|
37
|
+
if (d.v >= 35n)
|
|
38
|
+
return d.v % 2n === 0n ? 1 : 0;
|
|
39
|
+
}
|
|
40
|
+
})(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
|
|
18
41
|
}
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
const P = /* @__PURE__ */ r("transaction", l);
|
|
43
|
+
function m(e) {
|
|
44
|
+
return e.map((d) => ({
|
|
45
|
+
address: d.address,
|
|
46
|
+
chainId: Number(d.chainId),
|
|
47
|
+
nonce: Number(d.nonce),
|
|
48
|
+
r: d.r,
|
|
49
|
+
s: d.s,
|
|
50
|
+
yParity: Number(d.yParity)
|
|
51
|
+
}));
|
|
21
52
|
}
|
|
22
53
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
P as defineTransaction,
|
|
55
|
+
l as formatTransaction,
|
|
56
|
+
u as transactionType
|
|
26
57
|
};
|
package/dist/esm/index44.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { SizeOverflowError as u } from "./index50.js";
|
|
2
|
+
import { size as t } from "./index38.js";
|
|
3
|
+
function s(n, { size: i }) {
|
|
4
|
+
if (t(n) > i)
|
|
5
|
+
throw new u({
|
|
6
|
+
givenSize: t(n),
|
|
7
|
+
maxSize: i
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function z(n, i = {}) {
|
|
11
|
+
const { signed: o } = i;
|
|
12
|
+
i.size && s(n, { size: i.size });
|
|
13
|
+
const e = BigInt(n);
|
|
14
|
+
if (!o)
|
|
15
|
+
return e;
|
|
16
|
+
const r = (n.length - 2) / 2, f = (1n << BigInt(r) * 8n - 1n) - 1n;
|
|
17
|
+
return e <= f ? e : e - BigInt(`0x${"f".padStart(r * 2, "f")}`) - 1n;
|
|
18
|
+
}
|
|
19
|
+
function g(n, i = {}) {
|
|
20
|
+
return Number(z(n, i));
|
|
11
21
|
}
|
|
12
22
|
export {
|
|
13
|
-
|
|
23
|
+
s as assertSize,
|
|
24
|
+
z as hexToBigInt,
|
|
25
|
+
g as hexToNumber
|
|
14
26
|
};
|