@coinbase/cdp-core 0.0.33 → 0.0.35

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 (91) hide show
  1. package/README.md +74 -8
  2. package/dist/esm/index.native.js +40 -37
  3. package/dist/esm/index.native100.js +41 -7
  4. package/dist/esm/index.native101.js +18 -11
  5. package/dist/esm/index.native102.js +28 -13
  6. package/dist/esm/index.native103.js +8 -10
  7. package/dist/esm/index.native104.js +11 -17
  8. package/dist/esm/index.native105.js +12 -80
  9. package/dist/esm/index.native106.js +10 -13
  10. package/dist/esm/index.native107.js +17 -36
  11. package/dist/esm/index.native108.js +79 -40
  12. package/dist/esm/index.native14.js +6 -5
  13. package/dist/esm/index.native15.js +12 -10
  14. package/dist/esm/index.native17.js +1 -0
  15. package/dist/esm/index.native28.js +1 -1
  16. package/dist/esm/index.native54.js +1 -1
  17. package/dist/esm/index.native55.js +1 -1
  18. package/dist/esm/index.native57.js +2 -2
  19. package/dist/esm/index.native59.js +1 -1
  20. package/dist/esm/index.native6.js +188 -134
  21. package/dist/esm/index.native77.js +6 -6
  22. package/dist/esm/index.native82.js +2 -21
  23. package/dist/esm/index.native83.js +21 -2
  24. package/dist/esm/index.native84.js +18 -102
  25. package/dist/esm/index.native85.js +80 -20
  26. package/dist/esm/index.native86.js +103 -79
  27. package/dist/esm/index.native89.js +10 -21
  28. package/dist/esm/index.native90.js +21 -10
  29. package/dist/esm/index.native91.js +9 -19
  30. package/dist/esm/index.native92.js +15 -89
  31. package/dist/esm/index.native93.js +92 -19
  32. package/dist/esm/index.native94.js +18 -115
  33. package/dist/esm/index.native95.js +112 -73
  34. package/dist/esm/index.native96.js +79 -10
  35. package/dist/esm/index.native98.js +13 -18
  36. package/dist/esm/index.native99.js +35 -27
  37. package/dist/esm/index.web.js +41 -38
  38. package/dist/esm/index.web12.js +6 -5
  39. package/dist/esm/index.web13.js +12 -10
  40. package/dist/esm/index.web15.js +1 -0
  41. package/dist/esm/index.web5.js +188 -134
  42. package/dist/native/index.native.js +40 -37
  43. package/dist/native/index.native100.js +41 -7
  44. package/dist/native/index.native101.js +18 -11
  45. package/dist/native/index.native102.js +28 -13
  46. package/dist/native/index.native103.js +8 -10
  47. package/dist/native/index.native104.js +11 -17
  48. package/dist/native/index.native105.js +12 -80
  49. package/dist/native/index.native106.js +10 -13
  50. package/dist/native/index.native107.js +17 -36
  51. package/dist/native/index.native108.js +79 -40
  52. package/dist/native/index.native14.js +6 -5
  53. package/dist/native/index.native15.js +12 -10
  54. package/dist/native/index.native17.js +1 -0
  55. package/dist/native/index.native28.js +1 -1
  56. package/dist/native/index.native54.js +1 -1
  57. package/dist/native/index.native55.js +1 -1
  58. package/dist/native/index.native57.js +2 -2
  59. package/dist/native/index.native59.js +1 -1
  60. package/dist/native/index.native6.js +188 -134
  61. package/dist/native/index.native77.js +6 -6
  62. package/dist/native/index.native82.js +2 -21
  63. package/dist/native/index.native83.js +21 -2
  64. package/dist/native/index.native84.js +18 -102
  65. package/dist/native/index.native85.js +80 -20
  66. package/dist/native/index.native86.js +103 -79
  67. package/dist/native/index.native89.js +10 -21
  68. package/dist/native/index.native90.js +21 -10
  69. package/dist/native/index.native91.js +9 -19
  70. package/dist/native/index.native92.js +15 -89
  71. package/dist/native/index.native93.js +92 -19
  72. package/dist/native/index.native94.js +18 -115
  73. package/dist/native/index.native95.js +112 -73
  74. package/dist/native/index.native96.js +79 -10
  75. package/dist/native/index.native98.js +13 -18
  76. package/dist/native/index.native99.js +35 -27
  77. package/dist/native-types/auth/withAuth.d.ts +3 -1
  78. package/dist/native-types/core.d.ts +3 -1
  79. package/dist/native-types/types.d.ts +20 -3
  80. package/dist/types/auth/withAuth.d.ts +3 -1
  81. package/dist/types/core.d.ts +3 -1
  82. package/dist/types/types.d.ts +20 -3
  83. package/dist/web/index.web.js +41 -38
  84. package/dist/web/index.web12.js +6 -5
  85. package/dist/web/index.web13.js +12 -10
  86. package/dist/web/index.web15.js +1 -0
  87. package/dist/web/index.web5.js +188 -134
  88. package/dist/web-types/auth/withAuth.d.ts +3 -1
  89. package/dist/web-types/core.d.ts +3 -1
  90. package/dist/web-types/types.d.ts +20 -3
  91. package/package.json +2 -2
