@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,19 +1,43 @@
1
- async function n() {
2
- const e = await window.crypto.subtle.generateKey(
3
- {
4
- name: "ECDSA",
5
- namedCurve: "P-256"
6
- // secp256r1
7
- },
8
- !1,
9
- // Do not allow key export.
10
- ["sign", "verify"]
11
- // Key usages
12
- ), r = await window.crypto.subtle.exportKey("spki", e.publicKey), t = new Uint8Array(r), a = btoa(
13
- Array.from(t).map((i) => String.fromCharCode(i)).join("")
14
- );
15
- return { privateKey: e.privateKey, publicKeyBase64: a };
1
+ import { CompactSign as i } from "./index71.js";
2
+ import { JWTInvalid as r } from "./index72.js";
3
+ import { JWTClaimsBuilder as n } from "./index73.js";
4
+ class d {
5
+ #s;
6
+ #t;
7
+ constructor(t = {}) {
8
+ this.#t = new n(t);
9
+ }
10
+ setIssuer(t) {
11
+ return this.#t.iss = t, this;
12
+ }
13
+ setSubject(t) {
14
+ return this.#t.sub = t, this;
15
+ }
16
+ setAudience(t) {
17
+ return this.#t.aud = t, this;
18
+ }
19
+ setJti(t) {
20
+ return this.#t.jti = t, this;
21
+ }
22
+ setNotBefore(t) {
23
+ return this.#t.nbf = t, this;
24
+ }
25
+ setExpirationTime(t) {
26
+ return this.#t.exp = t, this;
27
+ }
28
+ setIssuedAt(t) {
29
+ return this.#t.iat = t, this;
30
+ }
31
+ setProtectedHeader(t) {
32
+ return this.#s = t, this;
33
+ }
34
+ async sign(t, e) {
35
+ const s = new i(this.#t.data());
36
+ if (s.setProtectedHeader(this.#s), Array.isArray(this.#s?.crit) && this.#s.crit.includes("b64") && this.#s.b64 === !1)
37
+ throw new r("JWTs MUST NOT use unencoded payload");
38
+ return s.sign(t, e);
39
+ }
16
40
  }
17
41
  export {
18
- n as createKeyPair
42
+ d as SignJWT
19
43
  };
@@ -1,7 +1,19 @@
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
+ async function n() {
2
+ const e = await window.crypto.subtle.generateKey(
3
+ {
4
+ name: "ECDSA",
5
+ namedCurve: "P-256"
6
+ // secp256r1
7
+ },
8
+ !1,
9
+ // Do not allow key export.
10
+ ["sign", "verify"]
11
+ // Key usages
12
+ ), r = await window.crypto.subtle.exportKey("spki", e.publicKey), t = new Uint8Array(r), a = btoa(
13
+ Array.from(t).map((i) => String.fromCharCode(i)).join("")
14
+ );
15
+ return { privateKey: e.privateKey, publicKeyBase64: a };
4
16
  }
5
17
  export {
6
- t as generateRandomId
18
+ n as createKeyPair
7
19
  };
@@ -1,7 +1,7 @@
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
+ 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("");
4
+ }
5
5
  export {
6
- h as hash
6
+ t as generateRandomId
7
7
  };
@@ -1,11 +1,7 @@
1
- function n(e) {
2
- return {
3
- formatters: void 0,
4
- fees: void 0,
5
- serializers: void 0,
6
- ...e
7
- };
8
- }
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
+ };
9
5
  export {
10
- n as defineChain
6
+ h as hash
11
7
  };
@@ -1,20 +1,11 @@
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;
1
+ function n(e) {
2
+ return {
3
+ formatters: void 0,
4
+ fees: void 0,
5
+ serializers: void 0,
6
+ ...e
7
+ };
17
8
  }
18
9
  export {
19
- f as serializeAuthorizationList
10
+ n as defineChain
20
11
  };
@@ -1,48 +1,20 @@
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
- });
1
+ import { toHex as i } from "./index28.js";
2
+ import { toYParitySignatureArray as c } from "./index16.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
+ ]);
33
15
  }
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);
16
+ return t;
41
17
  }
42
18
  export {
43
- z as boolToHex,
44
- m as bytesToHex,
45
- y as numberToHex,
46
- $ as stringToHex,
47
- B as toHex
19
+ f as serializeAuthorizationList
48
20
  };
@@ -1,16 +1,48 @@
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;
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);
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);
13
41
  }
