@account-kit/infra 4.0.0-alpha.9 → 4.0.0-beta.0

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 (130) hide show
  1. package/dist/esm/actions/simulateUserOperationChanges.d.ts +17 -0
  2. package/dist/esm/actions/simulateUserOperationChanges.js +17 -0
  3. package/dist/esm/actions/simulateUserOperationChanges.js.map +1 -1
  4. package/dist/esm/actions/types.d.ts +4 -0
  5. package/dist/esm/actions/types.js +4 -0
  6. package/dist/esm/actions/types.js.map +1 -1
  7. package/dist/esm/chains.d.ts +22 -0
  8. package/dist/esm/chains.js +60 -1
  9. package/dist/esm/chains.js.map +1 -1
  10. package/dist/esm/client/decorators/alchemyEnhancedApis.d.ts +18 -5393
  11. package/dist/esm/client/decorators/alchemyEnhancedApis.js +37 -18
  12. package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
  13. package/dist/esm/client/decorators/smartAccount.d.ts +15 -0
  14. package/dist/esm/client/decorators/smartAccount.js +15 -0
  15. package/dist/esm/client/decorators/smartAccount.js.map +1 -1
  16. package/dist/esm/client/internal/smartAccountClientFromRpc.d.ts +7 -0
  17. package/dist/esm/client/internal/smartAccountClientFromRpc.js +17 -0
  18. package/dist/esm/client/internal/smartAccountClientFromRpc.js.map +1 -1
  19. package/dist/esm/client/isAlchemySmartAccountClient.d.ts +17 -5393
  20. package/dist/esm/client/isAlchemySmartAccountClient.js +21 -2
  21. package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
  22. package/dist/esm/client/rpcClient.d.ts +22 -0
  23. package/dist/esm/client/rpcClient.js +22 -0
  24. package/dist/esm/client/rpcClient.js.map +1 -1
  25. package/dist/esm/client/smartAccountClient.js +17 -0
  26. package/dist/esm/client/smartAccountClient.js.map +1 -1
  27. package/dist/esm/defaults.d.ts +14 -0
  28. package/dist/esm/defaults.js +14 -0
  29. package/dist/esm/defaults.js.map +1 -1
  30. package/dist/esm/errors/base.js +1 -0
  31. package/dist/esm/errors/base.js.map +1 -1
  32. package/dist/esm/gas-manager.d.ts +13 -0
  33. package/dist/esm/gas-manager.js +13 -0
  34. package/dist/esm/gas-manager.js.map +1 -1
  35. package/dist/esm/index.d.ts +1 -1
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/middleware/feeEstimator.d.ts +19 -0
  39. package/dist/esm/middleware/feeEstimator.js +20 -0
  40. package/dist/esm/middleware/feeEstimator.js.map +1 -1
  41. package/dist/esm/middleware/gasManager.d.ts +19 -0
  42. package/dist/esm/middleware/gasManager.js +19 -0
  43. package/dist/esm/middleware/gasManager.js.map +1 -1
  44. package/dist/esm/middleware/userOperationSimulator.d.ts +19 -0
  45. package/dist/esm/middleware/userOperationSimulator.js +19 -0
  46. package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
  47. package/dist/esm/version.d.ts +1 -1
  48. package/dist/esm/version.js +3 -1
  49. package/dist/esm/version.js.map +1 -1
  50. package/dist/types/chains.d.ts +3 -0
  51. package/dist/types/chains.d.ts.map +1 -1
  52. package/dist/types/client/decorators/alchemyEnhancedApis.d.ts +1 -5393
  53. package/dist/types/client/decorators/alchemyEnhancedApis.d.ts.map +1 -1
  54. package/dist/types/client/isAlchemySmartAccountClient.d.ts +2 -5393
  55. package/dist/types/client/isAlchemySmartAccountClient.d.ts.map +1 -1
  56. package/dist/types/index.d.ts +1 -1
  57. package/dist/types/index.d.ts.map +1 -1
  58. package/dist/types/version.d.ts +1 -1
  59. package/dist/types/version.d.ts.map +1 -1
  60. package/package.json +12 -13
  61. package/src/chains.ts +44 -0
  62. package/src/client/decorators/alchemyEnhancedApis.ts +13 -11
  63. package/src/client/isAlchemySmartAccountClient.ts +3 -3
  64. package/src/index.ts +3 -0
  65. package/src/version.ts +1 -1
  66. package/dist/cjs/actions/simulateUserOperationChanges.d.ts +0 -5
  67. package/dist/cjs/actions/simulateUserOperationChanges.js +0 -24
  68. package/dist/cjs/actions/simulateUserOperationChanges.js.map +0 -1
  69. package/dist/cjs/actions/types.d.ts +0 -39
  70. package/dist/cjs/actions/types.js +0 -17
  71. package/dist/cjs/actions/types.js.map +0 -1
  72. package/dist/cjs/chains.d.ts +0 -30
  73. package/dist/cjs/chains.js +0 -215
  74. package/dist/cjs/chains.js.map +0 -1
  75. package/dist/cjs/client/decorators/alchemyEnhancedApis.d.ts +0 -5406
  76. package/dist/cjs/client/decorators/alchemyEnhancedApis.js +0 -26
  77. package/dist/cjs/client/decorators/alchemyEnhancedApis.js.map +0 -1
  78. package/dist/cjs/client/decorators/smartAccount.d.ts +0 -7
  79. package/dist/cjs/client/decorators/smartAccount.js +0 -9
  80. package/dist/cjs/client/decorators/smartAccount.js.map +0 -1
  81. package/dist/cjs/client/internal/smartAccountClientFromRpc.d.ts +0 -11
  82. package/dist/cjs/client/internal/smartAccountClientFromRpc.js +0 -44
  83. package/dist/cjs/client/internal/smartAccountClientFromRpc.js.map +0 -1
  84. package/dist/cjs/client/isAlchemySmartAccountClient.d.ts +0 -5395
  85. package/dist/cjs/client/isAlchemySmartAccountClient.js +0 -9
  86. package/dist/cjs/client/isAlchemySmartAccountClient.js.map +0 -1
  87. package/dist/cjs/client/rpcClient.d.ts +0 -8
  88. package/dist/cjs/client/rpcClient.js +0 -36
  89. package/dist/cjs/client/rpcClient.js.map +0 -1
  90. package/dist/cjs/client/smartAccountClient.d.ts +0 -17
  91. package/dist/cjs/client/smartAccountClient.js +0 -32
  92. package/dist/cjs/client/smartAccountClient.js.map +0 -1
  93. package/dist/cjs/client/types.d.ts +0 -29
  94. package/dist/cjs/client/types.js +0 -3
  95. package/dist/cjs/client/types.js.map +0 -1
  96. package/dist/cjs/defaults.d.ts +0 -3
  97. package/dist/cjs/defaults.js +0 -23
  98. package/dist/cjs/defaults.js.map +0 -1
  99. package/dist/cjs/errors/base.d.ts +0 -4
  100. package/dist/cjs/errors/base.js +0 -18
  101. package/dist/cjs/errors/base.js.map +0 -1
  102. package/dist/cjs/errors/rpcUrl.d.ts +0 -10
  103. package/dist/cjs/errors/rpcUrl.js +0 -26
  104. package/dist/cjs/errors/rpcUrl.js.map +0 -1
  105. package/dist/cjs/gas-manager.d.ts +0 -6
  106. package/dist/cjs/gas-manager.js +0 -35
  107. package/dist/cjs/gas-manager.js.map +0 -1
  108. package/dist/cjs/index.d.ts +0 -25
  109. package/dist/cjs/index.js +0 -53
  110. package/dist/cjs/index.js.map +0 -1
  111. package/dist/cjs/middleware/feeEstimator.d.ts +0 -3
  112. package/dist/cjs/middleware/feeEstimator.js +0 -26
  113. package/dist/cjs/middleware/feeEstimator.js.map +0 -1
  114. package/dist/cjs/middleware/gasManager.d.ts +0 -2
  115. package/dist/cjs/middleware/gasManager.js +0 -11
  116. package/dist/cjs/middleware/gasManager.js.map +0 -1
  117. package/dist/cjs/middleware/userOperationSimulator.d.ts +0 -3
  118. package/dist/cjs/middleware/userOperationSimulator.js +0 -21
  119. package/dist/cjs/middleware/userOperationSimulator.js.map +0 -1
  120. package/dist/cjs/package.json +0 -1
  121. package/dist/cjs/schema.d.ts +0 -396
  122. package/dist/cjs/schema.js +0 -19
  123. package/dist/cjs/schema.js.map +0 -1
  124. package/dist/cjs/type.d.ts +0 -3
  125. package/dist/cjs/type.js +0 -3
  126. package/dist/cjs/type.js.map +0 -1
  127. package/dist/cjs/version.d.ts +0 -1
  128. package/dist/cjs/version.js +0 -5
  129. package/dist/cjs/version.js.map +0 -1
  130. package/dist/esm/package.json +0 -1