@@ -1,135 +1,156 @@
1
- import { configureCdpApiClient as A, setAuthManager as S, initiateAuthentication as k, createEndUserEvmAccount as E, createEndUserEvmSmartAccount as h, verifyEmailAuthentication as U, verifySmsAuthentication as M, signEvmHashWithEndUserAccount as T, signEvmTransactionWithEndUserAccount as P, sendEvmTransactionWithEndUserAccount as j, signEvmMessageWithEndUserAccount as C, signEvmTypedDataWithEndUserAccount as O, sendUserOperationWithEndUserAccount as x, getUserOperationWithEndUserAccount as H, exportEndUserEvmAccount as W } from "@coinbase/cdp-api-client";
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
2
  import { AuthManager as b } from "./index.web6.js";
3
- import { toAuthState as m } from "./index.web12.js";
4
- import { withAuth as i } from "./index.web13.js";
3
+ import { toAuthState as u } from "./index.web12.js";
4
+ import { withAuth as o } from "./index.web13.js";
5
5
  import { MockAuthManager as K } from "./index.web14.js";
6
- import { mockUser as p } from "./index.web15.js";
7
- import { getPlatformServices as f, getPlatformCrypto as D } from "./index.web2.js";
6
+ import { mockUser as g } from "./index.web15.js";
7
+ import { getPlatformServices as l, getPlatformCrypto as D } from "./index.web2.js";
8
8
  import { isChainSupportedForCDPSends as _ } from "./index.web16.js";
9
- import { getConfig as t, setCoreAuthManager as w, getCoreAuthManager as n, setConfig as z } from "./index.web17.js";
9
+ import { getConfig as n, setCoreAuthManager as m, getCoreAuthManager as a, setConfig as N } from "./index.web17.js";
10
10
  import "viem";
