@account-kit/infra 4.0.0-beta.7 → 4.0.0-beta.8

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 (89) hide show
  1. package/dist/esm/alchemyTransport.d.ts +69 -0
  2. package/dist/esm/alchemyTransport.js +139 -0
  3. package/dist/esm/alchemyTransport.js.map +1 -0
  4. package/dist/esm/chains.d.ts +1 -0
  5. package/dist/esm/chains.js +17 -0
  6. package/dist/esm/chains.js.map +1 -1
  7. package/dist/esm/client/decorators/alchemyEnhancedApis.d.ts +2 -2
  8. package/dist/esm/client/decorators/alchemyEnhancedApis.js +3 -7
  9. package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
  10. package/dist/esm/client/isAlchemySmartAccountClient.d.ts +1 -1
  11. package/dist/esm/client/isAlchemySmartAccountClient.js +2 -6
  12. package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
  13. package/dist/esm/client/rpcClient.d.ts +9 -10
  14. package/dist/esm/client/rpcClient.js +9 -33
  15. package/dist/esm/client/rpcClient.js.map +1 -1
  16. package/dist/esm/client/smartAccountClient.d.ts +12 -9
  17. package/dist/esm/client/smartAccountClient.js +34 -20
  18. package/dist/esm/client/smartAccountClient.js.map +1 -1
  19. package/dist/esm/client/types.d.ts +8 -7
  20. package/dist/esm/client/types.js.map +1 -1
  21. package/dist/esm/index.d.ts +3 -4
  22. package/dist/esm/index.js +2 -3
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/middleware/feeEstimator.d.ts +10 -6
  25. package/dist/esm/middleware/feeEstimator.js +11 -6
  26. package/dist/esm/middleware/feeEstimator.js.map +1 -1
  27. package/dist/esm/middleware/gasManager.d.ts +5 -6
  28. package/dist/esm/middleware/gasManager.js +5 -6
  29. package/dist/esm/middleware/gasManager.js.map +1 -1
  30. package/dist/esm/middleware/userOperationSimulator.d.ts +11 -7
  31. package/dist/esm/middleware/userOperationSimulator.js +12 -8
  32. package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
  33. package/dist/esm/schema.d.ts +0 -391
  34. package/dist/esm/schema.js +1 -5
  35. package/dist/esm/schema.js.map +1 -1
  36. package/dist/esm/version.d.ts +1 -1
  37. package/dist/esm/version.js +1 -1
  38. package/dist/esm/version.js.map +1 -1
  39. package/dist/types/alchemyTransport.d.ts +70 -0
  40. package/dist/types/alchemyTransport.d.ts.map +1 -0
  41. package/dist/types/chains.d.ts +1 -0
  42. package/dist/types/chains.d.ts.map +1 -1
  43. package/dist/types/client/decorators/alchemyEnhancedApis.d.ts +2 -2
  44. package/dist/types/client/decorators/alchemyEnhancedApis.d.ts.map +1 -1
  45. package/dist/types/client/isAlchemySmartAccountClient.d.ts +1 -1
  46. package/dist/types/client/isAlchemySmartAccountClient.d.ts.map +1 -1
  47. package/dist/types/client/rpcClient.d.ts +9 -10
  48. package/dist/types/client/rpcClient.d.ts.map +1 -1
  49. package/dist/types/client/smartAccountClient.d.ts +12 -9
  50. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  51. package/dist/types/client/types.d.ts +8 -7
  52. package/dist/types/client/types.d.ts.map +1 -1
  53. package/dist/types/index.d.ts +3 -4
  54. package/dist/types/index.d.ts.map +1 -1
  55. package/dist/types/middleware/feeEstimator.d.ts +10 -6
  56. package/dist/types/middleware/feeEstimator.d.ts.map +1 -1
  57. package/dist/types/middleware/gasManager.d.ts +5 -6
  58. package/dist/types/middleware/gasManager.d.ts.map +1 -1
  59. package/dist/types/middleware/userOperationSimulator.d.ts +11 -7
  60. package/dist/types/middleware/userOperationSimulator.d.ts.map +1 -1
  61. package/dist/types/schema.d.ts +0 -391
  62. package/dist/types/schema.d.ts.map +1 -1
  63. package/dist/types/version.d.ts +1 -1
  64. package/package.json +3 -3
  65. package/src/alchemyTransport.ts +214 -0
  66. package/src/chains.ts +18 -0
  67. package/src/client/decorators/alchemyEnhancedApis.ts +9 -16
  68. package/src/client/isAlchemySmartAccountClient.ts +4 -9
  69. package/src/client/rpcClient.ts +14 -47
  70. package/src/client/smartAccountClient.ts +64 -57
  71. package/src/client/types.ts +10 -7
  72. package/src/index.ts +3 -3
  73. package/src/middleware/feeEstimator.ts +15 -10
  74. package/src/middleware/gasManager.ts +5 -6
  75. package/src/middleware/userOperationSimulator.ts +13 -10
  76. package/src/schema.ts +1 -14
  77. package/src/version.ts +1 -1
  78. package/dist/esm/client/internal/smartAccountClientFromRpc.d.ts +0 -18
  79. package/dist/esm/client/internal/smartAccountClientFromRpc.js +0 -56
  80. package/dist/esm/client/internal/smartAccountClientFromRpc.js.map +0 -1
  81. package/dist/esm/type.d.ts +0 -3
  82. package/dist/esm/type.js +0 -2
  83. package/dist/esm/type.js.map +0 -1
  84. package/dist/types/client/internal/smartAccountClientFromRpc.d.ts +0 -19
  85. package/dist/types/client/internal/smartAccountClientFromRpc.d.ts.map +0 -1
  86. package/dist/types/type.d.ts +0 -4
  87. package/dist/types/type.d.ts.map +0 -1
  88. package/src/client/internal/smartAccountClientFromRpc.ts +0 -125
  89. package/src/type.ts +0 -4
