@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,19 +1,19 @@
1
1
  import { b as m } from "./index.web21.js";
2
- import { configureCdpApiClient as C, setAuthManager as M, initiateAuthentication as O, createEndUserEvmAccount as T, createEndUserEvmSmartAccount as A, createEndUserSolanaAccount as P, verifyEmailAuthentication as b, verifySmsAuthentication as j, verifyOAuthCode as x, signEvmHashWithEndUserAccount as K, signEvmTransactionWithEndUserAccount as W, signSolanaTransactionWithEndUserAccount as H, sendEvmTransactionWithEndUserAccount as B, sendSolanaTransactionWithEndUserAccount as D, signEvmMessageWithEndUserAccount as L, signSolanaMessageWithEndUserAccount as N, signEvmTypedDataWithEndUserAccount as F, sendUserOperationWithEndUserAccount as z, getUserOperationWithEndUserAccount as R, exportEndUserEvmAccount as $, exportEndUserSolanaAccount as V } from "@coinbase/cdp-api-client";
2
+ import { configureCdpApiClient as C, setAuthManager as M, initiateAuthentication as T, createEndUserEvmAccount as O, createEndUserEvmSmartAccount as A, createEndUserSolanaAccount as P, verifyEmailAuthentication as b, verifySmsAuthentication as x, verifyOAuthCode as j, signEvmHashWithEndUserAccount as K, signEvmTransactionWithEndUserAccount as W, signSolanaTransactionWithEndUserAccount as H, sendEvmTransactionWithEndUserAccount as B, sendSolanaTransactionWithEndUserAccount as D, signEvmMessageWithEndUserAccount as L, signSolanaMessageWithEndUserAccount as N, signEvmTypedDataWithEndUserAccount as F, sendUserOperationWithEndUserAccount as z, getUserOperationWithEndUserAccount as R, exportEndUserEvmAccount as $, exportEndUserSolanaAccount as V } from "@coinbase/cdp-api-client";
3
3
  import { Analytics as c } from "./index.web22.js";
4
4
  import "./index.web23.js";
5
5
  import { Keypair as v } from "@solana/web3.js";
6
6
  import w from "bs58";
7
7
  import { AuthManager as q } from "./index.web15.js";
8
8
  import { OAuthManager as G } from "./index.web24.js";
9
- import { toAuthState as h } from "./index.web25.js";
9
+ import { toAuthState as p } from "./index.web25.js";
10
10
  import { withAuth as u } from "./index.web26.js";
11
11
  import { MockAuthManager as J } from "./index.web27.js";
12
12
  import { MockOAuthManager as Q } from "./index.web28.js";
13
13
  import { mockUser as k } from "./index.web29.js";
14
14
  import { getPlatformServices as g, getPlatformCrypto as _ } from "./index.web2.js";
15
15
  import { isChainSupportedForCDPSends as X } from "./index.web30.js";
16
- import { getConfig as a, setCoreAuthManager as I, setCoreOAuthManager as E, getCoreAuthManager as o, getCoreOAuthManager as Y, setConfig as Z } from "./index.web31.js";
16
+ import { getConfig as a, setCoreAuthManager as E, setCoreOAuthManager as I, getCoreAuthManager as o, getCoreOAuthManager as Y, setConfig as Z } from "./index.web31.js";
17
17
  import "viem";
18
18
  import { serializeTransaction as U } from "./index.web32.js";
19
19
  const we = async (e) => {
@@ -27,7 +27,7 @@ const we = async (e) => {
27
27
  r = !0;
28
28
  }
29
29
  if (Z(e), a().useMock) {
30
- I(new J(a().projectId)), E(new Q());
30
+ E(new J(a().projectId)), I(new Q());
31
31
  return;
32
32
  }
33
33
  let n;
@@ -54,18 +54,18 @@ const we = async (e) => {
54
54
  refreshTokenStorage: n
55
55
  }), r) {
56
56
  const t = new G();
57
- E(t);
57
+ I(t);
58
58
  const s = new q(a().projectId);
59
- I(s), M(s);
59
+ E(s), M(s);
60
60
  }