11
- import { serializeTransaction as y } from "./index.web18.js";
12
- const Y = async (e) => {
11
+ import { serializeTransaction as w } from "./index.web18.js";
12
+ const R = async (e) => {
13
13
  if (!e.projectId)
14
14
  throw new Error("Project ID is required");
15
15
  let r;
16
16
  try {
17
- r = t().projectId !== e.projectId;
17
+ r = n().projectId !== e.projectId;
18
18
  } catch {
19
19
  r = !0;
20
20
  }
21
- if (z(e), t().useMock) {
22
- w(new K(t().projectId));
21
+ if (N(e), n().useMock) {
22
+ m(new K(n().projectId));
23
23
  return;
24
24
  }
25
- let s;
25
+ let t;
26
26
  try {
27
- const a = f();
28
- s = a.secureStorage ? {
29
- getRefreshToken: () => a.secureStorage.getItem("cdp_refresh_token"),
30
- setRefreshToken: (c) => a.secureStorage.setItem("cdp_refresh_token", c),
31
- removeRefreshToken: () => a.secureStorage.removeItem("cdp_refresh_token")
27
+ const s = l();
28
+ t = s.secureStorage ? {
29
+ getRefreshToken: () => s.secureStorage.getItem("cdp_refresh_token"),
30
+ setRefreshToken: (c) => s.secureStorage.setItem("cdp_refresh_token", c),
31
+ removeRefreshToken: () => s.secureStorage.removeItem("cdp_refresh_token")
32
32
  } : void 0;
33
33
  } catch {
34
- s = void 0;
34
+ t = void 0;
35
35
  }
36
- if (A({
37
- debugging: t().debugging,
38
- basePath: t().basePath,
39
- refreshTokenStorage: s
36
+ if (h({
37
+ debugging: n().debugging,
38
+ basePath: n().basePath,
39
+ refreshTokenStorage: t
40
40
  }), r) {
41
- const a = new b(t().projectId);
42
- w(a), S(a);
41
+ const s = new b(n().projectId);
42
+ m(s), I(s);
43
43
  }
44
- await n().ensureInitialized();
45
- }, Z = async (e) => l({
44
+ await a().ensureInitialized();
45
+ }, ee = async (e) => p({
46
46
  email: e.email,
47
47
  type: "email"
48
- }), ee = async (e) => l({
48
+ }), re = async (e) => p({
49
49
  phoneNumber: e.phoneNumber,
50
50
  type: "sms"
51
- }), te = async (e) => v(
51
+ }), te = async (e) => y(
52
52
  e,
53
53
  "Mock email OTP verified",
54
- (r, s) => U(r, s)
55
- ), re = async (e) => v(
54
+ (r, t) => S(r, t)
55
+ ), ne = async (e) => y(
56
56
  e,
57
57
  "Mock SMS OTP verified",
58
- (r, s) => M(r, s)
59
- ), se = async () => n().getUser(), ne = async () => n().isSignedIn(), ae = async () => {
60
- if (t().useMock) {
61
- await n().signOut();
58
+ (r, t) => E(r, t)
59
+ ), se = async () => a().getUser(), ae = async () => a().isSignedIn(), ce = async () => {
60
+ if (n().useMock) {
61
+ await a().signOut();
62
62
  return;
63
63
  }
64
- if (!await n().isSignedIn())
64
+ if (!await a().isSignedIn())
65
65
  throw new Error("User not signed in");
66
- await n().signOut();
66
+ await a().signOut();
67
67
  try {
68
- const r = f();
68
+ const r = l();
69
69
  if (r.secureStorage)
70
70
  try {
71
71
  await r.secureStorage.removeItem("cdp_refresh_token");
72
- } catch (s) {
73
- console.warn("Failed to clear stored refresh token:", s);
72
+ } catch (t) {
73
+ console.warn("Failed to clear stored refresh token:", t);
74
74
  }
75
75
  } catch {
76
76
  }
77
- }, ce = async () => n().getToken(), oe = (e) => {
78
- n().addAuthStateChangeCallback(e);
79
- }, ie = async (e) => t().useMock ? { signature: "0x0" } : i(e, n(), async ({ user: r, walletSecretId: s }) => ({
80
- signature: (await T(t().projectId, r.userId, {
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, {
81
81
  hash: e.hash,
82
82
  address: e.evmAccount,
83
- walletSecretId: s
83
+ walletSecretId: t
84
84
  })).signature
85
- })), ue = async (e) => t().useMock ? { signedTransaction: "0x0" } : i(e, n(), async ({ user: r, walletSecretId: s }) => {
86
- const a = y(e.transaction);
85
+ })), de = async (e) => n().useMock ? { signedTransaction: "0x0" } : o(e, a(), async ({ user: r, walletSecretId: t }) => {
86
+ const s = w(e.transaction);
87
87
  return {
88
- signedTransaction: (await P(
89
- t().projectId,
88
+ signedTransaction: (await T(
89
+ n().projectId,
90
90
  r.userId,
91
91
  {
92
- transaction: a,
92
+ transaction: s,
93
93
  address: e.evmAccount,
94
- walletSecretId: s
94
+ walletSecretId: t
95
95
  }
96
96
  )).signedTransaction
97
97
  };
98
- }), de = async (e) => {
98
+ }), ge = async (e) => n().useMock ? { signedTransaction: "mock-signed-transaction" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
99
+ signedTransaction: (await M(
100
+ n().projectId,
101
+ r.userId,
102
+ {
103
+ transaction: e.transaction,
104
+ address: e.solanaAccount,
105
+ walletSecretId: t
106
+ }
107
+ )).signedTransaction
108
+ })), me = async (e) => {
99
109
  if (!_(e.network))
100
110
  throw new Error(`Chain ${e.network} is not supported by the CDP Apis`);
101
- if (t().useMock)
111
+ if (n().useMock)
102
112
  return { transactionHash: "0x0" };
103
- const r = y(e.transaction);
104
- return i(e, n(), async ({ user: s, walletSecretId: a }) => ({
113
+ const r = w(e.transaction);
114
+ return o(e, a(), async ({ user: t, walletSecretId: s }) => ({
105
115
  transactionHash: (await j(
106
- t().projectId,
107
- s.userId,
116
+ n().projectId,
117
+ t.userId,
108
118
  {
109
119
  transaction: r,
110
120
  address: e.evmAccount,
111
- walletSecretId: a,
121
+ walletSecretId: s,
112
122
  network: e.network
113
123
  }
114
124
  )).transactionHash
115
125
  }));
116
- }, me = async (e) => t().useMock ? { signature: "0x0" } : i(e, n(), async ({ user: r, walletSecretId: s }) => ({
117
- signature: (await C(t().projectId, r.userId, {
126
+ }, le = async (e) => n().useMock ? { transactionSignature: "mock-signature" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
127
+ transactionSignature: (await P(
128
+ n().projectId,
129
+ r.userId,
130
+ {
131
+ transaction: e.transaction,
132
+ address: e.solanaAccount,
133
+ walletSecretId: t,
134
+ network: e.network
135
+ }
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, {
118
139
  message: e.message,
119
140
  address: e.evmAccount,
120
- walletSecretId: s
141
+ walletSecretId: t
121
142
  })).signature
122
- })), ge = async (e) => t().useMock ? { signature: "0x0" } : i(e, n(), async ({ user: r, walletSecretId: s }) => ({
123
- signature: (await O(t().projectId, r.userId, {
143
+ })), pe = async (e) => n().useMock ? { signature: "0x0" } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
144
+ signature: (await C(n().projectId, r.userId, {
124
145
  typedData: e.typedData,
125
146
  address: e.evmAccount,
126
- walletSecretId: s
147
+ walletSecretId: t
127
148
  })).signature
128
- })), he = async (e) => t().useMock ? {
149
+ })), ye = async (e) => n().useMock ? {
129
150
  userOperationHash: "0x1234567890123456789012345678901234567890123456789012345678901234"
130
- } : i(e, n(), async ({ user: r, walletSecretId: s }) => ({
151
+ } : o(e, a(), async ({ user: r, walletSecretId: t }) => ({
131
152
  userOperationHash: (await x(
132
- t().projectId,
153
+ n().projectId,
133
154
  r.userId,
134
155
  e.evmSmartAccount,
135
156
  {
@@ -139,12 +160,12 @@ const Y = async (e) => {
139
160
  value: String(c.value ?? 0n),
140
161
  data: c.data ?? "0x"
141
162
  })),
142
- walletSecretId: s,
163
+ walletSecretId: t,
143
164
  useCdpPaymaster: e.useCdpPaymaster ?? !1,
144
165
  paymasterUrl: e.paymasterUrl
145
166
  }
146
167
  )).userOpHash
147
- })), pe = async (e) => t().useMock ? {
168
+ })), fe = async (e) => n().useMock ? {
148
169
  userOpHash: e.userOperationHash,
149
170
  network: e.network,
150
171
  calls: [
@@ -157,122 +178,155 @@ const Y = async (e) => {
157
178
  status: "complete",
158
179
  transactionHash: "0x9876543210987654321098765432109876543210987654321098765432109876",
159
180
  receipts: []
160
- } : i(e, n(), async ({ user: r }) => await H(
161
- t().projectId,
181
+ } : o(e, a(), async ({ user: r }) => await W(
182
+ n().projectId,
162
183
  r.userId,
163
184
  e.evmSmartAccount,
164
185
  e.userOperationHash
165
- )), we = async (e) => {
166
- if (t().useMock)
186
+ )), he = async (e) => {
187
+ if (n().useMock)
167
188
  return {
168
189
  privateKey: "mock-private-key"
169
190
  };
170
- const r = D(), s = await r.createExportKeyPair();
171
- return i(e, n(), async ({ user: a, walletSecretId: c }) => {
172
- const o = await W(t().projectId, a.userId, {
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, {
173
194
  address: e.evmAccount,
174
195
  walletSecretId: c,
175
- exportEncryptionKey: s.publicKeyBase64
196
+ exportEncryptionKey: t.publicKeyBase64
176
197
  });
177
198
  return {
178
199
  privateKey: await r.decryptWithPrivateKey(
179
- s.privateKey,
180
- o.encryptedPrivateKey
200
+ t.privateKey,
201
+ i.encryptedPrivateKey
181
202
  )
182
203
  };
183
204
  });
184
- }, l = async (e) => {
185
- if (t().useMock)
205
+ }, p = async (e) => {
206
+ if (n().useMock)
186
207
  return {
187
208
  message: "Mock sign in initiated",
188
209
  flowId: "mock-flow-id"
189
210
  };
190
- if (await n().isSignedIn())
211
+ if (await a().isSignedIn())
191
212
  throw new Error("User is already authenticated. Please sign out first.");
192
- const s = await k(t().projectId, e);
213
+ const t = await A(n().projectId, e);
193
214
  return {
194
- flowId: s.flowId,
195
- message: s.message
215
+ flowId: t.flowId,
216
+ message: t.message
196
217
  };
197
- }, v = async (e, r, s) => {
198
- if (t().useMock)
199
- return await n().setAuthState({
218
+ }, y = async (e, r, t) => {
219
+ if (n().useMock)
220
+ return await a().setAuthState({
200
221
  accessToken: "mock-access-token",
201
222
  expiresAt: Date.now() + 1e3 * 60 * 60 * 24,
202
- user: p
223
+ user: g
203
224
  }), {
204
225
  message: r,
205
- user: p,
226
+ user: g,
206
227
  isNewUser: !1
207
228
  };
208
- if (await n().isSignedIn())
229
+ if (await a().isSignedIn())
209
230
  throw new Error("User is already authenticated. Please sign out first.");
210
- const c = await s(t().projectId, {
231
+ const c = await t(n().projectId, {
211
232
  flowId: e.flowId,
212
233
  otp: e.otp
213
- });
214
- let o = m(c.accessToken, c.validUntil, c.endUser);
215
- if (await n().setAuthState(o), !o.user.evmAccounts || o.user.evmAccounts.length === 0)
234
+ }), i = u(
235
+ c.accessToken,
236
+ c.validUntil,
237
+ c.endUser
238
+ );
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)
216
245
  try {
217
- const u = await n().getWalletSecretId();
218
- let d = await E(t().projectId, o.user.userId, {
219
- walletSecretId: u
246
+ const s = await a().getWalletSecretId();
247
+ let c = await k(n().projectId, r.user.userId, {
248
+ walletSecretId: s
220
249
  });
221
- if (t().createAccountOnLogin === "evm-smart") {
222
- const [I] = d.evmAccounts;
223
- d = await h(
224
- t().projectId,
225
- o.user.userId,
250
+ if (n().createAccountOnLogin === "evm-smart") {
251
+ const [i] = c.evmAccounts;
252
+ c = await d(
253
+ n().projectId,
254
+ r.user.userId,
226
255
  {
227
- owner: I,
256
+ owner: i,
228
257
  enableSpendPermissions: !1
229
258
  // Defaulting to false until the feature is ready.
230
259
  }
231
260
  );
232
261
  }
233
- o = m(c.accessToken, c.validUntil, d), await n().setAuthState(o);
234
- } catch (u) {
235
- throw new Error(`Failed to create EVM account: ${u}`);
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}`);
236
265
  }
237
- if (t().createAccountOnLogin === "evm-smart" && (!o.user.evmSmartAccounts || o.user.evmSmartAccounts.length === 0))
266
+ if (n().createAccountOnLogin === "evm-smart" && (!r.user.evmSmartAccounts || r.user.evmSmartAccounts.length === 0))
238
267
  try {
239
- const [u] = o.user.evmAccounts, d = await h(
240
- t().projectId,
241
- o.user.userId,
268
+ const [s] = r.user.evmAccounts, c = await d(
269
+ n().projectId,
270
+ r.user.userId,
242
271
  {
243
- owner: u,
272
+ owner: s,
244
273
  enableSpendPermissions: !1
245
274
  // Defaulting to false until the feature is ready.
246
275
  }
247
276
  );
248
- o = m(c.accessToken, c.validUntil, d), await n().setAuthState(o);
249
- } catch (u) {
250
- throw new Error(`Failed to create EVM Smart Account: ${u}`);
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}`);
251
280
  }
252
- const g = await n().getUser();
281
+ const t = await a().getUser();
253
282
  return {
254
- message: c.message,
255
- user: g,
256
- isNewUser: c.isNewEndUser
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
+ try {
293
+ const s = await a().getWalletSecretId(), c = await v(
294
+ n().projectId,
295
+ r.user.userId,
296
+ {
297
+ walletSecretId: s
298
+ }
299
+ );
300
+ r = u(e.accessToken, e.validUntil, c), await a().setAuthState(r);
301
+ } catch (s) {
302
+ throw new Error(`Failed to create Solana account: ${s}`);
303
+ }
304
+ const t = await a().getUser();
305
+ return {
306
+ message: e.message,
307
+ user: t,
308
+ isNewUser: e.isNewEndUser
257
309
  };
258
310
  };
259
311
  export {
260
- we as exportEvmAccount,
261
- ce as getAccessToken,
312
+ he as exportEvmAccount,
313
+ oe as getAccessToken,
262
314
  se as getCurrentUser,
263
- pe as getUserOperation,
264
- Y as initialize,
265
- ne as isSignedIn,
266
- oe as onAuthStateChange,
267
- de as sendEvmTransaction,
268
- he as sendUserOperation,
269
- ie as signEvmHash,
270
- me as signEvmMessage,
271
- ue as signEvmTransaction,
272
- ge as signEvmTypedData,
273
- Z as signInWithEmail,
274
- ee as signInWithSms,
275
- ae as signOut,
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,
327
+ re as signInWithSms,
328
+ ce as signOut,
329
+ ge as signSolanaTransaction,
276
330
  te as verifyEmailOTP,
277
- re as verifySmsOTP
331
+ ne as verifySmsOTP
278
332
  };
@@ -1,4 +1,4 @@
1
- import { EvmAddress, User } from '../types.js';
1
+ import { EvmAddress, SolanaAddress, User } from '../types.js';
2
2
  import { IAuthManager } from './types.js';
3
3
  export declare const isSignedIn: (authManager: IAuthManager) => Promise<boolean>;
4
4
  type AuthenticatedFunction<T, R> = (params: T & {
@@ -9,5 +9,7 @@ export declare function withAuth<T, R>(options: T & ({
9
9
  evmAccount: EvmAddress;
10
10
  } | {
11
11
  evmSmartAccount: EvmAddress;
12
+ } | {
13
+ solanaAccount: SolanaAddress;
12
14
  }), authManager: IAuthManager, fn: AuthenticatedFunction<T, R>): Promise<R>;
13
15
  export {};
@@ -1,4 +1,4 @@
1
- import { Config, User, SignInWithEmailOptions, SignInWithEmailResult, SignInWithSmsOptions, SignInWithSmsResult, VerifySmsOTPOptions, VerifySmsOTPResult, SignEvmHashOptions, SignEvmHashResult, VerifyEmailOTPOptions, VerifyEmailOTPResult, OnAuthStateChangeFn, SendEvmTransactionResult, SignEvmTransactionOptions, SignEvmTransactionResult, SignEvmTypedDataOptions, SignEvmTypedDataResult, SignEvmMessageOptions, ExportEvmAccountResult, SendEvmTransactionOptions, ExportEvmAccountOptions, SendUserOperationOptions, SendUserOperationResult, GetUserOperationOptions, GetUserOperationResult } from './types.js';
1
+ import { Config, User, SignInWithEmailOptions, SignInWithEmailResult, SignInWithSmsOptions, SignInWithSmsResult, VerifySmsOTPOptions, VerifySmsOTPResult, SignEvmHashOptions, SignEvmHashResult, VerifyEmailOTPOptions, VerifyEmailOTPResult, OnAuthStateChangeFn, SendEvmTransactionResult, SignEvmTransactionOptions, SignEvmTransactionResult, SignSolanaTransactionOptions, SignSolanaTransactionResult, SignEvmTypedDataOptions, SignEvmTypedDataResult, SignEvmMessageOptions, ExportEvmAccountResult, SendEvmTransactionOptions, SendSolanaTransactionOptions, SendSolanaTransactionResult, ExportEvmAccountOptions, SendUserOperationOptions, SendUserOperationResult, GetUserOperationOptions, GetUserOperationResult } from './types.js';
2
2
  export declare const initialize: (cfg: Config) => Promise<void>;
3
3
  export declare const signInWithEmail: (options: SignInWithEmailOptions) => Promise<SignInWithEmailResult>;
4
4
  export declare const signInWithSms: (options: SignInWithSmsOptions) => Promise<SignInWithSmsResult>;
@@ -11,7 +11,9 @@ export declare const getAccessToken: () => Promise<string | null>;
11
11
  export declare const onAuthStateChange: (callback: OnAuthStateChangeFn) => void;
12
12
  export declare const signEvmHash: (options: SignEvmHashOptions) => Promise<SignEvmHashResult>;
13
13
  export declare const signEvmTransaction: (options: SignEvmTransactionOptions) => Promise<SignEvmTransactionResult>;
14
+ export declare const signSolanaTransaction: (options: SignSolanaTransactionOptions) => Promise<SignSolanaTransactionResult>;
14
15
  export declare const sendEvmTransaction: (options: SendEvmTransactionOptions) => Promise<SendEvmTransactionResult>;
16
+ export declare const sendSolanaTransaction: (options: SendSolanaTransactionOptions) => Promise<SendSolanaTransactionResult>;
15
17
  export declare const signEvmMessage: (options: SignEvmMessageOptions) => Promise<SignEvmHashResult>;
16
18
  export declare const signEvmTypedData: (options: SignEvmTypedDataOptions) => Promise<SignEvmTypedDataResult>;
17
19
  export declare const sendUserOperation: (options: SendUserOperationOptions) => Promise<SendUserOperationResult>;
@@ -1,15 +1,16 @@
1
- import { SendEvmTransactionWithEndUserAccountBodyNetwork, APIError, APIErrorType, ErrorType, HttpErrorType, EvmUserOperation } from '@coinbase/cdp-api-client';
1
+ import { SendEvmTransactionWithEndUserAccountBodyNetwork, SendSolanaTransactionWithEndUserAccountBodyNetwork, APIError, APIErrorType, ErrorType, HttpErrorType, EvmUserOperation } from '@coinbase/cdp-api-client';
2
2
  import { TransactionSerializableEIP1559 } from 'viem';
3
- export { APIError, type APIErrorType, ErrorType, HttpErrorType, SendEvmTransactionWithEndUserAccountBodyNetwork, };
3
+ export { APIError, type APIErrorType, ErrorType, HttpErrorType, SendEvmTransactionWithEndUserAccountBodyNetwork, SendSolanaTransactionWithEndUserAccountBodyNetwork, };
4
4
  export type Config = {
5
5
  projectId: string;
6
6
  useMock?: boolean;
7
7
  debugging?: boolean;
8
8
  basePath?: string;
9
- createAccountOnLogin?: "evm-eoa" | "evm-smart";
9
+ createAccountOnLogin?: "evm-eoa" | "evm-smart" | "solana";
10
10
  };
11
11
  export type Hex = `0x${string}`;
12
12
  export type EvmAddress = `0x${string}`;
13
+ export type SolanaAddress = string;
13
14
  export type AuthenticationMethods = {
14
15
  email?: EmailAuthentication;
15
16
  sms?: SmsAuthentication;
@@ -19,6 +20,7 @@ export type User = {
19
20
  authenticationMethods: AuthenticationMethods;
20
21
  evmAccounts?: EvmAddress[];
21
22
  evmSmartAccounts?: EvmAddress[];
23
+ solanaAccounts?: SolanaAddress[];
22
24
  };
23
25
  export type EmailAuthentication = {
24
26
  type: "email";
@@ -76,6 +78,13 @@ export type SignEvmTransactionOptions = {
76
78
  export type SignEvmTransactionResult = {
77
79
  signedTransaction: Hex;
78
80
  };
81
+ export type SignSolanaTransactionOptions = {
82
+ solanaAccount: SolanaAddress;
83
+ transaction: string;
84
+ };
85
+ export type SignSolanaTransactionResult = {
86
+ signedTransaction: string;
87
+ };
79
88
  export type SendEvmTransactionOptions = {
80
89
  evmAccount: EvmAddress;
81
90
  network: SendEvmTransactionWithEndUserAccountBodyNetwork;
@@ -84,6 +93,14 @@ export type SendEvmTransactionOptions = {
84
93
  export type SendEvmTransactionResult = {
85
94
  transactionHash: Hex;
86
95
  };
96
+ export type SendSolanaTransactionOptions = {
97
+ solanaAccount: SolanaAddress;
98
+ network: SendSolanaTransactionWithEndUserAccountBodyNetwork;
99
+ transaction: string;
100
+ };
101
+ export type SendSolanaTransactionResult = {
102
+ transactionSignature: string;
103
+ };
87
104
  export type SignEvmMessageOptions = {
88
105
  evmAccount: EvmAddress;
89
106
  message: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-core",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**",
@@ -25,7 +25,7 @@
25
25
  "ox": "0.8.1",
26
26
  "viem": "^2.33.0",
27
27
  "zustand": "^5.0.6",
28
- "@coinbase/cdp-api-client": "^0.0.33"
28
+ "@coinbase/cdp-api-client": "^0.0.35"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@react-native-async-storage/async-storage": "^2.0.0",