@coinbase/cdp-core 0.0.46 → 0.0.48

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 (107) hide show
  1. package/dist/esm/index.native102.js +77 -19
  2. package/dist/esm/index.native103.js +9 -9
  3. package/dist/esm/index.native104.js +20 -19
  4. package/dist/esm/index.native105.js +9 -93
  5. package/dist/esm/index.native106.js +18 -19
  6. package/dist/esm/index.native107.js +81 -105
  7. package/dist/esm/index.native108.js +20 -9
  8. package/dist/esm/index.native109.js +112 -73
  9. package/dist/esm/index.native111.js +13 -18
  10. package/dist/esm/index.native112.js +35 -27
  11. package/dist/esm/index.native113.js +41 -7
  12. package/dist/esm/index.native114.js +18 -11
  13. package/dist/esm/index.native115.js +28 -13
  14. package/dist/esm/index.native116.js +8 -10
  15. package/dist/esm/index.native117.js +11 -17
  16. package/dist/esm/index.native118.js +12 -80
  17. package/dist/esm/index.native119.js +10 -13
  18. package/dist/esm/index.native120.js +17 -36
  19. package/dist/esm/index.native121.js +79 -40
  20. package/dist/esm/index.native35.js +1 -1
  21. package/dist/esm/index.native90.js +6 -6
  22. package/dist/esm/index.native99.js +1 -1
  23. package/dist/esm/index.web101.js +19 -77
  24. package/dist/esm/index.web102.js +9 -9
  25. package/dist/esm/index.web103.js +19 -20
  26. package/dist/esm/index.web104.js +93 -9
  27. package/dist/esm/index.web105.js +19 -18
  28. package/dist/esm/index.web106.js +105 -81
  29. package/dist/esm/index.web107.js +78 -20
  30. package/dist/esm/index.web108.js +9 -117
  31. package/dist/esm/index.web11.js +4 -4
  32. package/dist/esm/index.web110.js +18 -13
  33. package/dist/esm/index.web111.js +27 -35
  34. package/dist/esm/index.web112.js +7 -41
  35. package/dist/esm/index.web113.js +11 -18
  36. package/dist/esm/index.web114.js +13 -28
  37. package/dist/esm/index.web115.js +10 -8
  38. package/dist/esm/index.web116.js +17 -11
  39. package/dist/esm/index.web117.js +80 -12
  40. package/dist/esm/index.web118.js +13 -10
  41. package/dist/esm/index.web119.js +36 -17
  42. package/dist/esm/index.web120.js +40 -79
  43. package/dist/esm/index.web16.js +1 -1
  44. package/dist/esm/index.web31.js +149 -940
  45. package/dist/esm/index.web32.js +48 -2
  46. package/dist/esm/index.web33.js +244 -43
  47. package/dist/esm/index.web34.js +55 -27
  48. package/dist/esm/index.web35.js +940 -149
  49. package/dist/esm/index.web36.js +2 -48
  50. package/dist/esm/index.web37.js +43 -244
  51. package/dist/esm/index.web38.js +27 -55
  52. package/dist/esm/index.web89.js +6 -6
  53. package/dist/esm/index.web98.js +1 -1
  54. package/dist/native/index.native102.js +77 -19
  55. package/dist/native/index.native103.js +9 -9
  56. package/dist/native/index.native104.js +20 -19
  57. package/dist/native/index.native105.js +9 -93
  58. package/dist/native/index.native106.js +18 -19
  59. package/dist/native/index.native107.js +81 -105
  60. package/dist/native/index.native108.js +20 -9
  61. package/dist/native/index.native109.js +112 -73
  62. package/dist/native/index.native111.js +13 -18
  63. package/dist/native/index.native112.js +35 -27
  64. package/dist/native/index.native113.js +41 -7
  65. package/dist/native/index.native114.js +18 -11
  66. package/dist/native/index.native115.js +28 -13
  67. package/dist/native/index.native116.js +8 -10
  68. package/dist/native/index.native117.js +11 -17
  69. package/dist/native/index.native118.js +12 -80
  70. package/dist/native/index.native119.js +10 -13
  71. package/dist/native/index.native120.js +17 -36
  72. package/dist/native/index.native121.js +79 -40
  73. package/dist/native/index.native35.js +1 -1
  74. package/dist/native/index.native90.js +6 -6
  75. package/dist/native/index.native99.js +1 -1
  76. package/dist/web/index.web101.js +19 -77
  77. package/dist/web/index.web102.js +9 -9
  78. package/dist/web/index.web103.js +19 -20
  79. package/dist/web/index.web104.js +93 -9
  80. package/dist/web/index.web105.js +19 -18
  81. package/dist/web/index.web106.js +105 -81
  82. package/dist/web/index.web107.js +78 -20
  83. package/dist/web/index.web108.js +9 -117
  84. package/dist/web/index.web11.js +4 -4
  85. package/dist/web/index.web110.js +18 -13
  86. package/dist/web/index.web111.js +27 -35
  87. package/dist/web/index.web112.js +7 -41
  88. package/dist/web/index.web113.js +11 -18
  89. package/dist/web/index.web114.js +13 -28
  90. package/dist/web/index.web115.js +10 -8
  91. package/dist/web/index.web116.js +17 -11
  92. package/dist/web/index.web117.js +80 -12
  93. package/dist/web/index.web118.js +13 -10
  94. package/dist/web/index.web119.js +36 -17
  95. package/dist/web/index.web120.js +40 -79
  96. package/dist/web/index.web16.js +1 -1
  97. package/dist/web/index.web31.js +149 -940
  98. package/dist/web/index.web32.js +48 -2
  99. package/dist/web/index.web33.js +244 -43
  100. package/dist/web/index.web34.js +55 -27
  101. package/dist/web/index.web35.js +940 -149
  102. package/dist/web/index.web36.js +2 -48
  103. package/dist/web/index.web37.js +43 -244
  104. package/dist/web/index.web38.js +27 -55
  105. package/dist/web/index.web89.js +6 -6
  106. package/dist/web/index.web98.js +1 -1
  107. package/package.json +2 -2
