@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,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;
@@ -1,47 +1,50 @@
1
1
  import { setPlatformServices as r } from "./index.web2.js";
2
- import { webCrypto as e } from "./index.web3.js";
3
- import { webStorage as o } from "./index.web4.js";
4
- import { exportEvmAccount as g, getAccessToken as c, getCurrentUser as f, getUserOperation as d, initialize as v, isSignedIn as T, onAuthStateChange as u, sendEvmTransaction as A, sendUserOperation as S, signEvmHash as l, signEvmMessage as x, signEvmTransaction as y, signEvmTypedData as h, signInWithEmail as O, signInWithSms as P, signOut as C, verifyEmailOTP as D, verifySmsOTP as I } from "./index.web5.js";
5
- import { AuthManager as U } from "./index.web6.js";
6
- import { APIError as b, ErrorType as w, HttpErrorType as M, SendEvmTransactionWithEndUserAccountBodyNetwork as k } from "@coinbase/cdp-api-client";
2
+ import { webCrypto as o } from "./index.web3.js";
3
+ import { webStorage as e } from "./index.web4.js";
4
+ import { exportEvmAccount as c, getAccessToken as g, getCurrentUser as d, getUserOperation as f, initialize as S, isSignedIn as T, onAuthStateChange as l, sendEvmTransaction as v, sendSolanaTransaction as u, sendUserOperation as A, signEvmHash as y, signEvmMessage as h, signEvmTransaction as x, signEvmTypedData as O, signInWithEmail as P, signInWithSms as C, signOut as D, signSolanaTransaction as I, verifyEmailOTP as R, verifySmsOTP as U } from "./index.web5.js";
5
+ import { AuthManager as w } from "./index.web6.js";
6
+ import { APIError as k, ErrorType as M, HttpErrorType as N, SendEvmTransactionWithEndUserAccountBodyNetwork as B, SendSolanaTransactionWithEndUserAccountBodyNetwork as H } from "@coinbase/cdp-api-client";
7
7
  import "viem";
8
- import { createCDPEmbeddedWallet as N } from "./index.web7.js";
9
- import { EIP1193ProviderError as z, STANDARD_ERROR_CODES as B } from "./index.web8.js";
8
+ import { createCDPEmbeddedWallet as z } from "./index.web7.js";
9
+ import { EIP1193ProviderError as j, STANDARD_ERROR_CODES as q } from "./index.web8.js";
10
10
  import "ox";
11
11
  import "zustand";
12
- import { toViemAccount as j } from "./index.web9.js";
13
- import { ModuleResolutionError as F } from "./index.web10.js";
12
+ import { toViemAccount as G } from "./index.web9.js";
13
+ import { ModuleResolutionError as K } from "./index.web10.js";
14
14
  r({
15
- crypto: e,
16
- storage: o
15
+ crypto: o,
16
+ storage: e
17
17
  });
18
18
  export {
19
- b as APIError,
20
- U as AuthManager,
21
- z as EIP1193ProviderError,
22
- w as ErrorType,
23
- M as HttpErrorType,
24
- F as ModuleResolutionError,
25
- B as STANDARD_ERROR_CODES,
26
- k as SendEvmTransactionWithEndUserAccountBodyNetwork,
27
- N as createCDPEmbeddedWallet,
28
- g as exportEvmAccount,
29
- c as getAccessToken,
30
- f as getCurrentUser,
31
- d as getUserOperation,
32
- v as initialize,
19
+ k as APIError,
20
+ w as AuthManager,
21
+ j as EIP1193ProviderError,
22
+ M as ErrorType,
23
+ N as HttpErrorType,
24
+ K as ModuleResolutionError,
25
+ q as STANDARD_ERROR_CODES,
26
+ B as SendEvmTransactionWithEndUserAccountBodyNetwork,
27
+ H as SendSolanaTransactionWithEndUserAccountBodyNetwork,
28
+ z as createCDPEmbeddedWallet,
29
+ c as exportEvmAccount,
30
+ g as getAccessToken,
31
+ d as getCurrentUser,
32
+ f as getUserOperation,
33
+ S as initialize,
33
34
  T as isSignedIn,
34
- u as onAuthStateChange,
35
- A as sendEvmTransaction,
36
- S as sendUserOperation,
37
- l as signEvmHash,
38
- x as signEvmMessage,
39
- y as signEvmTransaction,
40
- h as signEvmTypedData,
41
- O as signInWithEmail,
42
- P as signInWithSms,
43
- C as signOut,
44
- j as toViemAccount,
45
- D as verifyEmailOTP,
46
- I as verifySmsOTP
35
+ l as onAuthStateChange,
36
+ v as sendEvmTransaction,
37
+ u as sendSolanaTransaction,
38
+ A as sendUserOperation,
39
+ y as signEvmHash,
40
+ h as signEvmMessage,
41
+ x as signEvmTransaction,
42
+ O as signEvmTypedData,
43
+ P as signInWithEmail,
44
+ C as signInWithSms,
45
+ D as signOut,
46
+ I as signSolanaTransaction,
47
+ G as toViemAccount,
48
+ R as verifyEmailOTP,
49
+ U as verifySmsOTP
47
50
  };
