@account-kit/smart-contracts 4.8.0 → 4.9.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 (43) hide show
  1. package/dist/esm/src/light-account/clients/alchemyClient.js +6 -12
  2. package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
  3. package/dist/esm/src/light-account/clients/client.d.ts +9 -4
  4. package/dist/esm/src/light-account/clients/client.js +26 -1
  5. package/dist/esm/src/light-account/clients/client.js.map +1 -1
  6. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js +6 -11
  7. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  8. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.d.ts +10 -4
  9. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +27 -3
  10. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  11. package/dist/esm/src/ma-v2/client/client.d.ts +10 -3
  12. package/dist/esm/src/ma-v2/client/client.js +15 -1
  13. package/dist/esm/src/ma-v2/client/client.js.map +1 -1
  14. package/dist/esm/src/msca/client/alchemyClient.js +4 -17
  15. package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
  16. package/dist/esm/src/msca/client/client.d.ts +14 -5
  17. package/dist/esm/src/msca/client/client.js +62 -0
  18. package/dist/esm/src/msca/client/client.js.map +1 -1
  19. package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +4 -2
  20. package/dist/esm/src/msca/client/multiSigAlchemyClient.js +5 -19
  21. package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  22. package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
  23. package/dist/types/src/light-account/clients/client.d.ts +9 -4
  24. package/dist/types/src/light-account/clients/client.d.ts.map +1 -1
  25. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
  26. package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts +10 -4
  27. package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts.map +1 -1
  28. package/dist/types/src/ma-v2/client/client.d.ts +10 -3
  29. package/dist/types/src/ma-v2/client/client.d.ts.map +1 -1
  30. package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
  31. package/dist/types/src/msca/client/client.d.ts +14 -5
  32. package/dist/types/src/msca/client/client.d.ts.map +1 -1
  33. package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +4 -2
  34. package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
  35. package/package.json +6 -5
  36. package/src/light-account/clients/alchemyClient.ts +5 -14
  37. package/src/light-account/clients/client.ts +52 -6
  38. package/src/light-account/clients/multiOwnerAlchemyClient.ts +5 -13
  39. package/src/light-account/clients/multiOwnerLightAccount.ts +64 -8
  40. package/src/ma-v2/client/client.ts +50 -7
  41. package/src/msca/client/alchemyClient.ts +3 -22
  42. package/src/msca/client/client.ts +157 -13
  43. package/src/msca/client/multiSigAlchemyClient.ts +6 -29
@@ -1,5 +1,5 @@
1
- import { createAlchemySmartAccountClient, } from "@account-kit/infra";
2
- import { createLightAccount, lightAccountClientActions, } from "@account-kit/smart-contracts";
1
+ import {} from "@account-kit/infra";
2
+ import { createLightAccountClient, } from "@account-kit/smart-contracts";
3
3
  import {} from "viem";
4
4
  /**
5
5
  * Creates an Alchemy smart account client connected to a Light Account instance.
@@ -17,22 +17,16 @@ import {} from "viem";
17
17
  * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
18
18
  * });
19
19
  * ```
20
- *
20
+ * @deprecated Use createLightAccountClient instead now, it should switch depending on the transport
21
21
  * @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client
22
22
  * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client
23
23
  */
24
24
  export async function createLightAccountAlchemyClient({ opts, transport, chain, ...config }) {
25
- const account = await createLightAccount({
26
- ...config,
25
+ return createLightAccountClient({
26
+ opts,
27
27
  transport,
28
28
  chain,
29
- });
30
- return createAlchemySmartAccountClient({
31
29
  ...config,
32
- transport,
33
- chain,
34
- account,
35
- opts,
36
- }).extend(lightAccountClientActions);
30
+ });
37
31
  }
38
32
  //# sourceMappingURL=alchemyClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,GAGhC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAI1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAc,MAAM,MAAM,CAAC;AAsBlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,EACpD,IAAI,EACJ,SAAS,EACT,KAAK,EACL,GAAG,MAAM,EACuB;IAChC,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC;QACvC,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC;QACrC,GAAG,MAAM;QACT,SAAS;QACT,KAAK;QACL,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n createAlchemySmartAccountClient,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createLightAccount,\n lightAccountClientActions,\n type CreateLightAccountParams,\n type LightAccount,\n type LightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { type Chain } from \"viem\";\n\nexport type AlchemyLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<CreateLightAccountParams<HttpTransport, TSigner>, \"transport\"> &\n Omit<\n AlchemySmartAccountClientConfig<Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates an Alchemy smart account client connected to a Light Account instance.\n *\n * @example\n * ```ts\n * import { createLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createLightAccountAlchemyClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client\n */\nexport async function createLightAccountAlchemyClient({\n opts,\n transport,\n chain,\n ...config\n}: AlchemyLightAccountClientConfig): Promise<AlchemySmartAccountClient> {\n const account = await createLightAccount({\n ...config,\n transport,\n chain,\n });\n\n return createAlchemySmartAccountClient({\n ...config,\n transport,\n chain,\n account,\n opts,\n }).extend(lightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,GAIzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAc,MAAM,MAAM,CAAC;AAsBlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,EACpD,IAAI,EACJ,SAAS,EACT,KAAK,EACL,GAAG,MAAM,EACuB;IAChC,OAAO,wBAAwB,CAAC;QAC9B,IAAI;QACJ,SAAS;QACT,KAAK;QACL,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createLightAccountClient,\n type CreateLightAccountParams,\n type LightAccount,\n type LightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { type Chain } from \"viem\";\n\nexport type AlchemyLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<CreateLightAccountParams<HttpTransport, TSigner>, \"transport\"> &\n Omit<\n AlchemySmartAccountClientConfig<Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates an Alchemy smart account client connected to a Light Account instance.\n *\n * @example\n * ```ts\n * import { createLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createLightAccountAlchemyClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n * @deprecated Use createLightAccountClient instead now, it should switch depending on the transport\n * @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client\n */\nexport async function createLightAccountAlchemyClient({\n opts,\n transport,\n chain,\n ...config\n}: AlchemyLightAccountClientConfig): Promise<AlchemySmartAccountClient> {\n return createLightAccountClient({\n opts,\n transport,\n chain,\n ...config,\n });\n}\n"]}
