@coinbase/cdp-core 0.0.33 → 0.0.34

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 (59) hide show
  1. package/README.md +74 -8
  2. package/dist/esm/index.native.js +40 -37
  3. package/dist/esm/index.native14.js +6 -5
  4. package/dist/esm/index.native15.js +12 -10
  5. package/dist/esm/index.native17.js +1 -0
  6. package/dist/esm/index.native54.js +1 -1
  7. package/dist/esm/index.native55.js +1 -1
  8. package/dist/esm/index.native57.js +2 -2
  9. package/dist/esm/index.native59.js +1 -1
  10. package/dist/esm/index.native6.js +188 -134
  11. package/dist/esm/index.native82.js +2 -21
  12. package/dist/esm/index.native83.js +21 -2
  13. package/dist/esm/index.native84.js +18 -102
  14. package/dist/esm/index.native85.js +80 -20
  15. package/dist/esm/index.native86.js +103 -79
  16. package/dist/esm/index.native95.js +1 -1
  17. package/dist/esm/index.web.js +41 -38
  18. package/dist/esm/index.web12.js +6 -5
  19. package/dist/esm/index.web13.js +12 -10
  20. package/dist/esm/index.web15.js +1 -0
  21. package/dist/esm/index.web26.js +1 -1
  22. package/dist/esm/index.web5.js +188 -134
  23. package/dist/esm/index.web84.js +1 -1
  24. package/dist/esm/index.web93.js +10 -79
  25. package/dist/esm/index.web94.js +79 -10
  26. package/dist/native/index.native.js +40 -37
  27. package/dist/native/index.native14.js +6 -5
  28. package/dist/native/index.native15.js +12 -10
  29. package/dist/native/index.native17.js +1 -0
  30. package/dist/native/index.native54.js +1 -1
  31. package/dist/native/index.native55.js +1 -1
  32. package/dist/native/index.native57.js +2 -2
  33. package/dist/native/index.native59.js +1 -1
  34. package/dist/native/index.native6.js +188 -134
  35. package/dist/native/index.native82.js +2 -21
  36. package/dist/native/index.native83.js +21 -2
  37. package/dist/native/index.native84.js +18 -102
  38. package/dist/native/index.native85.js +80 -20
  39. package/dist/native/index.native86.js +103 -79
  40. package/dist/native/index.native95.js +1 -1
  41. package/dist/native-types/auth/withAuth.d.ts +3 -1
  42. package/dist/native-types/core.d.ts +3 -1
  43. package/dist/native-types/types.d.ts +20 -3
  44. package/dist/types/auth/withAuth.d.ts +3 -1
  45. package/dist/types/core.d.ts +3 -1
  46. package/dist/types/types.d.ts +20 -3
  47. package/dist/web/index.web.js +41 -38
  48. package/dist/web/index.web12.js +6 -5
  49. package/dist/web/index.web13.js +12 -10
  50. package/dist/web/index.web15.js +1 -0
  51. package/dist/web/index.web26.js +1 -1
  52. package/dist/web/index.web5.js +188 -134
  53. package/dist/web/index.web84.js +1 -1
  54. package/dist/web/index.web93.js +10 -79
  55. package/dist/web/index.web94.js +79 -10
  56. package/dist/web-types/auth/withAuth.d.ts +3 -1
  57. package/dist/web-types/core.d.ts +3 -1
  58. package/dist/web-types/types.d.ts +20 -3
  59. package/package.json +2 -2