@@ -1,30 +1,15 @@
1
- import { JOSENotSupported as r } from "./index.web40.js";
2
- const S = (e, s) => {
3
- const a = `SHA-${e.slice(-3)}`;
4
- switch (e) {
5
- case "HS256":
6
- case "HS384":
7
- case "HS512":
8
- return { hash: a, name: "HMAC" };
9
- case "PS256":
10
- case "PS384":
11
- case "PS512":
12
- return { hash: a, name: "RSA-PSS", saltLength: parseInt(e.slice(-3), 10) >> 3 };
13
- case "RS256":
14
- case "RS384":
15
- case "RS512":
16
- return { hash: a, name: "RSASSA-PKCS1-v1_5" };
17
- case "ES256":
18
- case "ES384":
19
- case "ES512":
20
- return { hash: a, name: "ECDSA", namedCurve: s.namedCurve };
21
- case "Ed25519":
22
- case "EdDSA":
23
- return { name: "Ed25519" };
24
- default:
25
- throw new r(`alg ${e} is not supported either by JOSE or your javascript runtime`);
26
- }
27
- };
1
+ function i(n, e, ...o) {
2
+ if (o = o.filter(Boolean), o.length > 2) {
3
+ const f = o.pop();
4
+ n += `one of type ${o.join(", ")}, or ${f}.`;
5
+ } else o.length === 2 ? n += `one of type ${o[0]} or ${o[1]}.` : n += `of type ${o[0]}.`;
6
+ return e == null ? n += ` Received ${e}` : typeof e == "function" && e.name ? n += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor?.name && (n += ` Received an instance of ${e.constructor.name}`), n;
7
+ }
8
+ const r = (n, ...e) => i("Key must be ", n, ...e);
9
+ function t(n, e, ...o) {
10
+ return i(`Key for the ${n} algorithm must be `, e, ...o);
11
+ }
28
12
  export {
29
- S as default
13
+ r as default,
14
+ t as withAlg
30
15
  };
