@coinbase/cdp-core 0.0.117 → 0.0.119

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 (305) hide show
  1. package/dist/esm/index.web10.js +49 -44
  2. package/dist/esm/index.web107.js +3 -3
  3. package/dist/esm/index.web110.js +2 -2
  4. package/dist/esm/index.web114.js +3 -3
  5. package/dist/esm/index.web126.js +12 -12
  6. package/dist/esm/index.web127.js +13 -373
  7. package/dist/esm/index.web128.js +25 -2
  8. package/dist/esm/index.web129.js +48 -63
  9. package/dist/esm/index.web130.js +189 -177
  10. package/dist/esm/index.web131.js +2 -31
  11. package/dist/esm/index.web132.js +65 -28
  12. package/dist/esm/index.web133.js +360 -12
  13. package/dist/esm/index.web134.js +28 -22
  14. package/dist/esm/index.web135.js +28 -50
  15. package/dist/esm/index.web138.js +1 -1
  16. package/dist/esm/index.web139.js +1 -1
  17. package/dist/esm/index.web140.js +12 -4
  18. package/dist/esm/index.web141.js +11 -54
  19. package/dist/esm/index.web142.js +54 -10
  20. package/dist/esm/index.web143.js +11 -2
  21. package/dist/esm/index.web144.js +2 -45
  22. package/dist/esm/index.web145.js +44 -13
  23. package/dist/esm/index.web146.js +13 -12
  24. package/dist/esm/index.web147.js +4 -11
  25. package/dist/esm/index.web148.js +1 -1
  26. package/dist/esm/index.web150.js +13 -14
  27. package/dist/esm/index.web151.js +54 -27
  28. package/dist/esm/index.web152.js +6 -7
  29. package/dist/esm/index.web153.js +21 -3
  30. package/dist/esm/index.web154.js +16 -27
  31. package/dist/esm/index.web155.js +45 -8
  32. package/dist/esm/index.web156.js +3 -7
  33. package/dist/esm/index.web157.js +3 -80
  34. package/dist/esm/index.web158.js +32 -26
  35. package/dist/esm/index.web159.js +12 -3
  36. package/dist/esm/index.web160.js +4 -15
  37. package/dist/esm/index.web161.js +28 -4
  38. package/dist/esm/index.web162.js +6 -14
  39. package/dist/esm/index.web163.js +31 -18
  40. package/dist/esm/index.web164.js +9 -58
  41. package/dist/esm/index.web165.js +55 -17
  42. package/dist/esm/index.web166.js +41 -22
  43. package/dist/esm/index.web167.js +127 -8
  44. package/dist/esm/index.web168.js +102 -40
  45. package/dist/esm/index.web169.js +6 -7
  46. package/dist/esm/index.web170.js +3 -21
  47. package/dist/esm/index.web171.js +79 -2
  48. package/dist/esm/index.web172.js +2 -2
  49. package/dist/esm/index.web173.js +2 -14
  50. package/dist/esm/index.web174.js +33 -51
  51. package/dist/esm/index.web175.js +6 -6
  52. package/dist/esm/index.web176.js +32 -19
  53. package/dist/esm/index.web177.js +14 -17
  54. package/dist/esm/index.web178.js +30 -41
  55. package/dist/esm/index.web179.js +18 -3
  56. package/dist/esm/index.web180.js +8 -3
  57. package/dist/esm/index.web181.js +9 -33
  58. package/dist/esm/index.web182.js +11 -12
  59. package/dist/esm/index.web183.js +13 -4
  60. package/dist/esm/index.web184.js +5 -28
  61. package/dist/esm/index.web185.js +5 -7
  62. package/dist/esm/index.web186.js +10 -32
  63. package/dist/esm/index.web187.js +2 -13
  64. package/dist/esm/index.web188.js +2 -56
  65. package/dist/esm/index.web189.js +14 -42
  66. package/dist/esm/index.web190.js +27 -126
  67. package/dist/esm/index.web191.js +7 -104
  68. package/dist/esm/index.web192.js +3 -6
  69. package/dist/esm/index.web193.js +29 -3
  70. package/dist/esm/index.web194.js +8 -78
  71. package/dist/esm/index.web195.js +8 -2
  72. package/dist/esm/index.web196.js +81 -2
  73. package/dist/esm/index.web197.js +26 -35
  74. package/dist/esm/index.web198.js +3 -6
  75. package/dist/esm/index.web199.js +15 -34
  76. package/dist/esm/index.web200.js +4 -14
  77. package/dist/esm/index.web201.js +14 -34
  78. package/dist/esm/index.web202.js +18 -17
  79. package/dist/esm/index.web203.js +61 -8
  80. package/dist/esm/index.web204.js +17 -10
  81. package/dist/esm/index.web205.js +23 -11
  82. package/dist/esm/index.web206.js +8 -13
  83. package/dist/esm/index.web207.js +42 -5
  84. package/dist/esm/index.web208.js +8 -5
  85. package/dist/esm/index.web209.js +20 -10
  86. package/dist/esm/index.web21.js +16 -5
  87. package/dist/esm/index.web210.js +104 -2
  88. package/dist/esm/index.web211.js +77 -107
  89. package/dist/esm/index.web212.js +79 -2
  90. package/dist/esm/index.web213.js +1 -1
  91. package/dist/esm/index.web217.js +1 -1
  92. package/dist/esm/index.web219.js +106 -101
  93. package/dist/esm/index.web220.js +2 -79
  94. package/dist/esm/index.web221.js +2 -79
  95. package/dist/esm/index.web222.js +20 -7
  96. package/dist/esm/index.web223.js +2 -2
  97. package/dist/esm/index.web224.js +19 -360
  98. package/dist/esm/index.web225.js +32 -852
  99. package/dist/esm/index.web226.js +6 -38
  100. package/dist/esm/index.web227.js +39 -2
  101. package/dist/esm/index.web228.js +2 -70
  102. package/dist/esm/index.web229.js +66 -31
  103. package/dist/esm/index.web230.js +33 -13
  104. package/dist/esm/index.web231.js +12 -18
  105. package/dist/esm/index.web232.js +8 -2
  106. package/dist/esm/index.web233.js +2 -20
  107. package/dist/esm/index.web234.js +356 -28
  108. package/dist/esm/index.web235.js +852 -6
  109. package/dist/esm/index.web236.js +1 -1
  110. package/dist/esm/index.web239.js +1 -1
  111. package/dist/esm/index.web244.js +1 -1
  112. package/dist/esm/index.web245.js +1 -1
  113. package/dist/esm/index.web246.js +2 -2
  114. package/dist/esm/index.web247.js +2 -2
  115. package/dist/esm/index.web248.js +2 -2
  116. package/dist/esm/index.web3.js +1 -1
  117. package/dist/esm/index.web64.js +24 -22
  118. package/dist/esm/index.web65.js +13 -17
  119. package/dist/esm/index.web8.js +26 -12
  120. package/dist/esm/index.web9.js +1 -1
  121. package/dist/native/index.native11.js +1 -1
  122. package/dist/native/index.native112.js +2 -2
  123. package/dist/native/index.native116.js +3 -3
  124. package/dist/native/index.native12.js +50 -45
  125. package/dist/native/index.native129.js +371 -100
  126. package/dist/native/index.native130.js +2 -379
  127. package/dist/native/index.native131.js +65 -28
  128. package/dist/native/index.native132.js +364 -28
  129. package/dist/native/index.native133.js +108 -2
  130. package/dist/native/index.native134.js +28 -65
  131. package/dist/native/index.native135.js +28 -364
  132. package/dist/native/index.native136.js +1 -1
  133. package/dist/native/index.native138.js +4 -4
  134. package/dist/native/index.native141.js +1 -1
  135. package/dist/native/index.native142.js +1 -1
  136. package/dist/native/index.native143.js +1 -1
  137. package/dist/native/index.native145.js +5 -2
  138. package/dist/native/index.native146.js +13 -2
  139. package/dist/native/index.native147.js +11 -4
  140. package/dist/native/index.native148.js +53 -11
  141. package/dist/native/index.native149.js +10 -11
  142. package/dist/native/index.native150.js +2 -55
  143. package/dist/native/index.native151.js +45 -11
  144. package/dist/native/index.native152.js +14 -2
  145. package/dist/native/index.native153.js +2 -45
  146. package/dist/native/index.native154.js +2 -14
  147. package/dist/native/index.native162.js +1 -1
  148. package/dist/native/index.native174.js +1 -1
  149. package/dist/native/index.native199.js +2 -2
  150. package/dist/native/index.native207.js +2 -2
  151. package/dist/native/index.native221.js +1 -1
  152. package/dist/native/index.native23.js +16 -5
  153. package/dist/native/index.native241.js +46 -3
  154. package/dist/native/index.native242.js +3 -46
  155. package/dist/native/index.native249.js +1 -1
  156. package/dist/native/index.native252.js +1 -1
  157. package/dist/native/index.native255.js +78 -14
  158. package/dist/native/index.native256.js +14 -78
  159. package/dist/native/index.native66.js +24 -22
  160. package/dist/native/index.native67.js +15 -19
  161. package/dist/native/index.native8.js +16 -3
  162. package/dist/native/index.native86.js +1 -1
  163. package/dist/native/index.native9.js +21 -8
  164. package/dist/native-types/actions/createBitcoinAccount.d.ts +5 -2
  165. package/dist/native-types/actions/getCurrentUser.d.ts +18 -1
  166. package/dist/native-types/actions/signBitcoinHash.d.ts +7 -5
  167. package/dist/native-types/core.d.ts +1 -1
  168. package/dist/native-types/platform/types.d.ts +25 -0
  169. package/dist/native-types/types.d.ts +2 -2
  170. package/dist/native-types/version.d.ts +1 -1
  171. package/dist/types/actions/createBitcoinAccount.d.ts +5 -2
  172. package/dist/types/actions/getCurrentUser.d.ts +18 -1
  173. package/dist/types/actions/signBitcoinHash.d.ts +7 -5
  174. package/dist/types/core.d.ts +1 -1
  175. package/dist/types/platform/types.d.ts +25 -0
  176. package/dist/types/types.d.ts +2 -2
  177. package/dist/types/version.d.ts +1 -1
  178. package/dist/web/index.web10.js +49 -44
  179. package/dist/web/index.web107.js +3 -3
  180. package/dist/web/index.web110.js +2 -2
  181. package/dist/web/index.web114.js +3 -3
  182. package/dist/web/index.web126.js +12 -12
  183. package/dist/web/index.web127.js +13 -373
  184. package/dist/web/index.web128.js +25 -2
  185. package/dist/web/index.web129.js +48 -63
  186. package/dist/web/index.web130.js +189 -177
  187. package/dist/web/index.web131.js +2 -31
  188. package/dist/web/index.web132.js +65 -28
  189. package/dist/web/index.web133.js +360 -12
  190. package/dist/web/index.web134.js +28 -22
  191. package/dist/web/index.web135.js +28 -50
  192. package/dist/web/index.web138.js +1 -1
  193. package/dist/web/index.web139.js +1 -1
  194. package/dist/web/index.web140.js +12 -4
  195. package/dist/web/index.web141.js +11 -54
  196. package/dist/web/index.web142.js +54 -10
  197. package/dist/web/index.web143.js +11 -2
  198. package/dist/web/index.web144.js +2 -45
  199. package/dist/web/index.web145.js +44 -13
  200. package/dist/web/index.web146.js +13 -12
  201. package/dist/web/index.web147.js +4 -11
  202. package/dist/web/index.web148.js +1 -1
  203. package/dist/web/index.web150.js +13 -14
  204. package/dist/web/index.web151.js +54 -27
  205. package/dist/web/index.web152.js +6 -7
  206. package/dist/web/index.web153.js +21 -3
  207. package/dist/web/index.web154.js +16 -27
  208. package/dist/web/index.web155.js +45 -8
  209. package/dist/web/index.web156.js +3 -7
  210. package/dist/web/index.web157.js +3 -80
  211. package/dist/web/index.web158.js +32 -26
  212. package/dist/web/index.web159.js +12 -3
  213. package/dist/web/index.web160.js +4 -15
  214. package/dist/web/index.web161.js +28 -4
  215. package/dist/web/index.web162.js +6 -14
  216. package/dist/web/index.web163.js +31 -18
  217. package/dist/web/index.web164.js +9 -58
  218. package/dist/web/index.web165.js +55 -17
  219. package/dist/web/index.web166.js +41 -22
  220. package/dist/web/index.web167.js +127 -8
  221. package/dist/web/index.web168.js +102 -40
  222. package/dist/web/index.web169.js +6 -7
  223. package/dist/web/index.web170.js +3 -21
  224. package/dist/web/index.web171.js +79 -2
  225. package/dist/web/index.web172.js +2 -2
  226. package/dist/web/index.web173.js +2 -14
  227. package/dist/web/index.web174.js +33 -51
  228. package/dist/web/index.web175.js +6 -6
  229. package/dist/web/index.web176.js +32 -19
  230. package/dist/web/index.web177.js +14 -17
  231. package/dist/web/index.web178.js +30 -41
  232. package/dist/web/index.web179.js +18 -3
  233. package/dist/web/index.web180.js +8 -3
  234. package/dist/web/index.web181.js +9 -33
  235. package/dist/web/index.web182.js +11 -12
  236. package/dist/web/index.web183.js +13 -4
  237. package/dist/web/index.web184.js +5 -28
  238. package/dist/web/index.web185.js +5 -7
  239. package/dist/web/index.web186.js +10 -32
  240. package/dist/web/index.web187.js +2 -13
  241. package/dist/web/index.web188.js +2 -56
  242. package/dist/web/index.web189.js +14 -42
  243. package/dist/web/index.web190.js +27 -126
  244. package/dist/web/index.web191.js +7 -104
  245. package/dist/web/index.web192.js +3 -6
  246. package/dist/web/index.web193.js +29 -3
  247. package/dist/web/index.web194.js +8 -78
  248. package/dist/web/index.web195.js +8 -2
  249. package/dist/web/index.web196.js +81 -2
  250. package/dist/web/index.web197.js +26 -35
  251. package/dist/web/index.web198.js +3 -6
  252. package/dist/web/index.web199.js +15 -34
  253. package/dist/web/index.web200.js +4 -14
  254. package/dist/web/index.web201.js +14 -34
  255. package/dist/web/index.web202.js +18 -17
  256. package/dist/web/index.web203.js +61 -8
  257. package/dist/web/index.web204.js +17 -10
  258. package/dist/web/index.web205.js +23 -11
  259. package/dist/web/index.web206.js +8 -13
  260. package/dist/web/index.web207.js +42 -5
  261. package/dist/web/index.web208.js +8 -5
  262. package/dist/web/index.web209.js +20 -10
  263. package/dist/web/index.web21.js +16 -5
  264. package/dist/web/index.web210.js +104 -2
  265. package/dist/web/index.web211.js +77 -107
  266. package/dist/web/index.web212.js +79 -2
  267. package/dist/web/index.web213.js +1 -1
  268. package/dist/web/index.web217.js +1 -1
  269. package/dist/web/index.web219.js +106 -101
  270. package/dist/web/index.web220.js +2 -79
  271. package/dist/web/index.web221.js +2 -79
  272. package/dist/web/index.web222.js +20 -7
  273. package/dist/web/index.web223.js +2 -2
  274. package/dist/web/index.web224.js +19 -360
  275. package/dist/web/index.web225.js +32 -852
  276. package/dist/web/index.web226.js +6 -38
  277. package/dist/web/index.web227.js +39 -2
  278. package/dist/web/index.web228.js +2 -70
  279. package/dist/web/index.web229.js +66 -31
  280. package/dist/web/index.web230.js +33 -13
  281. package/dist/web/index.web231.js +12 -18
  282. package/dist/web/index.web232.js +8 -2
  283. package/dist/web/index.web233.js +2 -20
  284. package/dist/web/index.web234.js +356 -28
  285. package/dist/web/index.web235.js +852 -6
  286. package/dist/web/index.web236.js +1 -1
  287. package/dist/web/index.web239.js +1 -1
  288. package/dist/web/index.web244.js +1 -1
  289. package/dist/web/index.web245.js +1 -1
  290. package/dist/web/index.web246.js +2 -2
  291. package/dist/web/index.web247.js +2 -2
  292. package/dist/web/index.web248.js +2 -2
  293. package/dist/web/index.web3.js +1 -1
  294. package/dist/web/index.web64.js +24 -22
  295. package/dist/web/index.web65.js +13 -17
  296. package/dist/web/index.web8.js +26 -12
  297. package/dist/web/index.web9.js +1 -1
  298. package/dist/web-types/actions/createBitcoinAccount.d.ts +5 -2
  299. package/dist/web-types/actions/getCurrentUser.d.ts +18 -1
  300. package/dist/web-types/actions/signBitcoinHash.d.ts +7 -5
  301. package/dist/web-types/core.d.ts +1 -1
  302. package/dist/web-types/platform/types.d.ts +25 -0
  303. package/dist/web-types/types.d.ts +2 -2
  304. package/dist/web-types/version.d.ts +1 -1
  305. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { BaseError as f } from "./index.web129.js";
