@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,120 +1,12 @@
1
- import { isJWK as p } from "./index.web119.js";
2
- import { decode as m } from "./index.web103.js";
3
- import y from "./index.web120.js";
4
- import { isCryptoKey as S, isKeyObject as K } from "./index.web118.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 { contracts as o } from "./index.web118.js";
2
+ import { formatters as r } from "./index.web119.js";
3
+ import { serializers as t } from "./index.web120.js";
4
+ const e = {
5
+ blockTime: 2e3,
6
+ contracts: o,
7
+ formatters: r,
8
+ serializers: t
117
9
  };
118
10
  export {
119
- d as default
11
+ e as chainConfig
120
12
  };
@@ -1,14 +1,14 @@
1
1
  import { Provider as h } from "ox";
2
2
  import { http as m } from "viem";
3
3
  import { createStore as p } from "zustand";
4
- import { subscribeWithSelector as g, persist as f, createJSONStorage as S } from "./index.web35.js";
4
+ import { subscribeWithSelector as g, persist as f, createJSONStorage as S } from "./index.web31.js";
5
5
  import { validateRequest as I, EIP1193ProviderError as w, STANDARD_ERROR_CODES as C } from "./index.web12.js";
6
- import { EventEmitter as b } from "./index.web36.js";
6
+ import { EventEmitter as b } from "./index.web32.js";
7
7
  import { getPlatformStorage as _ } from "./index.web2.js";
8
8
  import "@coinbase/cdp-api-client";
9
- import { handleGetCapabilities as A, handleGetCallsStatus as v, handleSendCalls as D, handleChainId as P, handleSignTypedData as E, handleEthSign as R, handleSwitchEthereumChain as y, handleDisconnect as T, handleSendTransaction as q, handlePersonalSign as N, handleRequestAccounts as O, handleAccounts as G } from "./index.web37.js";
9
+ import { handleGetCapabilities as A, handleGetCallsStatus as v, handleSendCalls as D, handleChainId as P, handleSignTypedData as E, handleEthSign as R, handleSwitchEthereumChain as y, handleDisconnect as T, handleSendTransaction as q, handlePersonalSign as N, handleRequestAccounts as O, handleAccounts as G } from "./index.web33.js";
10
10
  import { onAuthStateChange as L } from "./index.web6.js";
11
- import { baseSepolia as l } from "./index.web38.js";
11
+ import { baseSepolia as l } from "./index.web34.js";
12
12
  function M(r, n, s) {
13
13
  n.subscribe(
14
14
  (t) => t.chainId,
@@ -1,15 +1,20 @@
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
- };
1
+ function o(t) {
2
+ if (Uint8Array.prototype.toBase64)
3
+ return t.toBase64();
4
+ const e = 32768, n = [];
5
+ for (let r = 0; r < t.length; r += e)
6
+ n.push(String.fromCharCode.apply(null, t.subarray(r, r + e)));
7
+ return btoa(n.join(""));
8
+ }
9
+ function a(t) {
10
+ if (Uint8Array.fromBase64)
11
+ return Uint8Array.fromBase64(t);
12
+ const e = atob(t), n = new Uint8Array(e.length);
13
+ for (let r = 0; r < e.length; r++)
14
+ n[r] = e.charCodeAt(r);
15
+ return n;
16
+ }
13
17
  export {
14
- s as contracts
18
+ a as decodeBase64,
19
+ o as encodeBase64
15
20
  };
@@ -1,38 +1,30 @@
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
- })
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
+ }
35
27
  };
36
28
  export {
37
- p as formatters
29
+ S as default
38
30
  };
@@ -1,44 +1,10 @@
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);
9
- }
10
- const E = {
11
- transaction: T
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
+ }
12
7
  };
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
- }
40
8
  export {
41
- w as assertTransactionDeposit,
42
- T as serializeTransaction,
43
- E as serializers
9
+ o as default
44
10
  };
@@ -1,20 +1,13 @@
1
- function o(t) {
2
- if (Uint8Array.prototype.toBase64)
3
- return t.toBase64();
4
- const e = 32768, n = [];
5
- for (let r = 0; r < t.length; r += e)
6
- n.push(String.fromCharCode.apply(null, t.subarray(r, r + e)));
7
- return btoa(n.join(""));
8
- }
9
- function a(t) {
10
- if (Uint8Array.fromBase64)
11
- return Uint8Array.fromBase64(t);
12
- const e = atob(t), n = new Uint8Array(e.length);
13
- for (let r = 0; r < e.length; r++)
14
- n[r] = e.charCodeAt(r);
15
- return n;
16
- }
1
+ import { checkSigCryptoKey as i } from "./index.web121.js";
2
+ import o from "./index.web114.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
+ };
17
11
  export {
18
- a as decodeBase64,
19
- o as encodeBase64
12
+ s as default
20
13
  };
@@ -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
  };