@@ -1,22 +1,41 @@
1
1
  import { AlchemySdkClientSchema } from "../../schema.js";
2
- export const alchemyEnhancedApiActions = (alchemy) => (client) => {
3
- const alchemySdk = AlchemySdkClientSchema.parse(alchemy);
4
- if (client.transport.type === "http") {
5
- const { url } = client.transport;
6
- if (client.transport.type === "http" &&
7
- alchemy.config.url &&
8
- alchemy.config.url !== url) {
9
- throw new Error("Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL");
2
+ /**
3
+ * Given an instance of the Alchemy SDK, returns a smart account client decorator which contains actions for interacting Alchemy's enhanced APIs.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { Alchemy } from "alchemy-sdk";
8
+ * import { alchemyEnhancedApiActions } from "@account-kit/infra";
9
+ * import { alchemySCAClient } from "./client";
10
+ *
11
+ * const alchemy = new Alchemy(...);
12
+ * const enhancedApiDecorator = alchemyEnhancedApiActions(alchemy);
13
+ * const withEnhancedApis = alchemySCAClient.extend(enhancedApiDecorator);
14
+ * ```
15
+ *
16
+ * @param {Alchemy} alchemy The Alchemy instance containing the SDK client
17
+ * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods
18
+ */
19
+ export function alchemyEnhancedApiActions(alchemy) {
20
+ return (client) => {
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
+ }
10
29
  }
11
- }
12
- return {
13
- core: alchemySdk.core,
14
- nft: alchemySdk.nft,
15
- transact: alchemySdk.transact,
16
- debug: alchemySdk.debug,
17
- ws: alchemySdk.ws,
18
- notify: alchemySdk.notify,
19
- config: alchemySdk.config,
30
+ return {
31
+ core: alchemySdk.core,
32
+ nft: alchemySdk.nft,
33
+ transact: alchemySdk.transact,
34
+ debug: alchemySdk.debug,
35
+ ws: alchemySdk.ws,
36
+ notify: alchemySdk.notify,
37
+ config: alchemySdk.config,
38
+ };
20
39
  };
21
- };
40
+ }
22
41
  //# sourceMappingURL=alchemyEnhancedApis.js.map
