@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.
Files changed (109) hide show
  1. package/README.md +12 -12
  2. package/dist/esm/index.js +17 -15
  3. package/dist/esm/index10.js +20 -14
  4. package/dist/esm/index100.js +6 -9
  5. package/dist/esm/index101.js +11 -13
  6. package/dist/esm/index102.js +11 -8
  7. package/dist/esm/index103.js +7 -14
  8. package/dist/esm/index104.js +16 -80
  9. package/dist/esm/index105.js +72 -70
  10. package/dist/esm/index106.js +81 -0
  11. package/dist/esm/index11.js +13 -117
  12. package/dist/esm/index12.js +116 -11
  13. package/dist/esm/index13.js +14 -22
  14. package/dist/esm/index14.js +42 -20
  15. package/dist/esm/index15.js +20 -172
  16. package/dist/esm/index16.js +170 -24
  17. package/dist/esm/index17.js +22 -156
  18. package/dist/esm/index18.js +157 -45
  19. package/dist/esm/index19.js +44 -149
  20. package/dist/esm/index2.js +10 -10
  21. package/dist/esm/index20.js +247 -53
  22. package/dist/esm/index21.js +56 -41
  23. package/dist/esm/index22.js +40 -16
  24. package/dist/esm/index23.js +16 -4
  25. package/dist/esm/index24.js +5 -5
  26. package/dist/esm/index25.js +5 -9
  27. package/dist/esm/index26.js +8 -17
  28. package/dist/esm/index27.js +16 -44
  29. package/dist/esm/index28.js +45 -13
  30. package/dist/esm/index29.js +13 -55
  31. package/dist/esm/index3.js +66 -60
  32. package/dist/esm/index30.js +55 -6
  33. package/dist/esm/index31.js +6 -21
  34. package/dist/esm/index32.js +21 -11
  35. package/dist/esm/index33.js +11 -3
  36. package/dist/esm/index34.js +3 -3
  37. package/dist/esm/index35.js +3 -34
  38. package/dist/esm/index36.js +32 -10
  39. package/dist/esm/index37.js +12 -4
  40. package/dist/esm/index38.js +4 -28
  41. package/dist/esm/index39.js +28 -6
  42. package/dist/esm/index4.js +48 -35
  43. package/dist/esm/index40.js +6 -24
  44. package/dist/esm/index41.js +24 -16
  45. package/dist/esm/index42.js +16 -54
  46. package/dist/esm/index43.js +53 -22
  47. package/dist/esm/index44.js +23 -11
  48. package/dist/esm/index45.js +10 -26
  49. package/dist/esm/index46.js +26 -41
  50. package/dist/esm/index47.js +41 -54
  51. package/dist/esm/index48.js +54 -126
  52. package/dist/esm/index49.js +126 -11
  53. package/dist/esm/index5.js +1 -1
  54. package/dist/esm/index50.js +9 -101
  55. package/dist/esm/index51.js +104 -6
  56. package/dist/esm/index52.js +7 -3
  57. package/dist/esm/index53.js +3 -15
  58. package/dist/esm/index54.js +14 -42
  59. package/dist/esm/index55.js +38 -74
  60. package/dist/esm/index56.js +79 -2
  61. package/dist/esm/index57.js +2 -2
  62. package/dist/esm/index58.js +2 -13
  63. package/dist/esm/index59.js +8 -33
  64. package/dist/esm/index6.js +13 -183
  65. package/dist/esm/index60.js +36 -5
  66. package/dist/esm/index61.js +5 -33
  67. package/dist/esm/index62.js +34 -8
  68. package/dist/esm/index63.js +8 -10
  69. package/dist/esm/index64.js +10 -11
  70. package/dist/esm/index65.js +11 -13
  71. package/dist/esm/index66.js +13 -18
  72. package/dist/esm/index67.js +18 -5
  73. package/dist/esm/index68.js +6 -5
  74. package/dist/esm/index69.js +5 -11
  75. package/dist/esm/index7.js +192 -15
  76. package/dist/esm/index70.js +10 -16
  77. package/dist/esm/index71.js +15 -21
  78. package/dist/esm/index72.js +21 -49
  79. package/dist/esm/index73.js +51 -2
  80. package/dist/esm/index74.js +1 -1
  81. package/dist/esm/index75.js +2 -20
  82. package/dist/esm/index76.js +20 -80
  83. package/dist/esm/index77.js +79 -103
  84. package/dist/esm/index78.js +101 -30
  85. package/dist/esm/index79.js +32 -6
  86. package/dist/esm/index8.js +14 -15
  87. package/dist/esm/index80.js +6 -78
  88. package/dist/esm/index81.js +79 -10
  89. package/dist/esm/index82.js +10 -55
  90. package/dist/esm/index83.js +54 -10
  91. package/dist/esm/index84.js +11 -2
  92. package/dist/esm/index85.js +2 -45
  93. package/dist/esm/index86.js +44 -13
  94. package/dist/esm/index87.js +14 -5
  95. package/dist/esm/index88.js +5 -13
  96. package/dist/esm/index89.js +12 -35
  97. package/dist/esm/index9.js +15 -20
  98. package/dist/esm/index90.js +35 -41
  99. package/dist/esm/index91.js +40 -19
  100. package/dist/esm/index92.js +21 -10
  101. package/dist/esm/index93.js +9 -19
  102. package/dist/esm/index94.js +15 -89
  103. package/dist/esm/index95.js +92 -19
  104. package/dist/esm/index96.js +18 -115
  105. package/dist/esm/index97.js +118 -18
  106. package/dist/esm/index98.js +18 -28
  107. package/dist/esm/index99.js +26 -6
  108. package/dist/types/index.d.ts +36 -1
  109. package/package.json +2 -2