@@ -1,9 +1,14 @@
1
- import { type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
1
+ import { type NotType, type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
2
2
  import { type Chain, type CustomTransport, type Transport } from "viem";
3
- import { type CreateLightAccountParams, type LightAccount } from "../accounts/account.js";
3
+ import { type CreateLightAccountParams, type LightAccount } from "@account-kit/smart-contracts";
4
4
  import { type LightAccountClientActions } from "../decorators/lightAccount.js";
5
- export type CreateLightAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
5
+ import { type AlchemySmartAccountClient, type AlchemyTransport } from "@account-kit/infra";
6
+ import { type AlchemyLightAccountClientConfig } from "./alchemyClient.js";
7
+ export type CreateLightAccountClientParams<TTransport extends Transport | AlchemyTransport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
6
8
  transport: CreateLightAccountParams<TTransport, TSigner>["transport"];
7
9
  chain: CreateLightAccountParams<TTransport, TSigner>["chain"];
8
10
  } & Omit<CreateLightAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
9
- export declare function createLightAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateLightAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, LightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & LightAccountClientActions<TSigner, LightAccount<TSigner>>>>;
11
+ export declare function createLightAccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyLightAccountClientConfig<TSigner> & {
12
+ transport: AlchemyTransport;
13
+ }): Promise<AlchemySmartAccountClient<Chain | undefined, LightAccount<TSigner>, LightAccountClientActions<TSigner>>>;
14
+ export declare function createLightAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner, TTransport extends Transport = Transport>(args: CreateLightAccountClientParams<TTransport, TChain, TSigner> & NotType<TTransport, AlchemyTransport>): Promise<SmartAccountClient<CustomTransport, TChain, LightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & LightAccountClientActions<TSigner, LightAccount<TSigner>>>>;
@@ -1,10 +1,14 @@
1
1
  import { createSmartAccountClient, } from "@aa-sdk/core";
2
2
  import {} from "viem";
3
- import { createLightAccount, } from "../accounts/account.js";
3
+ import { createLightAccount, } from "@account-kit/smart-contracts";
4
4
  import { lightAccountClientActions, } from "../decorators/lightAccount.js";