1
+ import { BaseError as f } from "./index.web132.js";
2
2
  import { pad as g } from "./index.web251.js";
3
3
  function m(t, i = {}) {
4
4
  const { signed: r, size: e } = i, o = BigInt(t);
@@ -1,4 +1,4 @@
1
- import { JOSENotSupported as r } from "./index.web134.js";
1
+ import { JOSENotSupported as r } from "./index.web128.js";
2
2
  const S = (e, s) => {
3
3
  const a = `SHA-${e.slice(-3)}`;
4
4
  switch (e) {
@@ -1,4 +1,4 @@
1
- import n from "./index.web145.js";
1
+ import n from "./index.web146.js";
2
2
  function r(t) {
3
3
  return n(t) && typeof t.kty == "string";
4
4
  }
@@ -1,4 +1,4 @@
1
- import { JOSENotSupported as s } from "./index.web134.js";
1
+ import { JOSENotSupported as s } from "./index.web128.js";
2
2
  function n(e) {
3
3
  let a, r;
4
4
  switch (e.kty) {
@@ -1,4 +1,4 @@
1
- var r = {};
1
+ var r = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ r as __module
4
4
  };
@@ -1,4 +1,4 @@
1
- var e = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- e as __module
3
+ r as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var r = { exports: {} };
1
+ var e = { exports: {} };
2
2
  export {
3
- r as __module
3
+ e as __module
4
4
  };
@@ -1,2 +1,2 @@
1
- import { __require as r } from "./index.web222.js";
1
+ import { __require as r } from "./index.web232.js";
2
2
  r();
@@ -1,37 +1,39 @@
1
- import { createEndUserBtcAccount as u } from "@coinbase/cdp-api-client";
2
- import { Analytics as d } from "./index.web2.js";
1
+ import { createEndUserBtcAccount as h } from "@coinbase/cdp-api-client";
2
+ import { Analytics as p } from "./index.web2.js";
3
3
  import "./index.web3.js";
4
4
  import { toAuthStateUser as m } from "./index.web101.js";
5
- import { InternalError as l } from "./index.web88.js";
6
- import { validateUserAuthState as p } from "./index.web102.js";
7
- import { getCoreAuthManager as w, getConfig as h } from "./index.web74.js";
8
- async function U(e) {
9
- d.sendActionCallEvent({ name: "create_bitcoin_account" });
10
- const t = w(), { user: c, authState: a } = p(
5
+ import { InternalError as o } from "./index.web88.js";
6
+ import { validateUserAuthState as w } from "./index.web102.js";
7
+ import { getCoreAuthManager as b, getConfig as A } from "./index.web74.js";
8
+ async function U(r) {
9
+ p.sendActionCallEvent({ name: "create_bitcoin_account" });
10
+ const t = b(), { user: c, authState: s } = w(
11
11
  t.getUser(),
12
12
  t.getAuthState()
13
- ), i = await u(
13
+ ), n = await h(
14
14
  c.userId,
15
15
  {
16
16
  walletSecretId: await t.getWalletSecretId(),
17
- addressType: e?.addressType ?? "segwit",
18
- network: e?.network ?? "bitcoin-testnet"
17
+ addressType: r?.addressType ?? "segwit",
18
+ network: r?.network ?? "bitcoin-testnet"
19
19
  },
20
- { projectID: h().projectId },
21
- e?.idempotencyKey
22
- ), n = m(i);
20
+ { projectID: A().projectId },
21
+ r?.idempotencyKey
22
+ ), i = m(n), u = t.getAuthState() ?? s;
23
23
  await t.setAuthState({
24
- ...a,
25
- user: n
24
+ ...u,
25
+ user: i
26
26
  });
27
- const s = new Set(c.btcAccountObjects?.map((r) => r.extendedPublicKey) ?? []), o = n.btcAccountObjects?.find(
28
- (r) => !s.has(r.extendedPublicKey)
29
- );
30
- if (!o)
31
- throw new l(
27
+ const d = new Set(c.btcAccountObjects?.map((a) => a.xpubHash) ?? []), e = (n.btcAccountObjects ?? []).find((a) => !d.has(a.xpubHash));
28
+ if (!e)
29
+ throw new o(
32
30
  "Bitcoin account was not created. Check the network log for more details."
33
31
  );
34
- return o;
32
+ if (!e.xpub)
33
+ throw new o(
34
+ "Bitcoin account was created but the server did not return its extended public key (xpub)."
35
+ );
36
+ return { ...e, xpub: e.xpub };
35
37
  }
36
38
  export {
37
39
  U as createBitcoinAccount
@@ -1,10 +1,10 @@
1
- import { signBtcHashWithEndUserAccount as i } from "@coinbase/cdp-api-client";
2
- import { Analytics as c } from "./index.web2.js";
1
+ import { signBtcHashWithEndUserAccount as c } from "@coinbase/cdp-api-client";
2
+ import { Analytics as i } from "./index.web2.js";
3
3
  import "./index.web3.js";
4
- import { withAuth as h } from "./index.web97.js";
5
- import { getConfig as o, getCoreAuthManager as d } from "./index.web74.js";
4
+ import { withAuth as s } from "./index.web97.js";
5
+ import { getConfig as e, getCoreAuthManager as o } from "./index.web74.js";
6
6
  import "viem";
7
- import { withMfa as m } from "./index.web82.js";
7
+ import { withMfa as h } from "./index.web82.js";
8
8
  import "jose";
9
9
  import "./index.web98.js";
10
10
  import "./index.web99.js";
@@ -12,26 +12,22 @@ import "@solana/web3.js";
12
12
  import "bs58";
13
13
  import "./index.web93.js";
14
14
  const j = async (t) => {
15
- if (c.sendActionCallEvent({ name: "sign_bitcoin_hash" }), !/^[0-9a-fA-F]{64}$/.test(t.hash))
15
+ if (i.sendActionCallEvent({ name: "sign_bitcoin_hash" }), !/^[0-9a-fA-F]{64}$/.test(t.hash))
16
16
  throw new Error("hash must be a 64-character hex string with no 0x prefix");
17
- return o().useMock ? { signature: "3045022100" + "a".repeat(64) + "0220" + "b".repeat(64) } : m(
18
- () => h(t, d(), async ({ user: e, walletSecretId: a }) => {
19
- const r = t.network ?? "bitcoin-testnet", n = t.addressType ?? "segwit";
20
- if (!e.btcAccountObjects?.find(
21
- (s) => s.network === r && s.addressType === n
22
- ))
17
+ return e().useMock ? { signature: "3045022100" + "a".repeat(64) + "0220" + "b".repeat(64) } : h(
18
+ () => s(t, o(), async ({ user: r, walletSecretId: a }) => {
19
+ if (!r.btcAccountObjects?.find((n) => n.xpubHash === t.xpubHash))
23
20
  throw new Error("Bitcoin account not found");
24
- return { signature: (await i(
25
- e.userId,
21
+ return { signature: (await c(
22
+ r.userId,
26
23
  {
27
24
  walletSecretId: a,
28
- addressType: n,
29
- network: r,
25
+ xpubHash: t.xpubHash,
30
26
  change: t.change,
31
27
  addressIndex: t.addressIndex,
32
28
  hash: t.hash
33
29
  },
34
- { projectID: o().projectId },
30
+ { projectID: e().projectId },
35
31
  t.idempotencyKey
36
32
  )).signature };
37
33
  })
@@ -7,11 +7,25 @@ const l = {
7
7
  * @param key - The storage key.
8
8
  * @returns Promise that resolves to the value.
9
9
  */
10
- async getItem(e) {
10
+ async getItem(t) {
11
+ return (await this.getItemWithOutcome(t)).value;
12
+ },
13
+ /**
14
+ * Retrieves a value from localStorage with read outcome metadata.
15
+ *
16
+ * @param key - The storage key.
17
+ * @returns Promise that resolves to the stored value and read outcome.
18
+ */
19
+ async getItemWithOutcome(t) {
11
20
  try {
12
- return localStorage.getItem(e);
13
- } catch (r) {
14
- return console.warn(`Failed to get item from localStorage: ${r}`), null;
21
+ const e = localStorage.getItem(t);
22
+ return e === null ? { value: null, outcome: "not_found" } : { value: e, outcome: "found" };
23
+ } catch (e) {
24
+ return console.warn(`Failed to get item from localStorage: ${e}`), {
25
+ value: null,
26
+ outcome: "error",
27
+ errorMessage: e instanceof Error ? e.message : String(e)
28
+ };
15
29
  }
16
30
  },
17
31
  /**
@@ -21,9 +35,9 @@ const l = {
21
35
  * @param value - The value to store.
22
36
  * @returns Promise that resolves when the value is stored.
23
37
  */
24
- async setItem(e, r) {
38
+ async setItem(t, e) {
25
39
  try {
26
- localStorage.setItem(e, r);
40
+ localStorage.setItem(t, e);
27
41
  } catch (o) {
28
42
  throw console.warn(`Failed to set item in localStorage: ${o}`), o;
29
43
  }
@@ -34,11 +48,11 @@ const l = {
34
48
  * @param key - The storage key.
35
49
  * @returns Promise that resolves when the value is removed.
36
50
  */
37
- async removeItem(e) {
51
+ async removeItem(t) {
38
52
  try {
39
- localStorage.removeItem(e);
40
- } catch (r) {
41
- throw console.warn(`Failed to remove item from localStorage: ${r}`), r;
53
+ localStorage.removeItem(t);
54
+ } catch (e) {
55
+ throw console.warn(`Failed to remove item from localStorage: ${e}`), e;
42
56
  }
43
57
  },
44
58
  /**
@@ -49,8 +63,8 @@ const l = {
49
63
  async clear() {
50
64
  try {
51
65
  localStorage.clear();
52
- } catch (e) {
53
- throw console.warn(`Failed to clear localStorage: ${e}`), e;
66
+ } catch (t) {
67
+ throw console.warn(`Failed to clear localStorage: ${t}`), t;
54
68
  }
55
69
  }
56
70
  };
@@ -1,4 +1,4 @@
1
- const o = "0.0.117";
1
+ const o = "0.0.119";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -1,4 +1,4 @@
1
- const o = "0.0.117";
1
+ const o = "0.0.119";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -1,5 +1,5 @@
1
- import { InvalidAddressError as s } from "./index.native148.js";
2
- import { isAddress as a } from "./index.native149.js";
1
+ import { InvalidAddressError as s } from "./index.native146.js";
2
+ import { isAddress as a } from "./index.native147.js";
3
3
  function r(n) {
4
4
  if (typeof n == "string") {
5
5
  if (!a(n, { strict: !1 }))
@@ -1,7 +1,7 @@
1
- import { DisconnectedError as l, from as d } from "./index.native130.js";
1
+ import { DisconnectedError as l, from as d } from "./index.native129.js";
2
2
  import { validateRequest as h, EIP1193ProviderError as m, STANDARD_ERROR_CODES as _ } from "./index.native93.js";
3
- import { createEOAHandlers as p } from "./index.native131.js";
4
- import { createSmartAccountHandlers as g } from "./index.native132.js";
3
+ import { createEOAHandlers as p } from "./index.native134.js";
4
+ import { createSmartAccountHandlers as g } from "./index.native135.js";
5
5
  import "viem";
6
6
  import "zustand";
7
7
  import "@coinbase/cdp-api-client";
@@ -1,27 +1,27 @@
1
- import { configureCdpApiClient as j, setAuthManager as k, getMfaConfig as C, APIError as g, getProjectConfig as v } from "@coinbase/cdp-api-client";
2
- import { Analytics as s } from "./index.native2.js";
1
+ import { configureCdpApiClient as j, setAuthManager as v, getMfaConfig as C, APIError as g, getProjectConfig as M } from "@coinbase/cdp-api-client";
2
+ import { Analytics as c } from "./index.native2.js";
3
3
  import "./index.native3.js";
4
- import { createAuthManager as M } from "./index.native117.js";
5
- import { OAuthManager as S } from "./index.native118.js";
6
- import { MockAuthManager as y } from "./index.native119.js";
4
+ import { createAuthManager as S } from "./index.native117.js";
5
+ import { OAuthManager as y } from "./index.native118.js";
6
+ import { MockAuthManager as w } from "./index.native119.js";
7
7
  import { MockOAuthManager as P } from "./index.native120.js";
8
- import { getAttestationModule as w } from "./index.native95.js";
8
+ import { getAttestationModule as _ } from "./index.native95.js";
9
9
  import { getPlatformServices as m } from "./index.native10.js";
10
- import { getConfig as n, setCoreAuthManager as h, setCoreOAuthManager as I, setMfaConfig as A, setProjectConfig as b, getCoreAuthManager as _, setConfig as E } from "./index.native76.js";
10
+ import { getConfig as i, setCoreAuthManager as h, setCoreOAuthManager as I, setMfaConfig as A, setProjectConfig as k, getCoreAuthManager as O, setConfig as R } from "./index.native76.js";
11
11
  import "viem";
12
12
  const U = async (t) => {
13
13
  if (!t.projectId)
14
14
  throw new Error("Project ID is required");
15
- t.disableAnalytics === void 0 || t.disableAnalytics === !1 ? (s.developerIdentifier = t.projectId, s.isUsingMocks = t.useMock === !0, s.isProduction = !t.basePath || t.basePath === "https://api.cdp.coinbase.com/platform") : s.enabled = !1;
16
- let i;
15
+ t.disableAnalytics === void 0 || t.disableAnalytics === !1 ? (c.developerIdentifier = t.projectId, c.isUsingMocks = t.useMock === !0, c.isProduction = !t.basePath || t.basePath === "https://api.cdp.coinbase.com/platform") : c.enabled = !1;
16
+ let a;
17
17
  try {
18
- i = n().projectId !== t.projectId;
18
+ a = i().projectId !== t.projectId;
19
19
  } catch {
20
- i = !0;
20
+ a = !0;
21
21
  }
22
- if (E(t), n().useMock) {
23
- h(new y(n().projectId)), I(new P()), A({
24
- projectId: n().projectId,
22
+ if (R(t), i().useMock) {
23
+ h(new w(i().projectId)), I(new P()), A({
24
+ projectId: i().projectId,
25
25
  enabled: !1,
26
26
  totpConfig: { enabled: !1 },
27
27
  smsConfig: { enabled: !1 },
@@ -30,57 +30,59 @@ const U = async (t) => {
30
30
  requireVerificationOnLogin: !1,
31
31
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
32
32
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
33
- }), b({
34
- projectId: n().projectId,
33
+ }), k({
34
+ projectId: i().projectId,
35
35
  name: "Mock Project",
36
36
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
37
37
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
38
38
  });
39
39
  return;
40
40
  }
41
- let a, d = !1;
41
+ let o, s = !1;
42
42
  try {
43
43
  const e = m();
44
- e.secureStorage ? (d = !0, a = {
44
+ e.secureStorage ? (s = !0, o = {
45
45
  getRefreshToken: () => e.secureStorage.getItem("cdp_refresh_token"),
46
- setRefreshToken: (o) => e.secureStorage.setItem("cdp_refresh_token", o),
46
+ getRefreshTokenWithOutcome: () => b(e.secureStorage),
47
+ setRefreshToken: (n) => e.secureStorage.setItem("cdp_refresh_token", n),
47
48
  removeRefreshToken: () => e.secureStorage.removeItem("cdp_refresh_token")
48
- }) : a = {
49
+ }) : o = {
49
50
  getRefreshToken: () => e.storage.getItem("cdp_refresh_token"),
50
- setRefreshToken: (o) => e.storage.setItem("cdp_refresh_token", o),
51
+ getRefreshTokenWithOutcome: () => b(e.storage),
52
+ setRefreshToken: (n) => e.storage.setItem("cdp_refresh_token", n),
51
53
  removeRefreshToken: () => e.storage.removeItem("cdp_refresh_token")
52
54
  };
53
55
  } catch {
54
- s.sendSessionRefreshEvent({
56
+ c.sendSessionRefreshEvent({
55
57
  name: "refresh_token_storage_not_initialized"
56
- }), a = void 0;
58
+ }), o = void 0;
57
59
  }
58
- let r, c, u;
60
+ let r, d, p;
59
61
  try {
60
62
  const e = m();
61
- u = e.deviceInfo?.getPlatform?.(), e.attestation && (r = e.attestation, c = e.deviceInfo?.getAppBundleId?.());
63
+ p = e.deviceInfo?.getPlatform?.(), e.attestation && (r = e.attestation, d = e.deviceInfo?.getAppBundleId?.());
62
64
  } catch {
63
65
  r = void 0;
64
66
  }
65
67
  if (j({
66
- debugging: n().debugging,
67
- basePath: n().basePath,
68
- refreshTokenStorage: a,
69
- retryTokenReads: d,
70
- platform: u,
68
+ debugging: i().debugging,
69
+ basePath: i().basePath,
70
+ refreshTokenStorage: o,
71
+ retryTokenReads: s,
72
+ platform: p,
71
73
  appAttestation: r && {
72
74
  isEnabled: () => r.isEnabled,
73
- appIdentifier: c,
75
+ appIdentifier: d,
74
76
  generateAssertion: r.generateAssertion.bind(r)
75
77
  }
76
- }), i) {
77
- const e = new S();
78
+ }), a) {
79
+ const e = new y();
78
80
  I(e);
79
- const o = M(n().projectId);
80
- h(o), k(o);
81
+ const n = S(i().projectId);
82
+ h(n), v(n);
81
83
  }
82
84
  const [, f, l] = await Promise.allSettled([
83
- _().ensureInitialized(),
85
+ O().ensureInitialized(),
84
86
  (async () => {
85
87
  try {
86
88
  return await C(t.projectId);
@@ -90,7 +92,7 @@ const U = async (t) => {
90
92
  })(),
91
93
  (async () => {
92
94
  try {
93
- return await v(t.projectId);
95
+ return await M(t.projectId);
94
96
  } catch (e) {
95
97
  return (!(e instanceof g) || e.statusCode !== 404) && console.warn("Failed to get project config", e), null;
96
98
  }
@@ -98,21 +100,24 @@ const U = async (t) => {
98
100
  ]);
99
101
  if (f.status === "fulfilled" && f.value && A(f.value), l.status === "fulfilled" && l.value) {
100
102
  const e = l.value;
101
- if (b(e), e.appAttestation && r && c) {
102
- const o = O(e.appAttestation, c);
103
- o !== null && (w() || console.warn(
103
+ if (k(e), e.appAttestation && r && d) {
104
+ const n = E(e.appAttestation, d);
105
+ n !== null && (_() || console.warn(
104
106
  "[Attestation] Project config has attestation enabled for this app, but no attestation provider is registered. Install @coinbase/cdp-app-attest and add `import '@coinbase/cdp-app-attest'` to your app's entry point."
105
- ), r.isEnabled = !0, r.cloudProjectNumber = o.cloudProjectNumber, r.initialize().catch((p) => {
107
+ ), r.isEnabled = !0, r.cloudProjectNumber = n.cloudProjectNumber, r.initialize().catch((u) => {
106
108
  console.error(
107
109
  "[Attestation] Background initialization failed:",
108
- p instanceof Error ? p.message : String(p)
110
+ u instanceof Error ? u.message : String(u)
109
111
  );
110
112
  }));
111
113
  }
112
114
  }
113
- }, O = (t, i) => {
114
- const a = t.android?.find((r) => r.identifier === i);
115
- return a ? { cloudProjectNumber: a.googleProjectNumber } : t.ios?.find((r) => r.identifier === i) ? {} : null;
115
+ }, b = async (t) => {
116
+ const { value: a, outcome: o, errorMessage: s } = await t.getItemWithOutcome("cdp_refresh_token");
117
+ return { token: a, outcome: o, errorMessage: s };
118
+ }, E = (t, a) => {
119
+ const o = t.android?.find((r) => r.identifier === a);
120
+ return o ? { cloudProjectNumber: o.googleProjectNumber } : t.ios?.find((r) => r.identifier === a) ? {} : null;
116
121
  };
117
122
  export {
118
123
  U as initialize