@coinbase/cdp-core 0.0.20 → 0.0.21

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 (87) hide show
  1. package/README.md +75 -1
  2. package/dist/esm/index.js +29 -27
  3. package/dist/esm/index103.js +1 -1
  4. package/dist/esm/index15.js +8 -8
  5. package/dist/esm/index16.js +2 -2
  6. package/dist/esm/index17.js +39 -158
  7. package/dist/esm/index18.js +16 -47
  8. package/dist/esm/index19.js +4 -152
  9. package/dist/esm/index2.js +154 -87
  10. package/dist/esm/index20.js +5 -56
  11. package/dist/esm/index21.js +158 -39
  12. package/dist/esm/index22.js +47 -16
  13. package/dist/esm/index23.js +152 -4
  14. package/dist/esm/index24.js +56 -5
  15. package/dist/esm/index25.js +8 -12
  16. package/dist/esm/index26.js +17 -11
  17. package/dist/esm/index27.js +45 -8
  18. package/dist/esm/index28.js +13 -17
  19. package/dist/esm/index29.js +50 -40
  20. package/dist/esm/index3.js +4 -4
  21. package/dist/esm/index30.js +6 -13
  22. package/dist/esm/index31.js +20 -54
  23. package/dist/esm/index32.js +11 -6
  24. package/dist/esm/index33.js +3 -21
  25. package/dist/esm/index34.js +3 -3
  26. package/dist/esm/index35.js +34 -3
  27. package/dist/esm/index36.js +10 -32
  28. package/dist/esm/index37.js +4 -12
  29. package/dist/esm/index38.js +28 -4
  30. package/dist/esm/index39.js +6 -28
  31. package/dist/esm/index40.js +24 -6
  32. package/dist/esm/index41.js +16 -24
  33. package/dist/esm/index42.js +54 -16
  34. package/dist/esm/index43.js +22 -53
  35. package/dist/esm/index44.js +11 -23
  36. package/dist/esm/index45.js +26 -10
  37. package/dist/esm/index46.js +41 -26
  38. package/dist/esm/index47.js +54 -41
  39. package/dist/esm/index48.js +126 -54
  40. package/dist/esm/index49.js +11 -126
  41. package/dist/esm/index50.js +101 -9
  42. package/dist/esm/index51.js +6 -104
  43. package/dist/esm/index52.js +3 -7
  44. package/dist/esm/index53.js +15 -3
  45. package/dist/esm/index54.js +42 -14
  46. package/dist/esm/index55.js +74 -38
  47. package/dist/esm/index56.js +2 -79
  48. package/dist/esm/index57.js +2 -2
  49. package/dist/esm/index58.js +13 -2
  50. package/dist/esm/index59.js +2 -2
  51. package/dist/esm/index6.js +4 -4
  52. package/dist/esm/index60.js +1 -1
  53. package/dist/esm/index61.js +1 -1
  54. package/dist/esm/index62.js +2 -2
  55. package/dist/esm/index63.js +2 -2
  56. package/dist/esm/index64.js +1 -1
  57. package/dist/esm/index65.js +1 -1
  58. package/dist/esm/index66.js +3 -3
  59. package/dist/esm/index7.js +7 -6
  60. package/dist/esm/index70.js +1 -1
  61. package/dist/esm/index72.js +4 -4
  62. package/dist/esm/index73.js +2 -104
  63. package/dist/esm/index74.js +17 -75
  64. package/dist/esm/index75.js +20 -80
  65. package/dist/esm/index76.js +80 -2
  66. package/dist/esm/index77.js +100 -17
  67. package/dist/esm/index78.js +31 -18
  68. package/dist/esm/index79.js +6 -32
  69. package/dist/esm/index8.js +10 -8
  70. package/dist/esm/index80.js +54 -6
  71. package/dist/esm/index81.js +11 -10
  72. package/dist/esm/index82.js +2 -55
  73. package/dist/esm/index83.js +45 -11
  74. package/dist/esm/index84.js +14 -2
  75. package/dist/esm/index85.js +9 -44
  76. package/dist/esm/index86.js +78 -13
  77. package/dist/esm/index88.js +20 -12
  78. package/dist/esm/index89.js +9 -35
  79. package/dist/esm/index90.js +19 -41
  80. package/dist/esm/index91.js +93 -20
  81. package/dist/esm/index92.js +20 -9
  82. package/dist/esm/index93.js +114 -16
  83. package/dist/esm/index94.js +11 -92
  84. package/dist/esm/index95.js +35 -20
  85. package/dist/esm/index96.js +41 -117
  86. package/dist/types/index.d.ts +33 -0
  87. package/package.json +3 -3