@@ -1,22 +1,82 @@
1
- const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
2
- function s(t, r = !1) {
3
- return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
4
- }
5
- function h(t, r = !1) {
6
- const n = t.length;
7
- let l = new Uint32Array(n), c = new Uint32Array(n);
8
- for (let e = 0; e < n; e++) {
9
- const { h: u, l: f } = s(t[e], r);
10
- [l[e], c[e]] = [u, f];
11
- }
12
- return [l, c];
13
- }
14
- const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
1
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
+ function o(e) {
3
+ return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
4
+ }
5
+ function w(e) {
6
+ if (!Number.isSafeInteger(e) || e < 0)
7
+ throw new Error("positive integer expected, got " + e);
8
+ }
9
+ function r(e, ...t) {
10
+ if (!o(e))
11
+ throw new Error("Uint8Array expected");
12
+ if (t.length > 0 && !t.includes(e.length))
13
+ throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
14
+ }
15
+ function h(e, t = !0) {
16
+ if (e.destroyed)
17
+ throw new Error("Hash instance has been destroyed");
18
+ if (t && e.finished)
19
+ throw new Error("Hash#digest() has already been called");
20
+ }
21
+ function l(e, t) {
22
+ r(e);
23
+ const n = t.outputLen;
24
+ if (e.length < n)
25
+ throw new Error("digestInto() expects output buffer of length at least " + n);
26
+ }
27
+ function a(e) {
28
+ return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
29
+ }
30
+ function g(...e) {
31
+ for (let t = 0; t < e.length; t++)
32
+ e[t].fill(0);
33
+ }
34
+ function p(e) {
35
+ return new DataView(e.buffer, e.byteOffset, e.byteLength);
36
+ }
37
+ function b(e, t) {
38
+ return e << 32 - t | e >>> t;
39
+ }
40
+ const i = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
41
+ function u(e) {
42
+ return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
43
+ }
44
+ function c(e) {
45
+ for (let t = 0; t < e.length; t++)
46
+ e[t] = u(e[t]);
47
+ return e;
48
+ }
49
+ const x = i ? (e) => e : c;
50
+ function s(e) {
51
+ if (typeof e != "string")
52
+ throw new Error("string expected");
53
+ return new Uint8Array(new TextEncoder().encode(e));
54
+ }
55
+ function y(e) {
56
+ return typeof e == "string" && (e = s(e)), r(e), e;
57
+ }
58
+ class d {
59
+ }
60
+ function E(e) {
61
+ const t = (f) => e().update(y(f)).digest(), n = e();
62
+ return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
63
+ }
15
64
  export {
16
- s as fromBig,
17
- B as rotlBH,
18
- a as rotlBL,
19
- m as rotlSH,
20
- A as rotlSL,
21
- h as split
65
+ d as Hash,
66
+ r as abytes,
67
+ h as aexists,
68
+ w as anumber,
69
+ l as aoutput,
70
+ u as byteSwap,
71
+ c as byteSwap32,
72
+ g as clean,
73
+ E as createHasher,
74
+ p as createView,
75
+ o as isBytes,
76
+ i as isLE,
77
+ b as rotr,
78
+ x as swap32IfBE,
79
+ y as toBytes,
80
+ a as u32,
81
+ s as utf8ToBytes
22
82
  };