5
+ import { isAlchemyTransport, createAlchemySmartAccountClient, } from "@account-kit/infra";
6
+ import {} from "./alchemyClient.js";
5
7
  /**
6
8
  * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.
7
9
  *
10
+ * Also, we modified the return type to be the light account alchemy client if the transport is alchemy.
11
+ *
8
12
  * @example
9
13
  * ```ts
10
14
  * import { createLightAccountClient } from "@account-kit/smart-contracts";
@@ -18,6 +22,19 @@ import { lightAccountClientActions, } from "../decorators/lightAccount.js";
18
22
  * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
19
23
  * });
20
24
  * ```
25
+ * @example
26
+ * ```ts
27
+ * import { createLightAccountClient } from "@account-kit/smart-contracts";
28
+ * import { sepolia, alchemy } from "@account-kit/infra";
29
+ * import { LocalAccountSigner } from "@aa-sdk/core";
30
+ * import { generatePrivateKey } from "viem"
31
+ *
32
+ * const lightAlchemyAccountClient = await createLightAccountClient({
33
+ * transport: alchemy({ apiKey: "your-api-key" }),
34
+ * chain: sepolia,
35
+ * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
36
+ * });
37
+ * ```
21
38
  *
22
39
  * @param {CreateLightAccountClientParams} params The parameters for creating a light account client
23
40
  * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods
@@ -29,6 +46,14 @@ export async function createLightAccountClient(params) {
29
46
  transport,
30
47
  chain,
31
48
  });
49
+ if (isAlchemyTransport(transport, chain)) {
50
+ return createAlchemySmartAccountClient({
51
+ ...params,
52
+ transport,
53
+ chain,
54
+ account: lightAccount,
55
+ }).extend(lightAccountClientActions);
56
+ }
32
57
  return createSmartAccountClient({
33
58
  ...params,
34
59
  transport,
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,kBAAkB,GAGnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAE1B,MAAM,+BAA+B,CAAC;AA8BvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC;QAC5C,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createLightAccount,\n type CreateLightAccountParams,\n type LightAccount,\n} from \"../accounts/account.js\";\nimport {\n lightAccountClientActions,\n type LightAccountClientActions,\n} from \"../decorators/lightAccount.js\";\n\nexport type CreateLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateLightAccountParams<TTransport, TSigner>[\"transport\"];\n chain: CreateLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<CreateLightAccountParams<TTransport, TSigner>, \"transport\" | \"chain\"> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n LightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n LightAccountClientActions<TSigner, LightAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.\n *\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountClientParams} params The parameters for creating a light account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods\n */\nexport async function createLightAccountClient(\n params: CreateLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createLightAccount({\n ...params,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAOzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,kBAAkB,GAGnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,yBAAyB,GAE1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,+BAA+B,GAGhC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAwC,MAAM,oBAAoB,CAAC;AA6C1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC;QAC5C,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IACH,IAAI,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,+BAA+B,CAAC;YACrC,GAAG,MAAM;YACT,SAAS;YACT,KAAK;YACL,OAAO,EAAE,YAAY;SACtB,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type NotType,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createLightAccount,\n type CreateLightAccountParams,\n type LightAccount,\n} from \"@account-kit/smart-contracts\";\nimport {\n lightAccountClientActions,\n type LightAccountClientActions,\n} from \"../decorators/lightAccount.js\";\nimport {\n isAlchemyTransport,\n createAlchemySmartAccountClient,\n type AlchemySmartAccountClient,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport { type AlchemyLightAccountClientConfig } from \"./alchemyClient.js\";\n\nexport type CreateLightAccountClientParams<\n TTransport extends Transport | AlchemyTransport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateLightAccountParams<TTransport, TSigner>[\"transport\"];\n chain: CreateLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<CreateLightAccountParams<TTransport, TSigner>, \"transport\" | \"chain\"> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createLightAccountClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner> & {\n transport: AlchemyTransport;\n }\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\nexport function createLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TTransport extends Transport = Transport\n>(\n args: CreateLightAccountClientParams<TTransport, TChain, TSigner> &\n NotType<TTransport, AlchemyTransport>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n TChain,\n LightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n LightAccountClientActions<TSigner, LightAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.\n *\n * Also, we modified the return type to be the light account alchemy client if the transport is alchemy.\n *\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAlchemyAccountClient = await createLightAccountClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountClientParams} params The parameters for creating a light account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods\n */\nexport async function createLightAccountClient(\n params: CreateLightAccountClientParams\n): Promise<SmartAccountClient | AlchemySmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createLightAccount({\n ...params,\n transport,\n chain,\n });\n if (isAlchemyTransport(transport, chain)) {\n return createAlchemySmartAccountClient({\n ...params,\n transport,\n chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n }\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { createAlchemySmartAccountClient, } from "@account-kit/infra";
2
- import { createMultiOwnerLightAccount, multiOwnerLightAccountClientActions, } from "@account-kit/smart-contracts";
1
+ import {} from "@account-kit/infra";
2
+ import { createMultiOwnerLightAccountClient, } from "@account-kit/smart-contracts";
3
3
  import {} from "viem";
4
4
  /**
5
5
  * Creates a multi-owner light account Alchemy client using the provided configuration.
@@ -20,21 +20,16 @@ import {} from "viem";
20
20
  * });
21
21
  * ```
22
22
  *
23
+ * @deprecated Use createMultiOwnerLightAccountAlchemyClient instead now, it should switch depending on the transport
23
24
  * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client
24
25
  * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods
25
26
  */
26
27
  export async function createMultiOwnerLightAccountAlchemyClient({ opts, transport, chain, ...config }) {
27
- const account = await createMultiOwnerLightAccount({
28
- ...config,
28
+ return createMultiOwnerLightAccountClient({
29
+ opts,
29
30
  transport,
30
31
  chain,
31
- });
32
- return createAlchemySmartAccountClient({
33
32
  ...config,
34
- transport,
35
- chain,
36
- account,
37
- opts,
38
- }).extend(multiOwnerLightAccountClientActions);
33
+ });
39
34
  }
40
35
  //# sourceMappingURL=multiOwnerAlchemyClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,GAGhC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,GAIpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAc,MAAM,MAAM,CAAC;AAyBlC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAAC,EAC9D,IAAI,EACJ,SAAS,EACT,KAAK,EACL,GAAG,MAAM,EACiC;IAC1C,MAAM,OAAO,GAAG,MAAM,4BAA4B,CAAC;QACjD,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC;QACrC,GAAG,MAAM;QACT,SAAS;QACT,KAAK;QACL,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n createAlchemySmartAccountClient,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccount,\n multiOwnerLightAccountClientActions,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { type Chain } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"type\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Chain, MultiOwnerLightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * transport: alchemy({\n * apiKey: \"your-api-key\",\n * }),\n * chain: sepolia\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient({\n opts,\n transport,\n chain,\n ...config\n}: AlchemyMultiOwnerLightAccountClientConfig): Promise<AlchemySmartAccountClient> {\n const account = await createMultiOwnerLightAccount({\n ...config,\n transport,\n chain,\n });\n\n return createAlchemySmartAccountClient({\n ...config,\n transport,\n chain,\n account,\n opts,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kCAAkC,GAInC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAc,MAAM,MAAM,CAAC;AAyBlC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAAC,EAC9D,IAAI,EACJ,SAAS,EACT,KAAK,EACL,GAAG,MAAM,EACiC;IAC1C,OAAO,kCAAkC,CAAC;QACxC,IAAI;QACJ,SAAS;QACT,KAAK;QACL,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccountClient,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { type Chain } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"type\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Chain, MultiOwnerLightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * transport: alchemy({\n * apiKey: \"your-api-key\",\n * }),\n * chain: sepolia\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @deprecated Use createMultiOwnerLightAccountAlchemyClient instead now, it should switch depending on the transport\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient({\n opts,\n transport,\n chain,\n ...config\n}: AlchemyMultiOwnerLightAccountClientConfig): Promise<AlchemySmartAccountClient> {\n return createMultiOwnerLightAccountClient({\n opts,\n transport,\n chain,\n ...config,\n });\n}\n"]}
@@ -1,9 +1,15 @@
1
- import { type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
1
+ import { type NotType, type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
2
2
  import { type Chain, type CustomTransport, type Transport } from "viem";
3
- import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount } from "../accounts/multiOwner.js";
4
- import { type MultiOwnerLightAccountClientActions } from "../decorators/multiOwnerLightAccount.js";
3
+ import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions, type AlchemyMultiOwnerLightAccountClientConfig } from "@account-kit/smart-contracts";
4
+ import { type AlchemySmartAccountClient, type AlchemyTransport } from "@account-kit/infra";
5
5
  export type CreateMultiOwnerLightAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
6
6
  transport: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["transport"];
7
7
  chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["chain"];
8
8
  } & Omit<CreateMultiOwnerLightAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
9
- export declare function createMultiOwnerLightAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerLightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & MultiOwnerLightAccountClientActions<TSigner, MultiOwnerLightAccount<TSigner>>>>;
9
+ export type CreateMultiOwnerLightAccountClientDynamicTransportParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = (AlchemyMultiOwnerLightAccountClientConfig<TSigner> & {
10
+ transport: AlchemyTransport;
11
+ }) | CreateMultiOwnerLightAccountClientParams<TTransport, TChain, TSigner>;
12
+ export declare function createMultiOwnerLightAccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultiOwnerLightAccountClientConfig<TSigner> & {
13
+ transport: AlchemyTransport;
14
+ }): Promise<AlchemySmartAccountClient<Chain | undefined, MultiOwnerLightAccount<TSigner>, MultiOwnerLightAccountClientActions<TSigner>>>;
15
+ export declare function createMultiOwnerLightAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerLightAccountClientParams<TTransport, TChain, TSigner> & NotType<TTransport, AlchemyTransport>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerLightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & MultiOwnerLightAccountClientActions<TSigner, MultiOwnerLightAccount<TSigner>>>>;
@@ -1,7 +1,7 @@
1
1
  import { createSmartAccountClient, } from "@aa-sdk/core";