@@ -1,6 +1,14 @@
1
- function n(e) {
2
- return `0x${e.reduce((c, r) => c + r.replace("0x", ""), "")}`;
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
- n as concatHex
12
+ h as isAddress,
13
+ r as isAddressCache
6
14
  };
@@ -1,6 +1,6 @@
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");
1
+ function n(e) {
2
+ return `0x${e.reduce((c, r) => c + r.replace("0x", ""), "")}`;
3
3
  }
4
4
  export {
5
- e as isHex
5
+ n as concatHex
6
6
  };
@@ -1,37 +1,6 @@
1
- import { SizeExceedsPaddingSizeError as d } from "./index36.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")}`;
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
- f as pad,
35
- i as padBytes,
36
- p as padHex
5
+ e as isHex
37
6
  };
@@ -1,15 +1,37 @@
1
- import { BaseError as o } from "./index47.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
- }
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
- 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" });
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
- n as SizeExceedsPaddingSizeError,
14
- d as SliceOffsetOutOfBoundsError
34
+ f as pad,
35
+ i as padBytes,
36
+ p as padHex
15
37
  };
@@ -1,7 +1,15 @@
1
- import { isHex as r } from "./index34.js";
2
- function i(t) {
3
- return r(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
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
- i as size
13
+ n as SizeExceedsPaddingSizeError,
14
+ d as SliceOffsetOutOfBoundsError
7
15
  };
@@ -1,31 +1,7 @@
1
- import { SliceOffsetOutOfBoundsError as n } from "./index36.js";
2
- import { isHex as c } from "./index34.js";
3
- import { size as s } from "./index37.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;
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
- O as slice,
29
- u as sliceBytes,
30
- l as sliceHex
6
+ i as size
31
7
  };
@@ -1,9 +1,31 @@
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;
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
- f as trim
28
+ O as slice,
29
+ u as sliceBytes,
30
+ l as sliceHex
9
31
  };
@@ -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 n = {
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, r) {
42
- super(r), this.code = t;
41
+ constructor(t, n) {
42
+ super(n), this.code = t;
43
43
  }
44
44
  }
45
- class a extends Error {
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, r) {
57
- super(r), this.code = t;
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 E(e, { chains: t }) {
72
- const { method: r, params: s } = e;
73
- if (typeof r != "string" || r.length === 0)
74
- throw new a(
75
- n.rpc.invalidParams,
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 i = (s ?? [])[0]?.chainId;
79
- if (typeof i == "string" && !t.some((c) => c.id === Number.parseInt(i, 16)))
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
- n.provider.unsupportedChain,
82
- `Chain ${i} not supported - make sure the provider is configured with the correct chains.`
84
+ r.provider.unsupportedChain,
85
+ `Chain ${s} not supported - make sure the provider is configured with the correct chains.`
83
86
  );
84
- if (s !== void 0 && !Array.isArray(s))
85
- throw new a(
86
- n.rpc.invalidParams,
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(r))
92
+ if (!p.has(n))
90
93
  throw new o(
91
- n.provider.unsupportedMethod,
94
+ r.provider.unsupportedMethod,
92
95
  `Method ${e.method} not supported`
93
96
  );
94
97
  }
95
- async function d() {
98
+ async function i() {
96
99
  const e = await u();
97
100
  if (!e)
98
101
  throw new o(
99
- n.provider.unauthorized,
102
+ r.provider.unauthorized,
100
103
  "User not connected"
101
104
  );
102
105
  return e;
103
106
  }
104
- async function _(e) {
105
- const t = await d();
107
+ async function E(e) {
108
+ const t = await i();
106
109
  if (!t.evmAccounts?.includes(e))
107
110
  throw new o(
108
- n.provider.unauthorized,
111
+ r.provider.unauthorized,
109
112
  "Address not owned by user"
110
113
  );
111
114
  return t;
112
115
  }
113
- async function R() {
114
- const e = await d();
116
+ async function y() {
117
+ const e = await i();
115
118
  if (!e.evmAccounts?.[0])
116
119
  throw new o(
117
- n.provider.unauthorized,
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
- a as RPCRequestError,
125
- n as STANDARD_ERROR_CODES,
126
- E as validateRequest,
127
- d as validateUserConnected,
128
- R as validateUserHasEvmAccount,
129
- _ as validateUserOwnsAddress
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
  };
@@ -1,27 +1,9 @@
1
- import { defineFormatter as s } from "./index41.js";
2
- import { formatTransaction as t } from "./index42.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
- };
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
- d as defineBlock,
26
- a as formatBlock
8
+ f as trim
27
9
  };
@@ -1,19 +1,27 @@
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
- });
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
- a as defineFormatter
25
+ d as defineBlock,
26
+ a as formatBlock
19
27
  };
@@ -1,57 +1,19 @@
1
- import { hexToNumber as i } from "./index43.js";
2
- import { defineFormatter as r } from "./index41.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;
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
- P as defineTransaction,
55
- l as formatTransaction,
56
- u as transactionType
18
+ a as defineFormatter
57
19
  };
@@ -1,26 +1,57 @@
1
- import { SizeOverflowError as u } from "./index49.js";
2
- import { size as t } from "./index37.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;
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
- function g(n, i = {}) {
20
- return Number(z(n, i));
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
- s as assertSize,
24
- z as hexToBigInt,
25
- g as hexToNumber
54
+ P as defineTransaction,
55
+ l as formatTransaction,
56
+ u as transactionType
26
57
  };
@@ -1,14 +1,26 @@
1
- function r(n, { args: t, eventName: a } = {}) {
2
- return {
3
- ...n,
4
- blockHash: n.blockHash ? n.blockHash : null,
5
- blockNumber: n.blockNumber ? BigInt(n.blockNumber) : null,
6
- logIndex: n.logIndex ? Number(n.logIndex) : null,
7
- transactionHash: n.transactionHash ? n.transactionHash : null,
8
- transactionIndex: n.transactionIndex ? Number(n.transactionIndex) : null,
9
- ...a ? { args: t, eventName: a } : {}
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
- r as formatLog
23
+ s as assertSize,
24
+ z as hexToBigInt,
25
+ g as hexToNumber
14
26
  };