@@ -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;AA8BzD,MAAM,CAAC,MAAM,yBAAyB,GACpC,CAAC,OAAgB,EAAE,EAAE,CACrB,CAOE,MAA+D,EAC1C,EAAE;IACvB,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEzD,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACrC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,SACa,CAAC;QAErC,IACE,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM;YAChC,OAAO,CAAC,MAAM,CAAC,GAAG;YAClB,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,EAC1B,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC,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 const 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 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"]}
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"]}
@@ -4,4 +4,19 @@ import type { SimulateUserOperationAssetChangesResponse } from "../../actions/ty
4
4
  export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = {
5
5
  simulateUserOperation: (args: SendUserOperationParameters<TAccount, TContext>) => Promise<SimulateUserOperationAssetChangesResponse>;
6
6
  };
7
+ /**
8
+ * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { alchemyActions } from "@account-kit/infra";
13
+ * import { createPublicClient } from "viem";
14
+ *
15
+ * const client = createPublicClient(...);
16
+ * const clientWithAlchemyActions = client.extend(alchemyActions);
17
+ * ```
18
+ *
19
+ * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions
20
+ * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions
21
+ */
7
22
  export declare const alchemyActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>) => AlchemySmartAccountClientActions<TAccount, TContext>;
@@ -1,4 +1,19 @@
1
1
  import { simulateUserOperationChanges } from "../../actions/simulateUserOperationChanges.js";