2
2
  import {} from "viem";
3
- import { createMultiOwnerLightAccount, } from "../accounts/multiOwner.js";
4
- import { multiOwnerLightAccountClientActions, } from "../decorators/multiOwnerLightAccount.js";
3
+ import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount, } from "@account-kit/smart-contracts";
4
+ import { isAlchemyTransport, createAlchemySmartAccountClient, } from "@account-kit/infra";
5
5
  /**
6
6
  * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.
7
7
  *
@@ -19,7 +19,23 @@ import { multiOwnerLightAccountClientActions, } from "../decorators/multiOwnerLi
19
19
  * });
20
20
  * ```
21
21
  *
22
- * @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client
22
+ * @example
23
+ * ```ts
24
+ * import { createMultiOwnerLightAccountClient } from "@account-kit/smart-contracts";
25
+ * import { sepolia, alchemy } from "@account-kit/infra";
26
+ * import { LocalAccountSigner } from "@aa-sdk/core";
27
+ * import { generatePrivateKey } from "viem"
28
+ *
29
+ * const lightAccountClient = await createMultiOwnerLightAccountClient({
30
+ * transport: alchemy({
31
+ * apiKey: "your-api-key",
32
+ * }),
33
+ * chain: sepolia
34
+ * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
35
+ * });
36
+ * ```
37
+ *
38
+ * @param {CreateMultiOwnerLightAccountClientDynamicTransportParams} params the configuration for creating the multi-owner light / alchemy account client with the provided parameters transport
23
39
  * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods
24
40
  */
25
41
  export async function createMultiOwnerLightAccountClient(params) {
@@ -29,6 +45,14 @@ export async function createMultiOwnerLightAccountClient(params) {
29
45
  transport,
30
46
  chain,
31
47
  });
