@coinbase/cdp-core 0.0.34 → 0.0.36

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 (57) hide show
  1. package/README.md +9 -5
  2. package/dist/esm/index.native6.js +172 -173
  3. package/dist/esm/index.native77.js +6 -6
  4. package/dist/esm/index.native86.js +1 -1
  5. package/dist/esm/index.native89.js +77 -19
  6. package/dist/esm/index.native90.js +21 -10
  7. package/dist/esm/index.native91.js +9 -19
  8. package/dist/esm/index.native92.js +15 -89
  9. package/dist/esm/index.native93.js +92 -19
  10. package/dist/esm/index.native94.js +18 -115
  11. package/dist/esm/index.native95.js +112 -73
  12. package/dist/esm/index.web26.js +1 -1
  13. package/dist/esm/index.web5.js +172 -173
  14. package/dist/esm/index.web55.js +2 -2
  15. package/dist/esm/index.web57.js +1 -1
  16. package/dist/esm/index.web75.js +6 -6
  17. package/dist/esm/index.web82.js +102 -18
  18. package/dist/esm/index.web83.js +20 -80
  19. package/dist/esm/index.web84.js +79 -103
  20. package/dist/esm/index.web87.js +77 -19
  21. package/dist/esm/index.web88.js +21 -10
  22. package/dist/esm/index.web89.js +9 -19
  23. package/dist/esm/index.web90.js +15 -89
  24. package/dist/esm/index.web91.js +92 -19
  25. package/dist/esm/index.web92.js +18 -115
  26. package/dist/esm/index.web93.js +117 -9
  27. package/dist/esm/index.web94.js +10 -79
  28. package/dist/native/index.native6.js +172 -173
  29. package/dist/native/index.native77.js +6 -6
  30. package/dist/native/index.native86.js +1 -1
  31. package/dist/native/index.native89.js +77 -19
  32. package/dist/native/index.native90.js +21 -10
  33. package/dist/native/index.native91.js +9 -19
  34. package/dist/native/index.native92.js +15 -89
  35. package/dist/native/index.native93.js +92 -19
  36. package/dist/native/index.native94.js +18 -115
  37. package/dist/native/index.native95.js +112 -73
  38. package/dist/native-types/types.d.ts +19 -2
  39. package/dist/types/types.d.ts +19 -2
  40. package/dist/web/index.web26.js +1 -1
  41. package/dist/web/index.web5.js +172 -173
  42. package/dist/web/index.web55.js +2 -2
  43. package/dist/web/index.web57.js +1 -1
  44. package/dist/web/index.web75.js +6 -6
  45. package/dist/web/index.web82.js +102 -18
  46. package/dist/web/index.web83.js +20 -80
  47. package/dist/web/index.web84.js +79 -103
  48. package/dist/web/index.web87.js +77 -19
  49. package/dist/web/index.web88.js +21 -10
  50. package/dist/web/index.web89.js +9 -19
  51. package/dist/web/index.web90.js +15 -89
  52. package/dist/web/index.web91.js +92 -19
  53. package/dist/web/index.web92.js +18 -115
  54. package/dist/web/index.web93.js +117 -9
  55. package/dist/web/index.web94.js +10 -79
  56. package/dist/web-types/types.d.ts +19 -2
  57. package/package.json +2 -2
package/README.md CHANGED
@@ -56,13 +56,15 @@ You can configure the SDK to create different types of accounts for new users:
56
56
  ```ts lines
57
57
  const config: Config = {
58
58
  projectId: "your-project-id",
59
- createAccountOnLogin: "evm-smart", // Creates Smart Accounts instead of EOAs
59
+ ethereum: {
60
+ createOnLogin: "smart", // Creates Smart Accounts instead of EOAs
61
+ },
60
62
  }
61
63
 
62
64
  await initialize(config);
63
65
  ```
64
66
 
65
- When `createAccountOnLogin` is set to `"evm-smart"`, the SDK will:
67
+ When `ethereum.createOnLogin` is set to `"smart"`, the SDK will:
66
68
  1. Create an EOA (Externally Owned Account) first
67
69
  2. Use that EOA as the owner to create a Smart Account