2
+ /**
3
+ * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { alchemyActions } from "@account-kit/infra";
8
+ * import { createPublicClient } from "viem";
9
+ *
10
+ * const client = createPublicClient(...);
11
+ * const clientWithAlchemyActions = client.extend(alchemyActions);
12
+ * ```
13
+ *
14
+ * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions
15
+ * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions
16
+ */
2
17
  export const alchemyActions = (client) => ({
3
18
  simulateUserOperation: async (args) => simulateUserOperationChanges(client, args),
4
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AA+B7F,MAAM,CAAC,MAAM,cAAc,GAWiC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvE,qBAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACpC,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC;CAC7C,CAAC,CAAC","sourcesContent":["import type {\n SendUserOperationParameters,\n SmartContractAccount,\n UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { simulateUserOperationChanges } from \"../../actions/simulateUserOperationChanges.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"../../actions/types.js\";\n\nexport type AlchemySmartAccountClientActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n simulateUserOperation: (\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<SimulateUserOperationAssetChangesResponse>;\n};\n\n/**\n * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.\n *\n * @example\n * ```ts\n * import { alchemyActions } from \"@account-kit/infra\";\n * import { createPublicClient } from \"viem\";\n *\n * const client = createPublicClient(...);\n * const clientWithAlchemyActions = client.extend(alchemyActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions\n * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions\n */\nexport const alchemyActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => AlchemySmartAccountClientActions<TAccount, TContext> = (client) => ({\n simulateUserOperation: async (args) =>\n simulateUserOperationChanges(client, args),\n});\n"]}
1
+ {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAgB7F;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAWiC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvE,qBAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACpC,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC;CAC7C,CAAC,CAAC","sourcesContent":["import type {\n SendUserOperationParameters,\n SmartContractAccount,\n UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { simulateUserOperationChanges } from \"../../actions/simulateUserOperationChanges.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"../../actions/types.js\";\n\nexport type AlchemySmartAccountClientActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n simulateUserOperation: (\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<SimulateUserOperationAssetChangesResponse>;\n};\n\n/**\n * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.\n *\n * @example\n * ```ts\n * import { alchemyActions } from \"@account-kit/infra\";\n * import { createPublicClient } from \"viem\";\n *\n * const client = createPublicClient(...);\n * const clientWithAlchemyActions = client.extend(alchemyActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions\n * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions\n */\nexport const alchemyActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => AlchemySmartAccountClientActions<TAccount, TContext> = (client) => ({\n simulateUserOperation: async (args) =>\n simulateUserOperationChanges(client, args),\n});\n"]}
@@ -8,4 +8,11 @@ export type CreateAlchemySmartAccountClientFromRpcClientParams<TAccount extends
8
8
  export declare function getSignerTypeHeader<TAccount extends SmartContractAccountWithSigner>(account: TAccount): {
9
9
  "Alchemy-Aa-Sdk-Signer": string;
10
10
  };
11
+ /**
12
+ * Helper method meant to be used internally to create an alchemy smart account client
13
+ * from an existing Alchemy Rpc Client
14
+ *
15
+ * @param {CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>} args configuration for the client
16
+ * @returns {AlchemySmartAccountClient} a smart account client configured to use Alchemy's RPC
17
+ */
11
18
  export declare function createAlchemySmartAccountClientFromRpcClient<TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(args: CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>): AlchemySmartAccountClient<CustomTransport, TChain, TAccount, Record<string, never>, TContext>;
@@ -6,6 +6,23 @@ import { alchemyActions } from "../decorators/smartAccount.js";
6
6
  export function getSignerTypeHeader(account) {
7
7
  return { "Alchemy-Aa-Sdk-Signer": account.getSigner().signerType };
8
8
  }
9
+ /**
10
+ * Creates an AlchemySmartAccountClient using the provided RPC client configuration, including options, account, simulation settings, gas management, fee estimation, middleware and user operation signing.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { createAlchemySmartAccountClientFromRpcClient, createAlchemyPublicRpcClient } from "@account-kit/infra";
15
+ *
16
+ * const client = createAlchemyPublicRpcClient(...);
17
+ * const scaClient = createAlchemySmartAccountClientFromRpcClient({
18
+ * client,
19
+ * ...
20
+ * });
21
+ * ```
22
+ *
23
+ * @param {CreateAlchemySmartAccountClientFromRpcClientParams} args The configuration object containing all required parameters
24
+ * @returns {AlchemySmartAccountClient} An instance of AlchemySmartAccountClient
25
+ */
9
26
  export function createAlchemySmartAccountClientFromRpcClient(args) {
10
27
  const { opts, account, useSimulation, policyId, feeEstimator, gasEstimator, customMiddleware, signUserOperation, client, } = args;
11
28
  const feeOptions = opts?.feeOptions ?? getDefaultUserOperationFeeOptions(client.chain);
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClientFromRpc.js","sourceRoot":"","sources":["../../../../src/client/internal/smartAccountClientFromRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EACjC,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAmB/D,MAAM,UAAU,mBAAmB,CAEjC,OAAiB;IACjB,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC;AACrE,CAAC;AA4CD,MAAM,UAAU,4CAA4C,CAC1D,IAAwD;IAExD,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,GACP,GAAG,IAAI,CAAC;IACT,MAAM,UAAU,GACd,IAAI,EAAE,UAAU,IAAI,iCAAiC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEtE,MAAM,SAAS,GAAG,oCAAoC,CAAC;QACrD,OAAO;QACP,MAAM;QACN,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE;YACJ,GAAG,IAAI;YACP,UAAU;SACX;QACD,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YACvC,IAAI,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3C,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1D,CAAC;YACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACpE,CAAC;QACD,YAAY,EAAE,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC;QACzD,sBAAsB,EAAE,aAAa;YACnC,CAAC,CAAC,6BAA6B,CAAC,MAAM,CAAC;YACvC,CAAC,CAAC,SAAS;QACb,YAAY;QACZ,GAAG,CAAC,QAAQ,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC;QACtD,iBAAiB;KAClB,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAE1B,IAAI,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {\n createSmartAccountClientFromExisting,\n getDefaultUserOperationFeeOptions,\n isSmartAccountWithSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { Chain, CustomTransport, Transport } from \"viem\";\nimport { alchemyFeeEstimator } from \"../../middleware/feeEstimator.js\";\nimport { alchemyGasManagerMiddleware } from \"../../middleware/gasManager.js\";\nimport { alchemyUserOperationSimulator } from \"../../middleware/userOperationSimulator.js\";\nimport { alchemyActions } from \"../decorators/smartAccount.js\";\nimport type {\n AlchemySmartAccountClient,\n AlchemySmartAccountClientConfig,\n} from \"../smartAccountClient.js\";\nimport type { ClientWithAlchemyMethods } from \"../types.js\";\n\nexport type CreateAlchemySmartAccountClientFromRpcClientParams<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, TAccount, TContext>,\n \"rpcUrl\" | \"chain\" | \"apiKey\" | \"jwt\"\n> & { client: ClientWithAlchemyMethods };\n\nexport function getSignerTypeHeader<\n TAccount extends SmartContractAccountWithSigner\n>(account: TAccount) {\n return { \"Alchemy-Aa-Sdk-Signer\": account.getSigner().signerType };\n}\n\n/**\n * Helper method meant to be used internally to create an alchemy smart account client\n * from an existing Alchemy Rpc Client\n *\n * @param {CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>} args configuration for the client\n * @returns {AlchemySmartAccountClient} a smart account client configured to use Alchemy's RPC\n */\nexport function createAlchemySmartAccountClientFromRpcClient<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n args: CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>\n): AlchemySmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n Record<string, never>,\n TContext\n>;\n\n/**\n * Creates an AlchemySmartAccountClient using the provided RPC client configuration, including options, account, simulation settings, gas management, fee estimation, middleware and user operation signing.\n *\n * @example\n * ```ts\n * import { createAlchemySmartAccountClientFromRpcClient, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient(...);\n * const scaClient = createAlchemySmartAccountClientFromRpcClient({\n * client,\n * ...\n * });\n * ```\n *\n * @param {CreateAlchemySmartAccountClientFromRpcClientParams} args The configuration object containing all required parameters\n * @returns {AlchemySmartAccountClient} An instance of AlchemySmartAccountClient\n */\nexport function createAlchemySmartAccountClientFromRpcClient(\n args: CreateAlchemySmartAccountClientFromRpcClientParams\n): AlchemySmartAccountClient {\n const {\n opts,\n account,\n useSimulation,\n policyId,\n feeEstimator,\n gasEstimator,\n customMiddleware,\n signUserOperation,\n client,\n } = args;\n const feeOptions =\n opts?.feeOptions ?? getDefaultUserOperationFeeOptions(client.chain);\n\n const scaClient = createSmartAccountClientFromExisting({\n account,\n client,\n type: \"AlchemySmartAccountClient\",\n opts: {\n ...opts,\n feeOptions,\n },\n customMiddleware: async (struct, args) => {\n if (isSmartAccountWithSigner(args.account)) {\n client.updateHeaders(getSignerTypeHeader(args.account));\n }\n return customMiddleware ? customMiddleware(struct, args) : struct;\n },\n feeEstimator: feeEstimator ?? alchemyFeeEstimator(client),\n userOperationSimulator: useSimulation\n ? alchemyUserOperationSimulator(client)\n : undefined,\n gasEstimator,\n ...(policyId && alchemyGasManagerMiddleware(policyId)),\n signUserOperation,\n }).extend(alchemyActions);\n\n if (account && isSmartAccountWithSigner(account)) {\n client.updateHeaders(getSignerTypeHeader(account));\n }\n\n return scaClient;\n}\n"]}
1
+ {"version":3,"file":"smartAccountClientFromRpc.js","sourceRoot":"","sources":["../../../../src/client/internal/smartAccountClientFromRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EACjC,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAmB/D,MAAM,UAAU,mBAAmB,CAEjC,OAAiB;IACjB,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC;AACrE,CAAC;AA2BD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4CAA4C,CAC1D,IAAwD;IAExD,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,GACP,GAAG,IAAI,CAAC;IACT,MAAM,UAAU,GACd,IAAI,EAAE,UAAU,IAAI,iCAAiC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEtE,MAAM,SAAS,GAAG,oCAAoC,CAAC;QACrD,OAAO;QACP,MAAM;QACN,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE;YACJ,GAAG,IAAI;YACP,UAAU;SACX;QACD,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YACvC,IAAI,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3C,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1D,CAAC;YACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACpE,CAAC;QACD,YAAY,EAAE,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC;QACzD,sBAAsB,EAAE,aAAa;YACnC,CAAC,CAAC,6BAA6B,CAAC,MAAM,CAAC;YACvC,CAAC,CAAC,SAAS;QACb,YAAY;QACZ,GAAG,CAAC,QAAQ,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC;QACtD,iBAAiB;KAClB,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAE1B,IAAI,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {\n createSmartAccountClientFromExisting,\n getDefaultUserOperationFeeOptions,\n isSmartAccountWithSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { Chain, CustomTransport, Transport } from \"viem\";\nimport { alchemyFeeEstimator } from \"../../middleware/feeEstimator.js\";\nimport { alchemyGasManagerMiddleware } from \"../../middleware/gasManager.js\";\nimport { alchemyUserOperationSimulator } from \"../../middleware/userOperationSimulator.js\";\nimport { alchemyActions } from \"../decorators/smartAccount.js\";\nimport type {\n AlchemySmartAccountClient,\n AlchemySmartAccountClientConfig,\n} from \"../smartAccountClient.js\";\nimport type { ClientWithAlchemyMethods } from \"../types.js\";\n\nexport type CreateAlchemySmartAccountClientFromRpcClientParams<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, TAccount, TContext>,\n \"rpcUrl\" | \"chain\" | \"apiKey\" | \"jwt\"\n> & { client: ClientWithAlchemyMethods };\n\nexport function getSignerTypeHeader<\n TAccount extends SmartContractAccountWithSigner\n>(account: TAccount) {\n return { \"Alchemy-Aa-Sdk-Signer\": account.getSigner().signerType };\n}\n\n/**\n * Helper method meant to be used internally to create an alchemy smart account client\n * from an existing Alchemy Rpc Client\n *\n * @param {CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>} args configuration for the client\n * @returns {AlchemySmartAccountClient} a smart account client configured to use Alchemy's RPC\n */\nexport function createAlchemySmartAccountClientFromRpcClient<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n args: CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>\n): AlchemySmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n Record<string, never>,\n TContext\n>;\n\n/**\n * Creates an AlchemySmartAccountClient using the provided RPC client configuration, including options, account, simulation settings, gas management, fee estimation, middleware and user operation signing.\n *\n * @example\n * ```ts\n * import { createAlchemySmartAccountClientFromRpcClient, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient(...);\n * const scaClient = createAlchemySmartAccountClientFromRpcClient({\n * client,\n * ...\n * });\n * ```\n *\n * @param {CreateAlchemySmartAccountClientFromRpcClientParams} args The configuration object containing all required parameters\n * @returns {AlchemySmartAccountClient} An instance of AlchemySmartAccountClient\n */\nexport function createAlchemySmartAccountClientFromRpcClient(\n args: CreateAlchemySmartAccountClientFromRpcClientParams\n): AlchemySmartAccountClient {\n const {\n opts,\n account,\n useSimulation,\n policyId,\n feeEstimator,\n gasEstimator,\n customMiddleware,\n signUserOperation,\n client,\n } = args;\n const feeOptions =\n opts?.feeOptions ?? getDefaultUserOperationFeeOptions(client.chain);\n\n const scaClient = createSmartAccountClientFromExisting({\n account,\n client,\n type: \"AlchemySmartAccountClient\",\n opts: {\n ...opts,\n feeOptions,\n },\n customMiddleware: async (struct, args) => {\n if (isSmartAccountWithSigner(args.account)) {\n client.updateHeaders(getSignerTypeHeader(args.account));\n }\n return customMiddleware ? customMiddleware(struct, args) : struct;\n },\n feeEstimator: feeEstimator ?? alchemyFeeEstimator(client),\n userOperationSimulator: useSimulation\n ? alchemyUserOperationSimulator(client)\n : undefined,\n gasEstimator,\n ...(policyId && alchemyGasManagerMiddleware(policyId)),\n signUserOperation,\n }).extend(alchemyActions);\n\n if (account && isSmartAccountWithSigner(account)) {\n client.updateHeaders(getSignerTypeHeader(account));\n }\n\n return scaClient;\n}\n"]}