@@ -0,0 +1,69 @@
1
+ import { type ConnectionConfig, type NoUndefined } from "@aa-sdk/core";
2
+ import { type EIP1193RequestFn, type HttpTransportConfig, type PublicRpcSchema, type Transport, type TransportConfig } from "viem";
3
+ import type { AlchemyRpcSchema } from "./client/types.js";
4
+ type Never<T> = T extends object ? {
5
+ [K in keyof T]?: never;
6
+ } : never;
7
+ type SplitTransportConfig = {
8
+ alchemyConnection: ConnectionConfig;
9
+ nodeRpcUrl: string;
10
+ };
11
+ export type AlchemyTransportConfig = ((ConnectionConfig & Never<SplitTransportConfig>) | (SplitTransportConfig & Never<ConnectionConfig>)) & {
12
+ /** The max number of times to retry. */
13
+ retryCount?: TransportConfig["retryCount"] | undefined;
14
+ /** The base delay (in ms) between retries. */
15
+ retryDelay?: TransportConfig["retryDelay"] | undefined;
16
+ fetchOptions?: NoUndefined<HttpTransportConfig["fetchOptions"]>;
17
+ };
18
+ type AlchemyTransportBase = Transport<"alchemy", {
19
+ alchemyRpcUrl: string;
20
+ fetchOptions?: AlchemyTransportConfig["fetchOptions"];
21
+ }, EIP1193RequestFn<[...PublicRpcSchema, ...AlchemyRpcSchema]>>;
22
+ export type AlchemyTransport = AlchemyTransportBase & {
23
+ updateHeaders(newHeaders: HeadersInit): void;
24
+ config: AlchemyTransportConfig;
25
+ };
26
+ /**
27
+ * Creates an Alchemy transport with the specified configuration options.
28
+ * When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.
29
+ * If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.
30
+ *
31
+ * @example
32
+ * ### Basic Example
33
+ * If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:
34
+ * ```ts
35
+ * import { alchemy } from "@account-kit/infra";
36
+ *
37
+ * const transport = alchemy({
38
+ * // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt
39
+ * apiKey: "your-api-key",
40
+ * });
41
+ * ```
42
+ *
43
+ * ### AA Only Chains
44
+ * For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only
45
+ * handles the Bundler and Paymaster RPCs for these chains.
46
+ * ```ts
47
+ * import { alchemy } from "@account-kit/infra";
48
+ *
49
+ * const transport = alchemy({
50
+ * alchemyConnection: {
51
+ * apiKey: "your-api-key",
52
+ * },
53
+ * nodeRpcUrl: "https://zora.rpc.url",
54
+ * });
55
+ * ```
56
+ *
57
+ * @param {AlchemyTransportConfig} config The configuration object for the Alchemy transport.
58
+ * @param {number} config.retryDelay Optional The delay between retries, in milliseconds.
59
+ * @param {number} config.retryCount Optional The number of retry attempts.
60
+ * @param {string} [config.alchemyConnection] Optional Alchemy connection configuration (if this is passed in, nodeRpcUrl is required).
61
+ * @param {string} [config.fetchOptions] Optional fetch options for HTTP requests.
62
+ * @param {string} [config.nodeRpcUrl] Optional RPC URL for node (if this is passed in, alchemyConnection is required).
63
+ * @param {string} [config.rpcUrl] Optional RPC URL.
64
+ * @param {string} [config.apiKey] Optional API key for Alchemy.
65
+ * @param {string} [config.jwt] Optional JSON Web Token for authorization.
66
+ * @returns {AlchemyTransport} The configured Alchemy transport object.
67
+ */
68
+ export declare function alchemy(config: AlchemyTransportConfig): AlchemyTransport;
69
+ export {};
@@ -0,0 +1,139 @@
1
+ import { ChainNotFoundError, ConnectionConfigSchema, split, } from "@aa-sdk/core";
2
+ import { createTransport, http, } from "viem";
3
+ import { AlchemyChainSchema } from "./schema.js";
4
+ import { VERSION } from "./version.js";
5
+ const alchemyMethods = [
6
+ "eth_sendUserOperation",
7
+ "eth_estimateUserOperationGas",
8
+ "eth_getUserOperationReceipt",
9
+ "eth_getUserOperationByHash",
10
+ "eth_supportedEntryPoints",
11
+ "rundler_maxPriorityFeePerGas",
12
+ "pm_getPaymasterData",
13
+ "pm_getPaymasterStubData",
14
+ ];
15
+ /**
16
+ * Creates an Alchemy transport with the specified configuration options.
17
+ * When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.
18
+ * If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.
19
+ *
20
+ * @example
21
+ * ### Basic Example
22
+ * If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:
23
+ * ```ts
24
+ * import { alchemy } from "@account-kit/infra";
25
+ *
26
+ * const transport = alchemy({
27
+ * // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt
28
+ * apiKey: "your-api-key",
29
+ * });
30
+ * ```
31
+ *
32
+ * ### AA Only Chains
33
+ * For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only
34
+ * handles the Bundler and Paymaster RPCs for these chains.
35
+ * ```ts
36
+ * import { alchemy } from "@account-kit/infra";
37
+ *
38
+ * const transport = alchemy({
39
+ * alchemyConnection: {
40
+ * apiKey: "your-api-key",
41
+ * },
42
+ * nodeRpcUrl: "https://zora.rpc.url",
43
+ * });
44
+ * ```
45
+ *
46
+ * @param {AlchemyTransportConfig} config The configuration object for the Alchemy transport.
47
+ * @param {number} config.retryDelay Optional The delay between retries, in milliseconds.
48
+ * @param {number} config.retryCount Optional The number of retry attempts.
49
+ * @param {string} [config.alchemyConnection] Optional Alchemy connection configuration (if this is passed in, nodeRpcUrl is required).
50
+ * @param {string} [config.fetchOptions] Optional fetch options for HTTP requests.
51
+ * @param {string} [config.nodeRpcUrl] Optional RPC URL for node (if this is passed in, alchemyConnection is required).
52
+ * @param {string} [config.rpcUrl] Optional RPC URL.
53
+ * @param {string} [config.apiKey] Optional API key for Alchemy.
54
+ * @param {string} [config.jwt] Optional JSON Web Token for authorization.
55
+ * @returns {AlchemyTransport} The configured Alchemy transport object.
56
+ */
57
+ export function alchemy(config) {
58
+ const { retryDelay, retryCount } = config;
59
+ // we create a copy here in case we create a split transport down below
60
+ // we don't want to add alchemy headers to 3rd party nodes
61
+ const fetchOptions = { ...config.fetchOptions };
62
+ const connectionConfig = ConnectionConfigSchema.parse(config.alchemyConnection ?? config);
63
+ const headersAsObject = convertHeadersToObject(fetchOptions.headers);
64
+ // TODO: we probably should just log these headers during telemetry logging instead of doing this mutable header stuff
65
+ fetchOptions.headers = {
66
+ ...headersAsObject,
67
+ "Alchemy-AA-Sdk-Version": VERSION,
68
+ };
69
+ if (connectionConfig.jwt != null) {
70
+ fetchOptions.headers = {
71
+ ...fetchOptions.headers,
72
+ Authorization: `Bearer ${connectionConfig.jwt}`,
73
+ };
74
+ }
75
+ const transport = (opts) => {
76
+ const { chain: chain_ } = opts;
77
+ if (!chain_) {
78
+ throw new ChainNotFoundError();
79
+ }
80
+ const chain = AlchemyChainSchema.parse(chain_);
81
+ const rpcUrl = connectionConfig.rpcUrl == null
82
+ ? `${chain.rpcUrls.alchemy.http[0]}/${connectionConfig.apiKey ?? ""}`
83
+ : connectionConfig.rpcUrl;
84
+ const innerTransport = (() => {
85
+ if (config.alchemyConnection && config.nodeRpcUrl) {
86
+ return split({
87
+ overrides: [
88
+ {
89
+ methods: alchemyMethods,
90
+ transport: http(rpcUrl, { fetchOptions }),
91
+ },
92
+ ],
93
+ fallback: http(config.nodeRpcUrl, {
94
+ fetchOptions: config.fetchOptions,
95
+ }),
96
+ });
97
+ }
98
+ return http(rpcUrl, { fetchOptions });
99
+ })();
100
+ return createTransport({
101
+ key: "alchemy",
102
+ name: "Alchemy Transport",
103
+ request: innerTransport(opts).request,
104
+ retryCount: retryCount ?? opts?.retryCount,
105
+ retryDelay,
106
+ type: "alchemy",
107
+ }, { alchemyRpcUrl: rpcUrl, fetchOptions });
108
+ };
109
+ return Object.assign(transport, {
110
+ updateHeaders(newHeaders_) {
111
+ const newHeaders = convertHeadersToObject(newHeaders_);
112
+ fetchOptions.headers = {
113
+ ...fetchOptions.headers,
114
+ ...newHeaders,
115
+ };
116
+ },
117
+ config,
118
+ });
119
+ }
120
+ const convertHeadersToObject = (headers) => {
121
+ if (!headers) {
122
+ return {};
123
+ }
124
+ if (headers instanceof Headers) {
125
+ const headersObject = {};
126
+ headers.forEach((value, key) => {
127
+ headersObject[key] = value;
128
+ });
129
+ return headersObject;
130
+ }
131
+ if (Array.isArray(headers)) {
132
+ return headers.reduce((acc, header) => {
133
+ acc[header[0]] = header[1];
134
+ return acc;
135
+ }, {});
136
+ }
137
+ return headers;
138
+ };
139
+ //# sourceMappingURL=alchemyTransport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alchemyTransport.js","sourceRoot":"","sources":["../../src/alchemyTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,GAGN,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,IAAI,GAML,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAavC,MAAM,cAAc,GAAG;IACrB,uBAAuB;IACvB,8BAA8B;IAC9B,6BAA6B;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O,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,EAA4B,CAAC;QACnD,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACpC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAA4B,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n ChainNotFoundError,\n ConnectionConfigSchema,\n split,\n type ConnectionConfig,\n type NoUndefined,\n} from \"@aa-sdk/core\";\nimport {\n createTransport,\n http,\n type EIP1193RequestFn,\n type HttpTransportConfig,\n type PublicRpcSchema,\n type Transport,\n type TransportConfig,\n} from \"viem\";\nimport type { AlchemyRpcSchema } from \"./client/types.js\";\nimport { AlchemyChainSchema } from \"./schema.js\";\nimport { VERSION } from \"./version.js\";\n\ntype Never<T> = T extends object\n ? {\n [K in keyof T]?: never;\n }\n : never;\n\ntype SplitTransportConfig = {\n alchemyConnection: ConnectionConfig;\n nodeRpcUrl: string;\n};\n\nconst alchemyMethods = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"eth_supportedEntryPoints\",\n \"rundler_maxPriorityFeePerGas\",\n \"pm_getPaymasterData\",\n \"pm_getPaymasterStubData\",\n];\n\nexport type AlchemyTransportConfig = (\n | (ConnectionConfig & Never<SplitTransportConfig>)\n | (SplitTransportConfig & Never<ConnectionConfig>)\n) & {\n /** The max number of times to retry. */\n retryCount?: TransportConfig[\"retryCount\"] | undefined;\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig[\"retryDelay\"] | undefined;\n fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>;\n};\n\ntype AlchemyTransportBase = Transport<\n \"alchemy\",\n {\n alchemyRpcUrl: string;\n fetchOptions?: AlchemyTransportConfig[\"fetchOptions\"];\n },\n EIP1193RequestFn<[...PublicRpcSchema, ...AlchemyRpcSchema]>\n>;\n\nexport type AlchemyTransport = AlchemyTransportBase & {\n updateHeaders(newHeaders: HeadersInit): void;\n config: AlchemyTransportConfig;\n};\n\n/**\n * Creates an Alchemy transport with the specified configuration options.\n * When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.\n * If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.\n *\n * @example\n * ### Basic Example\n * If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt\n * apiKey: \"your-api-key\",\n * });\n * ```\n *\n * ### AA Only Chains\n * For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only\n * handles the Bundler and Paymaster RPCs for these chains.\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * alchemyConnection: {\n * apiKey: \"your-api-key\",\n * },\n * nodeRpcUrl: \"https://zora.rpc.url\",\n * });\n * ```\n *\n * @param {AlchemyTransportConfig} config The configuration object for the Alchemy transport.\n * @param {number} config.retryDelay Optional The delay between retries, in milliseconds.\n * @param {number} config.retryCount Optional The number of retry attempts.\n * @param {string} [config.alchemyConnection] Optional Alchemy connection configuration (if this is passed in, nodeRpcUrl is required).\n * @param {string} [config.fetchOptions] Optional fetch options for HTTP requests.\n * @param {string} [config.nodeRpcUrl] Optional RPC URL for node (if this is passed in, alchemyConnection is required).\n * @param {string} [config.rpcUrl] Optional RPC URL.\n * @param {string} [config.apiKey] Optional API key for Alchemy.\n * @param {string} [config.jwt] Optional JSON Web Token for authorization.\n * @returns {AlchemyTransport} The configured Alchemy transport object.\n */\nexport function alchemy(config: AlchemyTransportConfig): AlchemyTransport {\n const { retryDelay, retryCount } = config;\n // we create a copy here in case we create a split transport down below\n // we don't want to add alchemy headers to 3rd party nodes\n const fetchOptions = { ...config.fetchOptions };\n\n const connectionConfig = ConnectionConfigSchema.parse(\n config.alchemyConnection ?? config\n );\n\n const headersAsObject = convertHeadersToObject(fetchOptions.headers);\n\n // TODO: we probably should just log these headers during telemetry logging instead of doing this mutable header stuff\n fetchOptions.headers = {\n ...headersAsObject,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n\n if (connectionConfig.jwt != null) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n Authorization: `Bearer ${connectionConfig.jwt}`,\n };\n }\n\n const transport: AlchemyTransportBase = (opts) => {\n const { chain: chain_ } = opts;\n if (!chain_) {\n throw new ChainNotFoundError();\n }\n const chain = AlchemyChainSchema.parse(chain_);\n\n const rpcUrl =\n connectionConfig.rpcUrl == null\n ? `${chain.rpcUrls.alchemy.http[0]}/${connectionConfig.apiKey ?? \"\"}`\n : connectionConfig.rpcUrl;\n\n const innerTransport = (() => {\n if (config.alchemyConnection && config.nodeRpcUrl) {\n return split({\n overrides: [\n {\n methods: alchemyMethods,\n transport: http(rpcUrl, { fetchOptions }),\n },\n ],\n fallback: http(config.nodeRpcUrl, {\n fetchOptions: config.fetchOptions,\n }),\n });\n }\n\n return http(rpcUrl, { fetchOptions });\n })();\n\n return createTransport(\n {\n key: \"alchemy\",\n name: \"Alchemy Transport\",\n request: innerTransport(opts).request,\n retryCount: retryCount ?? opts?.retryCount,\n retryDelay,\n type: \"alchemy\",\n },\n { alchemyRpcUrl: rpcUrl, fetchOptions }\n );\n };\n\n return Object.assign(transport, {\n updateHeaders(newHeaders_: HeadersInit) {\n const newHeaders = convertHeadersToObject(newHeaders_);\n\n fetchOptions.headers = {\n ...fetchOptions.headers,\n ...newHeaders,\n };\n },\n config,\n });\n}\n\nconst convertHeadersToObject = (\n headers?: HeadersInit\n): Record<string, string> => {\n if (!headers) {\n return {};\n }\n\n if (headers instanceof Headers) {\n const headersObject = {} as Record<string, string>;\n headers.forEach((value, key) => {\n headersObject[key] = value;\n });\n return headersObject;\n }\n\n if (Array.isArray(headers)) {\n return headers.reduce((acc, header) => {\n acc[header[0]] = header[1];\n return acc;\n }, {} as Record<string, string>);\n }\n\n return headers;\n};\n"]}
@@ -49,4 +49,5 @@ export declare const worldChainSepolia: Chain;
49
49
  export declare const worldChain: Chain;