48
+ if (isAlchemyTransport(transport, chain)) {
49
+ return createAlchemySmartAccountClient({
50
+ ...params,
51
+ transport,
52
+ chain,
53
+ account: lightAccount,
54
+ }).extend(multiOwnerLightAccountClientActions);
55
+ }
32
56
  return createSmartAccountClient({
33
57
  ...params,
34
58
  transport,
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,GAEpC,MAAM,yCAAyC,CAAC;AAuCjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAgD;IAEhD,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC;QACtD,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createMultiOwnerLightAccount,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n} from \"../accounts/multiOwner.js\";\nimport {\n multiOwnerLightAccountClientActions,\n type MultiOwnerLightAccountClientActions,\n} from \"../decorators/multiOwnerLightAccount.js\";\n\nexport type CreateMultiOwnerLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner\n >[\"transport\"];\n chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<\n CreateMultiOwnerLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createMultiOwnerLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerLightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n MultiOwnerLightAccountClientActions<\n TSigner,\n MultiOwnerLightAccount<TSigner>\n >\n >\n>;\n\n/**\n * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client\n * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods\n */\nexport async function createMultiOwnerLightAccountClient(\n params: CreateMultiOwnerLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createMultiOwnerLightAccount({\n ...params,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAOzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,mCAAmC,EACnC,4BAA4B,GAK7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,kBAAkB,EAClB,+BAA+B,GAGhC,MAAM,oBAAoB,CAAC;AAiE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAgE;IAEhE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC;QACtD,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IACH,IAAI,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,+BAA+B,CAAC;YACrC,GAAG,MAAM;YACT,SAAS;YACT,KAAK;YACL,OAAO,EAAE,YAAY;SACtB,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type NotType,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n multiOwnerLightAccountClientActions,\n createMultiOwnerLightAccount,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n type AlchemyMultiOwnerLightAccountClientConfig,\n} from \"@account-kit/smart-contracts\";\nimport {\n isAlchemyTransport,\n createAlchemySmartAccountClient,\n type AlchemySmartAccountClient,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\n\nexport type CreateMultiOwnerLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner\n >[\"transport\"];\n chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<\n CreateMultiOwnerLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport type CreateMultiOwnerLightAccountClientDynamicTransportParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> =\n | (AlchemyMultiOwnerLightAccountClientConfig<TSigner> & {\n transport: AlchemyTransport;\n })\n | CreateMultiOwnerLightAccountClientParams<TTransport, TChain, TSigner>;\n\nexport async function createMultiOwnerLightAccountClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner> & {\n transport: AlchemyTransport;\n }\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\nexport function createMultiOwnerLightAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerLightAccountClientParams<TTransport, TChain, TSigner> &\n NotType<TTransport, AlchemyTransport>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerLightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n MultiOwnerLightAccountClientActions<\n TSigner,\n MultiOwnerLightAccount<TSigner>\n >\n >\n>;\n\n/**\n * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountClient({\n * transport: alchemy({\n * apiKey: \"your-api-key\",\n * }),\n * chain: sepolia\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountClientDynamicTransportParams} params the configuration for creating the multi-owner light / alchemy account client with the provided parameters transport\n * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods\n */\nexport async function createMultiOwnerLightAccountClient(\n params: CreateMultiOwnerLightAccountClientDynamicTransportParams\n): Promise<SmartAccountClient | AlchemySmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createMultiOwnerLightAccount({\n ...params,\n transport,\n chain,\n });\n if (isAlchemyTransport(transport, chain)) {\n return createAlchemySmartAccountClient({\n ...params,\n transport,\n chain,\n account: lightAccount,\n }).extend(multiOwnerLightAccountClientActions);\n }\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
@@ -1,6 +1,13 @@
1
- import { type SmartAccountClient, type SmartAccountSigner, type SmartAccountClientConfig } from "@aa-sdk/core";
1
+ import { type SmartAccountClient, type SmartAccountSigner, type SmartAccountClientConfig, type NotType } from "@aa-sdk/core";
2
2
  import { type Chain, type Transport } from "viem";
3
3
  import { type CreateSMAV2AccountParams, type MAV2Account } from "../account/semiModularAccountV2.js";
4
- export type SMAV2AccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner> = SmartAccountClient<Transport, Chain, MAV2Account<TSigner>>;
4
+ import { type AlchemySmartAccountClientConfig, type AlchemyTransport } from "@account-kit/infra";
5
+ import type { LightAccount } from "../../light-account/accounts/account.js";
6
+ export type SMAV2AccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner, TChain extends Chain = Chain, TTransport extends Transport | AlchemyTransport = Transport> = SmartAccountClient<TTransport, TChain, MAV2Account<TSigner>>;
5
7
  export type CreateSMAV2AccountClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner> = CreateSMAV2AccountParams<TTransport, TSigner> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
6
- export declare function createSMAV2AccountClient<TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateSMAV2AccountClientParams<Transport, TChain, TSigner>): Promise<SMAV2AccountClient<TSigner>>;
8
+ export type CreateSMAV2AlchemyAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateSMAV2AccountClientParams<TTransport, TChain, TSigner>, "transport"> & Omit<AlchemySmartAccountClientConfig<TChain, LightAccount<TSigner>>, "account"> & {
9
+ paymasterAndData?: never;
10
+ dummyPaymasterAndData?: never;
11
+ };
12
+ export declare function createSMAV2AccountClient<TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateSMAV2AlchemyAccountClientParams<AlchemyTransport, TChain, TSigner>): Promise<SMAV2AccountClient<TSigner, TChain, AlchemyTransport>>;
13
+ export declare function createSMAV2AccountClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateSMAV2AccountClientParams<TTransport, TChain, TSigner> & NotType<TTransport, AlchemyTransport>): Promise<SMAV2AccountClient<TSigner, TChain>>;
@@ -1,6 +1,7 @@
1
1
  import { createSmartAccountClient, } from "@aa-sdk/core";
2
2
  import {} from "viem";
3
3
  import { createSMAV2Account, } from "../account/semiModularAccountV2.js";