14
42
  export {
15
- a as checksumAddress
43
+ z as boolToHex,
44
+ m as bytesToHex,
45
+ y as numberToHex,
46
+ $ as stringToHex,
47
+ B as toHex
16
48
  };
@@ -1,58 +1,16 @@
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);
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;
41
- }
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;
1
+ import { stringToBytes as p } from "./index30.js";
2
+ import { keccak256 as f } from "./index31.js";
3
+ import { LruMap as m } from "./index32.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;
51
13
  }
52
14
  export {
53
- B as boolToBytes,
54
- y as hexToBytes,
55
- T as numberToBytes,
56
- l as stringToBytes,
57
- F as toBytes
15
+ a as checksumAddress
58
16
  };
@@ -1,93 +1,99 @@
1
- import { Provider as h } from "ox";
1
+ import { Provider as d } from "ox";
2
2
  import { http as p } from "viem";
3
- import { create as l } from "zustand";
4
- import { subscribeWithSelector as f, persist as g } from "./index17.js";
5
- import { validateRequest as w, EIP1193ProviderError as I, STANDARD_ERROR_CODES as S } from "./index4.js";
6
- import { EventEmitter as b } from "./index18.js";
3
+ import { create as m } from "zustand";
4
+ import { subscribeWithSelector as f, persist as g } from "./index18.js";
5
+ import { validateRequest as w, EIP1193ProviderError as C, STANDARD_ERROR_CODES as S } from "./index4.js";
6
+ import { EventEmitter as b } from "./index19.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";
9
- import { onAuthStateChange as T } from "./index2.js";
10
- import { baseSepolia as d } from "./index20.js";
11
- function q(r, e, a) {
12
- e.subscribe(
13
- (t) => t.chainId,
14
- (t, n) => {
15
- t !== n && r.emit("chainChanged", t);
8
+ import { handleGetCapabilities as I, handleGetCallsStatus as _, handleSendCalls as A, handleChainId as v, handleSignTypedData as D, handleEthSign as E, handleSwitchEthereumChain as P, handleDisconnect as R, handleSendTransaction as y, handlePersonalSign as T, handleRequestAccounts as q, handleAccounts as G } from "./index20.js";
9
+ import { onAuthStateChange as L } from "./index2.js";
10
+ import { baseSepolia as h } from "./index21.js";
11
+ function M(a, n, r) {
12
+ n.subscribe(
13
+ (e) => e.chainId,
14
+ (e, t) => {
15
+ e !== t && a.emit("chainChanged", e);
16
16
  }
17
- ), e.subscribe(
18
- (t) => t.user,
19
- (t, n) => {
20
- if (!(t?.userId === n?.userId && t?.evmAccounts?.length === n?.evmAccounts?.length)) {
21
- if (!t && n) {
22
- r.emit("disconnect", new h.DisconnectedError());
17
+ ), n.subscribe(
18
+ (e) => e.user,
19
+ (e, t) => {
20
+ if (!(e?.userId === t?.userId && e?.evmAccounts?.length === t?.evmAccounts?.length)) {
21
+ if (!e && t) {
22
+ a.emit("disconnect", new d.DisconnectedError());
23
23
  return;
24
24
  }
25
- if (t && t.evmAccounts?.length && (!n || n.evmAccounts?.length === 0)) {
26
- const m = e.getState().chainId;
27
- r.emit("connect", { chainId: m });
25
+ if (e && e.evmAccounts?.length && (!t || t.evmAccounts?.length === 0)) {
26
+ const u = n.getState().chainId;
27
+ a.emit("connect", { chainId: u });
28
28
  return;
29
29
  }
30
30
  }
31
31
  }
32
32
  );
33
- const { chainId: i, setChainId: o } = e.getState(), c = i || a.chains[0].id;
34
- return i || o(c), h.from({
35
- request: async (t) => {
36
- w(t, a);
37
- const n = t;
38
- switch (n.method) {
33
+ const { chainId: o, setChainId: s } = n.getState(), c = o || r.chains[0].id;
34
+ return o || s(c), d.from({
35
+ request: async (e) => {
36
+ w(e, r);
37
+ const t = e;
38
+ switch (t.method) {
39
39
  case "eth_accounts":
40
- return y();
40
+ return G();
41
41
  case "eth_requestAccounts":
42
- return R(r, e);
42
+ return q(a, n);
43
43
  case "personal_sign":
44
- return P(n.params);
44
+ return T(t.params);
45
45
  case "eth_sendTransaction":
46
- return E(n.params, e, a.transports);
46
+ return y(t.params, n, r.transports);
47
47
  case "wallet_disconnect":
48
- return D();
48
+ return R();
49
49
  case "wallet_switchEthereumChain":
50
- return v(n.params, e);
50
+ return P(t.params, n);
51
51
  case "eth_sign":
52
- return _(n.params);
52
+ return E(t.params);
53
53
  case "eth_signTypedData_v4":
54
- return C(n.params);
54
+ return D(t.params);
55
55
  case "eth_chainId":
56
- return A(e);
56
+ return v(n);
57
+ case "wallet_sendCalls":
58
+ return A(t.params, n);
59
+ case "wallet_getCallsStatus":
60
+ return _(t.params, n);
61
+ case "wallet_getCapabilities":
62
+ return I();
57
63
  // Catch-all for any unknown method
58
64
  default:
59
- throw new I(
65
+ throw new C(
60
66
  S.provider.unsupportedMethod,
61
- `Method ${n.method} not supported`
67
+ `Method ${t.method} not supported`
62
68
  );
63
69
  }
64
70
  },
65
71
  // Event emitter methods - only the ones required by the interface
66
- on: r.on.bind(r),
67
- removeListener: r.removeListener.bind(r)
72
+ on: a.on.bind(a),
73
+ removeListener: a.removeListener.bind(a)
68
74
  });
69
75
  }
70
- const u = {
71
- chains: [d],
76
+ const l = {
77
+ chains: [h],
72
78
  transports: {
73
- [d.id]: p()
79
+ [h.id]: p()
74
80
  }
75
81
  };
76
- function B(r) {
77
- if (r?.chains.length === 0)
82
+ function H(a) {
83
+ if (a?.chains.length === 0)
78
84
  throw new Error("At least one chain must be configured");
79
- const e = r?.chains ?? u.chains, a = r?.transports ?? u.transports;
80
- if (e.length === 0)
85
+ const n = a?.chains ?? l.chains, r = a?.transports ?? l.transports;
86
+ if (n.length === 0)
81
87
  throw new Error("No chains found in configuration");
82
- const i = new b(), o = l()(
88
+ const o = new b(), s = m()(
83
89
  f(
84
90
  g(
85
- (s) => ({
86
- chainId: e[0].id,
87
- setChainId: (t) => s({ chainId: t }),
88
- chains: e,
91
+ (i) => ({
92
+ chainId: n[0].id,
93
+ setChainId: (e) => i({ chainId: e }),
94
+ chains: n,
89
95
  user: null,
90
- setUser: (t) => s({ user: t })
96
+ setUser: (e) => i({ user: e })
91
97
  }),
92
98
  {
93
99
  name: "cdp-provider-store"
@@ -96,15 +102,15 @@ function B(r) {
96
102
  )
97
103
  )
98
104
  );
99
- return o.persist.rehydrate(), T((s) => {
100
- o.getState().setUser(s);
105
+ return s.persist.rehydrate(), L((i) => {
106
+ s.getState().setUser(i);
101
107
  }), {
102
- provider: q(i, o, {
103
- chains: e,
104
- transports: a
108
+ provider: M(o, s, {
109
+ chains: n,
110
+ transports: r
105
111
  })
106
112
  };
107
113
  }
108
114
  export {
109
- B as createCDPEmbeddedWallet
115
+ H as createCDPEmbeddedWallet
110
116
  };
@@ -1,9 +1,58 @@
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);
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 "./index28.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;
41
+ }
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;
6
51
  }
7
52
  export {
8
- k as keccak256
53
+ B as boolToBytes,
54
+ y as hexToBytes,
55
+ T as numberToBytes,
56
+ l as stringToBytes,
57
+ F as toBytes
9
58
  };
@@ -1,24 +1,9 @@
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
+ import { keccak_256 as o } from "./index51.js";
2
+ import { isHex as r } from "./index35.js";
3
+ import { toBytes as c } from "./index30.js";
4
+ function k(t, e) {
5
+ return o(r(t, { strict: !1 }) ? c(t) : t);
21
6
  }
22
7
  export {
23
- r as LruMap
8
+ k as keccak256
24
9
  };
@@ -1,14 +1,24 @@
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;
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
+ }
10
21
  }
11
22
  export {
12
- h as isAddress,
13
- r as isAddressCache
23
+ r as LruMap
14
24
  };