@@ -1,17 +1,18 @@
1
1
  import "@coinbase/cdp-api-client";
2
- const r = (u, c, e) => {
3
- const s = new Date(c).getTime(), m = {
2
+ const m = (c, a, e) => {
3
+ const s = new Date(a).getTime(), u = {
4
4
  userId: e.userId,
5
5
  evmAccounts: e.evmAccounts?.map((t) => t) ?? [],
6
6
  evmSmartAccounts: e.evmSmartAccounts?.map((t) => t) ?? [],
7
+ solanaAccounts: e.solanaAccounts?.map((t) => t) ?? [],
7
8
  authenticationMethods: e.authenticationMethods.reduce((t, o) => (t[o.type] = o, t), {})
8
9
  };
9
10
  return {
10
- accessToken: u,
11
+ accessToken: c,
11
12
  expiresAt: s,
12
- user: m
13
+ user: u
13
14
  };
14
15
  };
15
16
  export {
16
- r as toAuthState
17
+ m as toAuthState
17
18
  };
@@ -1,18 +1,20 @@
1
1
  import "@coinbase/cdp-api-client";
2
2
  import "viem";
3
- const o = async (t) => await t.isSignedIn();
4
- async function w(t, n, e) {
5
- if (!await o(n))
3
+ const i = async (n) => await n.isSignedIn();
4
+ async function f(n, r, o) {
5
+ if (!await i(r))
6
6
  throw new Error("User not signed in");
7
- const r = await n.getUser();
8
- if ("evmAccount" in t && !r.evmAccounts?.find((c) => c === t.evmAccount))
7
+ const c = await r.getUser();
8
+ if ("evmAccount" in n && !c.evmAccounts?.find((t) => t === n.evmAccount))
9
9
  throw new Error("EVM account not found");
10
- if ("evmSmartAccount" in t && !r.evmSmartAccounts?.find((c) => c === t.evmSmartAccount))
10
+ if ("evmSmartAccount" in n && !c.evmSmartAccounts?.find((t) => t === n.evmSmartAccount))
11
11
  throw new Error("EVM Smart Account not found");
12
- const i = await n.getWalletSecretId();
13
- return e({ ...t, user: r, walletSecretId: i });
12
+ if ("solanaAccount" in n && !c.solanaAccounts?.find((t) => t === n.solanaAccount))
13
+ throw new Error("Solana account not found");
14
+ const e = await r.getWalletSecretId();
15
+ return o({ ...n, user: c, walletSecretId: e });
14
16
  }
15
17
  export {
16
- o as isSignedIn,
17
- w as withAuth
18
+ i as isSignedIn,
19
+ f as withAuth
18
20
  };
@@ -3,6 +3,7 @@ import "viem";
3
3
  const t = "0x0000000000000000000000000000000000000000", s = {
4
4
  userId: "mock-user-id",
5
5
  evmAccounts: [t],
6
+ solanaAccounts: ["5fNfvyp5f3BB9T24s6bC8QjDXuJqvU8WjziJpEQi9PWT"],
6
7
  authenticationMethods: {
7
8
  email: {
8
9
  type: "email",