@coinbase/cdp-core 0.0.58 → 0.0.60

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 (197) hide show
  1. package/dist/esm/index.native.js +55 -54
  2. package/dist/esm/index.native103.js +1 -1
  3. package/dist/esm/index.native115.js +1 -1
  4. package/dist/esm/index.native127.js +1 -1
  5. package/dist/esm/index.native141.js +46 -3
  6. package/dist/esm/index.native142.js +3 -46
  7. package/dist/esm/index.native16.js +8 -0
  8. package/dist/esm/index.native164.js +1 -1
  9. package/dist/esm/index.native29.js +10 -2
  10. package/dist/esm/index.native47.js +1 -1
  11. package/dist/esm/index.native7.js +52 -51
  12. package/dist/esm/index.web.js +59 -58
  13. package/dist/esm/index.web100.js +2 -4
  14. package/dist/esm/index.web101.js +44 -19
  15. package/dist/esm/index.web102.js +13 -8
  16. package/dist/esm/index.web103.js +2 -8
  17. package/dist/esm/index.web104.js +4 -71
  18. package/dist/esm/index.web105.js +12 -12
  19. package/dist/esm/index.web106.js +7 -3
  20. package/dist/esm/index.web107.js +3 -4
  21. package/dist/esm/index.web108.js +19 -4
  22. package/dist/esm/index.web109.js +8 -4
  23. package/dist/esm/index.web110.js +7 -19
  24. package/dist/esm/index.web111.js +66 -47
  25. package/dist/esm/index.web112.js +18 -17
  26. package/dist/esm/index.web113.js +3 -20
  27. package/dist/esm/index.web114.js +4 -8
  28. package/dist/esm/index.web115.js +4 -30
  29. package/dist/esm/index.web116.js +4 -7
  30. package/dist/esm/index.web117.js +10 -11
  31. package/dist/esm/index.web118.js +52 -4
  32. package/dist/esm/index.web119.js +17 -54
  33. package/dist/esm/index.web120.js +20 -10
  34. package/dist/esm/index.web121.js +9 -2
  35. package/dist/esm/index.web122.js +30 -44
  36. package/dist/esm/index.web123.js +7 -13
  37. package/dist/esm/index.web124.js +21 -2
  38. package/dist/esm/index.web126.js +2 -2
  39. package/dist/esm/index.web131.js +32 -6
  40. package/dist/esm/index.web132.js +6 -32
  41. package/dist/esm/index.web137.js +3 -46
  42. package/dist/esm/index.web138.js +20 -3
  43. package/dist/esm/index.web139.js +10 -21
  44. package/dist/esm/index.web140.js +19 -9
  45. package/dist/esm/index.web141.js +89 -15
  46. package/dist/esm/index.web142.js +19 -92
  47. package/dist/esm/index.web143.js +115 -18
  48. package/dist/esm/index.web144.js +44 -115
  49. package/dist/esm/index.web145.js +7 -38
  50. package/dist/esm/index.web147.js +375 -67
  51. package/dist/esm/index.web148.js +832 -34
  52. package/dist/esm/index.web149.js +38 -20
  53. package/dist/esm/index.web15.js +8 -0
  54. package/dist/esm/index.web150.js +2 -8
  55. package/dist/esm/index.web151.js +70 -2
  56. package/dist/esm/index.web152.js +30 -373
  57. package/dist/esm/index.web153.js +20 -832
  58. package/dist/esm/index.web155.js +17 -14
  59. package/dist/esm/index.web156.js +28 -18
  60. package/dist/esm/index.web157.js +6 -26
  61. package/dist/esm/index.web158.js +9 -6
  62. package/dist/esm/index.web159.js +13 -11
  63. package/dist/esm/index.web160.js +8 -11
  64. package/dist/esm/index.web161.js +14 -7
  65. package/dist/esm/index.web162.js +80 -16
  66. package/dist/esm/index.web163.js +14 -80
  67. package/dist/esm/index.web164.js +2 -2
  68. package/dist/esm/index.web165.js +2 -2
  69. package/dist/esm/index.web166.js +2 -2
  70. package/dist/esm/index.web23.js +1 -1
  71. package/dist/esm/index.web27.js +10 -2
  72. package/dist/esm/index.web40.js +1 -1
  73. package/dist/esm/index.web41.js +3 -3
  74. package/dist/esm/index.web46.js +377 -2
  75. package/dist/esm/index.web47.js +2 -379
  76. package/dist/esm/index.web48.js +65 -28
  77. package/dist/esm/index.web49.js +364 -28
  78. package/dist/esm/index.web50.js +4 -2
  79. package/dist/esm/index.web51.js +28 -65
  80. package/dist/esm/index.web52.js +28 -364
  81. package/dist/esm/index.web53.js +1 -1
  82. package/dist/esm/index.web55.js +4 -4
  83. package/dist/esm/index.web6.js +52 -51
  84. package/dist/esm/index.web73.js +1 -1
  85. package/dist/esm/index.web91.js +1 -1
  86. package/dist/esm/index.web92.js +1 -1
  87. package/dist/esm/index.web97.js +4 -4
  88. package/dist/esm/index.web98.js +53 -17
  89. package/dist/esm/index.web99.js +10 -7
  90. package/dist/native/index.native.js +55 -54
  91. package/dist/native/index.native103.js +1 -1
  92. package/dist/native/index.native115.js +1 -1
  93. package/dist/native/index.native127.js +1 -1
  94. package/dist/native/index.native141.js +46 -3
  95. package/dist/native/index.native142.js +3 -46
  96. package/dist/native/index.native16.js +8 -0
  97. package/dist/native/index.native164.js +1 -1
  98. package/dist/native/index.native29.js +10 -2
  99. package/dist/native/index.native47.js +1 -1
  100. package/dist/native/index.native7.js +52 -51
  101. package/dist/native-types/auth/authManager.d.ts +1 -0
  102. package/dist/native-types/auth/types.d.ts +1 -0
  103. package/dist/native-types/core.d.ts +1 -0
  104. package/dist/native-types/mocks/mockAuthManager.d.ts +1 -0
  105. package/dist/native-types/types.d.ts +4 -0
  106. package/dist/native-types/version.d.ts +1 -1
  107. package/dist/types/auth/authManager.d.ts +1 -0
  108. package/dist/types/auth/types.d.ts +1 -0
  109. package/dist/types/core.d.ts +1 -0
  110. package/dist/types/mocks/mockAuthManager.d.ts +1 -0
  111. package/dist/types/types.d.ts +4 -0
  112. package/dist/types/version.d.ts +1 -1
  113. package/dist/web/index.web.js +59 -58
  114. package/dist/web/index.web100.js +2 -4
  115. package/dist/web/index.web101.js +44 -19
  116. package/dist/web/index.web102.js +13 -8
  117. package/dist/web/index.web103.js +2 -8
  118. package/dist/web/index.web104.js +4 -71
  119. package/dist/web/index.web105.js +12 -12
  120. package/dist/web/index.web106.js +7 -3
  121. package/dist/web/index.web107.js +3 -4
  122. package/dist/web/index.web108.js +19 -4
  123. package/dist/web/index.web109.js +8 -4
  124. package/dist/web/index.web110.js +7 -19
  125. package/dist/web/index.web111.js +66 -47
  126. package/dist/web/index.web112.js +18 -17
  127. package/dist/web/index.web113.js +3 -20
  128. package/dist/web/index.web114.js +4 -8
  129. package/dist/web/index.web115.js +4 -30
  130. package/dist/web/index.web116.js +4 -7
  131. package/dist/web/index.web117.js +10 -11
  132. package/dist/web/index.web118.js +52 -4
  133. package/dist/web/index.web119.js +17 -54
  134. package/dist/web/index.web120.js +20 -10
  135. package/dist/web/index.web121.js +9 -2
  136. package/dist/web/index.web122.js +30 -44
  137. package/dist/web/index.web123.js +7 -13
  138. package/dist/web/index.web124.js +21 -2
  139. package/dist/web/index.web126.js +2 -2
  140. package/dist/web/index.web131.js +32 -6
  141. package/dist/web/index.web132.js +6 -32
  142. package/dist/web/index.web137.js +3 -46
  143. package/dist/web/index.web138.js +20 -3
  144. package/dist/web/index.web139.js +10 -21
  145. package/dist/web/index.web140.js +19 -9
  146. package/dist/web/index.web141.js +89 -15
  147. package/dist/web/index.web142.js +19 -92
  148. package/dist/web/index.web143.js +115 -18
  149. package/dist/web/index.web144.js +44 -115
  150. package/dist/web/index.web145.js +7 -38
  151. package/dist/web/index.web147.js +375 -67
  152. package/dist/web/index.web148.js +832 -34
  153. package/dist/web/index.web149.js +38 -20
  154. package/dist/web/index.web15.js +8 -0
  155. package/dist/web/index.web150.js +2 -8
  156. package/dist/web/index.web151.js +70 -2
  157. package/dist/web/index.web152.js +30 -373
  158. package/dist/web/index.web153.js +20 -832
  159. package/dist/web/index.web155.js +17 -14
  160. package/dist/web/index.web156.js +28 -18
  161. package/dist/web/index.web157.js +6 -26
  162. package/dist/web/index.web158.js +9 -6
  163. package/dist/web/index.web159.js +13 -11
  164. package/dist/web/index.web160.js +8 -11
  165. package/dist/web/index.web161.js +14 -7
  166. package/dist/web/index.web162.js +80 -16
  167. package/dist/web/index.web163.js +14 -80
  168. package/dist/web/index.web164.js +2 -2
  169. package/dist/web/index.web165.js +2 -2
  170. package/dist/web/index.web166.js +2 -2
  171. package/dist/web/index.web23.js +1 -1
  172. package/dist/web/index.web27.js +10 -2
  173. package/dist/web/index.web40.js +1 -1
  174. package/dist/web/index.web41.js +3 -3
  175. package/dist/web/index.web46.js +377 -2
  176. package/dist/web/index.web47.js +2 -379
  177. package/dist/web/index.web48.js +65 -28
  178. package/dist/web/index.web49.js +364 -28
  179. package/dist/web/index.web50.js +4 -2
  180. package/dist/web/index.web51.js +28 -65
  181. package/dist/web/index.web52.js +28 -364
  182. package/dist/web/index.web53.js +1 -1
  183. package/dist/web/index.web55.js +4 -4
  184. package/dist/web/index.web6.js +52 -51
  185. package/dist/web/index.web73.js +1 -1
  186. package/dist/web/index.web91.js +1 -1
  187. package/dist/web/index.web92.js +1 -1
  188. package/dist/web/index.web97.js +4 -4
  189. package/dist/web/index.web98.js +53 -17
  190. package/dist/web/index.web99.js +10 -7
  191. package/dist/web-types/auth/authManager.d.ts +1 -0
  192. package/dist/web-types/auth/types.d.ts +1 -0
  193. package/dist/web-types/core.d.ts +1 -0
  194. package/dist/web-types/mocks/mockAuthManager.d.ts +1 -0
  195. package/dist/web-types/types.d.ts +4 -0
  196. package/dist/web-types/version.d.ts +1 -1
  197. package/package.json +2 -2