@@ -1,7 +1,155 @@
1
- async function t() {
2
- const r = new Uint8Array(16);
3
- return window.crypto.getRandomValues(r), Array.from(r, (n) => n.toString(16).padStart(2, "0")).join("");
1
+ import { Hex as y } from "ox";
2
+ import { createWalletClient as I } from "viem";
3
+ import { signEvmTypedData as E, signEvmHash as S, getCurrentUser as f, signOut as P, sendEvmTransaction as R, signEvmTransaction as T, signEvmMessage as A } from "./index2.js";
4
+ import "@coinbase/cdp-api-client";
5
+ import "./index3.js";
6
+ import { validateUserOwnsAddress as m, EIP1193ProviderError as l, STANDARD_ERROR_CODES as s, RPCRequestError as o, validateUserHasEvmAccount as x, validateUserConnected as C } from "./index4.js";
7
+ import "zustand";
8
+ import { isChainIdSupportedForCDPSends as D, chainIdToNameMapping as b } from "./index13.js";
9
+ function g(e) {
10
+ return {
11
+ to: e.to,
12
+ data: e.data,
13
+ value: e.value ? BigInt(e.value) : void 0,
14
+ nonce: e.nonce ? Number(e.nonce) : void 0,
15
+ gas: e.gas ? BigInt(e.gas) : void 0,
16
+ maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
17
+ maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
18
+ type: "eip1559"
19
+ };
20
+ }
21
+ async function M() {
22
+ return (await f())?.evmAccounts || [];
23
+ }
24
+ async function _(e, n) {
25
+ const a = await C();
26
+ return e.emit("connect", {
27
+ chainId: y.fromNumber(n.getState().chainId)
28
+ }), a.evmAccounts || [];
29
+ }
30
+ async function k(e) {
31
+ const [n, a] = e;
32
+ await m(a);
33
+ const t = Buffer.from(n.slice(2), "hex").toString();
34
+ try {
35
+ return (await A({
36
+ evmAccount: a,
37
+ message: t
38
+ })).signature;
39
+ } catch (c) {
40
+ throw new l(
41
+ s.provider.userRejectedRequest,
42
+ c instanceof Error ? c.message : "Signing failed"
43
+ );
44
+ }
45
+ }
46
+ async function z(e) {
47
+ const [n, a] = e;
48
+ await m(n);
49
+ try {
50
+ return (await E({
51
+ evmAccount: n,
52
+ typedData: JSON.parse(a)
53
+ })).signature;
54
+ } catch (t) {
55
+ throw new l(
56
+ s.provider.userRejectedRequest,
57
+ t instanceof Error ? t.message : "Signing failed"
58
+ );
59
+ }
60
+ }
61
+ async function J(e, n, a) {
62
+ const [t] = e;
63
+ if (!t || typeof t != "object")
64
+ throw new o(
65
+ s.rpc.invalidParams,
66
+ "Transaction parameter must be an object"
67
+ );
68
+ if (!t.to)
69
+ throw new o(
70
+ s.rpc.invalidParams,
71
+ "Transaction must include 'to' field"
72
+ );
73
+ const d = (await x()).evmAccounts?.[0], u = n.getState(), i = t.chainId ? Number(t.chainId) : u.chainId;
74
+ if (!d)
75
+ throw new o(
76
+ s.rpc.invalidParams,
77
+ "User does not have an EVM account"
78
+ );
79
+ if (D(i))
80
+ try {
81
+ return (await R({
82
+ evmAccount: d,
83
+ transaction: { ...g(t), chainId: i },
84
+ network: b[i]
85
+ })).transactionHash;
86
+ } catch (r) {
87
+ throw console.log("Transaction failed", r), new o(
88
+ s.rpc.transactionRejected,
89
+ r instanceof Error ? r.message : "Transaction failed"
90
+ );
91
+ }
92
+ else
93
+ try {
94
+ const r = I({
95
+ // Safe as we check before calling this handler that chainId is configured
96
+ chain: u.chains.find((h) => h.id === i),
97
+ transport: a[i],
98
+ account: d
99
+ }), p = u.chains.find((h) => h.id === i), w = await r.prepareTransactionRequest({
100
+ ...g(t),
101
+ chain: p
102
+ }), v = await T({
103
+ evmAccount: d,
104
+ transaction: {
105
+ ...w,
106
+ type: "eip1559"
107
+ }
108
+ });
109
+ return await r.sendRawTransaction({
110
+ serializedTransaction: v.signedTransaction
111
+ });
112
+ } catch (r) {
113
+ throw new o(
114
+ s.rpc.transactionRejected,
115
+ r instanceof Error ? r.message : "Transaction failed"
116
+ );
117
+ }
118
+ }
119
+ async function V(e) {
120
+ const [n, a] = e;
121
+ await m(a);
122
+ try {
123
+ return (await S({
124
+ evmAccount: a,
125
+ hash: n
126
+ })).signature;
127
+ } catch (t) {
128
+ throw new l(
129
+ s.provider.userRejectedRequest,
130
+ t instanceof Error ? t.message : "Signing failed"
131
+ );
132
+ }
133
+ }
134
+ async function W(e) {
135
+ return `0x${e.getState().chainId.toString(16)}`;
136
+ }
137
+ async function $() {
138
+ await f() && await P();
139
+ }
140
+ function K(e, n) {
141
+ const a = Number.parseInt(e[0].chainId, 16);
142
+ n.getState().setChainId(a);
4
143
  }
5
144
  export {
6
- t as generateRandomId
145
+ M as handleAccounts,
146
+ W as handleChainId,
147
+ $ as handleDisconnect,
148
+ V as handleEthSign,
149
+ k as handlePersonalSign,
150
+ _ as handleRequestAccounts,
151
+ J as handleSendTransaction,
152
+ z as handleSignTypedData,
153
+ K as handleSwitchEthereumChain,
154
+ g as shimProviderTxRequest
7
155
  };
@@ -1,7 +1,58 @@
1
- const h = async (t) => {
2
- const a = await window.crypto.subtle.digest("SHA-256", t), r = new Uint8Array(a);
3
- return Array.from(r).map((s) => s.toString(16).padStart(2, "0")).join("");
4
- };
1
+ import { chainConfig as a } from "./index85.js";
2
+ import { defineChain as t } from "./index25.js";
3
+ const e = 11155111, r = /* @__PURE__ */ t({
4
+ ...a,
5
+ id: 84532,
6
+ network: "base-sepolia",
7
+ name: "Base Sepolia",
8
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
9
+ rpcUrls: {
10
+ default: {
11
+ http: ["https://sepolia.base.org"]
12
+ }
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: "Basescan",
17
+ url: "https://sepolia.basescan.org",
18
+ apiUrl: "https://api-sepolia.basescan.org/api"
19
+ }
20
+ },
21
+ contracts: {
22
+ ...a.contracts,
23
+ disputeGameFactory: {
24
+ [e]: {
25
+ address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"
26
+ }
27
+ },
28
+ l2OutputOracle: {
29
+ [e]: {
30
+ address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"
31
+ }
32
+ },
33
+ portal: {
34
+ [e]: {
35
+ address: "0x49f53e41452c74589e85ca1677426ba426459e85",
36
+ blockCreated: 4446677
37
+ }
38
+ },
39
+ l1StandardBridge: {
40
+ [e]: {
41
+ address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
42
+ blockCreated: 4446677
43
+ }
44
+ },
45
+ multicall3: {
46
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
47
+ blockCreated: 1059647
48
+ }
49
+ },
50
+ testnet: !0,
51
+ sourceId: e
52
+ });
53
+ ({
54
+ ...r
55
+ });
5
56
  export {
6
- h as hash
57
+ r as baseSepolia
7
58
  };