61
61
  await o().ensureInitialized();
62
62
  }, ke = async (e) => (c.sendActionCallEvent({ name: "sign_in_with_email" }), f({
63
63
  email: e.email,
64
64
  type: "email"
65
- })), Ie = async (e) => (c.sendActionCallEvent({ name: "sign_in_with_sms" }), f({
65
+ })), Ee = async (e) => (c.sendActionCallEvent({ name: "sign_in_with_sms" }), f({
66
66
  phoneNumber: e.phoneNumber,
67
67
  type: "sms"
68
- })), Ee = async (e) => {
68
+ })), Ie = async (e) => {
69
69
  c.sendActionCallEvent({ name: "sign_in_with_oauth" });
70
70
  const r = g().oauth.getRedirectUrl();
71
71
  if (a().useMock) {
@@ -85,12 +85,12 @@ const we = async (e) => {
85
85
  )), _e = async (e) => (c.sendActionCallEvent({ name: "verify_sms_otp" }), y(
86
86
  e,
87
87
  "Mock SMS OTP verified",
88
- (r, n) => j(r, n)
88
+ (r, n) => x(r, n)
89
89
  )), Ue = async (e) => (c.sendActionCallEvent({ name: "verify_oauth" }), y(
90
90
  e,
91
91
  "Mock OAuth code verified",
92
- (r, n) => x(r, n.providerType, n)
93
- )), Ce = async () => (c.sendActionCallEvent({ name: "get_current_user" }), o().getUser()), Me = async () => (c.sendActionCallEvent({ name: "is_signed_in" }), o().isSignedIn()), Oe = async () => {
92
+ (r, n) => j(r, n.providerType, n)
93
+ )), Ce = async () => (c.sendActionCallEvent({ name: "get_current_user" }), o().getUser()), Me = async () => (c.sendActionCallEvent({ name: "is_signed_in" }), o().isSignedIn()), Te = async () => {
94
94
  if (c.sendActionCallEvent({ name: "sign_out" }), a().useMock) {
95
95
  await o().signOut();
96
96
  return;
@@ -98,9 +98,9 @@ const we = async (e) => {
98
98
  if (!await o().isSignedIn())
99
99
  throw new Error("User not signed in");
100
100
  await o().signOut();
101
- }, Te = async () => (c.sendActionCallEvent({ name: "get_access_token" }), o().getToken()), Pe = (e) => {
101
+ }, Oe = async () => (c.sendActionCallEvent({ name: "get_access_token" }), o().getToken()), Pe = async () => (c.sendActionCallEvent({ name: "get_access_token_expiration" }), o().getTokenExpiration()), be = (e) => {
102
102
  o().addAuthStateChangeCallback(e);
103
- }, be = (e) => {
103
+ }, xe = (e) => {
104
104
  Y().addOAuthStateChangeCallback(e);
105
105
  }, je = async (e) => (c.sendActionCallEvent({ name: "sign_evm_hash" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
106
106
  signature: (await K(a().projectId, r.userId, {
@@ -108,7 +108,7 @@ const we = async (e) => {
108
108
  address: e.evmAccount,
109
109
  walletSecretId: n
110
110
  })).signature
111
- }))), xe = async (e) => (c.sendActionCallEvent({ name: "sign_evm_transaction" }), a().useMock ? { signedTransaction: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => {
111
+ }))), Ke = async (e) => (c.sendActionCallEvent({ name: "sign_evm_transaction" }), a().useMock ? { signedTransaction: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => {
112
112
  const t = U(e.transaction);
113
113
  return {
114
114
  signedTransaction: (await W(
@@ -121,7 +121,7 @@ const we = async (e) => {
121
121
  }
122
122
  )).signedTransaction
123
123
  };
124
- })), Ke = async (e) => (c.sendActionCallEvent({ name: "sign_solana_transaction" }), a().useMock ? { signedTransaction: "mock-signed-transaction" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
124
+ })), We = async (e) => (c.sendActionCallEvent({ name: "sign_solana_transaction" }), a().useMock ? { signedTransaction: "mock-signed-transaction" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
125
125
  signedTransaction: (await H(
126
126
  a().projectId,
127
127
  r.userId,
@@ -131,7 +131,7 @@ const we = async (e) => {
131
131
  walletSecretId: n
132
132
  }
133
133
  )).signedTransaction
134
- }))), We = async (e) => {
134
+ }))), He = async (e) => {
135
135
  if (c.sendActionCallEvent({ name: "send_evm_transaction" }), !X(e.network))
136
136
  throw new Error(`Chain ${e.network} is not supported by the CDP Apis`);
137
137
  if (a().useMock)
@@ -149,7 +149,7 @@ const we = async (e) => {
149
149
  }
150
150
  )).transactionHash