4
+ import { createAlchemySmartAccountClient, isAlchemyTransport, } from "@account-kit/infra";
4
5
  /**
5
6
  * Creates a SMAv2 account client using the provided configuration parameters.
6
7
  *
@@ -31,7 +32,20 @@ import { createSMAV2Account, } from "../account/semiModularAccountV2.js";
31
32
  * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance
32
33
  */
33
34
  export async function createSMAV2AccountClient(config) {
34
- const smaV2Account = await createSMAV2Account(config);
35
+ const { transport, chain } = config;
36
+ const smaV2Account = await createSMAV2Account({
37
+ ...config,
38
+ transport,
39
+ chain,
40
+ });
41
+ if (isAlchemyTransport(transport, chain)) {
42
+ return createAlchemySmartAccountClient({
43
+ ...config,
44
+ transport,
45
+ chain,
46
+ account: smaV2Account,
47
+ });
48
+ }
35
49
  return createSmartAccountClient({
36
50
  ...config,
37
51
  account: smaV2Account,
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,kBAAkB,GAGnB,MAAM,oCAAoC,CAAC;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEtD,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartAccountClientConfig,\n} from \"@aa-sdk/core\";\nimport { type Chain, type Transport } from \"viem\";\n\nimport {\n createSMAV2Account,\n type CreateSMAV2AccountParams,\n type MAV2Account,\n} from \"../account/semiModularAccountV2.js\";\n\nexport type SMAV2AccountClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartAccountClient<Transport, Chain, MAV2Account<TSigner>>;\n\nexport type CreateSMAV2AccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = CreateSMAV2AccountParams<TTransport, TSigner> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createSMAV2AccountClient<\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateSMAV2AccountClientParams<Transport, TChain, TSigner>\n): Promise<SMAV2AccountClient<TSigner>>;\n\n/**\n * Creates a SMAv2 account client using the provided configuration parameters.\n *\n * @example\n * ```ts\n * import { http } from \"viem\";\n * import { createSMAV2AccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const MNEMONIC = \"...\";\n * const RPC_URL = \"...\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);\n *\n * const chain = sepolia;\n *\n * const transport = http(RPC_URL);\n *\n * const SMAV2SignerAccountClient = await createSMAV2AccountClient({\n * chain,\n * signer,\n * transport,\n * });\n * ```\n *\n * @param {CreateSMAV2AccountClientParams} config The configuration parameters required to create the MAv2 account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance\n */\nexport async function createSMAV2AccountClient(\n config: CreateSMAV2AccountClientParams\n): Promise<SmartAccountClient> {\n const smaV2Account = await createSMAV2Account(config);\n\n return createSmartAccountClient({\n ...config,\n account: smaV2Account,\n });\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,kBAAkB,GAGnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,GAGnB,MAAM,oBAAoB,CAAC;AA8C5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC;QAC5C,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IACH,IAAI,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,+BAA+B,CAAC;YACrC,GAAG,MAAM;YACT,SAAS;YACT,KAAK;YACL,OAAO,EAAE,YAAY;SACtB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartAccountClientConfig,\n type NotType,\n createSmartAccountClient,\n} from \"@aa-sdk/core\";\nimport { type Chain, type Transport } from \"viem\";\n\nimport {\n createSMAV2Account,\n type CreateSMAV2AccountParams,\n type MAV2Account,\n} from \"../account/semiModularAccountV2.js\";\nimport {\n createAlchemySmartAccountClient,\n isAlchemyTransport,\n type AlchemySmartAccountClientConfig,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport type { LightAccount } from \"../../light-account/accounts/account.js\";\nexport type SMAV2AccountClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TChain extends Chain = Chain,\n TTransport extends Transport | AlchemyTransport = Transport\n> = SmartAccountClient<TTransport, TChain, MAV2Account<TSigner>>;\n\nexport type CreateSMAV2AccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = CreateSMAV2AccountParams<TTransport, TSigner> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\nexport type CreateSMAV2AlchemyAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateSMAV2AccountClientParams<TTransport, TChain, TSigner>,\n \"transport\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<TChain, LightAccount<TSigner>>,\n \"account\"\n > & { paymasterAndData?: never; dummyPaymasterAndData?: never };\n\nexport function createSMAV2AccountClient<\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateSMAV2AlchemyAccountClientParams<AlchemyTransport, TChain, TSigner>\n): Promise<SMAV2AccountClient<TSigner, TChain, AlchemyTransport>>;\n\nexport function createSMAV2AccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateSMAV2AccountClientParams<TTransport, TChain, TSigner> &\n NotType<TTransport, AlchemyTransport>\n): Promise<SMAV2AccountClient<TSigner, TChain>>;\n\n/**\n * Creates a SMAv2 account client using the provided configuration parameters.\n *\n * @example\n * ```ts\n * import { http } from \"viem\";\n * import { createSMAV2AccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const MNEMONIC = \"...\";\n * const RPC_URL = \"...\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);\n *\n * const chain = sepolia;\n *\n * const transport = http(RPC_URL);\n *\n * const SMAV2SignerAccountClient = await createSMAV2AccountClient({\n * chain,\n * signer,\n * transport,\n * });\n * ```\n *\n * @param {CreateSMAV2AccountClientParams} config The configuration parameters required to create the MAv2 account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance\n */\nexport async function createSMAV2AccountClient(\n config: CreateSMAV2AccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = config;\n const smaV2Account = await createSMAV2Account({\n ...config,\n transport,\n chain,\n });\n if (isAlchemyTransport(transport, chain)) {\n return createAlchemySmartAccountClient({\n ...config,\n transport,\n chain,\n account: smaV2Account,\n });\n }\n\n return createSmartAccountClient({\n ...config,\n account: smaV2Account,\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { createAlchemySmartAccountClient, } from "@account-kit/infra";
2
- import { accountLoupeActions, createMultiOwnerModularAccount, multiOwnerPluginActions, pluginManagerActions, } from "@account-kit/smart-contracts";
1
+ import {} from "@account-kit/infra";
2
+ import { createMultiOwnerModularAccountClient, } from "@account-kit/smart-contracts";
3
3
  import {} from "viem";
4
4
  /**
5
5
  * Creates a modular account Alchemy client with the provided configuration.
@@ -17,24 +17,11 @@ import {} from "viem";
17
17
  * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
18
18
  * });
19
19
  * ```
20
- *
20
+ * @deprecated Use createModularAccountClient instead of this function, we are switching based on the transport
21
21
  * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client
22
22
  * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions
23
23
  */
24
24
  export async function createModularAccountAlchemyClient(config) {
25
- const { transport, chain, opts } = config;
26
- const account = await createMultiOwnerModularAccount({
27
- ...config,
28
- transport,
29
- chain,
30
- });
31
- return createAlchemySmartAccountClient({
32
- ...config,
33
- account,
34
- opts,
35
- })
36
- .extend(multiOwnerPluginActions)
37
- .extend(pluginManagerActions)
38
- .extend(accountLoupeActions);
25
+ return createMultiOwnerModularAccountClient(config);
39
26
  }
40
27
  //# sourceMappingURL=alchemyClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,GAGhC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAkC,MAAM,MAAM,CAAC;AA2BtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAE1C,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;QACnD,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC;QACrC,GAAG,MAAM;QACT,OAAO;QACP,IAAI;KACL,CAAC;SACC,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n createAlchemySmartAccountClient,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultiOwnerModularAccount,\n multiOwnerPluginActions,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport { type Chain, type HttpTransport } from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { transport, chain, opts } = config;\n\n const account = await createMultiOwnerModularAccount({\n ...config,\n transport,\n chain,\n });\n\n return createAlchemySmartAccountClient({\n ...config,\n account,\n opts,\n })\n .extend(multiOwnerPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
1
+ {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oCAAoC,GAOrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAkC,MAAM,MAAM,CAAC;AA2BtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,OAAO,oCAAoC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerModularAccountClient,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport { type Chain, type HttpTransport } from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n * @deprecated Use createModularAccountClient instead of this function, we are switching based on the transport\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n return createMultiOwnerModularAccountClient(config);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type SmartAccountClient, type SmartAccountClientRpcSchema, type SmartAccountSigner } from "@aa-sdk/core";
1
+ import { type NotType, type SmartAccountClient, type SmartAccountClientRpcSchema, type SmartAccountSigner } from "@aa-sdk/core";
2
2
  import { type Chain, type CustomTransport, type Transport } from "viem";
3
3
  import type { CreateLightAccountClientParams } from "../../light-account/clients/client.js";
4
4
  import { type AccountLoupeActions } from "../account-loupe/decorator.js";
@@ -7,7 +7,16 @@ import { type CreateMultisigModularAccountParams, type MultisigModularAccount }
7
7
  import { type PluginManagerActions } from "../plugin-manager/decorator.js";
8
8
  import { type MultiOwnerPluginActions } from "../plugins/multi-owner/index.js";
9
9
  import { type MultisigPluginActions, type MultisigUserOperationContext } from "../plugins/multisig/index.js";
10
- export type CreateMultiOwnerModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
11
- export type CreateMultisigModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultisigModularAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
12
- export declare function createMultiOwnerModularAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerModularAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
13
- export declare function createMultisigModularAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultisigModularAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, SmartAccountClientRpcSchema, MultisigUserOperationContext>>;
10
+ import type { AlchemyModularAccountClientConfig } from "./alchemyClient.js";
11
+ import { type AlchemySmartAccountClient, type AlchemyTransport } from "@account-kit/infra";
12
+ import type { AlchemyMultisigAccountClientConfig } from "./multiSigAlchemyClient.js";
13
+ export type CreateMultiOwnerModularAccountClientWithoutAlchemyParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
14
+ export type CreateMultiOwnerModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = CreateMultiOwnerModularAccountClientWithoutAlchemyParams<TTransport, TChain, TSigner> | AlchemyModularAccountClientConfig<TSigner>;
15
+ export type CreateMultisigModularAccountClientWithoutAlchemyParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultisigModularAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
16
+ export type CreateMultisigModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = CreateMultisigModularAccountClientWithoutAlchemyParams<TTransport, TChain, TSigner> | AlchemyMultisigAccountClientConfig<TSigner>;
17
+ export declare function createMultiOwnerModularAccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyModularAccountClientConfig<TSigner> & {
18
+ transport: AlchemyTransport;
19
+ }): Promise<AlchemySmartAccountClient<Chain | undefined, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
20
+ export declare function createMultiOwnerModularAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerModularAccountClientParams<TTransport, TChain, TSigner> & NotType<TTransport, AlchemyTransport>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
21
+ export declare function createMultisigModularAccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultisigAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<Chain | undefined, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, MultisigUserOperationContext>>;
22
+ export declare function createMultisigModularAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultisigModularAccountClientParams<TTransport, TChain, TSigner> & NotType<TTransport, AlchemyTransport>): Promise<SmartAccountClient<CustomTransport, Chain, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, SmartAccountClientRpcSchema, MultisigUserOperationContext>>;
@@ -7,6 +7,7 @@ import { pluginManagerActions, } from "../plugin-manager/decorator.js";
7
7
  import { multiOwnerPluginActions, } from "../plugins/multi-owner/index.js";