@@ -1,15 +1,11 @@
1
- import { BaseError as r } from "./index48.js";
2
- class d extends r {
3
- constructor({ address: s }) {
4
- super(`Address "${s}" is invalid.`, {
5
- metaMessages: [
6
- "- Address must be a hex value of 20 bytes (40 hex characters).",
7
- "- Address must match its checksum counterpart."
8
- ],
9
- name: "InvalidAddressError"
10
- });
11
- }
1
+ function n(e) {
2
+ return {
3
+ formatters: void 0,
4
+ fees: void 0,
5
+ serializers: void 0,
6
+ ...e
7
+ };
12
8
  }
13
9
  export {
14
- d as InvalidAddressError
10
+ n as defineChain
15
11
  };
@@ -1,14 +1,20 @@
1
- import { LruMap as u } from "./index33.js";
2
- import { checksumAddress as c } from "./index30.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;
1
+ import { toHex as i } from "./index27.js";
2
+ import { toYParitySignatureArray as c } from "./index15.js";
3
+ function f(r) {
4
+ if (!r || r.length === 0)
5
+ return [];
6
+ const t = [];
7
+ for (const o of r) {
8
+ const { chainId: n, nonce: e, ...s } = o, a = o.address;
9
+ t.push([
10
+ n ? i(n) : "0x",
11
+ a,
12
+ e ? i(e) : "0x",
13
+ ...c({}, s)
14
+ ]);
15
+ }
16
+ return t;
10
17
  }
11
18
  export {
12
- h as isAddress,
13
- r as isAddressCache
19
+ f as serializeAuthorizationList
14
20
  };
@@ -1,11 +1,48 @@
1
- function n(e) {
2
- return {
3
- formatters: void 0,
4
- fees: void 0,
5
- serializers: void 0,
6
- ...e
7
- };
1
+ import { IntegerOutOfRangeError as x } from "./index49.js";
2
+ import { pad as s } from "./index35.js";
3
+ import { assertSize as c } from "./index43.js";
4
+ const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
5
+ function B(n, e = {}) {
6
+ return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
7
+ }
8
+ function z(n, e = {}) {
9
+ const t = `0x${Number(n)}`;
10
+ return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
11
+ }
12
+ function m(n, e = {}) {
13
+ let t = "";
14
+ for (let i = 0; i < n.length; i++)
15
+ t += b[n[i]];
16
+ const r = `0x${t}`;
17
+ return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
18
+ }
19
+ function y(n, e = {}) {
20
+ const { signed: t, size: r } = e, i = BigInt(n);
21
+ let o;
22
+ r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
23
+ const g = typeof o == "bigint" && t ? -o - 1n : 0;
24
+ if (o && i > o || i < g) {
25
+ const f = typeof n == "bigint" ? "n" : "";
26
+ throw new x({
27
+ max: o ? `${o}${f}` : void 0,
28
+ min: `${g}${f}`,
29
+ signed: t,
30
+ size: r,
31
+ value: `${n}${f}`
32
+ });
33
+ }
34
+ const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
35
+ return r ? s(u, { size: r }) : u;
36
+ }
37
+ const d = /* @__PURE__ */ new TextEncoder();
38
+ function $(n, e = {}) {
39
+ const t = d.encode(n);
40
+ return m(t, e);
8
41
  }
9
42
  export {
10
- n as defineChain
43
+ z as boolToHex,
44
+ m as bytesToHex,
45
+ y as numberToHex,
46
+ $ as stringToHex,
47
+ B as toHex
11
48
  };
@@ -1,20 +1,16 @@
1
- import { toHex as i } from "./index29.js";
2
- import { toYParitySignatureArray as c } from "./index15.js";
3
- function f(r) {
4
- if (!r || r.length === 0)
5
- return [];
6
- const t = [];
7
- for (const o of r) {
8
- const { chainId: n, nonce: e, ...s } = o, a = o.address;
9
- t.push([
10
- n ? i(n) : "0x",
11
- a,
12
- e ? i(e) : "0x",
13
- ...c({}, s)
14
- ]);
15
- }
16
- return t;
1
+ import { stringToBytes as p } from "./index29.js";
2
+ import { keccak256 as f } from "./index30.js";
3
+ import { LruMap as m } from "./index31.js";
4
+ const r = /* @__PURE__ */ new m(8192);
5
+ function a(s, o) {
6
+ if (r.has(`${s}.${o}`))
7
+ return r.get(`${s}.${o}`);
8
+ const c = s.substring(2).toLowerCase(), n = f(p(c)), e = c.split("");
9
+ for (let t = 0; t < 40; t += 2)
10
+ n[t >> 1] >> 4 >= 8 && e[t] && (e[t] = e[t].toUpperCase()), (n[t >> 1] & 15) >= 8 && e[t + 1] && (e[t + 1] = e[t + 1].toUpperCase());
11
+ const i = `0x${e.join("")}`;
12
+ return r.set(`${s}.${o}`, i), i;
17
13
  }
18
14
  export {
19
- f as serializeAuthorizationList
15
+ a as checksumAddress
20
16
  };
@@ -1,48 +1,58 @@
1
- import { IntegerOutOfRangeError as x } from "./index50.js";
2
- import { pad as s } from "./index36.js";
3
- import { assertSize as c } from "./index44.js";
4
- const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
5
- function B(n, e = {}) {
6
- return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
1
+ import { BaseError as g } from "./index47.js";
2
+ import { isHex as x } from "./index34.js";
3
+ import { pad as s } from "./index35.js";
4
+ import { assertSize as u } from "./index43.js";
5
+ import { numberToHex as h } from "./index27.js";
6
+ const A = /* @__PURE__ */ new TextEncoder();
7
+ function F(e, n = {}) {
8
+ return typeof e == "number" || typeof e == "bigint" ? T(e, n) : typeof e == "boolean" ? B(e, n) : x(e) ? y(e, n) : l(e, n);
7
9
  }
8
- function z(n, e = {}) {
9
- const t = `0x${Number(n)}`;
10
- return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
10
+ function B(e, n = {}) {
11
+ const r = new Uint8Array(1);
12
+ return r[0] = Number(e), typeof n.size == "number" ? (u(r, { size: n.size }), s(r, { size: n.size })) : r;
11
13
  }
12
- function m(n, e = {}) {
13
- let t = "";
14
- for (let i = 0; i < n.length; i++)
15
- t += b[n[i]];
16
- const r = `0x${t}`;
17
- return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
14
+ const t = {
15
+ zero: 48,
16
+ nine: 57,
17
+ A: 65,
18
+ F: 70,
19
+ a: 97,
20
+ f: 102
21
+ };
22
+ function m(e) {
23
+ if (e >= t.zero && e <= t.nine)
24
+ return e - t.zero;
25
+ if (e >= t.A && e <= t.F)
26
+ return e - (t.A - 10);
27
+ if (e >= t.a && e <= t.f)
28
+ return e - (t.a - 10);
18
29
  }
19
- function y(n, e = {}) {
20
- const { signed: t, size: r } = e, i = BigInt(n);
21
- let o;
22
- r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
23
- const g = typeof o == "bigint" && t ? -o - 1n : 0;
24
- if (o && i > o || i < g) {
25
- const f = typeof n == "bigint" ? "n" : "";
26
- throw new x({
27
- max: o ? `${o}${f}` : void 0,
28
- min: `${g}${f}`,
29
- signed: t,
30
- size: r,
31
- value: `${n}${f}`
32
- });
30
+ function y(e, n = {}) {
31
+ let r = e;
32
+ n.size && (u(r, { size: n.size }), r = s(r, { dir: "right", size: n.size }));
33
+ let i = r.slice(2);
34
+ i.length % 2 && (i = `0${i}`);
35
+ const z = i.length / 2, d = new Uint8Array(z);
36
+ for (let f = 0, o = 0; f < z; f++) {
37
+ const b = m(i.charCodeAt(o++)), c = m(i.charCodeAt(o++));
38
+ if (b === void 0 || c === void 0)
39
+ throw new g(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
40
+ d[f] = b * 16 + c;
33
41
  }
34
- const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
35
- return r ? s(u, { size: r }) : u;
42
+ return d;
43
+ }
44
+ function T(e, n) {
45
+ const r = h(e, n);
46
+ return y(r);
36
47
  }
37
- const d = /* @__PURE__ */ new TextEncoder();
38
- function $(n, e = {}) {
39
- const t = d.encode(n);
40
- return m(t, e);
48
+ function l(e, n = {}) {
49
+ const r = A.encode(e);
50
+ return typeof n.size == "number" ? (u(r, { size: n.size }), s(r, { dir: "right", size: n.size })) : r;
41
51
  }
42
52
  export {
43
- z as boolToHex,
44
- m as bytesToHex,
45
- y as numberToHex,
46
- $ as stringToHex,
47
- B as toHex
53
+ B as boolToBytes,
54
+ y as hexToBytes,
55
+ T as numberToBytes,
56
+ l as stringToBytes,
57
+ F as toBytes
48
58
  };
@@ -1,13 +1,13 @@
1
1
  import { Provider as h } from "ox";
2
2
  import { http as p } from "viem";
3
3
  import { create as l } from "zustand";
4
- import { subscribeWithSelector as f, persist as g } from "./index17.js";
4
+ import { subscribeWithSelector as f, persist as g } from "./index21.js";
5
5
  import { validateRequest as w, EIP1193ProviderError as I, STANDARD_ERROR_CODES as S } from "./index4.js";
6
- import { EventEmitter as b } from "./index18.js";
6
+ import { EventEmitter as b } from "./index22.js";
7
7
  import "@coinbase/cdp-api-client";
8
- import { handleChainId as A, handleSignTypedData as C, handleEthSign as _, handleSwitchEthereumChain as v, handleDisconnect as D, handleSendTransaction as E, handlePersonalSign as P, handleRequestAccounts as R, handleAccounts as y } from "./index19.js";
8
+ import { handleChainId as A, handleSignTypedData as C, handleEthSign as _, handleSwitchEthereumChain as v, handleDisconnect as D, handleSendTransaction as E, handlePersonalSign as P, handleRequestAccounts as R, handleAccounts as y } from "./index23.js";
9
9
  import { onAuthStateChange as T } from "./index2.js";
10
- import { baseSepolia as d } from "./index20.js";
10
+ import { baseSepolia as d } from "./index24.js";
11
11
  function q(r, e, a) {
12
12
  e.subscribe(
13
13
  (t) => t.chainId,
@@ -1,16 +1,9 @@
1
- import { stringToBytes as p } from "./index31.js";
2
- import { keccak256 as f } from "./index32.js";
3
- import { LruMap as m } from "./index33.js";
4
- const r = /* @__PURE__ */ new m(8192);
5
- function a(s, o) {
6
- if (r.has(`${s}.${o}`))
7
- return r.get(`${s}.${o}`);
8
- const c = s.substring(2).toLowerCase(), n = f(p(c)), e = c.split("");
9
- for (let t = 0; t < 40; t += 2)
10
- n[t >> 1] >> 4 >= 8 && e[t] && (e[t] = e[t].toUpperCase()), (n[t >> 1] & 15) >= 8 && e[t + 1] && (e[t + 1] = e[t + 1].toUpperCase());
11
- const i = `0x${e.join("")}`;
12
- return r.set(`${s}.${o}`, i), i;
1
+ import { keccak_256 as o } from "./index50.js";
2
+ import { isHex as r } from "./index34.js";
3
+ import { toBytes as c } from "./index29.js";
4
+ function k(t, e) {
5
+ return o(r(t, { strict: !1 }) ? c(t) : t);
13
6
  }
14
7
  export {
15
- a as checksumAddress
8
+ k as keccak256
16
9
  };
@@ -1,58 +1,24 @@
1
- import { BaseError as g } from "./index48.js";
2
- import { isHex as x } from "./index35.js";
3
- import { pad as s } from "./index36.js";
4
- import { assertSize as u } from "./index44.js";
5
- import { numberToHex as h } from "./index29.js";
6
- const A = /* @__PURE__ */ new TextEncoder();
7
- function F(e, n = {}) {
8
- return typeof e == "number" || typeof e == "bigint" ? T(e, n) : typeof e == "boolean" ? B(e, n) : x(e) ? y(e, n) : l(e, n);
9
- }
10
- function B(e, n = {}) {
11
- const r = new Uint8Array(1);
12
- return r[0] = Number(e), typeof n.size == "number" ? (u(r, { size: n.size }), s(r, { size: n.size })) : r;
13
- }
14
- const t = {
15
- zero: 48,
16
- nine: 57,
17
- A: 65,
18
- F: 70,
19
- a: 97,
20
- f: 102
21
- };
22
- function m(e) {
23
- if (e >= t.zero && e <= t.nine)
24
- return e - t.zero;
25
- if (e >= t.A && e <= t.F)
26
- return e - (t.A - 10);
27
- if (e >= t.a && e <= t.f)
28
- return e - (t.a - 10);
29
- }
30
- function y(e, n = {}) {
31
- let r = e;
32
- n.size && (u(r, { size: n.size }), r = s(r, { dir: "right", size: n.size }));
33
- let i = r.slice(2);
34
- i.length % 2 && (i = `0${i}`);
35
- const z = i.length / 2, d = new Uint8Array(z);
36
- for (let f = 0, o = 0; f < z; f++) {
37
- const b = m(i.charCodeAt(o++)), c = m(i.charCodeAt(o++));
38
- if (b === void 0 || c === void 0)
39
- throw new g(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
40
- d[f] = b * 16 + c;
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;
41
20
  }
42
- return d;
43
- }
44
- function T(e, n) {
45
- const r = h(e, n);
46
- return y(r);
47
- }
48
- function l(e, n = {}) {
49
- const r = A.encode(e);
50
- return typeof n.size == "number" ? (u(r, { size: n.size }), s(r, { dir: "right", size: n.size })) : r;
51
21
  }
52
22
  export {
53
- B as boolToBytes,
54
- y as hexToBytes,
55
- T as numberToBytes,
56
- l as stringToBytes,
57
- F as toBytes
23
+ r as LruMap
58
24
  };
@@ -1,9 +1,14 @@
1
- import { keccak_256 as o } from "./index51.js";
2
- import { isHex as r } from "./index35.js";
3
- import { toBytes as c } from "./index31.js";
4
- function k(t, e) {
5
- return o(r(t, { strict: !1 }) ? c(t) : t);
1
+ import { LruMap as u } from "./index31.js";
2
+ import { checksumAddress as c } from "./index28.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;
6
10
  }
7
11
  export {
8
- k as keccak256
12
+ h as isAddress,
13
+ r as isAddressCache
9
14
  };
@@ -1,24 +1,6 @@
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
- }
1
+ function n(e) {
2
+ return `0x${e.reduce((c, r) => c + r.replace("0x", ""), "")}`;
21
3
  }
22
4
  export {
23
- r as LruMap
5
+ n as concatHex
24
6
  };
@@ -1,6 +1,6 @@
1
- function n(e) {
2
- return `0x${e.reduce((c, r) => c + r.replace("0x", ""), "")}`;
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");
3
3
  }
4
4
  export {
5
- n as concatHex
5
+ e as isHex
6
6
  };