151
151
  }));
152
- }, He = async (e) => (c.sendActionCallEvent({ name: "send_solana_transaction" }), a().useMock ? { transactionSignature: "mock-signature" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
152
+ }, Be = async (e) => (c.sendActionCallEvent({ name: "send_solana_transaction" }), a().useMock ? { transactionSignature: "mock-signature" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
153
153
  transactionSignature: (await D(
154
154
  a().projectId,
155
155
  r.userId,
@@ -160,13 +160,13 @@ const we = async (e) => {
160
160
  network: e.network
161
161
  }
162
162
  )).transactionSignature
163
- }))), Be = async (e) => (c.sendActionCallEvent({ name: "sign_evm_message" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
163
+ }))), De = async (e) => (c.sendActionCallEvent({ name: "sign_evm_message" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
164
164
  signature: (await L(a().projectId, r.userId, {
165
165
  message: e.message,
166
166
  address: e.evmAccount,
167
167
  walletSecretId: n
168
168
  })).signature
169
- }))), De = async (e) => (c.sendActionCallEvent({ name: "sign_solana_message" }), a().useMock ? { signature: "mockSignature" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
169
+ }))), Le = async (e) => (c.sendActionCallEvent({ name: "sign_solana_message" }), a().useMock ? { signature: "mockSignature" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
170
170
  signature: (await N(
171
171
  a().projectId,
172
172
  r.userId,
@@ -176,13 +176,13 @@ const we = async (e) => {
176
176
  walletSecretId: n
177
177
  }
178
178
  )).signature
179
- }))), Le = async (e) => (c.sendActionCallEvent({ name: "sign_evm_typed_data" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
179
+ }))), Ne = async (e) => (c.sendActionCallEvent({ name: "sign_evm_typed_data" }), a().useMock ? { signature: "0x0" } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
180
180
  signature: (await F(a().projectId, r.userId, {
181
181
  typedData: e.typedData,
182
182
  address: e.evmAccount,
183
183
  walletSecretId: n
184
184
  })).signature
185
- }))), Ne = async (e) => (c.sendActionCallEvent({ name: "send_user_operation" }), a().useMock ? {
185
+ }))), Fe = async (e) => (c.sendActionCallEvent({ name: "send_user_operation" }), a().useMock ? {
186
186
  userOperationHash: "0x1234567890123456789012345678901234567890123456789012345678901234"
187
187
  } : u(e, o(), async ({ user: r, walletSecretId: n }) => ({
188
188
  userOperationHash: (await z(
@@ -201,7 +201,7 @@ const we = async (e) => {
201
201
  paymasterUrl: e.paymasterUrl
202
202
  }
203
203
  )).userOpHash
204
- }))), Fe = async (e) => (c.sendActionCallEvent({ name: "get_user_operation" }), a().useMock ? {
204
+ }))), ze = async (e) => (c.sendActionCallEvent({ name: "get_user_operation" }), a().useMock ? {
205
205
  userOpHash: e.userOperationHash,
206
206
  network: e.network,
207
207
  calls: [
@@ -219,7 +219,7 @@ const we = async (e) => {
219
219
  r.userId,
220
220
  e.evmSmartAccount,
221
221
  e.userOperationHash
222
- ))), ze = async (e) => {
222
+ ))), Re = async (e) => {
223
223
  if (c.sendActionCallEvent({ name: "export_evm_account" }), a().useMock)
224
224
  return {
225
225
  privateKey: m.Buffer.from("mock-private-key").toString("hex")
@@ -238,7 +238,7 @@ const we = async (e) => {
238
238
  privateKey: m.Buffer.from(d).toString("hex")
239
239
  };
240
240
  });