8
8
  import { multisigPluginActions, } from "../plugins/multisig/index.js";
9
9
  import { multisigSignatureMiddleware } from "../plugins/multisig/middleware.js";
10
+ import { createAlchemySmartAccountClient, isAlchemyTransport, } from "@account-kit/infra";
10
11
  /**
11
12
  * Creates a multi-owner modular account client with the provided parameters including account, transport, chain, and additional client configuration. This function uses a modular account and extends it with various plugin actions.
12
13
  *
@@ -24,6 +25,19 @@ import { multisigSignatureMiddleware } from "../plugins/multisig/middleware.js";
24
25
  * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
25
26
  * });
26
27
  * ```
28
+ * @example
29
+ * ```ts
30
+ * import { createMultiOwnerModularAccountClient } from "@account-kit/smart-contracts";
31
+ * import { sepolia, alchemy } from "@account-kit/infra";
32
+ * import { LocalAccountSigner } from "@aa-sdk/core";
33
+ * import { generatePrivateKey } from "viem"
34
+ *
35
+ * const alchemyAccountClient = await createMultiOwnerModularAccountClient({
36
+ * transport: alchemy({ apiKey: "your-api-key" }),
37
+ * chain: sepolia,
38
+ * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
39
+ * });
40
+ * ```
27
41
  *
28
42
  * @param {CreateMultiOwnerModularAccountClientParams} config The parameters for creating the multi-owner modular account client
29
43
  * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance with extended plugin actions
@@ -34,6 +48,19 @@ export async function createMultiOwnerModularAccountClient({ transport, chain, .
34
48
  transport,
35
49
  chain,
36
50
  });
51
+ if (isAlchemyTransport(transport, chain)) {
52
+ const { opts } = params;
53
+ return createAlchemySmartAccountClient({
54
+ ...params,
55
+ account: modularAccount,
56
+ transport,
57
+ chain,
58
+ opts,
59
+ })
60
+ .extend(multiOwnerPluginActions)
61
+ .extend(pluginManagerActions)
62
+ .extend(accountLoupeActions);
63
+ }
37
64
  return createSmartAccountClient({
38
65
  ...params,
39
66
  transport,
@@ -63,6 +90,21 @@ export async function createMultiOwnerModularAccountClient({ transport, chain, .
63
90
  * threshold: 2, // 2 of N signatures
64
91
  * });
65
92
  * ```
93
+ * @example
94
+ * ```ts
95
+ * import { createMultisigModularAccountClient } from "@account-kit/smart-contracts";
96
+ * import { sepolia } from "@account-kit/infra";
97
+ * import { LocalAccountSigner } from "@aa-sdk/core";
98
+ * import { generatePrivateKey } from "viem"
99
+ *
100
+ * const alchemyAccountClient = await createMultisigModularAccountClient({
101
+ * transport: alchemy({ apiKey: "your-api-key" }),
102
+ * chain: sepolia,
103
+ * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
104
+ * owners: [...], // other owners on the account
105
+ * threshold: 2, // 2 of N signatures
106
+ * });
107
+ * ```
66
108
  *
67
109
  * @param {CreateMultisigModularAccountClientParams} config the parameters for configuring the multisig modular account client
68
110
  * @returns {Promise<SmartAccountClient<Transport, Chain, MultisigModularAccount<SmartAccountSigner>, {}, SmartAccountClientRpcSchema, MultisigUserOperationContext>>} a promise that resolves to a `SmartAccountClient` object extended with the multisig modular account and additional actions
@@ -73,6 +115,26 @@ export async function createMultisigModularAccountClient({ transport, chain, ...
73
115
  transport,
74
116
  chain,
75
117
  });
118
+ if (isAlchemyTransport(transport, chain)) {
119
+ // Need to fit the type into this since the previous multiSigAlchemyClient had it at this point, but without an Value as Type should be safe
120
+ // And the createAlchemySmartAccountClient signUserOperation could not infer without this
121
+ let config = {
122
+ ...params,
123
+ chain,
124
+ transport,
125
+ };
126
+ const { opts } = config;
127
+ return createAlchemySmartAccountClient({
128
+ ...config,
129
+ account: modularAccount,
130
+ opts,
131
+ signUserOperation: multisigSignatureMiddleware,
132
+ })
133
+ .extend(smartAccountClientActions)
134
+ .extend(multisigPluginActions)
135
+ .extend(pluginManagerActions)
136
+ .extend(accountLoupeActions);
137
+ }
76
138
  const client = createSmartAccountClient({
77
139
  ...params,
78
140
  transport,