@coinbase/cdp-core 0.0.35 → 0.0.36

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 (73) hide show
  1. package/README.md +9 -5
  2. package/dist/esm/index.native100.js +7 -41
  3. package/dist/esm/index.native101.js +11 -18
  4. package/dist/esm/index.native102.js +13 -28
  5. package/dist/esm/index.native103.js +10 -8
  6. package/dist/esm/index.native104.js +17 -11
  7. package/dist/esm/index.native105.js +80 -12
  8. package/dist/esm/index.native106.js +13 -10
  9. package/dist/esm/index.native107.js +36 -17
  10. package/dist/esm/index.native108.js +40 -79
  11. package/dist/esm/index.native28.js +1 -1
  12. package/dist/esm/index.native6.js +172 -173
  13. package/dist/esm/index.native86.js +1 -1
  14. package/dist/esm/index.native89.js +79 -10
  15. package/dist/esm/index.native90.js +1 -1
  16. package/dist/esm/index.native91.js +3 -3
  17. package/dist/esm/index.native93.js +3 -3
  18. package/dist/esm/index.native95.js +3 -3
  19. package/dist/esm/index.native96.js +10 -79
  20. package/dist/esm/index.native98.js +18 -13
  21. package/dist/esm/index.native99.js +27 -35
  22. package/dist/esm/index.web5.js +172 -173
  23. package/dist/esm/index.web55.js +2 -2
  24. package/dist/esm/index.web57.js +1 -1
  25. package/dist/esm/index.web75.js +6 -6
  26. package/dist/esm/index.web82.js +102 -18
  27. package/dist/esm/index.web83.js +20 -80
  28. package/dist/esm/index.web84.js +79 -103
  29. package/dist/esm/index.web87.js +77 -19
  30. package/dist/esm/index.web88.js +21 -10
  31. package/dist/esm/index.web89.js +9 -19
  32. package/dist/esm/index.web90.js +15 -89
  33. package/dist/esm/index.web91.js +92 -19
  34. package/dist/esm/index.web92.js +18 -115
  35. package/dist/esm/index.web93.js +112 -73
  36. package/dist/native/index.native100.js +7 -41
  37. package/dist/native/index.native101.js +11 -18
  38. package/dist/native/index.native102.js +13 -28
  39. package/dist/native/index.native103.js +10 -8
  40. package/dist/native/index.native104.js +17 -11
  41. package/dist/native/index.native105.js +80 -12
  42. package/dist/native/index.native106.js +13 -10
  43. package/dist/native/index.native107.js +36 -17
  44. package/dist/native/index.native108.js +40 -79
  45. package/dist/native/index.native28.js +1 -1
  46. package/dist/native/index.native6.js +172 -173
  47. package/dist/native/index.native86.js +1 -1
  48. package/dist/native/index.native89.js +79 -10
  49. package/dist/native/index.native90.js +1 -1
  50. package/dist/native/index.native91.js +3 -3
  51. package/dist/native/index.native93.js +3 -3
  52. package/dist/native/index.native95.js +3 -3
  53. package/dist/native/index.native96.js +10 -79
  54. package/dist/native/index.native98.js +18 -13
  55. package/dist/native/index.native99.js +27 -35
  56. package/dist/native-types/types.d.ts +19 -2
  57. package/dist/types/types.d.ts +19 -2
  58. package/dist/web/index.web5.js +172 -173
  59. package/dist/web/index.web55.js +2 -2
  60. package/dist/web/index.web57.js +1 -1
  61. package/dist/web/index.web75.js +6 -6
  62. package/dist/web/index.web82.js +102 -18
  63. package/dist/web/index.web83.js +20 -80
  64. package/dist/web/index.web84.js +79 -103
  65. package/dist/web/index.web87.js +77 -19
  66. package/dist/web/index.web88.js +21 -10
  67. package/dist/web/index.web89.js +9 -19
  68. package/dist/web/index.web90.js +15 -89
  69. package/dist/web/index.web91.js +92 -19
  70. package/dist/web/index.web92.js +18 -115
  71. package/dist/web/index.web93.js +112 -73
  72. package/dist/web-types/types.d.ts +19 -2
  73. package/package.json +2 -2