@@ -1,10 +1,12 @@
1
- const o = (t, r) => {
2
- if (t.startsWith("RS") || t.startsWith("PS")) {
3
- const { modulusLength: e } = r.algorithm;
4
- if (typeof e != "number" || e < 2048)
5
- throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`);
6
- }
7
- };
1
+ function e(t) {
2
+ return t?.[Symbol.toStringTag] === "CryptoKey";
3
+ }
4
+ function r(t) {
5
+ return t?.[Symbol.toStringTag] === "KeyObject";
6
+ }
7
+ const n = (t) => e(t) || r(t);
8
8
  export {
9
- o as default
9
+ n as default,
10
+ e as isCryptoKey,
11
+ r as isKeyObject
10
12
  };
@@ -1,13 +1,19 @@
1
- import { checkSigCryptoKey as i } from "./index.web121.js";
2
- import o from "./index.web117.js";
3
- const s = async (t, r, e) => {
4
- if (r instanceof Uint8Array) {
5
- if (!t.startsWith("HS"))
6
- throw new TypeError(o(r, "CryptoKey", "KeyObject", "JSON Web Key"));
7
- return crypto.subtle.importKey("raw", r, { hash: `SHA-${t.slice(-3)}`, name: "HMAC" }, !1, [e]);
8
- }
9
- return i(r, t, e), r;
10
- };
1
+ import n from "./index.web93.js";
2
+ function r(t) {
3
+ return n(t) && typeof t.kty == "string";
4
+ }
5
+ function o(t) {
6
+ return t.kty !== "oct" && typeof t.d == "string";
7
+ }
8
+ function e(t) {
9
+ return t.kty !== "oct" && typeof t.d > "u";
10
+ }
11
+ function c(t) {
12
+ return t.kty === "oct" && typeof t.k == "string";
13
+ }
11
14
  export {
12
- s as default
15
+ r as isJWK,
16
+ o as isPrivateJWK,
17
+ e as isPublicJWK,
18
+ c as isSecretJWK
13
19
  };
@@ -1,15 +1,83 @@
1
- function i(n, e, ...o) {
2
- if (o = o.filter(Boolean), o.length > 2) {
3
- const f = o.pop();
4
- n += `one of type ${o.join(", ")}, or ${f}.`;
5
- } else o.length === 2 ? n += `one of type ${o[0]} or ${o[1]}.` : n += `of type ${o[0]}.`;
6
- return e == null ? n += ` Received ${e}` : typeof e == "function" && e.name ? n += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor?.name && (n += ` Received an instance of ${e.constructor.name}`), n;
7
- }
8
- const r = (n, ...e) => i("Key must be ", n, ...e);
9
- function t(n, e, ...o) {
10
- return i(`Key for the ${n} algorithm must be `, e, ...o);
1
+ import { JOSENotSupported as s } from "./index.web40.js";
2
+ function n(e) {
3
+ let a, r;
4
+ switch (e.kty) {
5
+ case "RSA": {
6
+ switch (e.alg) {
7
+ case "PS256":
8
+ case "PS384":
9
+ case "PS512":
10
+ a = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
11
+ break;
12
+ case "RS256":
13
+ case "RS384":
14
+ case "RS512":
15
+ a = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
16
+ break;
17
+ case "RSA-OAEP":
18
+ case "RSA-OAEP-256":
19
+ case "RSA-OAEP-384":
20
+ case "RSA-OAEP-512":
21
+ a = {
22
+ name: "RSA-OAEP",
23
+ hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
24
+ }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
25
+ break;
26
+ default:
27
+ throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
28
+ }
29
+ break;
30
+ }
31
+ case "EC": {
32
+ switch (e.alg) {
33
+ case "ES256":
34
+ a = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
35
+ break;
36
+ case "ES384":
37
+ a = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
38
+ break;
39
+ case "ES512":
40
+ a = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
41
+ break;
42
+ case "ECDH-ES":
43
+ case "ECDH-ES+A128KW":
44
+ case "ECDH-ES+A192KW":
45
+ case "ECDH-ES+A256KW":
46
+ a = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
47
+ break;
48
+ default:
49
+ throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
50
+ }
51
+ break;
52
+ }
53
+ case "OKP": {
54
+ switch (e.alg) {
55
+ case "Ed25519":
56
+ case "EdDSA":
57
+ a = { name: "Ed25519" }, r = e.d ? ["sign"] : ["verify"];
58
+ break;
59
+ case "ECDH-ES":
60
+ case "ECDH-ES+A128KW":
61
+ case "ECDH-ES+A192KW":
62
+ case "ECDH-ES+A256KW":
63
+ a = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
64
+ break;
65
+ default:
66
+ throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
67
+ }
68
+ break;
69
+ }
70
+ default:
71
+ throw new s('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
72
+ }
73
+ return { algorithm: a, keyUsages: r };
11
74
  }
75
+ const i = async (e) => {
76
+ if (!e.alg)
77
+ throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
78
+ const { algorithm: a, keyUsages: r } = n(e), t = { ...e };
79
+ return delete t.alg, delete t.use, crypto.subtle.importKey("jwk", t, a, e.ext ?? !e.d, e.key_ops ?? r);
80
+ };
12
81
  export {
13
- r as default,
14
- t as withAlg
82
+ i as default
15
83
  };
@@ -1,12 +1,15 @@
1
- function e(t) {
2
- return t?.[Symbol.toStringTag] === "CryptoKey";
3
- }
4
- function r(t) {
5
- return t?.[Symbol.toStringTag] === "KeyObject";
6
- }
7
- const n = (t) => e(t) || r(t);
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"
11
+ }
12
+ };
8
13
  export {
9
- n as default,
10
- e as isCryptoKey,
11
- r as isKeyObject
14
+ s as contracts
12
15
  };
@@ -1,19 +1,38 @@
1
- import n from "./index.web93.js";
2
- function r(t) {
3
- return n(t) && typeof t.kty == "string";
4
- }
5
- function o(t) {
6
- return t.kty !== "oct" && typeof t.d == "string";
7
- }
8
- function e(t) {
9
- return t.kty !== "oct" && typeof t.d > "u";
10
- }
11
- function c(t) {
12
- return t.kty === "oct" && typeof t.k == "string";
13
- }
1
+ import { hexToBigInt as n } from "./index.web62.js";
2
+ import { defineBlock as r } from "./index.web59.js";
3
+ import { defineTransaction as s, formatTransaction as m } from "./index.web61.js";
4
+ import { defineTransactionReceipt as l } from "./index.web64.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
+ })
35
+ };
14
36
  export {
15
- r as isJWK,
16
- o as isPrivateJWK,
17
- e as isPublicJWK,
18
- c as isSecretJWK
37
+ p as formatters
19
38
  };
@@ -1,83 +1,44 @@
1
- import { JOSENotSupported as s } from "./index.web40.js";
2
- function n(e) {
3
- let a, r;
4
- switch (e.kty) {
5
- case "RSA": {
6
- switch (e.alg) {
7
- case "PS256":
8
- case "PS384":
9
- case "PS512":
10
- a = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
11
- break;
12
- case "RS256":
13
- case "RS384":
14
- case "RS512":
15
- a = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
16
- break;
17
- case "RSA-OAEP":
18
- case "RSA-OAEP-256":
19
- case "RSA-OAEP-384":
20
- case "RSA-OAEP-512":
21
- a = {
22
- name: "RSA-OAEP",
23
- hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
24
- }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
25
- break;
26
- default:
27
- throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
28
- }
29
- break;
30
- }
31
- case "EC": {
32
- switch (e.alg) {
33
- case "ES256":
34
- a = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
35
- break;
36
- case "ES384":
37
- a = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
38
- break;
39
- case "ES512":
40
- a = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
41
- break;
42
- case "ECDH-ES":
43
- case "ECDH-ES+A128KW":
44
- case "ECDH-ES+A192KW":
45
- case "ECDH-ES+A256KW":
46
- a = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
47
- break;
48
- default:
49
- throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
50
- }
51
- break;
52
- }
53
- case "OKP": {
54
- switch (e.alg) {
55
- case "Ed25519":
56
- case "EdDSA":
57
- a = { name: "Ed25519" }, r = e.d ? ["sign"] : ["verify"];
58
- break;
59
- case "ECDH-ES":
60
- case "ECDH-ES+A128KW":
61
- case "ECDH-ES+A192KW":
62
- case "ECDH-ES+A256KW":
63
- a = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
64
- break;
65
- default:
66
- throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
67
- }
68
- break;
69
- }
70
- default:
71
- throw new s('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
72
- }
73
- return { algorithm: a, keyUsages: r };
1
+ import { InvalidAddressError as a } from "./index.web77.js";
2
+ import { isAddress as f } from "./index.web51.js";
3
+ import { concatHex as p } from "./index.web52.js";
4
+ import { toHex as i } from "./index.web46.js";
5
+ import { toRlp as x } from "./index.web65.js";
6
+ import { serializeTransaction as l } from "./index.web25.js";
7
+ function T(r, e) {
8
+ return h(r) ? z(r) : l(r, e);
74
9
  }
75
- const i = async (e) => {
76
- if (!e.alg)
77
- throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
78
- const { algorithm: a, keyUsages: r } = n(e), t = { ...e };
79
- return delete t.alg, delete t.use, crypto.subtle.importKey("jwk", t, a, e.ext ?? !e.d, e.key_ops ?? r);
10
+ const E = {
11
+ transaction: T
80
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
+ }
81
40
  export {
82
- i as default
41
+ w as assertTransactionDeposit,
42
+ T as serializeTransaction,
43
+ E as serializers
83
44
  };
@@ -1,4 +1,4 @@
1
- import { __require as r } from "./index.web31.js";
1
+ import { __require as r } from "./index.web35.js";
2
2
  var f = r();
3
3
  export {
4
4
  f as b