68
70
  3. Both accounts will be available on the user object
@@ -71,13 +73,15 @@ When `createAccountOnLogin` is set to `"evm-smart"`, the SDK will:
71
73
  ```ts lines
72
74
  const config: Config = {
73
75
  projectId: "your-project-id",
74
- createAccountOnLogin: "solana", // Creates Solana accounts instead of EVM accounts
76
+ solana: {
77
+ createOnLogin: true, // Creates Solana accounts
78
+ },
75
79
  }
76
80
 
77
81
  await initialize(config);
78
82
  ```
79
83
 
80
- When `createAccountOnLogin` is set to `"solana"`, the SDK will:
84
+ When `solana.createOnLogin` is set to `true`, the SDK will:
81
85
  1. Create a Solana account for new users
82
86
  2. The Solana account will be available on the `solanaAccounts` property
83
87
 
@@ -213,7 +217,7 @@ Smart Accounts provide advanced account abstraction features, including user ope
213
217
 
214
218
  ### Sign a Solana Transaction
215
219
 
216
- When your application is configured with `createAccountOnLogin: "solana"`, you can sign Solana transactions:
220
+ When your application is configured with `solana: { createOnLogin: true }`, you can sign Solana transactions:
217
221
 
218
222
  ```typescript lines
219
223
  import { signSolanaTransaction, getCurrentUser } from "@coinbase/cdp-core";
@@ -1,171 +1,171 @@
1
- import { configureCdpApiClient as h, setAuthManager as I, initiateAuthentication as A, createEndUserSolanaAccount as v, createEndUserEvmAccount as k, createEndUserEvmSmartAccount as d, verifyEmailAuthentication as S, verifySmsAuthentication as E, signEvmHashWithEndUserAccount as U, signEvmTransactionWithEndUserAccount as T, signSolanaTransactionWithEndUserAccount as M, sendEvmTransactionWithEndUserAccount as j, sendSolanaTransactionWithEndUserAccount as P, signEvmMessageWithEndUserAccount as O, signEvmTypedDataWithEndUserAccount as C, sendUserOperationWithEndUserAccount as x, getUserOperationWithEndUserAccount as W, exportEndUserEvmAccount as H } from "@coinbase/cdp-api-client";
2
- import { AuthManager as b } from "./index.native7.js";
3
- import { toAuthState as u } from "./index.native14.js";
4
- import { withAuth as o } from "./index.native15.js";
5
- import { MockAuthManager as K } from "./index.native16.js";
6
- import { mockUser as g } from "./index.native17.js";
7
- import { getPlatformServices as l, getPlatformCrypto as D } from "./index.native5.js";
8
- import { isChainSupportedForCDPSends as _ } from "./index.native18.js";
9
- import { getConfig as n, setCoreAuthManager as m, getCoreAuthManager as a, setConfig as N } from "./index.native19.js";
1
+ import { configureCdpApiClient as A, setAuthManager as v, initiateAuthentication as S, createEndUserEvmAccount as k, createEndUserEvmSmartAccount as m, createEndUserSolanaAccount as E, verifyEmailAuthentication as U, verifySmsAuthentication as T, signEvmHashWithEndUserAccount as M, signEvmTransactionWithEndUserAccount as j, signSolanaTransactionWithEndUserAccount as O, sendEvmTransactionWithEndUserAccount as P, sendSolanaTransactionWithEndUserAccount as C, signEvmMessageWithEndUserAccount as x, signEvmTypedDataWithEndUserAccount as W, sendUserOperationWithEndUserAccount as H, getUserOperationWithEndUserAccount as b, exportEndUserEvmAccount as K } from "@coinbase/cdp-api-client";
2
+ import { AuthManager as D } from "./index.native7.js";
3
+ import { toAuthState as d } from "./index.native14.js";
4
+ import { withAuth as i } from "./index.native15.js";
5
+ import { MockAuthManager as _ } from "./index.native16.js";
6
+ import { mockUser as l } from "./index.native17.js";
7
+ import { getPlatformServices as w, getPlatformCrypto as N } from "./index.native5.js";
8
+ import { isChainSupportedForCDPSends as z } from "./index.native18.js";
9
+ import { getConfig as n, setCoreAuthManager as h, getCoreAuthManager as c, setConfig as F } from "./index.native19.js";
10
10
  import "viem";
11
- import { serializeTransaction as w } from "./index.native20.js";
12
- const R = async (e) => {
11
+ import { serializeTransaction as f } from "./index.native20.js";
12
+ const ee = async (e) => {
13
13
  if (!e.projectId)
14
14
  throw new Error("Project ID is required");
15
- let r;
15
+ let t;
16
16
  try {
17
- r = n().projectId !== e.projectId;
17
+ t = n().projectId !== e.projectId;
18
18
  } catch {
19
- r = !0;
19
+ t = !0;
20
20
  }
21
- if (N(e), n().useMock) {
22
- m(new K(n().projectId));
21
+ if (F(e), n().useMock) {
22
+ h(new _(n().projectId));
23
23
  return;
24
24
  }
25
- let t;
25
+ let r;
26
26
  try {
27
- const s = l();
28
- t = s.secureStorage ? {
27
+ const s = w();
28
+ r = s.secureStorage ? {
29
29
  getRefreshToken: () => s.secureStorage.getItem("cdp_refresh_token"),
30
- setRefreshToken: (c) => s.secureStorage.setItem("cdp_refresh_token", c),
30
+ setRefreshToken: (a) => s.secureStorage.setItem("cdp_refresh_token", a),
31
31
  removeRefreshToken: () => s.secureStorage.removeItem("cdp_refresh_token")
32
32
  } : void 0;
33
33
  } catch {
34
- t = void 0;
34
+ r = void 0;
35
35
  }
36
- if (h({
36
+ if (A({
37
37
  debugging: n().debugging,
38
38
  basePath: n().basePath,
39
- refreshTokenStorage: t
40
- }), r) {
41
- const s = new b(n().projectId);
42
- m(s), I(s);
39
+ refreshTokenStorage: r
40
+ }), t) {
41
+ const s = new D(n().projectId);
42
+ h(s), v(s);
43
43
  }
44
- await a().ensureInitialized();
45
- }, ee = async (e) => p({
44
+ await c().ensureInitialized();
45
+ }, te = async (e) => y({
46
46
  email: e.email,
47
47
  type: "email"
48
- }), re = async (e) => p({
48
+ }), re = async (e) => y({
49
49
  phoneNumber: e.phoneNumber,
50
50
  type: "sms"
51
- }), te = async (e) => y(
51
+ }), ne = async (e) => I(
52
52
  e,
53
53
  "Mock email OTP verified",
54
- (r, t) => S(r, t)
55
- ), ne = async (e) => y(
54
+ (t, r) => U(t, r)
55
+ ), se = async (e) => I(
56
56
  e,
57
57
  "Mock SMS OTP verified",
58
- (r, t) => E(r, t)
59
- ), se = async () => a().getUser(), ae = async () => a().isSignedIn(), ce = async () => {
58
+ (t, r) => T(t, r)
59
+ ), ae = async () => c().getUser(), ce = async () => c().isSignedIn(), oe = async () => {
60
60
  if (n().useMock) {
61
- await a().signOut();
61
+ await c().signOut();
62
62
  return;
63
63
  }
64
- if (!await a().isSignedIn())
64
+ if (!await c().isSignedIn())
65
65
  throw new Error("User not signed in");
66
- await a().signOut();
66
+ await c().signOut();
67
67
  try {
68
- const r = l();
69
- if (r.secureStorage)
68
+ const t = w();
69
+ if (t.secureStorage)
70
70
  try {
71
- await r.secureStorage.removeItem("cdp_refresh_token");
72
- } catch (t) {
73
- console.warn("Failed to clear stored refresh token:", t);
71
+ await t.secureStorage.removeItem("cdp_refresh_token");
72
+ } catch (r) {
73
+ console.warn("Failed to clear stored refresh token:", r);
74
74
  }
75
75
  } catch {
76
76
  }
77
- }, oe = async () => a().getToken(), ie = (e) => {
78
- a().addAuthStateChangeCallback(e);
79
- }, ue = async (e) => n().useMock ? { signature: "0x0" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
80
- signature: (await U(n().projectId, r.userId, {
77
+ }, ie = async () => c().getToken(), ue = (e) => {
78
+ c().addAuthStateChangeCallback(e);
79
+ }, de = async (e) => n().useMock ? { signature: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
80
+ signature: (await M(n().projectId, t.userId, {
81
81
  hash: e.hash,
82
82
  address: e.evmAccount,
83
- walletSecretId: t
83
+ walletSecretId: r
84
84
  })).signature
85
- })), de = async (e) => n().useMock ? { signedTransaction: "0x0" } : o(e, a(), async ({ user: r, walletSecretId: t }) => {
86
- const s = w(e.transaction);
85
+ })), ge = async (e) => n().useMock ? { signedTransaction: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => {
86
+ const s = f(e.transaction);
87
87
  return {
88
- signedTransaction: (await T(
88
+ signedTransaction: (await j(
89
89
  n().projectId,
90
- r.userId,
90
+ t.userId,
91
91
  {
92
92
  transaction: s,
93
93
  address: e.evmAccount,
94
- walletSecretId: t
94
+ walletSecretId: r
95
95
  }
96
96
  )).signedTransaction
97
97
  };
98
- }), ge = async (e) => n().useMock ? { signedTransaction: "mock-signed-transaction" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
99
- signedTransaction: (await M(
98
+ }), me = async (e) => n().useMock ? { signedTransaction: "mock-signed-transaction" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
99
+ signedTransaction: (await O(
100
100
  n().projectId,
101
- r.userId,
101
+ t.userId,
102
102
  {
103
103
  transaction: e.transaction,
104
104
  address: e.solanaAccount,
105
- walletSecretId: t
105
+ walletSecretId: r
106
106
  }
107
107
  )).signedTransaction
108
- })), me = async (e) => {
109
- if (!_(e.network))
108
+ })), le = async (e) => {
109
+ if (!z(e.network))
110
110
  throw new Error(`Chain ${e.network} is not supported by the CDP Apis`);
111
111
  if (n().useMock)
112
112
  return { transactionHash: "0x0" };
113
- const r = w(e.transaction);
114
- return o(e, a(), async ({ user: t, walletSecretId: s }) => ({
115
- transactionHash: (await j(
113
+ const t = f(e.transaction);
114
+ return i(e, c(), async ({ user: r, walletSecretId: s }) => ({
115
+ transactionHash: (await P(
116
116
  n().projectId,
117
- t.userId,
117
+ r.userId,
118
118
  {
119
- transaction: r,
119
+ transaction: t,
120
120
  address: e.evmAccount,
121
121
  walletSecretId: s,
122
122
  network: e.network
123
123
  }
124
124
  )).transactionHash
125
125
  }));
126
- }, le = async (e) => n().useMock ? { transactionSignature: "mock-signature" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
127
- transactionSignature: (await P(
126
+ }, he = async (e) => n().useMock ? { transactionSignature: "mock-signature" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
127
+ transactionSignature: (await C(
128
128
  n().projectId,
129
- r.userId,
129
+ t.userId,
130
130
  {
131
131
  transaction: e.transaction,
132
132
  address: e.solanaAccount,
133
- walletSecretId: t,
133
+ walletSecretId: r,
134
134
  network: e.network
135
135
  }
136
136
  )).transactionSignature
137
- })), we = async (e) => n().useMock ? { signature: "0x0" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
138
- signature: (await O(n().projectId, r.userId, {
137
+ })), pe = async (e) => n().useMock ? { signature: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
138
+ signature: (await x(n().projectId, t.userId, {
139
139
  message: e.message,
140
140
  address: e.evmAccount,
141
- walletSecretId: t
141
+ walletSecretId: r
142
142
  })).signature
143
- })), pe = async (e) => n().useMock ? { signature: "0x0" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
144
- signature: (await C(n().projectId, r.userId, {
143
+ })), we = async (e) => n().useMock ? { signature: "0x0" } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
144
+ signature: (await W(n().projectId, t.userId, {
145
145
  typedData: e.typedData,
146
146
  address: e.evmAccount,
147
- walletSecretId: t
147
+ walletSecretId: r
148
148
  })).signature
149
- })), ye = async (e) => n().useMock ? {
149
+ })), fe = async (e) => n().useMock ? {
150
150
  userOperationHash: "0x1234567890123456789012345678901234567890123456789012345678901234"
151
- } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
152
- userOperationHash: (await x(
151
+ } : i(e, c(), async ({ user: t, walletSecretId: r }) => ({
152
+ userOperationHash: (await H(
153
153
  n().projectId,
154
- r.userId,
154
+ t.userId,
155
155
  e.evmSmartAccount,
156
156
  {
157
157
  network: e.network,
158
- calls: e.calls.map((c) => ({
159
- to: c.to,
160
- value: String(c.value ?? 0n),
161
- data: c.data ?? "0x"
158
+ calls: e.calls.map((a) => ({
159
+ to: a.to,
160
+ value: String(a.value ?? 0n),
161
+ data: a.data ?? "0x"
162
162
  })),
163
- walletSecretId: t,
163
+ walletSecretId: r,
164
164
  useCdpPaymaster: e.useCdpPaymaster ?? !1,
165
165
  paymasterUrl: e.paymasterUrl
166
166
  }
167
167
  )).userOpHash
168
- })), fe = async (e) => n().useMock ? {
168
+ })), ye = async (e) => n().useMock ? {
169
169
  userOpHash: e.userOperationHash,
170
170
  network: e.network,
171
171
  calls: [
@@ -178,155 +178,154 @@ const R = async (e) => {
178
178
  status: "complete",
179
179
  transactionHash: "0x9876543210987654321098765432109876543210987654321098765432109876",
180
180
  receipts: []
181
- } : o(e, a(), async ({ user: r }) => await W(
181
+ } : i(e, c(), async ({ user: t }) => await b(
182
182
  n().projectId,
183
- r.userId,
183
+ t.userId,
184
184
  e.evmSmartAccount,
185
185
  e.userOperationHash
186
- )), he = async (e) => {
186
+ )), Ie = async (e) => {
187
187
  if (n().useMock)
188
188
  return {
189
189
  privateKey: "mock-private-key"
190
190
  };
191
- const r = D(), t = await r.createExportKeyPair();
192
- return o(e, a(), async ({ user: s, walletSecretId: c }) => {
193
- const i = await H(n().projectId, s.userId, {
191
+ const t = N(), r = await t.createExportKeyPair();
192
+ return i(e, c(), async ({ user: s, walletSecretId: a }) => {
193
+ const o = await K(n().projectId, s.userId, {
194
194
  address: e.evmAccount,
195
- walletSecretId: c,
196
- exportEncryptionKey: t.publicKeyBase64
195
+ walletSecretId: a,
196
+ exportEncryptionKey: r.publicKeyBase64
197
197
  });
198
198
  return {
199
- privateKey: await r.decryptWithPrivateKey(
200
- t.privateKey,
201
- i.encryptedPrivateKey
199
+ privateKey: await t.decryptWithPrivateKey(
200
+ r.privateKey,
201
+ o.encryptedPrivateKey
202
202
  )
203
203
  };
204
204
  });
205
- }, p = async (e) => {
205
+ }, y = async (e) => {
206
206
  if (n().useMock)
207
207
  return {
208
208
  message: "Mock sign in initiated",
209
209
  flowId: "mock-flow-id"
210
210
  };
211
- if (await a().isSignedIn())
211
+ if (await c().isSignedIn())
212
212
  throw new Error("User is already authenticated. Please sign out first.");
213
- const t = await A(n().projectId, e);
213
+ const r = await S(n().projectId, e);
214
214
  return {
215
- flowId: t.flowId,
216
- message: t.message
215
+ flowId: r.flowId,
216
+ message: r.message
217
217
  };
218
- }, y = async (e, r, t) => {
218
+ }, I = async (e, t, r) => {
219
219
  if (n().useMock)
220
- return await a().setAuthState({
220
+ return await c().setAuthState({
221
221
  accessToken: "mock-access-token",
222
222
  expiresAt: Date.now() + 1e3 * 60 * 60 * 24,
223
- user: g
223
+ user: l
224
224
  }), {
225
- message: r,
226
- user: g,
225
+ message: t,
226
+ user: l,
227
227
  isNewUser: !1
228
228
  };
229
- if (await a().isSignedIn())
229
+ if (await c().isSignedIn())
230
230
  throw new Error("User is already authenticated. Please sign out first.");
231
- const c = await t(n().projectId, {
231
+ const a = await r(n().projectId, {
232
232
  flowId: e.flowId,
233
233
  otp: e.otp
234
- }), i = u(
235
- c.accessToken,
236
- c.validUntil,
237
- c.endUser
234
+ });
235
+ let o = d(
236
+ a.accessToken,
237
+ a.validUntil,
238
+ a.endUser
238
239
  );
239
- return await a().setAuthState(i), n().createAccountOnLogin === "solana" ? F({ authResponse: c, authState: i }) : z({ authResponse: c, authState: i });
240
- }, z = async ({
241
- authResponse: e,
242
- authState: r
243
- }) => {
244
- if (!r.user.evmAccounts || r.user.evmAccounts.length === 0)
240
+ await c().setAuthState(o);
241
+ const u = n();
242
+ u.ethereum?.createOnLogin && (o = await p(
243
+ a,
244
+ o,
245
+ u.ethereum.createOnLogin
246
+ )), u.solana?.createOnLogin && (o = await L(a, o)), !u.ethereum?.createOnLogin && !u.solana?.createOnLogin && (o = await p(a, o, "eoa"));
247
+ const g = await c().getUser();
248
+ return {
249
+ message: a.message,
250
+ user: g,
251
+ isNewUser: a.isNewEndUser
252
+ };
253
+ }, p = async (e, t, r) => {
254
+ let s = t;
255
+ if (!t.user.evmAccounts || t.user.evmAccounts.length === 0)
245
256
  try {
246
- const s = await a().getWalletSecretId();
247
- let c = await k(n().projectId, r.user.userId, {
248
- walletSecretId: s
257
+ const a = await c().getWalletSecretId();
258
+ let o = await k(n().projectId, t.user.userId, {
259
+ walletSecretId: a
249
260
  });
250
- if (n().createAccountOnLogin === "evm-smart") {
251
- const [i] = c.evmAccounts;
252
- c = await d(
261
+ if (r === "smart") {
262
+ const [u] = o.evmAccounts;
263
+ o = await m(
253
264
  n().projectId,
254
- r.user.userId,
265
+ t.user.userId,
255
266
  {
256
- owner: i,
267
+ owner: u,
257
268
  enableSpendPermissions: !1
258
269
  // Defaulting to false until the feature is ready.
259
270
  }
260
271
  );
261
272
  }
262
- r = u(e.accessToken, e.validUntil, c), await a().setAuthState(r);
263
- } catch (s) {
264
- throw new Error(`Failed to create EVM account: ${s}`);
273
+ s = d(e.accessToken, e.validUntil, o), await c().setAuthState(s);
274
+ } catch (a) {
275
+ throw new Error(`Failed to create EVM account: ${a}`);
265
276
  }
266
- if (n().createAccountOnLogin === "evm-smart" && (!r.user.evmSmartAccounts || r.user.evmSmartAccounts.length === 0))
277
+ if (r === "smart" && (!s.user.evmSmartAccounts || s.user.evmSmartAccounts.length === 0))
267
278
  try {
268
- const [s] = r.user.evmAccounts, c = await d(
279
+ const [a] = s.user.evmAccounts, o = await m(
269
280
  n().projectId,
270
- r.user.userId,
281
+ s.user.userId,
271
282
  {
272
- owner: s,
283
+ owner: a,
273
284
  enableSpendPermissions: !1
274
285
  // Defaulting to false until the feature is ready.
275
286
  }
276
287
  );
277
- r = u(e.accessToken, e.validUntil, c), await a().setAuthState(r);
278
- } catch (s) {
279
- throw new Error(`Failed to create EVM Smart Account: ${s}`);
288
+ s = d(e.accessToken, e.validUntil, o), await c().setAuthState(s);
289
+ } catch (a) {
290
+ throw new Error(`Failed to create EVM Smart Account: ${a}`);
280
291
  }
281
- const t = await a().getUser();
282
- return {
283
- message: e.message,
284
- user: t,
285
- isNewUser: e.isNewEndUser
286
- };
287
- }, F = async ({
288
- authResponse: e,
289
- authState: r
290
- }) => {
291
- if (!r.user.solanaAccounts || r.user.solanaAccounts.length === 0)
292
+ return s;
293
+ }, L = async (e, t) => {
294
+ let r = t;
295
+ if (!t.user.solanaAccounts || t.user.solanaAccounts.length === 0)
292
296
  try {
293
- const s = await a().getWalletSecretId(), c = await v(
297
+ const s = await c().getWalletSecretId(), a = await E(
294
298
  n().projectId,
295
- r.user.userId,
299
+ t.user.userId,
296
300
  {
297
301
  walletSecretId: s
298
302
  }
299
303
  );
300
- r = u(e.accessToken, e.validUntil, c), await a().setAuthState(r);
304
+ r = d(e.accessToken, e.validUntil, a), await c().setAuthState(r);
301
305
  } catch (s) {
302
306
  throw new Error(`Failed to create Solana account: ${s}`);
303
307
  }
304
- const t = await a().getUser();
305
- return {
306
- message: e.message,
307
- user: t,
308
- isNewUser: e.isNewEndUser
309
- };
308
+ return r;
310
309
  };
311
310
  export {
312
- he as exportEvmAccount,
313
- oe as getAccessToken,
314
- se as getCurrentUser,
315
- fe as getUserOperation,
316
- R as initialize,
317
- ae as isSignedIn,
318
- ie as onAuthStateChange,
319
- me as sendEvmTransaction,
320
- le as sendSolanaTransaction,
321
- ye as sendUserOperation,
322
- ue as signEvmHash,
323
- we as signEvmMessage,
324
- de as signEvmTransaction,
325
- pe as signEvmTypedData,
326
- ee as signInWithEmail,
311
+ Ie as exportEvmAccount,
312
+ ie as getAccessToken,
313
+ ae as getCurrentUser,
314
+ ye as getUserOperation,
315
+ ee as initialize,
316
+ ce as isSignedIn,
317
+ ue as onAuthStateChange,
318
+ le as sendEvmTransaction,
319
+ he as sendSolanaTransaction,
320
+ fe as sendUserOperation,
321
+ de as signEvmHash,
322
+ pe as signEvmMessage,
323
+ ge as signEvmTransaction,
324
+ we as signEvmTypedData,
325
+ te as signInWithEmail,
327
326
  re as signInWithSms,
328
- ce as signOut,
329
- ge as signSolanaTransaction,
330
- te as verifyEmailOTP,
331
- ne as verifySmsOTP
327
+ oe as signOut,
328
+ me as signSolanaTransaction,
329
+ ne as verifyEmailOTP,
330
+ se as verifySmsOTP
332
331
  };
@@ -1,11 +1,11 @@
1
- import { encode as d } from "./index.native89.js";
2
- import y from "./index.native90.js";
3
- import b from "./index.native91.js";
1
+ import { encode as d } from "./index.native90.js";
2
+ import y from "./index.native91.js";
3
+ import b from "./index.native92.js";
4
4
  import { JWSInvalid as r } from "./index.native30.js";
5
5
  import { encoder as s, concat as u, decoder as h } from "./index.native78.js";
6
- import g from "./index.native92.js";
7
- import H from "./index.native93.js";
8
- import P from "./index.native94.js";
6
+ import g from "./index.native93.js";
7
+ import H from "./index.native94.js";
8
+ import P from "./index.native95.js";
9
9
  class x {
10
10
  #r;
11
11
  #e;
@@ -1,4 +1,4 @@
1
- import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index.native95.js";
1
+ import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index.native89.js";
2
2
  import { createHasher as u, clean as C, rotr as i } from "./index.native85.js";
3
3
  const B = /* @__PURE__ */ Uint32Array.from([
4
4
  1116352408,