package/README.md CHANGED
@@ -56,13 +56,15 @@ You can configure the SDK to create different types of accounts for new users:
56
56
  ```ts lines
57
57
  const config: Config = {
58
58
  projectId: "your-project-id",
59
- createAccountOnLogin: "evm-smart", // Creates Smart Accounts instead of EOAs
59
+ ethereum: {
60
+ createOnLogin: "smart", // Creates Smart Accounts instead of EOAs
61
+ },
60
62
  }
61
63
 
62
64
  await initialize(config);
63
65
  ```
64
66
 
65
- When `createAccountOnLogin` is set to `"evm-smart"`, the SDK will:
67
+ When `ethereum.createOnLogin` is set to `"smart"`, the SDK will:
66
68
  1. Create an EOA (Externally Owned Account) first
67
69
  2. Use that EOA as the owner to create a Smart Account
68
70
  3. Both accounts will be available on the user object
@@ -71,13 +73,15 @@ When `createAccountOnLogin` is set to `"evm-smart"`, the SDK will:
71
73
  ```ts lines
72
74
  const config: Config = {
73
75
  projectId: "your-project-id",
74
- createAccountOnLogin: "solana", // Creates Solana accounts instead of EVM accounts
76
+ solana: {
77
+ createOnLogin: true, // Creates Solana accounts
78
+ },
75
79
  }
76
80
 
77
81
  await initialize(config);
78
82
  ```
79
83
 
80
- When `createAccountOnLogin` is set to `"solana"`, the SDK will:
84
+ When `solana.createOnLogin` is set to `true`, the SDK will:
81
85
  1. Create a Solana account for new users
82
86
  2. The Solana account will be available on the `solanaAccounts` property
83
87
 
@@ -213,7 +217,7 @@ Smart Accounts provide advanced account abstraction features, including user ope
213
217
 
214
218
  ### Sign a Solana Transaction
215
219
 
216
- When your application is configured with `createAccountOnLogin: "solana"`, you can sign Solana transactions:
220
+ When your application is configured with `solana: { createOnLogin: true }`, you can sign Solana transactions:
217
221
 
218
222
  ```typescript lines
219
223
  import { signSolanaTransaction, getCurrentUser } from "@coinbase/cdp-core";
@@ -1,44 +1,10 @@
1
- import { InvalidAddressError as a } from "./index.native65.js";
2
- import { isAddress as f } from "./index.native39.js";
3
- import { concatHex as p } from "./index.native40.js";
4
- import { toHex as i } from "./index.native34.js";
5
- import { toRlp as x } from "./index.native53.js";
6
- import { serializeTransaction as l } from "./index.native20.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.native109.js";
2
+ import o from "./index.native102.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.native30.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.native109.js";
2
- import o from "./index.native105.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.native81.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.native30.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.native81.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.native50.js";
2
+ import { defineBlock as r } from "./index.native47.js";
3
+ import { defineTransaction as s, formatTransaction as m } from "./index.native49.js";
4
+ import { defineTransactionReceipt as l } from "./index.native52.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.native30.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.native65.js";
2
+ import { isAddress as f } from "./index.native39.js";
3
+ import { concatHex as p } from "./index.native40.js";
4
+ import { toHex as i } from "./index.native34.js";
5
+ import { toRlp as x } from "./index.native53.js";
6
+ import { serializeTransaction as l } from "./index.native20.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 { chainConfig as a } from "./index.native89.js";
1
+ import { chainConfig as a } from "./index.native96.js";
2
2
  import { defineChain as t } from "./index.native32.js";
3
3
  const e = 11155111, r = /* @__PURE__ */ t({
4
4
  ...a,