50
50
  export declare const shapeSepolia: Chain;
51
51
  export declare const shape: Chain;
52
+ export declare const beraChainBartio: Chain;
52
53
  export declare const arbitrumNova: Chain;
@@ -261,6 +261,23 @@ export const shape = defineChain({
261
261
  },
262
262
  },
263
263
  });
264
+ export const beraChainBartio = defineChain({
265
+ id: 80084,
266
+ name: "BeraChain Bartio",
267
+ network: "BeraChain Bartio",
268
+ nativeCurrency: { name: "Bera", symbol: "BERA", decimals: 18 },
269
+ rpcUrls: {
270
+ default: {
271
+ http: ["https://berachain-bartio.g.alchemy.com/v2"],
272
+ },
273
+ public: {
274
+ http: ["https://berachain-bartio.g.alchemy.com/v2"],
275
+ },
276
+ alchemy: {
277
+ http: ["https://berachain-bartio.g.alchemy.com/v2"],
278
+ },
279
+ },
280
+ });
264
281
  export const arbitrumNova = {
265
282
  ...vabn,
266
283
  rpcUrls: {
@@ -1 +1 @@
1
- {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EACL,QAAQ,IAAI,GAAG,EAC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MAAM,CAAC,MAAM,YAAY,GAAU,WAAW,CAAC;IAC7C,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,eAAe;IACxB,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAU,WAAW,CAAC;IACtC,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,GAAG,IAAI;IACP,OAAO,EAAE;QACP,GAAG,IAAI,CAAC,OAAO;KAChB;CACF,CAAC","sourcesContent":["import type { Chain } from \"viem\";\n\nimport { defineChain } from \"viem\";\nimport {\n arbitrum as vab,\n arbitrumGoerli as vabg,\n arbitrumSepolia as vabs,\n base as vbase,\n baseGoerli as vbaseg,\n baseSepolia as vbases,\n fraxtal as vfrax,\n goerli as vgo,\n mainnet as vmain,\n optimism as vop,\n optimismGoerli as vopg,\n optimismSepolia as vops,\n polygon as vpg,\n polygonAmoy as vpga,\n polygonMumbai as vpgm,\n sepolia as vsep,\n arbitrumNova as vabn,\n zora as vzora,\n zoraSepolia as vzoras,\n} from \"viem/chains\";\n\nexport type AlchemyChainConfig = {\n chain: Chain;\n rpcBaseUrl: string;\n};\n\n/**\n * Defines an Alchemy chain configuration by adding an Alchemy-specific RPC base URL to the chain's RPC URLs.\n *\n * @example\n * ```ts\n * import { defineAlchemyChain } from \"@account-kit/infra\";\n * import { sepolia } from \"viem/chains\";\n *\n * const chain = defineAlchemyChain({\n * chain: sepolia,\n * rpcBaseUrl: \"https://eth-sepolia.g.alchemy.com/v2\"\n * });\n * ```\n *\n * @param {AlchemyChainConfig} params The parameters for defining the Alchemy chain\n * @param {Chain} params.chain The original chain configuration\n * @param {string} params.rpcBaseUrl The Alchemy-specific RPC base URL\n * @returns {Chain} The updated chain configuration with the Alchemy RPC URL added\n */\nexport const defineAlchemyChain = ({\n chain,\n rpcBaseUrl,\n}: {\n chain: Chain;\n rpcBaseUrl: string;\n}): Chain => {\n return {\n ...chain,\n rpcUrls: {\n ...chain.rpcUrls,\n alchemy: {\n http: [rpcBaseUrl],\n },\n },\n };\n};\n\nexport const arbitrum: Chain = {\n ...vab,\n rpcUrls: {\n ...vab.rpcUrls,\n alchemy: {\n http: [\"https://arb-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumGoerli: Chain = {\n ...vabg,\n rpcUrls: {\n ...vabg.rpcUrls,\n alchemy: {\n http: [\"https://arb-goerli.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumSepolia: Chain = {\n ...vabs,\n rpcUrls: {\n ...vabs.rpcUrls,\n alchemy: {\n http: [\"https://arb-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const goerli: Chain = {\n ...vgo,\n rpcUrls: {\n ...vgo.rpcUrls,\n alchemy: {\n http: [\"https://eth-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const mainnet: Chain = {\n ...vmain,\n rpcUrls: {\n ...vmain.rpcUrls,\n alchemy: {\n http: [\"https://eth-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimism: Chain = {\n ...vop,\n rpcUrls: {\n ...vop.rpcUrls,\n alchemy: {\n http: [\"https://opt-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismGoerli: Chain = {\n ...vopg,\n rpcUrls: {\n ...vopg.rpcUrls,\n alchemy: {\n http: [\"https://opt-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismSepolia: Chain = {\n ...vops,\n rpcUrls: {\n ...vops.rpcUrls,\n alchemy: {\n http: [\"https://opt-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const sepolia: Chain = {\n ...vsep,\n rpcUrls: {\n ...vsep.rpcUrls,\n alchemy: {\n http: [\"https://eth-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const base: Chain = {\n ...vbase,\n rpcUrls: {\n ...vbase.rpcUrls,\n alchemy: {\n http: [\"https://base-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseGoerli: Chain = {\n ...vbaseg,\n rpcUrls: {\n ...vbaseg.rpcUrls,\n alchemy: {\n http: [\"https://base-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseSepolia: Chain = {\n ...vbases,\n rpcUrls: {\n ...vbases.rpcUrls,\n alchemy: {\n http: [\"https://base-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonMumbai: Chain = {\n ...vpgm,\n rpcUrls: {\n ...vpgm.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mumbai.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonAmoy: Chain = {\n ...vpga,\n rpcUrls: {\n ...vpga.rpcUrls,\n alchemy: {\n http: [\"https://polygon-amoy.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygon: Chain = {\n ...vpg,\n rpcUrls: {\n ...vpg.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const fraxtal: Chain = {\n ...vfrax,\n rpcUrls: {\n ...vfrax.rpcUrls,\n },\n};\n\nexport const fraxtalSepolia: Chain = defineChain({\n id: 2523,\n name: \"Fraxtal Sepolia\",\n nativeCurrency: { name: \"Frax Ether\", symbol: \"frxETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://rpc.testnet-sepolia.frax.com\"],\n },\n },\n});\n\nexport const zora: Chain = {\n ...vzora,\n rpcUrls: {\n ...vzora.rpcUrls,\n },\n};\n\nexport const zoraSepolia: Chain = {\n ...vzoras,\n rpcUrls: {\n ...vzoras.rpcUrls,\n },\n};\n\nexport const worldChainSepolia: Chain = defineChain({\n id: 4801,\n name: \"World Chain Sepolia\",\n network: \"World Chain Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const worldChain: Chain = defineChain({\n id: 480,\n name: \"World Chain\",\n network: \"World Chain\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const shapeSepolia: Chain = defineChain({\n id: 11011,\n name: \"Shape Sepolia\",\n network: \"Shape Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const shape: Chain = defineChain({\n id: 360,\n name: \"Shape\",\n network: \"Shape\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const arbitrumNova: Chain = {\n ...vabn,\n rpcUrls: {\n ...vabn.rpcUrls,\n },\n};\n"]}
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EACL,QAAQ,IAAI,GAAG,EACf,cAAc,IAAI,IAAI,EACtB,eAAe,IAAI,IAAI,EACvB,IAAI,IAAI,KAAK,EACb,UAAU,IAAI,MAAM,EACpB,WAAW,IAAI,MAAM,EACrB,OAAO,IAAI,KAAK,EAChB,MAAM,IAAI,GAAG,EACb,OAAO,IAAI,KAAK,EAChB,QAAQ,IAAI,GAAG,EACf,cAAc,IAAI,IAAI,EACtB,eAAe,IAAI,IAAI,EACvB,OAAO,IAAI,GAAG,EACd,WAAW,IAAI,IAAI,EACnB,aAAa,IAAI,IAAI,EACrB,OAAO,IAAI,IAAI,EACf,YAAY,IAAI,IAAI,EACpB,IAAI,IAAI,KAAK,EACb,WAAW,IAAI,MAAM,GACtB,MAAM,aAAa,CAAC;AAOrB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EACL,UAAU,GAIX,EAAS,EAAE;IACV,OAAO;QACL,GAAG,KAAK;QACR,OAAO,EAAE;YACP,GAAG,KAAK,CAAC,OAAO;YAChB,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC,UAAU,C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IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,wCAAwC,CAAC;SACjD;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAU,WAAW,CAAC;IAChD,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,kBAAkB;IAC3B,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,2CAA2C,CAAC;SACpD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,CAAC,2CAA2C,CAAC;SACpD;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,2CAA2C,CAAC;SACpD;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,GAAG,IAAI;IACP,OAAO,EAAE;QACP,GAAG,IAAI,CAAC,OAAO;KAChB;CACF,CAAC","sourcesContent":["import type { Chain } from \"viem\";\n\nimport { defineChain } from \"viem\";\nimport {\n arbitrum as vab,\n arbitrumGoerli as vabg,\n arbitrumSepolia as vabs,\n base as vbase,\n baseGoerli as vbaseg,\n baseSepolia as vbases,\n fraxtal as vfrax,\n goerli as vgo,\n mainnet as vmain,\n optimism as vop,\n optimismGoerli as vopg,\n optimismSepolia as vops,\n polygon as vpg,\n polygonAmoy as vpga,\n polygonMumbai as vpgm,\n sepolia as vsep,\n arbitrumNova as vabn,\n zora as vzora,\n zoraSepolia as vzoras,\n} from \"viem/chains\";\n\nexport type AlchemyChainConfig = {\n chain: Chain;\n rpcBaseUrl: string;\n};\n\n/**\n * Defines an Alchemy chain configuration by adding an Alchemy-specific RPC base URL to the chain's RPC URLs.\n *\n * @example\n * ```ts\n * import { defineAlchemyChain } from \"@account-kit/infra\";\n * import { sepolia } from \"viem/chains\";\n *\n * const chain = defineAlchemyChain({\n * chain: sepolia,\n * rpcBaseUrl: \"https://eth-sepolia.g.alchemy.com/v2\"\n * });\n * ```\n *\n * @param {AlchemyChainConfig} params The parameters for defining the Alchemy chain\n * @param {Chain} params.chain The original chain configuration\n * @param {string} params.rpcBaseUrl The Alchemy-specific RPC base URL\n * @returns {Chain} The updated chain configuration with the Alchemy RPC URL added\n */\nexport const defineAlchemyChain = ({\n chain,\n rpcBaseUrl,\n}: {\n chain: Chain;\n rpcBaseUrl: string;\n}): Chain => {\n return {\n ...chain,\n rpcUrls: {\n ...chain.rpcUrls,\n alchemy: {\n http: [rpcBaseUrl],\n },\n },\n };\n};\n\nexport const arbitrum: Chain = {\n ...vab,\n rpcUrls: {\n ...vab.rpcUrls,\n alchemy: {\n http: [\"https://arb-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumGoerli: Chain = {\n ...vabg,\n rpcUrls: {\n ...vabg.rpcUrls,\n alchemy: {\n http: [\"https://arb-goerli.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumSepolia: Chain = {\n ...vabs,\n rpcUrls: {\n ...vabs.rpcUrls,\n alchemy: {\n http: [\"https://arb-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const goerli: Chain = {\n ...vgo,\n rpcUrls: {\n ...vgo.rpcUrls,\n alchemy: {\n http: [\"https://eth-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const mainnet: Chain = {\n ...vmain,\n rpcUrls: {\n ...vmain.rpcUrls,\n alchemy: {\n http: [\"https://eth-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimism: Chain = {\n ...vop,\n rpcUrls: {\n ...vop.rpcUrls,\n alchemy: {\n http: [\"https://opt-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismGoerli: Chain = {\n ...vopg,\n rpcUrls: {\n ...vopg.rpcUrls,\n alchemy: {\n http: [\"https://opt-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismSepolia: Chain = {\n ...vops,\n rpcUrls: {\n ...vops.rpcUrls,\n alchemy: {\n http: [\"https://opt-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const sepolia: Chain = {\n ...vsep,\n rpcUrls: {\n ...vsep.rpcUrls,\n alchemy: {\n http: [\"https://eth-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const base: Chain = {\n ...vbase,\n rpcUrls: {\n ...vbase.rpcUrls,\n alchemy: {\n http: [\"https://base-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseGoerli: Chain = {\n ...vbaseg,\n rpcUrls: {\n ...vbaseg.rpcUrls,\n alchemy: {\n http: [\"https://base-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseSepolia: Chain = {\n ...vbases,\n rpcUrls: {\n ...vbases.rpcUrls,\n alchemy: {\n http: [\"https://base-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonMumbai: Chain = {\n ...vpgm,\n rpcUrls: {\n ...vpgm.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mumbai.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonAmoy: Chain = {\n ...vpga,\n rpcUrls: {\n ...vpga.rpcUrls,\n alchemy: {\n http: [\"https://polygon-amoy.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygon: Chain = {\n ...vpg,\n rpcUrls: {\n ...vpg.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const fraxtal: Chain = {\n ...vfrax,\n rpcUrls: {\n ...vfrax.rpcUrls,\n },\n};\n\nexport const fraxtalSepolia: Chain = defineChain({\n id: 2523,\n name: \"Fraxtal Sepolia\",\n nativeCurrency: { name: \"Frax Ether\", symbol: \"frxETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://rpc.testnet-sepolia.frax.com\"],\n },\n },\n});\n\nexport const zora: Chain = {\n ...vzora,\n rpcUrls: {\n ...vzora.rpcUrls,\n },\n};\n\nexport const zoraSepolia: Chain = {\n ...vzoras,\n rpcUrls: {\n ...vzoras.rpcUrls,\n },\n};\n\nexport const worldChainSepolia: Chain = defineChain({\n id: 4801,\n name: \"World Chain Sepolia\",\n network: \"World Chain Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const worldChain: Chain = defineChain({\n id: 480,\n name: \"World Chain\",\n network: \"World Chain\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const shapeSepolia: Chain = defineChain({\n id: 11011,\n name: \"Shape Sepolia\",\n network: \"Shape Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const shape: Chain = defineChain({\n id: 360,\n name: \"Shape\",\n network: \"Shape\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const beraChainBartio: Chain = defineChain({\n id: 80084,\n name: \"BeraChain Bartio\",\n network: \"BeraChain Bartio\",\n nativeCurrency: { name: \"Bera\", symbol: \"BERA\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://berachain-bartio.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://berachain-bartio.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://berachain-bartio.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const arbitrumNova: Chain = {\n ...vabn,\n rpcUrls: {\n ...vabn.rpcUrls,\n },\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { SmartContractAccount } from "@aa-sdk/core";
2
2
  import type { Alchemy } from "alchemy-sdk";
3
- import type { Chain, Transport } from "viem";
3
+ import type { Chain } from "viem";
4
4
  import type { AlchemySmartAccountClient } from "../smartAccountClient.js";
5
5
  export type AlchemyEnhancedApis = {
6
6
  core: Alchemy["core"];
@@ -28,4 +28,4 @@ export type AlchemyEnhancedApis = {
28
28
  * @param {Alchemy} alchemy The Alchemy instance containing the SDK client
29
29
  * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods
30
30
  */
31
- export declare function alchemyEnhancedApiActions(alchemy: Alchemy): <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: AlchemySmartAccountClient<TTransport, TChain, TAccount>) => AlchemyEnhancedApis;
31
+ export declare function alchemyEnhancedApiActions(alchemy: Alchemy): <TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: AlchemySmartAccountClient<TChain, TAccount>) => AlchemyEnhancedApis;
@@ -19,13 +19,9 @@ import { AlchemySdkClientSchema } from "../../schema.js";
19
19
  export function alchemyEnhancedApiActions(alchemy) {
20
20
  return (client) => {
21
21
  const alchemySdk = AlchemySdkClientSchema.parse(alchemy);
22
- if (client.transport.type === "http") {
23
- const { url } = client.transport;
24
- if (client.transport.type === "http" &&
25
- alchemy.config.url &&
26
- alchemy.config.url !== url) {
27
- throw new Error("Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL");
28
- }
22
+ if (alchemy.config.url &&
23
+ alchemy.config.url !== client.transport.alchemyRpcUrl) {
24
+ throw new Error("Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL");
29
25
  }
30
26
  return {
31
27
  core: alchemySdk.core,
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyEnhancedApis.js","sourceRoot":"","sources":["../../../../src/client/decorators/alchemyEnhancedApis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAazD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAgB;IAUhB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEzD,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACrC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,SACa,CAAC;YAErC,IACE,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM;gBAChC,OAAO,CAAC,MAAM,CAAC,GAAG;gBAClB,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,EAC1B,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Alchemy } from \"alchemy-sdk\";\nimport type { Chain, HttpTransport, Transport } from \"viem\";\nimport { AlchemySdkClientSchema } from \"../../schema.js\";\nimport type { AlchemySmartAccountClient } from \"../smartAccountClient.js\";\n\nexport type AlchemyEnhancedApis = {\n core: Alchemy[\"core\"];\n nft: Alchemy[\"nft\"];\n transact: Alchemy[\"transact\"];\n debug: Alchemy[\"debug\"];\n ws: Alchemy[\"ws\"];\n notify: Alchemy[\"notify\"];\n config: Alchemy[\"config\"];\n};\n\n/**\n * Given an instance of the Alchemy SDK, returns a smart account client decorator which contains actions for interacting Alchemy's enhanced APIs.\n *\n * @example\n * ```ts\n * import { Alchemy } from \"alchemy-sdk\";\n * import { alchemyEnhancedApiActions } from \"@account-kit/infra\";\n * import { alchemySCAClient } from \"./client\";\n *\n * const alchemy = new Alchemy(...);\n * const enhancedApiDecorator = alchemyEnhancedApiActions(alchemy);\n * const withEnhancedApis = alchemySCAClient.extend(enhancedApiDecorator);\n * ```\n *\n * @param {Alchemy} alchemy The Alchemy instance containing the SDK client\n * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods\n */\nexport function alchemyEnhancedApiActions(\n alchemy: Alchemy\n): <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: AlchemySmartAccountClient<TTransport, TChain, TAccount>\n) => AlchemyEnhancedApis {\n return (client) => {\n const alchemySdk = AlchemySdkClientSchema.parse(alchemy);\n\n if (client.transport.type === \"http\") {\n const { url } = client.transport as ReturnType<HttpTransport>[\"config\"] &\n ReturnType<HttpTransport>[\"value\"];\n\n if (\n client.transport.type === \"http\" &&\n alchemy.config.url &&\n alchemy.config.url !== url\n ) {\n throw new Error(\n \"Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL\"\n );\n }\n }\n\n return {\n core: alchemySdk.core,\n nft: alchemySdk.nft,\n transact: alchemySdk.transact,\n debug: alchemySdk.debug,\n ws: alchemySdk.ws,\n notify: alchemySdk.notify,\n config: alchemySdk.config,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"alchemyEnhancedApis.js","sourceRoot":"","sources":["../../../../src/client/decorators/alchemyEnhancedApis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAazD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAgB;IAShB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEzD,IACE,OAAO,CAAC,MAAM,CAAC,GAAG;YAClB,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC,aAAa,EACrD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Alchemy } from \"alchemy-sdk\";\nimport type { Chain } from \"viem\";\nimport { AlchemySdkClientSchema } from \"../../schema.js\";\nimport type { AlchemySmartAccountClient } from \"../smartAccountClient.js\";\n\nexport type AlchemyEnhancedApis = {\n core: Alchemy[\"core\"];\n nft: Alchemy[\"nft\"];\n transact: Alchemy[\"transact\"];\n debug: Alchemy[\"debug\"];\n ws: Alchemy[\"ws\"];\n notify: Alchemy[\"notify\"];\n config: Alchemy[\"config\"];\n};\n\n/**\n * Given an instance of the Alchemy SDK, returns a smart account client decorator which contains actions for interacting Alchemy's enhanced APIs.\n *\n * @example\n * ```ts\n * import { Alchemy } from \"alchemy-sdk\";\n * import { alchemyEnhancedApiActions } from \"@account-kit/infra\";\n * import { alchemySCAClient } from \"./client\";\n *\n * const alchemy = new Alchemy(...);\n * const enhancedApiDecorator = alchemyEnhancedApiActions(alchemy);\n * const withEnhancedApis = alchemySCAClient.extend(enhancedApiDecorator);\n * ```\n *\n * @param {Alchemy} alchemy The Alchemy instance containing the SDK client\n * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods\n */\nexport function alchemyEnhancedApiActions(\n alchemy: Alchemy\n): <\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: AlchemySmartAccountClient<TChain, TAccount>\n) => AlchemyEnhancedApis {\n return (client) => {\n const alchemySdk = AlchemySdkClientSchema.parse(alchemy);\n\n if (\n alchemy.config.url &&\n alchemy.config.url !== client.transport.alchemyRpcUrl\n ) {\n throw new Error(\n \"Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL\"\n );\n }\n\n return {\n core: alchemySdk.core,\n nft: alchemySdk.nft,\n transact: alchemySdk.transact,\n debug: alchemySdk.debug,\n ws: alchemySdk.ws,\n notify: alchemySdk.notify,\n config: alchemySdk.config,\n };\n };\n}\n"]}
@@ -16,4 +16,4 @@ import type { AlchemySmartAccountClient } from "./smartAccountClient";
16
16
  * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked
17
17
  * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`
18
18
  */
19
- export declare function isAlchemySmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>): client is AlchemySmartAccountClient<TTransport, TChain, TAccount>;
19
+ export declare function isAlchemySmartAccountClient<TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<Transport, TChain, TAccount>): client is AlchemySmartAccountClient<TChain, TAccount>;
@@ -1,4 +1,4 @@
1
- import { isSmartAccountClient } from "@aa-sdk/core";
1
+ import {} from "@aa-sdk/core";
2
2
  /**
3
3
  * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.
4
4
  *
@@ -15,10 +15,6 @@ import { isSmartAccountClient } from "@aa-sdk/core";
15
15
  * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`
16
16
  */
17
17
  export function isAlchemySmartAccountClient(client) {
18
- // TODO: the goal of this check is to make sure that the client supports certain RPC methods
19
- // we should probably do this by checking the client's transport and configured URL, since alchemy
20
- // clients have to be RPC clients. this is difficult to do though because the transport might
21
- // point to a proxy url :/
22
- return isSmartAccountClient(client);
18
+ return client.transport.type === "alchemy";
23
19
  }
24
20
  //# sourceMappingURL=isAlchemySmartAccountClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA6B,MAAM,cAAc,CAAC;AAI/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAOzC,MAA4C;IAE5C,4FAA4F;IAC5F,kGAAkG;IAClG,6FAA6F;IAC7F,0BAA0B;IAC1B,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { isSmartAccountClient, type SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"./smartAccountClient\";\n\n/**\n * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.\n *\n * @example\n * ```ts\n * import { isAlchemySmartAccountClient } from \"@account-kit/infra\";\n *\n * if (isAlchemySmartAccountClient(client)) {\n * // do things with the client as an Alchemy Smart Account Client\n * }\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked\n * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`\n */\nexport function isAlchemySmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): client is AlchemySmartAccountClient<TTransport, TChain, TAccount> {\n // TODO: the goal of this check is to make sure that the client supports certain RPC methods\n // we should probably do this by checking the client's transport and configured URL, since alchemy\n // clients have to be RPC clients. this is difficult to do though because the transport might\n // point to a proxy url :/\n return isSmartAccountClient(client);\n}\n"]}
1
+ {"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,cAAc,CAAC;AAIzD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAMzC,MAA2C;IAE3C,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC;AAC7C,CAAC","sourcesContent":["import { type SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"./smartAccountClient\";\n\n/**\n * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.\n *\n * @example\n * ```ts\n * import { isAlchemySmartAccountClient } from \"@account-kit/infra\";\n *\n * if (isAlchemySmartAccountClient(client)) {\n * // do things with the client as an Alchemy Smart Account Client\n * }\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked\n * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`\n */\nexport function isAlchemySmartAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<Transport, TChain, TAccount>\n): client is AlchemySmartAccountClient<TChain, TAccount> {\n return client.transport.type === \"alchemy\";\n}\n"]}
@@ -1,19 +1,19 @@
1
- import { type ConnectionConfig, type NoUndefined } from "@aa-sdk/core";
2
- import { type Chain, type HttpTransportConfig } from "viem";
1
+ import type { Chain } from "viem";
2
+ import type { AlchemyTransport } from "../alchemyTransport.js";
3
3
  import type { ClientWithAlchemyMethods } from "./types.js";
4
4
  /**
5
5
  * Creates an Alchemy public RPC client with the provided chain, connection configuration, and optional fetch options. The client has alchemy methods and can dynamically update HTTP headers.
6
6
  *
7
7
  * @example
8
8
  * ```ts
9
- * import { createAlchemyPublicRpcClient } from "@account-kit/infra";
9
+ * import { createAlchemyPublicRpcClient, alchemy } from "@account-kit/infra";
10
10
  * import { sepolia } from "@account-kit/infra";
11
11
  *
12
12
  * const client = createAlchemyPublicRpcClient({
13
+ * transport: alchemy({
14
+ * apiKey: "ALCHEMY_API_KEY"
15
+ * }),
13
16
  * chain: sepolia,
14
- * connectionConfig: {
15
- * apiKey: "your-api-key",
16
- * }
17
17
  * });
18
18
  * ```
19
19
  *
@@ -23,8 +23,7 @@ import type { ClientWithAlchemyMethods } from "./types.js";
23
23
  * @param {NoUndefined<HttpTransportConfig["fetchOptions"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport
24
24
  * @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain
25
25
  */
26
- export declare const createAlchemyPublicRpcClient: ({ chain: chain_, connectionConfig, fetchOptions, }: {
27
- connectionConfig: ConnectionConfig;
28
- chain: Chain;
29
- fetchOptions?: Omit<RequestInit, "body"> | undefined;
26
+ export declare const createAlchemyPublicRpcClient: ({ transport, chain, }: {
27
+ transport: AlchemyTransport;
28
+ chain: Chain | undefined;
30
29
  }) => ClientWithAlchemyMethods;
@@ -1,20 +1,17 @@
1
- import { createBundlerClient, } from "@aa-sdk/core";
2
- import { http } from "viem";
3
- import { AlchemyChainSchema } from "../schema.js";
4
- import { VERSION } from "../version.js";
1
+ import { createBundlerClient } from "@aa-sdk/core";
5
2
  /**
6
3
  * Creates an Alchemy public RPC client with the provided chain, connection configuration, and optional fetch options. The client has alchemy methods and can dynamically update HTTP headers.
7
4
  *
8
5
  * @example
9
6
  * ```ts
10
- * import { createAlchemyPublicRpcClient } from "@account-kit/infra";
7
+ * import { createAlchemyPublicRpcClient, alchemy } from "@account-kit/infra";
11
8
  * import { sepolia } from "@account-kit/infra";
12
9
  *
13
10
  * const client = createAlchemyPublicRpcClient({
11
+ * transport: alchemy({
12
+ * apiKey: "ALCHEMY_API_KEY"
13
+ * }),
14
14
  * chain: sepolia,
15
- * connectionConfig: {
16
- * apiKey: "your-api-key",
17
- * }
18
15
  * });
19
16
  * ```
20
17
  *
@@ -24,31 +21,10 @@ import { VERSION } from "../version.js";
24
21
  * @param {NoUndefined<HttpTransportConfig["fetchOptions"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport
25
22
  * @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain
26
23
  */
27
- export const createAlchemyPublicRpcClient = ({ chain: chain_, connectionConfig, fetchOptions = {}, }) => {
28
- const chain = AlchemyChainSchema.parse(chain_);
29
- const rpcUrl = connectionConfig.rpcUrl == null
30
- ? `${chain.rpcUrls.alchemy.http[0]}/${connectionConfig.apiKey ?? ""}`
31
- : connectionConfig.rpcUrl;
32
- fetchOptions.headers = {
33
- ...fetchOptions.headers,
34
- "Alchemy-AA-Sdk-Version": VERSION,
35
- };
36
- if (connectionConfig.jwt != null) {
37
- fetchOptions.headers = {
38
- ...fetchOptions.headers,
39
- Authorization: `Bearer ${connectionConfig.jwt}`,
40
- };
41
- }
24
+ export const createAlchemyPublicRpcClient = ({ transport, chain, }) => {
42
25
  return createBundlerClient({
43
- chain: chain,
44
- transport: http(rpcUrl, { fetchOptions }),
45
- }).extend(() => ({
46
- updateHeaders(newHeaders) {
47
- fetchOptions.headers = {
48
- ...fetchOptions.headers,
49
- ...newHeaders,
50
- };
51
- },
52
- }));
26
+ chain,
27
+ transport,
28
+ });
53
29
  };
54
30
  //# sourceMappingURL=rpcClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAGpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAwC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,KAAK,EAAE,MAAM,EACb,gBAAgB,EAChB,YAAY,GAAG,EAAE,GAKlB,EAA4B,EAAE;IAC7B,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE/C,MAAM,MAAM,GACV,gBAAgB,CAAC,MAAM,IAAI,IAAI;QAC7B,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,IAAI,EAAE,EAAE;QACrE,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE9B,YAAY,CAAC,OAAO,GAAG;QACrB,GAAG,YAAY,CAAC,OAAO;QACvB,wBAAwB,EAAE,OAAO;KAClC,CAAC;IAEF,IAAI,gBAAgB,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QACjC,YAAY,CAAC,OAAO,GAAG;YACrB,GAAG,YAAY,CAAC,OAAO;YACvB,aAAa,EAAE,UAAU,gBAAgB,CAAC,GAAG,EAAE;SAChD,CAAC;IACJ,CAAC;IAED,OAAO,mBAAmB,CAAC;QACzB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC;KAC1C,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACf,aAAa,CAAC,UAAuB;YACnC,YAAY,CAAC,OAAO,GAAG;gBACrB,GAAG,YAAY,CAAC,OAAO;gBACvB,GAAG,UAAU;aACd,CAAC;QACJ,CAAC;KACF,CAAC,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {\n createBundlerClient,\n type ConnectionConfig,\n type NoUndefined,\n} from \"@aa-sdk/core\";\nimport { http, type Chain, type HttpTransportConfig } from \"viem\";\nimport { AlchemyChainSchema } from \"../schema.js\";\nimport { VERSION } from \"../version.js\";\nimport type { ClientWithAlchemyMethods } from \"./types.js\";\n\n/**\n * Creates an Alchemy public RPC client with the provided chain, connection configuration, and optional fetch options. The client has alchemy methods and can dynamically update HTTP headers.\n *\n * @example\n * ```ts\n * import { createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient({\n * chain: sepolia,\n * connectionConfig: {\n * apiKey: \"your-api-key\",\n * }\n * });\n * ```\n *\n * @param {{connectionConfig: ConnectionConfig,chain: Chain,fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>}} params The parameters for creating the Alchemy public RPC client\n * @param {ConnectionConfig} params.connectionConfig The connection configuration containing the RPC URL and API key\n * @param {Chain} params.chain The blockchain chain configuration\n * @param {NoUndefined<HttpTransportConfig[\"fetchOptions\"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport\n * @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain\n */\nexport const createAlchemyPublicRpcClient = ({\n chain: chain_,\n connectionConfig,\n fetchOptions = {},\n}: {\n connectionConfig: ConnectionConfig;\n chain: Chain;\n fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>;\n}): ClientWithAlchemyMethods => {\n const chain = AlchemyChainSchema.parse(chain_);\n\n const rpcUrl =\n connectionConfig.rpcUrl == null\n ? `${chain.rpcUrls.alchemy.http[0]}/${connectionConfig.apiKey ?? \"\"}`\n : connectionConfig.rpcUrl;\n\n fetchOptions.headers = {\n ...fetchOptions.headers,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n\n if (connectionConfig.jwt != null) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n Authorization: `Bearer ${connectionConfig.jwt}`,\n };\n }\n\n return createBundlerClient({\n chain: chain,\n transport: http(rpcUrl, { fetchOptions }),\n }).extend(() => ({\n updateHeaders(newHeaders: HeadersInit) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n ...newHeaders,\n };\n },\n }));\n};\n"]}
1
+ {"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,SAAS,EACT,KAAK,GAIN,EAA4B,EAAE;IAC7B,OAAO,mBAAmB,CAAC;QACzB,KAAK;QACL,SAAS;KACV,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { createBundlerClient } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport type { AlchemyTransport } from \"../alchemyTransport.js\";\nimport type { ClientWithAlchemyMethods } from \"./types.js\";\n\n/**\n * Creates an Alchemy public RPC client with the provided chain, connection configuration, and optional fetch options. The client has alchemy methods and can dynamically update HTTP headers.\n *\n * @example\n * ```ts\n * import { createAlchemyPublicRpcClient, alchemy } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient({\n * transport: alchemy({\n * apiKey: \"ALCHEMY_API_KEY\"\n * }),\n * chain: sepolia,\n * });\n * ```\n *\n * @param {{connectionConfig: ConnectionConfig,chain: Chain,fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>}} params The parameters for creating the Alchemy public RPC client\n * @param {ConnectionConfig} params.connectionConfig The connection configuration containing the RPC URL and API key\n * @param {Chain} params.chain The blockchain chain configuration\n * @param {NoUndefined<HttpTransportConfig[\"fetchOptions\"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport\n * @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain\n */\nexport const createAlchemyPublicRpcClient = ({\n transport,\n chain,\n}: {\n transport: AlchemyTransport;\n chain: Chain | undefined;\n}): ClientWithAlchemyMethods => {\n return createBundlerClient({\n chain,\n transport,\n });\n};\n"]}
@@ -1,17 +1,20 @@
1
- import { type Prettify, type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountClientRpcSchema, type SmartContractAccount, type UserOperationContext } from "@aa-sdk/core";
2
- import { type Chain, type Transport } from "viem";
3
- import type { AlchemyProviderConfig } from "../type.js";
4
- import type { AlchemySmartAccountClientActions } from "./decorators/smartAccount.js";
1
+ import { type Prettify, type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountClientRpcSchema, type SmartContractAccount, type SmartContractAccountWithSigner, type UserOperationContext } from "@aa-sdk/core";
2
+ import { type Chain } from "viem";
3
+ import type { AlchemyTransport } from "../alchemyTransport.js";
4
+ import { type AlchemySmartAccountClientActions } from "./decorators/smartAccount.js";
5
5
  import type { AlchemyRpcSchema } from "./types.js";
6
- export type AlchemySmartAccountClientConfig<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, context extends UserOperationContext | undefined = UserOperationContext | undefined> = {
6
+ export declare function getSignerTypeHeader<TAccount extends SmartContractAccountWithSigner>(account: TAccount): {
7
+ "Alchemy-Aa-Sdk-Signer": string;
8
+ };
9
+ export type AlchemySmartAccountClientConfig<chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, context extends UserOperationContext | undefined = UserOperationContext | undefined> = {
7
10
  account?: account;
8
11
  useSimulation?: boolean;
9
12
  policyId?: string;
10
- } & AlchemyProviderConfig & Pick<SmartAccountClientConfig<transport, chain, account, context>, "customMiddleware" | "feeEstimator" | "gasEstimator" | "signUserOperation">;
13
+ } & Pick<SmartAccountClientConfig<AlchemyTransport, chain, account, context>, "customMiddleware" | "feeEstimator" | "gasEstimator" | "signUserOperation" | "transport" | "chain" | "opts">;
11
14
  export type BaseAlchemyActions<chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, context extends UserOperationContext | undefined = UserOperationContext | undefined> = SmartAccountClientActions<chain, account, context> & AlchemySmartAccountClientActions<account, context>;
12
- export type AlchemySmartAccountClient_Base<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<string, unknown>, context extends UserOperationContext | undefined = UserOperationContext | undefined> = Prettify<SmartAccountClient<transport, chain, account, actions & BaseAlchemyActions<chain, account, context>, [
15
+ export type AlchemySmartAccountClient_Base<chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<string, unknown>, context extends UserOperationContext | undefined = UserOperationContext | undefined> = Prettify<SmartAccountClient<AlchemyTransport, chain, account, actions & BaseAlchemyActions<chain, account, context>, [
13
16
  ...SmartAccountClientRpcSchema,
14
17
  ...AlchemyRpcSchema
15
18
  ], context>>;
16
- export type AlchemySmartAccountClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<string, unknown>, context extends UserOperationContext | undefined = UserOperationContext | undefined> = Prettify<AlchemySmartAccountClient_Base<transport, chain, account, actions, context>>;
17
- export declare function createAlchemySmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>({ account, policyId, useSimulation, feeEstimator, customMiddleware, gasEstimator, signUserOperation, ...config_ }: AlchemySmartAccountClientConfig<TTransport, TChain, TAccount, TContext>): AlchemySmartAccountClient<TTransport, TChain, TAccount, Record<string, never>, TContext>;
19
+ export type AlchemySmartAccountClient<chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<string, unknown>, context extends UserOperationContext | undefined = UserOperationContext | undefined> = Prettify<AlchemySmartAccountClient_Base<chain, account, actions, context>>;
20
+ export declare function createAlchemySmartAccountClient<TChain extends Chain = Chain, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>): AlchemySmartAccountClient<TChain, TAccount, Record<string, never>, TContext>;