@coinbase/cdp-core 0.0.20 → 0.0.21

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 (87) hide show
  1. package/README.md +75 -1
  2. package/dist/esm/index.js +29 -27
  3. package/dist/esm/index103.js +1 -1
  4. package/dist/esm/index15.js +8 -8
  5. package/dist/esm/index16.js +2 -2
  6. package/dist/esm/index17.js +39 -158
  7. package/dist/esm/index18.js +16 -47
  8. package/dist/esm/index19.js +4 -152
  9. package/dist/esm/index2.js +154 -87
  10. package/dist/esm/index20.js +5 -56
  11. package/dist/esm/index21.js +158 -39
  12. package/dist/esm/index22.js +47 -16
  13. package/dist/esm/index23.js +152 -4
  14. package/dist/esm/index24.js +56 -5
  15. package/dist/esm/index25.js +8 -12
  16. package/dist/esm/index26.js +17 -11
  17. package/dist/esm/index27.js +45 -8
  18. package/dist/esm/index28.js +13 -17
  19. package/dist/esm/index29.js +50 -40
  20. package/dist/esm/index3.js +4 -4
  21. package/dist/esm/index30.js +6 -13
  22. package/dist/esm/index31.js +20 -54
  23. package/dist/esm/index32.js +11 -6
  24. package/dist/esm/index33.js +3 -21
  25. package/dist/esm/index34.js +3 -3
  26. package/dist/esm/index35.js +34 -3
  27. package/dist/esm/index36.js +10 -32
  28. package/dist/esm/index37.js +4 -12
  29. package/dist/esm/index38.js +28 -4
  30. package/dist/esm/index39.js +6 -28
  31. package/dist/esm/index40.js +24 -6
  32. package/dist/esm/index41.js +16 -24
  33. package/dist/esm/index42.js +54 -16
  34. package/dist/esm/index43.js +22 -53
  35. package/dist/esm/index44.js +11 -23
  36. package/dist/esm/index45.js +26 -10
  37. package/dist/esm/index46.js +41 -26
  38. package/dist/esm/index47.js +54 -41
  39. package/dist/esm/index48.js +126 -54
  40. package/dist/esm/index49.js +11 -126
  41. package/dist/esm/index50.js +101 -9
  42. package/dist/esm/index51.js +6 -104
  43. package/dist/esm/index52.js +3 -7
  44. package/dist/esm/index53.js +15 -3
  45. package/dist/esm/index54.js +42 -14
  46. package/dist/esm/index55.js +74 -38
  47. package/dist/esm/index56.js +2 -79
  48. package/dist/esm/index57.js +2 -2
  49. package/dist/esm/index58.js +13 -2
  50. package/dist/esm/index59.js +2 -2
  51. package/dist/esm/index6.js +4 -4
  52. package/dist/esm/index60.js +1 -1
  53. package/dist/esm/index61.js +1 -1
  54. package/dist/esm/index62.js +2 -2
  55. package/dist/esm/index63.js +2 -2
  56. package/dist/esm/index64.js +1 -1
  57. package/dist/esm/index65.js +1 -1
  58. package/dist/esm/index66.js +3 -3
  59. package/dist/esm/index7.js +7 -6
  60. package/dist/esm/index70.js +1 -1
  61. package/dist/esm/index72.js +4 -4
  62. package/dist/esm/index73.js +2 -104
  63. package/dist/esm/index74.js +17 -75
  64. package/dist/esm/index75.js +20 -80
  65. package/dist/esm/index76.js +80 -2
  66. package/dist/esm/index77.js +100 -17
  67. package/dist/esm/index78.js +31 -18
  68. package/dist/esm/index79.js +6 -32
  69. package/dist/esm/index8.js +10 -8
  70. package/dist/esm/index80.js +54 -6
  71. package/dist/esm/index81.js +11 -10
  72. package/dist/esm/index82.js +2 -55
  73. package/dist/esm/index83.js +45 -11
  74. package/dist/esm/index84.js +14 -2
  75. package/dist/esm/index85.js +9 -44
  76. package/dist/esm/index86.js +78 -13
  77. package/dist/esm/index88.js +20 -12
  78. package/dist/esm/index89.js +9 -35
  79. package/dist/esm/index90.js +19 -41
  80. package/dist/esm/index91.js +93 -20
  81. package/dist/esm/index92.js +20 -9
  82. package/dist/esm/index93.js +114 -16
  83. package/dist/esm/index94.js +11 -92
  84. package/dist/esm/index95.js +35 -20
  85. package/dist/esm/index96.js +41 -117
  86. package/dist/types/index.d.ts +33 -0
  87. package/package.json +3 -3