241
- }, Re = async (e) => {
241
+ }, $e = async (e) => {
242
242
  if (c.sendActionCallEvent({ name: "export_solana_account" }), a().useMock) {
243
243
  const t = m.Buffer.from("mock-private-key").subarray(0, 32), s = m.Buffer.alloc(32);
244
244
  t.copy(s);
@@ -256,9 +256,9 @@ const we = async (e) => {
256
256
  }), d = await r.decryptWithPrivateKey(
257
257
  n.privateKey,
258
258
  i.encryptedPrivateKey
259
- ), l = v.fromSeed(new Uint8Array(d)), p = m.Buffer.concat([l.secretKey.subarray(0, 32), l.publicKey.toBytes()]);
259
+ ), l = v.fromSeed(new Uint8Array(d)), h = m.Buffer.concat([l.secretKey.subarray(0, 32), l.publicKey.toBytes()]);
260
260
  return {
261
- privateKey: w.encode(p)
261
+ privateKey: w.encode(h)
262
262
  };
263
263
  });
264
264
  }, f = async (e) => {
@@ -272,7 +272,7 @@ const we = async (e) => {
272
272
  };
273
273
  if (await o().isSignedIn())
274
274
  throw new Error("User is already authenticated. Please sign out first.");
275
- const n = await O(a().projectId, e);
275
+ const n = await T(a().projectId, e);
276
276
  return "authUrl" in n ? {
277
277
  flowId: n.flowId,
278
278
  authUrl: n.authUrl
@@ -292,7 +292,7 @@ const we = async (e) => {
292
292
  isNewUser: !1
293
293
  };
294
294
  const t = await n(a().projectId, e);
295
- let s = h(
295
+ let s = p(
296
296
  t.accessToken,
297
297
  t.validUntil,
298
298
  t.endUser
@@ -315,22 +315,22 @@ const we = async (e) => {
315
315
  if (!r.user.evmAccounts || r.user.evmAccounts.length === 0)
316
316
  try {
317
317
  const s = await o().getWalletSecretId();
318
- let i = await T(a().projectId, r.user.userId, {
318
+ let i = await O(a().projectId, r.user.userId, {
319
319
  walletSecretId: s
320
320
  }), d = !1;
321
321
  const l = a().ethereum;
322
322
  if (l?.createOnLogin === "smart" && (d = l.enableSpendPermissions ?? !1), n === "smart") {
323
- const [p] = i.evmAccounts;
323
+ const [h] = i.evmAccounts;
324
324
  i = await A(
325
325
  a().projectId,
326
326
  r.user.userId,
327
327
  {
328
- owner: p,
328
+ owner: h,
329
329
  enableSpendPermissions: d
330
330
  }
331
331
  );
332
332
  }
333
- t = h(e.accessToken, e.validUntil, i), await o().setAuthState(t);
333
+ t = p(e.accessToken, e.validUntil, i), await o().setAuthState(t);
334
334
  } catch (s) {
335
335
  throw new Error(`Failed to create EVM account: ${s}`);
336
336
  }
@@ -345,7 +345,7 @@ const we = async (e) => {
345
345
  // Defaulting to false until the feature is ready.
346
346
  }
347
347
  );
348
- t = h(e.accessToken, e.validUntil, i), await o().setAuthState(t);
348
+ t = p(e.accessToken, e.validUntil, i), await o().setAuthState(t);
349
349
  } catch (s) {
350
350
  throw new Error(`Failed to create EVM Smart Account: ${s}`);
351
351
  }
@@ -361,35 +361,36 @@ const we = async (e) => {
361
361
  walletSecretId: t
362
362
  }
363
363
  );
364
- n = h(e.accessToken, e.validUntil, s), await o().setAuthState(n);
364
+ n = p(e.accessToken, e.validUntil, s), await o().setAuthState(n);
365
365
  } catch (t) {
366
366
  throw new Error(`Failed to create Solana account: ${t}`);
367
367
  }
368
368
  return n;
369
369
  };
370
370
  export {
371
- ze as exportEvmAccount,
372
- Re as exportSolanaAccount,
373
- Te as getAccessToken,
371
+ Re as exportEvmAccount,
372
+ $e as exportSolanaAccount,
373
+ Oe as getAccessToken,
374
+ Pe as getAccessTokenExpiration,
374
375
  Ce as getCurrentUser,
375
- Fe as getUserOperation,
376
+ ze as getUserOperation,
376
377
  we as initialize,
377
378
  Me as isSignedIn,
378
- Pe as onAuthStateChange,
379
- be as onOAuthStateChange,
380
- We as sendEvmTransaction,
381
- He as sendSolanaTransaction,
382
- Ne as sendUserOperation,
379
+ be as onAuthStateChange,
380
+ xe as onOAuthStateChange,
381
+ He as sendEvmTransaction,
382
+ Be as sendSolanaTransaction,
383
+ Fe as sendUserOperation,
383
384
  je as signEvmHash,
384
- Be as signEvmMessage,
385
- xe as signEvmTransaction,
386
- Le as signEvmTypedData,
385
+ De as signEvmMessage,
386
+ Ke as signEvmTransaction,
387
+ Ne as signEvmTypedData,
387
388
  ke as signInWithEmail,
388
- Ee as signInWithOAuth,
389
- Ie as signInWithSms,
390
- Oe as signOut,
391
- De as signSolanaMessage,
392
- Ke as signSolanaTransaction,
389
+ Ie as signInWithOAuth,
390
+ Ee as signInWithSms,
391
+ Te as signOut,
392
+ Le as signSolanaMessage,
393
+ We as signSolanaTransaction,
393
394
  Se as verifyEmailOTP,
394
395
  Ue as verifyOAuth,
395
396
  _e as verifySmsOTP
@@ -1,4 +1,4 @@
1
- import { version as o } from "./index.web124.js";
1
+ import { version as o } from "./index.web103.js";
2
2
  let r = {
3
3
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
4
4
  version: `viem@${o}`
@@ -1,4 +1,4 @@
1
- import { commitmentToVersionedHash as i } from "./index.web131.js";
1
+ import { commitmentToVersionedHash as i } from "./index.web132.js";
2
2
  function r(o) {
3
3
  const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
4
4
  for (const m of t)
@@ -1,6 +1,6 @@
1
1
  import { blobsToCommitments as f } from "./index.web89.js";
2
2
  import { blobsToProofs as l } from "./index.web90.js";
3
- import { toBlobs as p } from "./index.web132.js";
3
+ import { toBlobs as p } from "./index.web131.js";
4
4
  function k(t) {
5
5
  const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
6
6
  for (let o = 0; o < s.length; o++)
@@ -1,7 +1,7 @@
1
- import { getCurrentUser as r } from "./index.web6.js";
2
- async function n() {
3
- return (await r())?.evmAccounts || [];
1
+ import { version as r } from "./index.web133.js";
2
+ function e() {
3
+ return r;
4
4
  }
5
5
  export {
6
- n as handleAccounts
6
+ e as getVersion
7
7
  };
@@ -1,21 +1,57 @@
1
- import { signEvmHash as o } from "./index.web6.js";
2
- import { validateUserOwnsEOA as a, EIP1193ProviderError as i, STANDARD_ERROR_CODES as s } from "./index.web19.js";
3
- async function h(t) {
4
- const [n, e] = t;
5
- await a(e);
6
- try {
7
- const { signature: r } = await o({
8
- evmAccount: e,
9
- hash: n
10
- });
11
- return r;
12
- } catch (r) {
13
- throw new i(
14
- s.provider.userRejectedRequest,
15
- r instanceof Error ? r.message : "Signing failed"
16
- );
1
+ import { encode as d } from "./index.web138.js";
2
+ import y from "./index.web139.js";
3
+ import b from "./index.web140.js";
4
+ import { JWSInvalid as r } from "./index.web54.js";
5
+ import { encoder as s, concat as u, decoder as h } from "./index.web99.js";
6
+ import g from "./index.web141.js";
7
+ import H from "./index.web142.js";
8
+ import P from "./index.web143.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;
17
53
  }
18
54
  }
19
55
  export {
20
- h as handleEthSign
56
+ x as FlattenedSign
21
57
  };
@@ -1,10 +1,13 @@
1
- import { EIP1193ProviderError as t, STANDARD_ERROR_CODES as r } from "./index.web19.js";
2
- async function a(o, e) {
3
- throw new t(
4
- r.provider.unsupportedMethod,
5
- "wallet_getCallsStatus is not supported with EOAs"
6
- );
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;
7
8
  }
8
9
  export {
9
- a as handleGetCallsStatus
10
+ f as concat,
11
+ s as decoder,
12
+ d as encoder
10
13
  };
@@ -13,6 +13,7 @@ export declare class AuthManager implements IAuthManager {
13
13
  signOut(): Promise<void>;
14
14
  addAuthStateChangeCallback(callback: OnAuthStateChangeFn): void;
15
15
  getToken(): Promise<string | null>;
16
+ getTokenExpiration(): Promise<number | null>;
16
17
  getWalletSecretId(): Promise<string>;
17
18
  getXWalletAuth(options: {
18
19
  requestMethod: string;
@@ -23,6 +23,7 @@ export interface IAuthManager {
23
23
  signOut(): Promise<void>;
24
24
  addAuthStateChangeCallback(callback: OnAuthStateChangeFn): void;
25
25
  getToken(): Promise<string | null>;
26
+ getTokenExpiration(): Promise<number | null>;
26
27
  getWalletSecretId(): Promise<string>;
27
28
  getXWalletAuth(options: {
28
29
  requestMethod: string;
@@ -11,6 +11,7 @@ export declare const getCurrentUser: () => Promise<User | null>;
11
11
  export declare const isSignedIn: () => Promise<boolean>;
12
12
  export declare const signOut: () => Promise<void>;
13
13
  export declare const getAccessToken: () => Promise<string | null>;
14
+ export declare const getAccessTokenExpiration: () => Promise<number | null>;
14
15
  export declare const onAuthStateChange: (callback: OnAuthStateChangeFn) => void;
15
16
  export declare const onOAuthStateChange: (callback: OnOAuthStateChangeFn) => void;
16
17
  export declare const signEvmHash: (options: SignEvmHashOptions) => Promise<SignEvmHashResult>;
@@ -10,6 +10,7 @@ export declare class MockAuthManager implements IAuthManager {
10
10
  signOut(): Promise<void>;
11
11
  addAuthStateChangeCallback(callback: OnAuthStateChangeFn): void;
12
12
  getToken(): Promise<string | null>;
13
+ getTokenExpiration(): Promise<number | null>;
13
14
  getWalletSecretId(): Promise<string>;
14
15
  getXWalletAuth(_options: {
15
16
  requestMethod: string;
@@ -6,6 +6,7 @@ export type BaseConfig = {
6
6
  useMock?: boolean;
7
7
  debugging?: boolean;
8
8
  basePath?: string;
9
+ secureIframeBasePath?: string;
9
10
  disableAnalytics?: boolean;
10
11
  nativeOAuthCallback?: string;
11
12
  };
@@ -39,6 +40,9 @@ export type AuthenticationMethods = {
39
40
  sms?: SmsAuthentication;
40
41
  google?: OAuth2Authentication;
41
42
  apple?: OAuth2Authentication;
43
+ x?: OAuth2Authentication & {
44
+ username?: string;
45
+ };
42
46
  };
43
47
  export type User = {
44
48
  userId: string;
@@ -1 +1 @@
1
- export declare const VERSION = "0.0.58";
1
+ export declare const VERSION = "0.0.59";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-core",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**",
@@ -28,7 +28,7 @@
28
28
  "ox": "0.8.1",
29
29
  "viem": "^2.33.0",
30
30
  "zustand": "^5.0.6",
31
- "@coinbase/cdp-api-client": "^0.0.58"
31
+ "@coinbase/cdp-api-client": "^0.0.60"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@react-native-async-storage/async-storage": "^2.0.0",