@@ -1,11 +1,7 @@
1
- import { fromNumber as c } from "./index.web137.js";
2
- import { validateUserConnected as o } from "./index.web19.js";
3
- async function m(t, e) {
4
- const n = await o();
5
- return t.emit("connect", {
6
- chainId: c(e.getState().chainId)
7
- }), n.evmSmartAccounts || [];
1
+ import { getCurrentUser as t, signOut as n } from "./index.web6.js";
2
+ async function i() {
3
+ await t() && await n();
8
4
  }
9
5
  export {
10
- m as handleRequestAccounts
6
+ i as handleDisconnect
11
7
  };
@@ -1,33 +1,7 @@
1
- import { sendUserOperation as c } from "./index.web6.js";
2
- import { isChainIdSupportedForCDPUserOps as u, userOperationChainIdToNameMapping as p } from "./index.web30.js";
3
- import { validateUserHasEvmSmartAccount as d, RPCRequestError as o, STANDARD_ERROR_CODES as s } from "./index.web19.js";
4
- async function R(r, t) {
5
- const [{ calls: n }] = r, i = (await d()).evmSmartAccounts[0], a = t.getState().chainId;
6
- if (!u(a))
7
- throw new o(
8
- s.rpc.invalidParams,
9
- "Chain ID is not supported for user operations"
10
- );
11
- try {
12
- return (await c({
13
- evmSmartAccount: i,
14
- calls: m(n),
15
- network: p[a]
16
- })).userOperationHash;
17
- } catch (e) {
18
- throw new o(
19
- s.rpc.transactionRejected,
20
- e instanceof Error ? e.message : "User operation failed"
21
- );
22
- }
23
- }
24
- function m(r) {
25
- return r.map((t) => ({
26
- to: t.to,
27
- data: t.data,
28
- value: t.value ? BigInt(t.value) : void 0
29
- }));
1
+ function a(t, e) {
2
+ const n = Number.parseInt(t[0].chainId, 16);
3
+ e.getState().setChainId(n);
30
4
  }
31
5
  export {
32
- R as handleSendCalls
6
+ a as handleSwitchEthereumChain
33
7
  };
@@ -1,10 +1,7 @@
1
- import { EIP1193ProviderError as r, STANDARD_ERROR_CODES as t } from "./index.web19.js";
2
- async function a(n, o, s) {
3
- throw new r(
4
- t.provider.unsupportedMethod,
5
- "eth_sendTransaction is not supported with smart accounts. Use wallet_sendCalls instead."
6
- );
1
+ import { getCurrentUser as r } from "./index.web6.js";
2
+ async function n() {
3
+ return (await r())?.evmSmartAccounts || [];
7
4
  }
8
5
  export {
9
- a as handleSendTransaction
6
+ n as handleAccounts
10
7
  };
@@ -1,23 +1,22 @@
1
- import { hashTypedData as s } from "viem";
2
- import { signAndWrapTypedDataForSmartAccount as c } from "./index.web36.js";
3
- import { validateUserOwnsSmartAccount as i, EIP1193ProviderError as d, STANDARD_ERROR_CODES as m } from "./index.web19.js";
4
- async function A(a, e) {
5
- const [t, n] = a, o = await i(t);
1
+ import { signAndWrapTypedDataForSmartAccount as s } from "./index.web36.js";
2
+ import { validateUserOwnsSmartAccount as c, EIP1193ProviderError as i, STANDARD_ERROR_CODES as d } from "./index.web19.js";
3
+ async function h(e, n) {
4
+ const [a, t] = e, o = await c(t);
6
5
  try {
7
- const { signature: r } = await c({
6
+ const { signature: r } = await s({
8
7
  smartAccount: t,
9
8
  ownerAddress: o.evmAccounts[0],
10
- hash: s(JSON.parse(n)),
11
- chainId: e.getState().chainId
9
+ hash: a,
10
+ chainId: n.getState().chainId
12
11
  });
13
12
  return r;
14
13
  } catch (r) {
15
- throw new d(
16
- m.provider.userRejectedRequest,
14
+ throw new i(
15
+ d.provider.userRejectedRequest,
17
16
  r instanceof Error ? r.message : "Signing failed"
18
17
  );
19
18
  }
20
19
  }
21
20
  export {
22
- A as handleSignTypedData
21
+ h as handleEthSign
23
22
  };
@@ -1,7 +1,55 @@
1
- import { version as r } from "./index.web133.js";
2
- function e() {
3
- return r;
1
+ import { getUserOperation as u } from "./index.web6.js";
2
+ import { isChainIdSupportedForCDPUserOps as p, userOperationChainIdToNameMapping as r, userOperationNameToChainIdMapping as m } from "./index.web30.js";
3
+ import { validateUserHasEvmSmartAccount as d, RPCRequestError as o, STANDARD_ERROR_CODES as n } from "./index.web19.js";
4
+ async function I(t, s) {
5
+ const i = t[0], c = (await d()).evmSmartAccounts?.[0], a = s.getState().chainId;
6
+ if (!p(a) || !r[a])
7
+ throw new o(
8
+ n.rpc.invalidParams,
9
+ "Chain ID is not supported for user operations"
10
+ );
11
+ try {
12
+ const e = await u({
13
+ userOperationHash: i,
14
+ evmSmartAccount: c,
15
+ network: r[a]
16
+ });
17
+ return l(e);
18
+ } catch (e) {
19
+ throw console.log("Failed to get user operation status", e), new o(
20
+ n.rpc.internal,
21
+ "Failed to get user operation status"
22
+ );
23
+ }
24
+ }
25
+ function l(t) {
26
+ return {
27
+ atomic: !0,
28
+ chainId: m[t.network] ?? 0,
29
+ receipts: t.receipts?.map((s) => ({
30
+ transactionHash: s.transactionHash,
31
+ blockHash: s.blockHash,
32
+ blockNumber: BigInt(s.blockNumber ?? 0),
33
+ gasUsed: BigInt(s.gasUsed ?? 0),
34
+ logs: [],
35
+ status: ""
36
+ })),
37
+ id: t.userOpHash,
38
+ status: h(t.status),
39
+ version: "1"
40
+ };
41
+ }
42
+ function h(t) {
43
+ switch (t) {
44
+ case "dropped":
45
+ case "failed":
46
+ return 400;
47
+ case "complete":
48
+ return 200;
49
+ default:
50
+ return 100;
51
+ }
4
52
  }
5
53
  export {
6
- e as getVersion
54
+ I as handleGetCallsStatus
7
55
  };
@@ -1,57 +1,20 @@
1
- import { encode as d } from "./index.web139.js";
2
- import y from "./index.web140.js";
3
- import b from "./index.web141.js";
4
- import { JWSInvalid as r } from "./index.web54.js";
5
- import { encoder as s, concat as u, decoder as h } from "./index.web120.js";
6
- import g from "./index.web142.js";
7
- import H from "./index.web143.js";
8
- import P from "./index.web144.js";
9
- class x {
10
- #r;
11
- #e;
12
- #t;
13
- constructor(e) {
14
- if (!(e instanceof Uint8Array))
15
- throw new TypeError("payload must be an instance of Uint8Array");
16
- this.#r = e;
17
- }
18
- setProtectedHeader(e) {
19
- if (this.#e)
20
- throw new TypeError("setProtectedHeader can only be called once");
21
- return this.#e = e, this;
22
- }
23
- setUnprotectedHeader(e) {
24
- if (this.#t)
25
- throw new TypeError("setUnprotectedHeader can only be called once");
26
- return this.#t = e, this;
27
- }
28
- async sign(e, l) {
29
- if (!this.#e && !this.#t)
30
- throw new r("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
31
- if (!b(this.#e, this.#t))
32
- throw new r("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
33
- const c = {
34
- ...this.#e,
35
- ...this.#t
36
- }, p = H(r, /* @__PURE__ */ new Map([["b64", !0]]), l?.crit, this.#e, c);
37
- let o = !0;
38
- if (p.has("b64") && (o = this.#e.b64, typeof o != "boolean"))
39
- throw new r('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
40
- const { alg: t } = c;
41
- if (typeof t != "string" || !t)
42
- throw new r('JWS "alg" (Algorithm) Header Parameter missing or invalid');
43
- g(t, e, "sign");
44
- let i = this.#r;
45
- o && (i = s.encode(d(i)));
46
- let n;
47
- this.#e ? n = s.encode(d(JSON.stringify(this.#e))) : n = s.encode("");
48
- const f = u(n, s.encode("."), i), m = await P(e, t), w = await y(t, m, f), a = {
49
- signature: d(w),
50
- payload: ""
51
- };
52
- return o && (a.payload = h.decode(i)), this.#t && (a.header = this.#t), this.#e && (a.protected = h.decode(n)), a;
53
- }
1
+ import { toHex as a } from "viem";
2
+ import { userOperationChainIdToNameMapping as o } from "./index.web30.js";
3
+ import { validateUserConnected as i } from "./index.web19.js";
4
+ import "zustand";
5
+ import "@coinbase/cdp-api-client";
6
+ async function l() {
7
+ return !(await i()).evmSmartAccounts?.length ? {} : Object.keys(o).reduce(
8
+ (t, e) => {
9
+ const r = a(Number(e));
10
+ return t[r] = {
11
+ atomic: { status: "supported" },
12
+ paymasterService: { supported: !0 }
13
+ }, t;
14
+ },
15
+ {}
16
+ );
54
17
  }
55
18
  export {
56
- x as FlattenedSign
19
+ l as handleGetCapabilities
57
20
  };
@@ -1,13 +1,23 @@
1
- const d = new TextEncoder(), s = new TextDecoder();
2
- function f(...n) {
3
- const c = n.reduce((e, { length: r }) => e + r, 0), t = new Uint8Array(c);
4
- let o = 0;
5
- for (const e of n)
6
- t.set(e, o), o += e.length;
7
- return t;
1
+ import { hashMessage as o, hexToString as c } from "viem";
2
+ import { signAndWrapTypedDataForSmartAccount as i } from "./index.web36.js";
3
+ import { validateUserOwnsSmartAccount as d, EIP1193ProviderError as m, STANDARD_ERROR_CODES as g } from "./index.web19.js";
4
+ async function S(t, a) {
5
+ const [n, e] = t, s = await d(e);
6
+ try {
7
+ const { signature: r } = await i({
8
+ smartAccount: e,
9
+ ownerAddress: s.evmAccounts[0],
10
+ hash: o(c(n)),
11
+ chainId: a.getState().chainId
12
+ });
13
+ return r;
14
+ } catch (r) {
15
+ throw new m(
16
+ g.provider.userRejectedRequest,
17
+ r instanceof Error ? r.message : "Signing failed"
18
+ );
19
+ }
8
20
  }
9
21
  export {
10
- f as concat,
11
- s as decoder,
12
- d as encoder
22
+ S as handlePersonalSign
13
23
  };
@@ -1,4 +1,11 @@
1
- const o = (e) => Math.floor(e.getTime() / 1e3);
1
+ import { fromNumber as c } from "./index.web144.js";
2
+ import { validateUserConnected as o } from "./index.web19.js";
3
+ async function m(t, e) {
4
+ const n = await o();
5
+ return t.emit("connect", {
6
+ chainId: c(e.getState().chainId)
7
+ }), n.evmSmartAccounts || [];
8
+ }
2
9
  export {
3
- o as default
10
+ m as handleRequestAccounts
4
11
  };
@@ -1,47 +1,33 @@
1
- const o = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, t = (c) => {
2
- const s = o.exec(c);
3
- if (!s || s[4] && s[1])
4
- throw new TypeError("Invalid time period format");
5
- const a = parseFloat(s[2]), r = s[3].toLowerCase();
6
- let e;
7
- switch (r) {
8
- case "sec":
9
- case "secs":
10
- case "second":
11
- case "seconds":
12
- case "s":
13
- e = Math.round(a);
14
- break;
15
- case "minute":
16
- case "minutes":
17
- case "min":
18
- case "mins":
19
- case "m":
20
- e = Math.round(a * 60);
21
- break;
22
- case "hour":
23
- case "hours":
24
- case "hr":
25
- case "hrs":
26
- case "h":
27
- e = Math.round(a * 3600);
28
- break;
29
- case "day":
30
- case "days":
31
- case "d":
32
- e = Math.round(a * 86400);
33
- break;
34
- case "week":
35
- case "weeks":
36
- case "w":
37
- e = Math.round(a * 604800);
38
- break;
39
- default:
40
- e = Math.round(a * 31557600);
41
- break;
1
+ import { sendUserOperation as c } from "./index.web6.js";
2
+ import { isChainIdSupportedForCDPUserOps as u, userOperationChainIdToNameMapping as p } from "./index.web30.js";
3
+ import { validateUserHasEvmSmartAccount as d, RPCRequestError as o, STANDARD_ERROR_CODES as s } from "./index.web19.js";
4
+ async function R(r, t) {
5
+ const [{ calls: n }] = r, i = (await d()).evmSmartAccounts[0], a = t.getState().chainId;
6
+ if (!u(a))
7
+ throw new o(
8
+ s.rpc.invalidParams,
9
+ "Chain ID is not supported for user operations"
10
+ );
11
+ try {
12
+ return (await c({
13
+ evmSmartAccount: i,
14
+ calls: m(n),
15
+ network: p[a]
16
+ })).userOperationHash;
17
+ } catch (e) {
18
+ throw new o(
19
+ s.rpc.transactionRejected,
20
+ e instanceof Error ? e.message : "User operation failed"
21
+ );
42
22
  }
43
- return s[1] === "-" || s[4] === "ago" ? -e : e;
44
- };
23
+ }
24
+ function m(r) {
25
+ return r.map((t) => ({
26
+ to: t.to,
27
+ data: t.data,
28
+ value: t.value ? BigInt(t.value) : void 0
29
+ }));
30
+ }
45
31
  export {
46
- t as default
32
+ R as handleSendCalls
47
33
  };
@@ -1,16 +1,10 @@
1
- function o(t) {
2
- return typeof t == "object" && t !== null;
1
+ import { EIP1193ProviderError as r, STANDARD_ERROR_CODES as t } from "./index.web19.js";
2
+ async function a(n, o, s) {
3
+ throw new r(
4
+ t.provider.unsupportedMethod,
5
+ "eth_sendTransaction is not supported with smart accounts. Use wallet_sendCalls instead."
6
+ );
3
7
  }
4
- const r = (t) => {
5
- if (!o(t) || Object.prototype.toString.call(t) !== "[object Object]")
6
- return !1;
7
- if (Object.getPrototypeOf(t) === null)
8
- return !0;
9
- let e = t;
10
- for (; Object.getPrototypeOf(e) !== null; )
11
- e = Object.getPrototypeOf(e);
12
- return Object.getPrototypeOf(t) === e;
13
- };
14
8
  export {
15
- r as default
9
+ a as handleSendTransaction
16
10
  };
@@ -1,4 +1,23 @@
1
- const o = "2.33.0";
1
+ import { hashTypedData as s } from "viem";
2
+ import { signAndWrapTypedDataForSmartAccount as c } from "./index.web36.js";
3
+ import { validateUserOwnsSmartAccount as i, EIP1193ProviderError as d, STANDARD_ERROR_CODES as m } from "./index.web19.js";
4
+ async function A(a, e) {
5
+ const [t, n] = a, o = await i(t);
6
+ try {
7
+ const { signature: r } = await c({
8
+ smartAccount: t,
9
+ ownerAddress: o.evmAccounts[0],
10
+ hash: s(JSON.parse(n)),
11
+ chainId: e.getState().chainId
12
+ });
13
+ return r;
14
+ } catch (r) {
15
+ throw new d(
16
+ m.provider.userRejectedRequest,
17
+ r instanceof Error ? r.message : "Signing failed"
18
+ );
19
+ }
20
+ }
2
21
  export {
3
- o as version
22
+ A as handleSignTypedData
4
23
  };
@@ -1,5 +1,5 @@
1
- import { getDefaultExportFromCjs as r } from "./index.web138.js";
2
- import { __require as o } from "./index.web145.js";
1
+ import { getDefaultExportFromCjs as r } from "./index.web137.js";
2
+ import { __require as o } from "./index.web149.js";
3
3
  var t = o();
4
4
  const a = /* @__PURE__ */ r(t);
5
5
  export {
@@ -1,9 +1,35 @@
1
- import { bytesToHex as i } from "./index.web59.js";
2
- import { sha256 as m } from "./index.web78.js";
3
- function f(t) {
4
- const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
- return o.set([s], 0), n === "bytes" ? o : i(o);
1
+ import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index.web154.js";
2
+ import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index.web86.js";
3
+ import { createCursor as B } from "./index.web74.js";
4
+ import { size as u } from "./index.web69.js";
5
+ import { hexToBytes as x } from "./index.web61.js";
6
+ import { bytesToHex as d } from "./index.web59.js";
7
+ function S(e) {
8
+ const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
+ if (!o)
10
+ throw new c();
11
+ if (o > y)
12
+ throw new h({
13
+ maxSize: y,
14
+ size: o
15
+ });
16
+ const s = [];
17
+ let n = !0, r = 0;
18
+ for (; n; ) {
19
+ const t = B(new Uint8Array(a));
20
+ let l = 0;
21
+ for (; l < f; ) {
22
+ const b = i.slice(r, r + (p - 1));
23
+ if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
+ t.pushByte(128), n = !1;
25
+ break;
26
+ }
27
+ l++, r += 31;
28
+ }
29
+ s.push(t);
30
+ }
31
+ return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
6
32
  }
7
33
  export {
8
- f as commitmentToVersionedHash
34
+ S as toBlobs
9
35
  };
@@ -1,35 +1,9 @@
1
- import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index.web154.js";
2
- import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index.web86.js";
3
- import { createCursor as B } from "./index.web74.js";
4
- import { size as u } from "./index.web69.js";
5
- import { hexToBytes as x } from "./index.web61.js";
6
- import { bytesToHex as d } from "./index.web59.js";
7
- function S(e) {
8
- const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
- if (!o)
10
- throw new c();
11
- if (o > y)
12
- throw new h({
13
- maxSize: y,
14
- size: o
15
- });
16
- const s = [];
17
- let n = !0, r = 0;
18
- for (; n; ) {
19
- const t = B(new Uint8Array(a));
20
- let l = 0;
21
- for (; l < f; ) {
22
- const b = i.slice(r, r + (p - 1));
23
- if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
- t.pushByte(128), n = !1;
25
- break;
26
- }
27
- l++, r += 31;
28
- }
29
- s.push(t);
30
- }
31
- return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
1
+ import { bytesToHex as i } from "./index.web59.js";
2
+ import { sha256 as m } from "./index.web78.js";
3
+ function f(t) {
4
+ const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
+ return o.set([s], 0), n === "bytes" ? o : i(o);
32
6
  }
33
7
  export {
34
- S as toBlobs
8
+ f as commitmentToVersionedHash
35
9
  };
@@ -1,49 +1,6 @@
1
- import { BaseError as f } from "./index.web51.js";
2
- import { pad as g } from "./index.web155.js";
3
- function m(t, i = {}) {
4
- const { signed: r, size: e } = i, o = BigInt(t);
5
- let n;
6
- e ? r ? n = (1n << BigInt(e) * 8n - 1n) - 1n : n = 2n ** (BigInt(e) * 8n) - 1n : typeof t == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
7
- const u = typeof n == "bigint" && r ? -n - 1n : 0;
8
- if (n && o > n || o < u) {
9
- const s = typeof t == "bigint" ? "n" : "";
10
- throw new d({
11
- max: n ? `${n}${s}` : void 0,
12
- min: `${u}${s}`,
13
- signed: r,
14
- size: e,
15
- value: `${t}${s}`
16
- });
17
- }
18
- const a = `0x${(r && o < 0 ? (1n << BigInt(e * 8)) + BigInt(o) : o).toString(16)}`;
19
- return e ? c(a, e) : a;
20
- }
21
- function c(t, i) {
22
- return g(t, { dir: "left", size: i });
23
- }
24
- class d extends f {
25
- constructor({ max: i, min: r, signed: e, size: o, value: n }) {
26
- super(`Number \`${n}\` is not in safe${o ? ` ${o * 8}-bit` : ""}${e ? " signed" : " unsigned"} integer range ${i ? `(\`${r}\` to \`${i}\`)` : `(above \`${r}\`)`}`), Object.defineProperty(this, "name", {
27
- enumerable: !0,
28
- configurable: !0,
29
- writable: !0,
30
- value: "Hex.IntegerOutOfRangeError"
31
- });
32
- }
33
- }
34
- class p extends f {
35
- constructor({ size: i, targetSize: r, type: e }) {
36
- super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (\`${i}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
37
- enumerable: !0,
38
- configurable: !0,
39
- writable: !0,
40
- value: "Hex.SizeExceedsPaddingSizeError"
41
- });
42
- }
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
43
3
  }
44
4
  export {
45
- d as IntegerOutOfRangeError,
46
- p as SizeExceedsPaddingSizeError,
47
- m as fromNumber,
48
- c as padLeft
5
+ e as getDefaultExportFromCjs
49
6
  };
@@ -1,6 +1,23 @@
1
- function e(t) {
2
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1
+ import { encoder as t, decoder as o } from "./index.web99.js";
2
+ import { encodeBase64 as c, decodeBase64 as a } from "./index.web155.js";
3
+ function i(r) {
4
+ if (Uint8Array.fromBase64)
5
+ return Uint8Array.fromBase64(typeof r == "string" ? r : o.decode(r), {
6
+ alphabet: "base64url"
7
+ });
8
+ let e = r;
9
+ e instanceof Uint8Array && (e = o.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
10
+ try {
11
+ return a(e);
12
+ } catch {
13
+ throw new TypeError("The input to be decoded is not correctly encoded.");
14
+ }
15
+ }
16
+ function p(r) {
17
+ let e = r;
18
+ return typeof e == "string" && (e = t.encode(e)), Uint8Array.prototype.toBase64 ? e.toBase64({ alphabet: "base64url", omitPadding: !0 }) : c(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
3
19
  }
4
20
  export {
5
- e as getDefaultExportFromCjs
21
+ i as decode,
22
+ p as encode
6
23
  };
@@ -1,23 +1,12 @@
1
- import { encoder as t, decoder as o } from "./index.web120.js";
2
- import { encodeBase64 as c, decodeBase64 as a } from "./index.web156.js";
3
- function i(r) {
4
- if (Uint8Array.fromBase64)
5
- return Uint8Array.fromBase64(typeof r == "string" ? r : o.decode(r), {
6
- alphabet: "base64url"
7
- });
8
- let e = r;
9
- e instanceof Uint8Array && (e = o.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
10
- try {
11
- return a(e);
12
- } catch {
13
- throw new TypeError("The input to be decoded is not correctly encoded.");
14
- }
15
- }
16
- function p(r) {
17
- let e = r;
18
- return typeof e == "string" && (e = t.encode(e)), Uint8Array.prototype.toBase64 ? e.toBase64({ alphabet: "base64url", omitPadding: !0 }) : c(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
19
- }
1
+ import n from "./index.web156.js";
2
+ import s from "./index.web157.js";
3
+ import a from "./index.web158.js";
4
+ const y = async (t, o, e) => {
5
+ const r = await a(t, o, "sign");
6
+ s(t, r);
7
+ const i = await crypto.subtle.sign(n(t, r.algorithm), r, e);
8
+ return new Uint8Array(i);
9
+ };
20
10
  export {
21
- i as decode,
22
- p as encode
11
+ y as default
23
12
  };