@@ -1,22 +1,120 @@
1
- const a = (...o) => {
2
- const t = o.filter(Boolean);
3
- if (t.length === 0 || t.length === 1)
4
- return !0;
5
- let e;
6
- for (const s of t) {
7
- const r = Object.keys(s);
8
- if (!e || e.size === 0) {
9
- e = new Set(r);
10
- continue;
1
+ import { isJWK as p } from "./index103.js";
2
+ import { decode as m } from "./index88.js";
3
+ import y from "./index104.js";
4
+ import { isCryptoKey as S, isKeyObject as K } from "./index102.js";
5
+ let c;
6
+ const f = async (e, r, s, i = !1) => {
7
+ c ||= /* @__PURE__ */ new WeakMap();
8
+ let n = c.get(e);
9
+ if (n?.[s])
10
+ return n[s];
11
+ const t = await y({ ...r, alg: s });
12
+ return i && Object.freeze(e), n ? n[s] = t : c.set(e, { [s]: t }), t;
13
+ }, E = (e, r) => {
14
+ c ||= /* @__PURE__ */ new WeakMap();
15
+ let s = c.get(e);
16
+ if (s?.[r])
17
+ return s[r];
18
+ const i = e.type === "public", n = !!i;
19
+ let t;
20
+ if (e.asymmetricKeyType === "x25519") {
21
+ switch (r) {
22
+ case "ECDH-ES":
23
+ case "ECDH-ES+A128KW":
24
+ case "ECDH-ES+A192KW":
25
+ case "ECDH-ES+A256KW":
26
+ break;
27
+ default:
28
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
11
29
  }
12
- for (const n of r) {
13
- if (e.has(n))
14
- return !1;
15
- e.add(n);
30
+ t = e.toCryptoKey(e.asymmetricKeyType, n, i ? [] : ["deriveBits"]);
31
+ }
32
+ if (e.asymmetricKeyType === "ed25519") {
33
+ if (r !== "EdDSA" && r !== "Ed25519")
34
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
35
+ t = e.toCryptoKey(e.asymmetricKeyType, n, [
36
+ i ? "verify" : "sign"
37
+ ]);
38
+ }
39
+ if (e.asymmetricKeyType === "rsa") {
40
+ let a;
41
+ switch (r) {
42
+ case "RSA-OAEP":
43
+ a = "SHA-1";
44
+ break;
45
+ case "RS256":
46
+ case "PS256":
47
+ case "RSA-OAEP-256":
48
+ a = "SHA-256";
49
+ break;
50
+ case "RS384":
51
+ case "PS384":
52
+ case "RSA-OAEP-384":
53
+ a = "SHA-384";
54
+ break;
55
+ case "RS512":
56
+ case "PS512":
57
+ case "RSA-OAEP-512":
58
+ a = "SHA-512";
59
+ break;
60
+ default:
61
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
16
62
  }
63
+ if (r.startsWith("RSA-OAEP"))
64
+ return e.toCryptoKey({
65
+ name: "RSA-OAEP",
66
+ hash: a
67
+ }, n, i ? ["encrypt"] : ["decrypt"]);
68
+ t = e.toCryptoKey({
69
+ name: r.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
70
+ hash: a
71
+ }, n, [i ? "verify" : "sign"]);
72
+ }
73
+ if (e.asymmetricKeyType === "ec") {
74
+ const o = (/* @__PURE__ */ new Map([
75
+ ["prime256v1", "P-256"],
76
+ ["secp384r1", "P-384"],
77
+ ["secp521r1", "P-521"]
78
+ ])).get(e.asymmetricKeyDetails?.namedCurve);
79
+ if (!o)
80
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
81
+ r === "ES256" && o === "P-256" && (t = e.toCryptoKey({
82
+ name: "ECDSA",
83
+ namedCurve: o
84
+ }, n, [i ? "verify" : "sign"])), r === "ES384" && o === "P-384" && (t = e.toCryptoKey({
85
+ name: "ECDSA",
86
+ namedCurve: o
87
+ }, n, [i ? "verify" : "sign"])), r === "ES512" && o === "P-521" && (t = e.toCryptoKey({
88
+ name: "ECDSA",
89
+ namedCurve: o
90
+ }, n, [i ? "verify" : "sign"])), r.startsWith("ECDH-ES") && (t = e.toCryptoKey({
91
+ name: "ECDH",
92
+ namedCurve: o
93
+ }, n, i ? [] : ["deriveBits"]));
94
+ }
95
+ if (!t)
96
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
97
+ return s ? s[r] = t : c.set(e, { [r]: t }), t;
98
+ }, d = async (e, r) => {
99
+ if (e instanceof Uint8Array || S(e))
100
+ return e;
101
+ if (K(e)) {
102
+ if (e.type === "secret")
103
+ return e.export();
104
+ if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
105
+ try {
106
+ return E(e, r);
107
+ } catch (i) {
108
+ if (i instanceof TypeError)
109
+ throw i;
110
+ }
111
+ let s = e.export({ format: "jwk" });
112
+ return f(e, s, r);
17
113
  }
18
- return !0;
114
+ if (p(e))
115
+ return e.k ? m(e.k) : f(e, e, r, !0);
116
+ throw new Error("unreachable");
19
117
  };
20
118
  export {
21
- a as default
119
+ d as default
22
120
  };
@@ -1,96 +1,15 @@
1
- import { withAlg as n } from "./index101.js";
2
- import c from "./index102.js";
3
- import { isJWK as p, isSecretJWK as a, isPublicJWK as y, isPrivateJWK as f } from "./index103.js";
4
- const s = (r) => r?.[Symbol.toStringTag], o = (r, e, t) => {
5
- if (e.use !== void 0) {
6
- let i;
7
- switch (t) {
8
- case "sign":
9
- case "verify":
10
- i = "sig";
11
- break;
12
- case "encrypt":
13
- case "decrypt":
14
- i = "enc";
15
- break;
16
- }
17
- if (e.use !== i)
18
- throw new TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`);
1
+ const s = {
2
+ gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
3
+ l1Block: { address: "0x4200000000000000000000000000000000000015" },
4
+ l2CrossDomainMessenger: {
5
+ address: "0x4200000000000000000000000000000000000007"
6
+ },
7
+ l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
8
+ l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
9
+ l2ToL1MessagePasser: {
10
+ address: "0x4200000000000000000000000000000000000016"
19
11
  }
20
- if (e.alg !== void 0 && e.alg !== r)
21
- throw new TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);
22
- if (Array.isArray(e.key_ops)) {
23
- let i;
24
- switch (!0) {
25
- case t === "sign":
26
- case r === "dir":
27
- case r.includes("CBC-HS"):
28
- i = t;
29
- break;
30
- case r.startsWith("PBES2"):
31
- i = "deriveBits";
32
- break;
33
- case /^A\d{3}(?:GCM)?(?:KW)?$/.test(r):
34
- !r.includes("GCM") && r.endsWith("KW") ? i = "unwrapKey" : i = t;
35
- break;
36
- case t === "encrypt":
37
- i = "wrapKey";
38
- break;
39
- case t === "decrypt":
40
- i = r.startsWith("RSA") ? "unwrapKey" : "deriveBits";
41
- break;
42
- }
43
- if (i && e.key_ops?.includes?.(i) === !1)
44
- throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`);
45
- }
46
- return !0;
47
- }, h = (r, e, t) => {
48
- if (!(e instanceof Uint8Array)) {
49
- if (p(e)) {
50
- if (a(e) && o(r, e, t))
51
- return;
52
- throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
53
- }
54
- if (!c(e))
55
- throw new TypeError(n(r, e, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
56
- if (e.type !== "secret")
57
- throw new TypeError(`${s(e)} instances for symmetric algorithms must be of type "secret"`);
58
- }
59
- }, m = (r, e, t) => {
60
- if (p(e))
61
- switch (t) {
62
- case "decrypt":
63
- case "sign":
64
- if (f(e) && o(r, e, t))
65
- return;
66
- throw new TypeError("JSON Web Key for this operation be a private JWK");
67
- case "encrypt":
68
- case "verify":
69
- if (y(e) && o(r, e, t))
70
- return;
71
- throw new TypeError("JSON Web Key for this operation be a public JWK");
72
- }
73
- if (!c(e))
74
- throw new TypeError(n(r, e, "CryptoKey", "KeyObject", "JSON Web Key"));
75
- if (e.type === "secret")
76
- throw new TypeError(`${s(e)} instances for asymmetric algorithms must not be of type "secret"`);
77
- if (e.type === "public")
78
- switch (t) {
79
- case "sign":
80
- throw new TypeError(`${s(e)} instances for asymmetric algorithm signing must be of type "private"`);
81
- case "decrypt":
82
- throw new TypeError(`${s(e)} instances for asymmetric algorithm decryption must be of type "private"`);
83
- }
84
- if (e.type === "private")
85
- switch (t) {
86
- case "verify":
87
- throw new TypeError(`${s(e)} instances for asymmetric algorithm verifying must be of type "public"`);
88
- case "encrypt":
89
- throw new TypeError(`${s(e)} instances for asymmetric algorithm encryption must be of type "public"`);
90
- }
91
- }, d = (r, e, t) => {
92
- r.startsWith("HS") || r === "dir" || r.startsWith("PBES2") || /^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(r) || /^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(r) ? h(r, e, t) : m(r, e, t);
93
12
  };
94
13
  export {
95
- d as default
14
+ s as contracts
96
15
  };
@@ -1,23 +1,38 @@
1
- import { JOSENotSupported as f } from "./index71.js";
2
- const w = (n, r, a, e, s) => {
3
- if (s.crit !== void 0 && e?.crit === void 0)
4
- throw new n('"crit" (Critical) Header Parameter MUST be integrity protected');
5
- if (!e || e.crit === void 0)
6
- return /* @__PURE__ */ new Set();
7
- if (!Array.isArray(e.crit) || e.crit.length === 0 || e.crit.some((i) => typeof i != "string" || i.length === 0))
8
- throw new n('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
9
- let t;
10
- a !== void 0 ? t = new Map([...Object.entries(a), ...r.entries()]) : t = r;
11
- for (const i of e.crit) {
12
- if (!t.has(i))
13
- throw new f(`Extension Header Parameter "${i}" is not recognized`);
14
- if (s[i] === void 0)
15
- throw new n(`Extension Header Parameter "${i}" is missing`);
16
- if (t.get(i) && e[i] === void 0)
17
- throw new n(`Extension Header Parameter "${i}" MUST be integrity protected`);
18
- }
19
- return new Set(e.crit);
1
+ import { hexToBigInt as n } from "./index43.js";
2
+ import { defineBlock as r } from "./index40.js";
3
+ import { defineTransaction as s, formatTransaction as m } from "./index42.js";
4
+ import { defineTransactionReceipt as l } from "./index45.js";
5
+ const p = {
6
+ block: /* @__PURE__ */ r({
7
+ format(e) {
8
+ return {
9
+ transactions: e.transactions?.map((t) => {
10
+ if (typeof t == "string")
11
+ return t;
12
+ const i = m(t);
13
+ return i.typeHex === "0x7e" && (i.isSystemTx = t.isSystemTx, i.mint = t.mint ? n(t.mint) : void 0, i.sourceHash = t.sourceHash, i.type = "deposit"), i;
14
+ }),
15
+ stateRoot: e.stateRoot
16
+ };
17
+ }
18
+ }),
19
+ transaction: /* @__PURE__ */ s({
20
+ format(e) {
21
+ const o = {};
22
+ return e.type === "0x7e" && (o.isSystemTx = e.isSystemTx, o.mint = e.mint ? n(e.mint) : void 0, o.sourceHash = e.sourceHash, o.type = "deposit"), o;
23
+ }
24
+ }),
25
+ transactionReceipt: /* @__PURE__ */ l({
26
+ format(e) {
27
+ return {
28
+ l1GasPrice: e.l1GasPrice ? n(e.l1GasPrice) : null,
29
+ l1GasUsed: e.l1GasUsed ? n(e.l1GasUsed) : null,
30
+ l1Fee: e.l1Fee ? n(e.l1Fee) : null,
31
+ l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
32
+ };
33
+ }
34
+ })
20
35
  };
21
36
  export {
22
- w as default
37
+ p as formatters
23
38
  };
@@ -1,120 +1,44 @@
1
- import { isJWK as p } from "./index103.js";
2
- import { decode as m } from "./index91.js";
3
- import y from "./index104.js";
4
- import { isCryptoKey as S, isKeyObject as K } from "./index102.js";
5
- let c;
6
- const f = async (e, r, s, i = !1) => {
7
- c ||= /* @__PURE__ */ new WeakMap();
8
- let n = c.get(e);
9
- if (n?.[s])
10
- return n[s];
11
- const t = await y({ ...r, alg: s });
12
- return i && Object.freeze(e), n ? n[s] = t : c.set(e, { [s]: t }), t;
13
- }, E = (e, r) => {
14
- c ||= /* @__PURE__ */ new WeakMap();
15
- let s = c.get(e);
16
- if (s?.[r])
17
- return s[r];
18
- const i = e.type === "public", n = !!i;
19
- let t;
20
- if (e.asymmetricKeyType === "x25519") {
21
- switch (r) {
22
- case "ECDH-ES":
23
- case "ECDH-ES+A128KW":
24
- case "ECDH-ES+A192KW":
25
- case "ECDH-ES+A256KW":
26
- break;
27
- default:
28
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
29
- }
30
- t = e.toCryptoKey(e.asymmetricKeyType, n, i ? [] : ["deriveBits"]);
31
- }
32
- if (e.asymmetricKeyType === "ed25519") {
33
- if (r !== "EdDSA" && r !== "Ed25519")
34
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
35
- t = e.toCryptoKey(e.asymmetricKeyType, n, [
36
- i ? "verify" : "sign"
37
- ]);
38
- }
39
- if (e.asymmetricKeyType === "rsa") {
40
- let a;
41
- switch (r) {
42
- case "RSA-OAEP":
43
- a = "SHA-1";
44
- break;
45
- case "RS256":
46
- case "PS256":
47
- case "RSA-OAEP-256":
48
- a = "SHA-256";
49
- break;
50
- case "RS384":
51
- case "PS384":
52
- case "RSA-OAEP-384":
53
- a = "SHA-384";
54
- break;
55
- case "RS512":
56
- case "PS512":
57
- case "RSA-OAEP-512":
58
- a = "SHA-512";
59
- break;
60
- default:
61
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
62
- }
63
- if (r.startsWith("RSA-OAEP"))
64
- return e.toCryptoKey({
65
- name: "RSA-OAEP",
66
- hash: a
67
- }, n, i ? ["encrypt"] : ["decrypt"]);
68
- t = e.toCryptoKey({
69
- name: r.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
70
- hash: a
71
- }, n, [i ? "verify" : "sign"]);
72
- }
73
- if (e.asymmetricKeyType === "ec") {
74
- const o = (/* @__PURE__ */ new Map([
75
- ["prime256v1", "P-256"],
76
- ["secp384r1", "P-384"],
77
- ["secp521r1", "P-521"]
78
- ])).get(e.asymmetricKeyDetails?.namedCurve);
79
- if (!o)
80
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
81
- r === "ES256" && o === "P-256" && (t = e.toCryptoKey({
82
- name: "ECDSA",
83
- namedCurve: o
84
- }, n, [i ? "verify" : "sign"])), r === "ES384" && o === "P-384" && (t = e.toCryptoKey({
85
- name: "ECDSA",
86
- namedCurve: o
87
- }, n, [i ? "verify" : "sign"])), r === "ES512" && o === "P-521" && (t = e.toCryptoKey({
88
- name: "ECDSA",
89
- namedCurve: o
90
- }, n, [i ? "verify" : "sign"])), r.startsWith("ECDH-ES") && (t = e.toCryptoKey({
91
- name: "ECDH",
92
- namedCurve: o
93
- }, n, i ? [] : ["deriveBits"]));
94
- }
95
- if (!t)
96
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
97
- return s ? s[r] = t : c.set(e, { [r]: t }), t;
98
- }, d = async (e, r) => {
99
- if (e instanceof Uint8Array || S(e))
100
- return e;
101
- if (K(e)) {
102
- if (e.type === "secret")
103
- return e.export();
104
- if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
105
- try {
106
- return E(e, r);
107
- } catch (i) {
108
- if (i instanceof TypeError)
109
- throw i;
110
- }
111
- let s = e.export({ format: "jwk" });
112
- return f(e, s, r);
113
- }
114
- if (p(e))
115
- return e.k ? m(e.k) : f(e, e, r, !0);
116
- throw new Error("unreachable");
1
+ import { InvalidAddressError as a } from "./index58.js";
2
+ import { isAddress as f } from "./index32.js";
3
+ import { concatHex as p } from "./index33.js";
4
+ import { toHex as i } from "./index27.js";
5
+ import { toRlp as x } from "./index46.js";
6
+ import { serializeTransaction as l } from "./index15.js";
7
+ function T(r, e) {
8
+ return h(r) ? z(r) : l(r, e);
9
+ }
10
+ const E = {
11
+ transaction: T
117
12
  };
13
+ function z(r) {
14
+ w(r);
15
+ const { sourceHash: e, data: o, from: m, gas: t, isSystemTx: u, mint: s, to: c, value: n } = r, d = [
16
+ e,
17
+ m,
18
+ c ?? "0x",
19
+ s ? i(s) : "0x",
20
+ n ? i(n) : "0x",
21
+ t ? i(t) : "0x",
22
+ u ? "0x1" : "0x",
23
+ o ?? "0x"
24
+ ];
25
+ return p([
26
+ "0x7e",
27
+ x(d)
28
+ ]);
29
+ }
30
+ function h(r) {
31
+ return r.type === "deposit" || typeof r.sourceHash < "u";
32
+ }
33
+ function w(r) {
34
+ const { from: e, to: o } = r;
35
+ if (e && !f(e))
36
+ throw new a({ address: e });
37
+ if (o && !f(o))
38
+ throw new a({ address: o });
39
+ }
118
40
  export {
119
- d as default
41
+ w as assertTransactionDeposit,
42
+ T as serializeTransaction,
43
+ E as serializers
120
44
  };
@@ -4,6 +4,7 @@ import { APIErrorType } from '@coinbase/cdp-api-client';
4
4
  import { Chain } from 'viem/chains';
5
5
  import { Chain as Chain_2 } from 'viem';
6
6
  import { ErrorType } from '@coinbase/cdp-api-client';
7
+ import { EvmUserOperation } from '@coinbase/cdp-api-client';
7
8
  import { HttpErrorType } from '@coinbase/cdp-api-client';
8
9
  import { LocalAccount } from 'viem';
9
10
  import { Mutate } from 'zustand';
@@ -49,6 +50,7 @@ export declare type Config = {
49
50
  useMock?: boolean;
50
51
  debugging?: boolean;
51
52
  basePath?: string;
53
+ createAccountOnLogin?: "evm-eoa" | "evm-smart";
52
54
  };
53
55
 
54
56
  export declare function createCDPEmbeddedWallet<chains extends readonly [Chain, ...Chain[]]>(_parameters: CDPEmbeddedWalletConfig<chains>): CDPEmbeddedWallet;
@@ -100,6 +102,12 @@ export declare type EthSignRequest = {
100
102
 
101
103
  export declare type EvmAddress = `0x${string}`;
102
104
 
105
+ export declare type EvmCall = {
106
+ to: EvmAddress;
107
+ value?: bigint;
108
+ data?: Hex;
109
+ };
110
+
103
111
  export declare type ExactPartial<T> = {
104
112
  [P in keyof T]?: T[P] extends object ? ExactPartial<T[P]> : T[P];
105
113
  };
@@ -118,6 +126,16 @@ export declare const getAccessToken: () => Promise<string | null>;
118
126
 
119
127
  export declare const getCurrentUser: () => Promise<User | null>;
120
128
 
129
+ export declare const getUserOperation: (options: GetUserOperationOptions) => Promise<GetUserOperationResult>;
130
+
131
+ export declare type GetUserOperationOptions = {
132
+ userOperationHash: Hex;
133
+ evmSmartAccount: EvmAddress;
134
+ network: SendEvmTransactionWithEndUserAccountBodyNetwork;
135
+ };
136
+
137
+ export declare type GetUserOperationResult = EvmUserOperation;
138
+
121
139
  export declare type Hex = `0x${string}`;
122
140
 
123
141
  export { HttpErrorType }
@@ -191,6 +209,20 @@ export declare type SendTransactionRequestParams = [
191
209
  }
192
210
  ];
193
211
 
212
+ export declare const sendUserOperation: (options: SendUserOperationOptions) => Promise<SendUserOperationResult>;
213
+
214
+ export declare type SendUserOperationOptions = {
215
+ evmSmartAccount: EvmAddress;
216
+ network: SendEvmTransactionWithEndUserAccountBodyNetwork;
217
+ calls: EvmCall[];
218
+ useCdpPaymaster?: boolean;
219
+ paymasterUrl?: string;
220
+ };
221
+
222
+ export declare type SendUserOperationResult = {
223
+ userOperationHash: Hex;
224
+ };
225
+
194
226
  export declare const signEvmHash: (options: SignEvmHashOptions) => Promise<SignEvmHashResult>;
195
227
 
196
228
  export declare type SignEvmHashOptions = {
@@ -311,6 +343,7 @@ export declare type User = {
311
343
  userId: string;
312
344
  authenticationMethods: AuthenticationMethods;
313
345
  evmAccounts?: EvmAddress[];
346
+ evmSmartAccounts?: EvmAddress[];
314
347
  };
315
348
 
316
349
  export declare const verifyEmailOTP: (options: VerifyEmailOTPOptions) => Promise<VerifyEmailOTPResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-core",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**",
@@ -17,7 +17,7 @@
17
17
  "ox": "0.8.1",
18
18
  "viem": "^2.33.0",
19
19
  "zustand": "^5.0.6",
20
- "@coinbase/cdp-api-client": "^0.0.20"
20
+ "@coinbase/cdp-api-client": "^0.0.21"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -45,7 +45,7 @@
45
45
  "path": "./dist/esm/index.js",
46
46
  "running": false,
47
47
  "import": "{ signEvmHash, signEvmTransaction, sendEvmTransaction, signEvmMessage, signEvmTypedData }",
48
- "limit": "25 KB"
48
+ "limit": "30 KB"
49
49
  },
50
50
  {
51
51
  "name": "export",