@@ -1,82 +1,106 @@
1
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
- function o(e) {
3
- return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
4
- }
5
- function w(e) {
6
- if (!Number.isSafeInteger(e) || e < 0)
7
- throw new Error("positive integer expected, got " + e);
8
- }
9
- function r(e, ...t) {
10
- if (!o(e))
11
- throw new Error("Uint8Array expected");
12
- if (t.length > 0 && !t.includes(e.length))
13
- throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
14
- }
15
- function h(e, t = !0) {
16
- if (e.destroyed)
17
- throw new Error("Hash instance has been destroyed");
18
- if (t && e.finished)
19
- throw new Error("Hash#digest() has already been called");
20
- }
21
- function l(e, t) {
22
- r(e);
23
- const n = t.outputLen;
24
- if (e.length < n)
25
- throw new Error("digestInto() expects output buffer of length at least " + n);
26
- }
27
- function a(e) {
28
- return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
29
- }
30
- function g(...e) {
31
- for (let t = 0; t < e.length; t++)
32
- e[t].fill(0);
33
- }
34
- function p(e) {
35
- return new DataView(e.buffer, e.byteOffset, e.byteLength);
36
- }
37
- function b(e, t) {
38
- return e << 32 - t | e >>> t;
39
- }
40
- const i = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
41
- function u(e) {
42
- return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
43
- }
44
- function c(e) {
45
- for (let t = 0; t < e.length; t++)
46
- e[t] = u(e[t]);
47
- return e;
48
- }
49
- const x = i ? (e) => e : c;
50
- function s(e) {
51
- if (typeof e != "string")
52
- throw new Error("string expected");
53
- return new Uint8Array(new TextEncoder().encode(e));
54
- }
55
- function y(e) {
56
- return typeof e == "string" && (e = s(e)), r(e), e;
57
- }
58
- class d {
59
- }
60
- function E(e) {
61
- const t = (f) => e().update(y(f)).digest(), n = e();
62
- return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
1
+ import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index.native95.js";
2
+ import { createHasher as u, clean as C, rotr as i } from "./index.native85.js";
3
+ const B = /* @__PURE__ */ Uint32Array.from([
4
+ 1116352408,
5
+ 1899447441,
6
+ 3049323471,
7
+ 3921009573,
8
+ 961987163,
9
+ 1508970993,
10
+ 2453635748,
11
+ 2870763221,
12
+ 3624381080,
13
+ 310598401,
14
+ 607225278,
15
+ 1426881987,
16
+ 1925078388,
17
+ 2162078206,
18
+ 2614888103,
19
+ 3248222580,
20
+ 3835390401,
21
+ 4022224774,
22
+ 264347078,
23
+ 604807628,
24
+ 770255983,
25
+ 1249150122,
26
+ 1555081692,
27
+ 1996064986,
28
+ 2554220882,
29
+ 2821834349,
30
+ 2952996808,
31
+ 3210313671,
32
+ 3336571891,
33
+ 3584528711,
34
+ 113926993,
35
+ 338241895,
36
+ 666307205,
37
+ 773529912,
38
+ 1294757372,
39
+ 1396182291,
40
+ 1695183700,
41
+ 1986661051,
42
+ 2177026350,
43
+ 2456956037,
44
+ 2730485921,
45
+ 2820302411,
46
+ 3259730800,
47
+ 3345764771,
48
+ 3516065817,
49
+ 3600352804,
50
+ 4094571909,
51
+ 275423344,
52
+ 430227734,
53
+ 506948616,
54
+ 659060556,
55
+ 883997877,
56
+ 958139571,
57
+ 1322822218,
58
+ 1537002063,
59
+ 1747873779,
60
+ 1955562222,
61
+ 2024104815,
62
+ 2227730452,
63
+ 2361852424,
64
+ 2428436474,
65
+ 2756734187,
66
+ 3204031479,
67
+ 3329325298
68
+ ]), h = /* @__PURE__ */ new Uint32Array(64);
69
+ class E extends D {
70
+ constructor(o = 32) {
71
+ super(64, o, 8, !1), this.A = b[0] | 0, this.B = b[1] | 0, this.C = b[2] | 0, this.D = b[3] | 0, this.E = b[4] | 0, this.F = b[5] | 0, this.G = b[6] | 0, this.H = b[7] | 0;
72
+ }
73
+ get() {
74
+ const { A: o, B: r, C: t, D: s, E: a, F: f, G: c, H: e } = this;
75
+ return [o, r, t, s, a, f, c, e];
76
+ }
77
+ // prettier-ignore
78
+ set(o, r, t, s, a, f, c, e) {
79
+ this.A = o | 0, this.B = r | 0, this.C = t | 0, this.D = s | 0, this.E = a | 0, this.F = f | 0, this.G = c | 0, this.H = e | 0;
80
+ }
81
+ process(o, r) {
82
+ for (let x = 0; x < 16; x++, r += 4)
83
+ h[x] = o.getUint32(r, !1);
84
+ for (let x = 16; x < 64; x++) {
85
+ const H = h[x - 15], d = h[x - 2], m = i(H, 7) ^ i(H, 18) ^ H >>> 3, l = i(d, 17) ^ i(d, 19) ^ d >>> 10;
86
+ h[x] = l + h[x - 7] + m + h[x - 16] | 0;
87
+ }
88
+ let { A: t, B: s, C: a, D: f, E: c, F: e, G: n, H: A } = this;
89
+ for (let x = 0; x < 64; x++) {
90
+ const H = i(c, 6) ^ i(c, 11) ^ i(c, 25), d = A + H + g(c, e, n) + B[x] + h[x] | 0, l = (i(t, 2) ^ i(t, 13) ^ i(t, 22)) + p(t, s, a) | 0;
91
+ A = n, n = e, e = c, c = f + d | 0, f = a, a = s, s = t, t = d + l | 0;
92
+ }
93
+ t = t + this.A | 0, s = s + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, c = c + this.E | 0, e = e + this.F | 0, n = n + this.G | 0, A = A + this.H | 0, this.set(t, s, a, f, c, e, n, A);
94
+ }
95
+ roundClean() {
96
+ C(h);
97
+ }
98
+ destroy() {
99
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), C(this.buffer);
100
+ }
63
101
  }
102
+ const y = /* @__PURE__ */ u(() => new E());
64
103
  export {
65
- d as Hash,
66
- r as abytes,
67
- h as aexists,
68
- w as anumber,
69
- l as aoutput,
70
- u as byteSwap,
71
- c as byteSwap32,
72
- g as clean,
73
- E as createHasher,
74
- p as createView,
75
- o as isBytes,
76
- i as isLE,
77
- b as rotr,
78
- x as swap32IfBE,
79
- y as toBytes,
80
- a as u32,
81
- s as utf8ToBytes
104
+ E as SHA256,
105
+ y as sha256
82
106
  };
@@ -1,4 +1,4 @@
1
- import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index.native86.js";
1
+ import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index.native85.js";
2
2
  function y(o, t, s, n) {
3
3
  if (typeof o.setBigUint64 == "function")
4
4
  return o.setBigUint64(t, s, n);
@@ -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",
@@ -1,4 +1,4 @@
1
- import { chainConfig as a } from "./index.web94.js";
1
+ import { chainConfig as a } from "./index.web93.js";
2
2
  import { defineChain as t } from "./index.web30.js";
3
3
  const e = 11155111, r = /* @__PURE__ */ t({
4
4
  ...a,