@account-kit/infra 4.0.0-beta.9 → 4.0.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.
@@ -1,8 +1,11 @@
1
- import type { SendUserOperationParameters, SmartContractAccount, UserOperationContext } from "@aa-sdk/core";
2
- import type { Chain, Client, Transport } from "viem";
1
+ import { type GetEntryPointFromAccount, type SendTransactionsParameters, type SendUserOperationParameters, type SendUserOperationResult, type SmartContractAccount, type UserOperationContext, type UserOperationOverrides } from "@aa-sdk/core";
2
+ import type { Chain, Client, Hex, SendTransactionParameters, Transport } from "viem";
3
3
  import type { SimulateUserOperationAssetChangesResponse } from "../../actions/types.js";
4
- export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = {
4
+ export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TChain extends Chain | undefined = Chain | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
5
5
  simulateUserOperation: (args: SendUserOperationParameters<TAccount, TContext>) => Promise<SimulateUserOperationAssetChangesResponse>;
6
+ sendUserOperation: (args: SendUserOperationParameters<TAccount, TContext, GetEntryPointFromAccount<TAccount>>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
7
+ sendTransaction: <TChainOverride extends Chain | undefined = undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<Hex>;
8
+ sendTransactions: (args: SendTransactionsParameters<TAccount, TContext>) => Promise<Hex>;
6
9
  };
7
10
  /**
8
11
  * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.
@@ -19,4 +22,4 @@ export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccou
19
22
  * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions
20
23
  * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions
21
24
  */
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>;
25
+ 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, TChain>;
@@ -1,4 +1,6 @@
1
+ import { isSmartAccountWithSigner, sendTransaction, sendTransactions, sendUserOperation, } from "@aa-sdk/core";
1
2
  import { simulateUserOperationChanges } from "../../actions/simulateUserOperationChanges.js";
3
+ import { InfraLogger } from "../../metrics.js";
2
4
  /**
3
5
  * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.
4
6
  *
@@ -16,5 +18,36 @@ import { simulateUserOperationChanges } from "../../actions/simulateUserOperatio
16
18
  */
17
19
  export const alchemyActions = (client) => ({
18
20
  simulateUserOperation: async (args) => simulateUserOperationChanges(client, args),
21
+ sendUserOperation: async (args) => {
22
+ const { account = client.account } = args;
23
+ const result = sendUserOperation(client, args);
24
+ logSendUoEvent(client.chain.id, account);
25
+ return result;
26
+ },
27
+ sendTransaction: async (args, overrides, context) => {
28
+ const { account = client.account } = args;
29
+ const result = await sendTransaction(client, args, overrides, context);
30
+ logSendUoEvent(client.chain.id, account);
31
+ return result;
32
+ },
33
+ async sendTransactions(args) {
34
+ const { account = client.account } = args;
35
+ const result = sendTransactions(client, args);
36
+ logSendUoEvent(client.chain.id, account);
37
+ return result;
38
+ },
19
39
  });
40
+ function logSendUoEvent(chainId, account) {
41
+ const signerType = isSmartAccountWithSigner(account)
42
+ ? account.getSigner().signerType
43
+ : "unknown";
44
+ InfraLogger.trackEvent({
45
+ name: "client_send_uo",
46
+ data: {
47
+ chainId,
48
+ signerType: signerType,
49
+ entryPoint: account.getEntryPoint().address,
50
+ },
51
+ });
52
+ }
20
53
  //# sourceMappingURL=smartAccount.js.map
@@ -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;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"]}
1
+ {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAQlB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgC/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAWyC,CAClE,MAAM,EACN,EAAE,CAAC,CAAC;IACJ,qBAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACpC,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC;IAC5C,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAChC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;QAE1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/C,cAAc,CAAC,MAAM,CAAC,KAAM,CAAC,EAAE,EAAE,OAAQ,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QAClD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;QAE1C,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACvE,cAAc,CAAC,MAAM,CAAC,KAAM,CAAC,EAAE,EAAE,OAA+B,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,IAAI;QACzB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;QAE1C,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9C,cAAc,CAAC,MAAM,CAAC,KAAM,CAAC,EAAE,EAAE,OAAQ,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,OAAe,EAAE,OAA6B;IACpE,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC;QAClD,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU;QAChC,CAAC,CAAC,SAAS,CAAC;IAEd,WAAW,CAAC,UAAU,CAAC;QACrB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE;YACJ,OAAO;YACP,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO;SAC5C;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n isSmartAccountWithSigner,\n sendTransaction,\n sendTransactions,\n sendUserOperation,\n type GetEntryPointFromAccount,\n type SendTransactionsParameters,\n type SendUserOperationParameters,\n type SendUserOperationResult,\n type SmartContractAccount,\n type UserOperationContext,\n type UserOperationOverrides,\n} from \"@aa-sdk/core\";\nimport type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport { simulateUserOperationChanges } from \"../../actions/simulateUserOperationChanges.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"../../actions/types.js\";\nimport { InfraLogger } from \"../../metrics.js\";\n\nexport type AlchemySmartAccountClientActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TChain extends Chain | undefined = Chain | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n simulateUserOperation: (\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<SimulateUserOperationAssetChangesResponse>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>\n ) => Promise<Hex>;\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, TChain> = (\n client\n) => ({\n simulateUserOperation: async (args) =>\n simulateUserOperationChanges(client, args),\n sendUserOperation: async (args) => {\n const { account = client.account } = args;\n\n const result = sendUserOperation(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n sendTransaction: async (args, overrides, context) => {\n const { account = client.account } = args;\n\n const result = await sendTransaction(client, args, overrides, context);\n logSendUoEvent(client.chain!.id, account as SmartContractAccount);\n return result;\n },\n async sendTransactions(args) {\n const { account = client.account } = args;\n\n const result = sendTransactions(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n});\n\nfunction logSendUoEvent(chainId: number, account: SmartContractAccount) {\n const signerType = isSmartAccountWithSigner(account)\n ? account.getSigner().signerType\n : \"unknown\";\n\n InfraLogger.trackEvent({\n name: \"client_send_uo\",\n data: {\n chainId,\n signerType: signerType,\n entryPoint: account.getEntryPoint().address,\n },\n });\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { Address } from "viem";
2
+ export type InfraEventsSchema = [
3
+ {
4
+ EventName: "client_send_uo";
5
+ EventData: {
6
+ signerType: string;
7
+ chainId: number;
8
+ entryPoint: Address;
9
+ };
10
+ }
11
+ ];
12
+ export declare const InfraLogger: import("@account-kit/logging").EventLogger<InfraEventsSchema>;
@@ -0,0 +1,7 @@
1
+ import { createLogger } from "@account-kit/logging";
2
+ import { VERSION } from "./version.js";
3
+ export const InfraLogger = createLogger({
4
+ package: "@account-kit/infra",
5
+ version: VERSION,
6
+ });
7
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAavC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAoB;IACzD,OAAO,EAAE,oBAAoB;IAC7B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC","sourcesContent":["import { createLogger } from \"@account-kit/logging\";\nimport type { Address } from \"viem\";\nimport { VERSION } from \"./version.js\";\n\nexport type InfraEventsSchema = [\n {\n EventName: \"client_send_uo\";\n EventData: {\n signerType: string;\n chainId: number;\n entryPoint: Address;\n };\n }\n];\n\nexport const InfraLogger = createLogger<InfraEventsSchema>({\n package: \"@account-kit/infra\",\n version: VERSION,\n});\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-beta.9";
1
+ export declare const VERSION = "4.0.0";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.0.0-beta.9";
3
+ export const VERSION = "4.0.0";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-beta.9\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0\";\n"]}
@@ -1,8 +1,11 @@
1
- import type { SendUserOperationParameters, SmartContractAccount, UserOperationContext } from "@aa-sdk/core";
2
- import type { Chain, Client, Transport } from "viem";
1
+ import { type GetEntryPointFromAccount, type SendTransactionsParameters, type SendUserOperationParameters, type SendUserOperationResult, type SmartContractAccount, type UserOperationContext, type UserOperationOverrides } from "@aa-sdk/core";
2
+ import type { Chain, Client, Hex, SendTransactionParameters, Transport } from "viem";
3
3
  import type { SimulateUserOperationAssetChangesResponse } from "../../actions/types.js";
4
- export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = {
4
+ export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TChain extends Chain | undefined = Chain | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
5
5
  simulateUserOperation: (args: SendUserOperationParameters<TAccount, TContext>) => Promise<SimulateUserOperationAssetChangesResponse>;
6
+ sendUserOperation: (args: SendUserOperationParameters<TAccount, TContext, GetEntryPointFromAccount<TAccount>>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
7
+ sendTransaction: <TChainOverride extends Chain | undefined = undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<Hex>;
8
+ sendTransactions: (args: SendTransactionsParameters<TAccount, TContext>) => Promise<Hex>;
6
9
  };
7
10
  /**
8
11
  * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.
@@ -19,5 +22,5 @@ export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccou
19
22
  * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions
20
23
  * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions
21
24
  */
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>;
25
+ 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, TChain>;
23
26
  //# sourceMappingURL=smartAccount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAErD,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,wBAAwB,CAAC;AAExF,MAAM,MAAM,gCAAgC,CAC1C,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,IACX;IACF,qBAAqB,EAAE,CACrB,IAAI,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAClD,OAAO,CAAC,yCAAyC,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,CAC3B,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,KACzC,gCAAgC,CAAC,QAAQ,EAAE,QAAQ,CAGtD,CAAC"}
1
+ {"version":3,"file":"smartAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACN,GAAG,EACH,yBAAyB,EACzB,SAAS,EACV,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,wBAAwB,CAAC;AAGxF,MAAM,MAAM,gCAAgC,CAC1C,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,kBAAkB,SAAS,wBAAwB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,IAChG;IACF,qBAAqB,EAAE,CACrB,IAAI,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAClD,OAAO,CAAC,yCAAyC,CAAC,CAAC;IACxD,iBAAiB,EAAE,CACjB,IAAI,EAAE,2BAA2B,CAC/B,QAAQ,EACR,QAAQ,EACR,wBAAwB,CAAC,QAAQ,CAAC,CACnC,KACE,OAAO,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC1D,eAAe,EAAE,CAAC,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACpE,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,EACjE,SAAS,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,EACtD,OAAO,CAAC,EAAE,QAAQ,KACf,OAAO,CAAC,GAAG,CAAC,CAAC;IAClB,gBAAgB,EAAE,CAChB,IAAI,EAAE,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,KACjD,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,CAC3B,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,KACzC,gCAAgC,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CA0B9D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Address } from "viem";
2
+ export type InfraEventsSchema = [
3
+ {
4
+ EventName: "client_send_uo";
5
+ EventData: {
6
+ signerType: string;
7
+ chainId: number;
8
+ entryPoint: Address;
9
+ };
10
+ }
11
+ ];
12
+ export declare const InfraLogger: import("@account-kit/logging").EventLogger<InfraEventsSchema>;
13
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,MAAM,MAAM,iBAAiB,GAAG;IAC9B;QACE,SAAS,EAAE,gBAAgB,CAAC;QAC5B,SAAS,EAAE;YACT,UAAU,EAAE,MAAM,CAAC;YACnB,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,EAAE,OAAO,CAAC;SACrB,CAAC;KACH;CACF,CAAC;AAEF,eAAO,MAAM,WAAW,+DAGtB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.0.0-beta.9";
1
+ export declare const VERSION = "4.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/infra",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0",
4
4
  "description": "adapters for @aa-sdk/core for interacting with alchemy services",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -36,8 +36,7 @@
36
36
  "docs:gen": "npx ak-docgen generate --in ./src/index.ts --out ../../site/pages/reference/account-kit/infra",
37
37
  "clean": "rm -rf ./dist",
38
38
  "test": "vitest",
39
- "test:run": "vitest run",
40
- "test:run-e2e": "vitest run --config vitest.config.e2e.ts"
39
+ "test:run": "vitest run"
41
40
  },
42
41
  "devDependencies": {
43
42
  "typescript": "^5.0.4",
@@ -45,7 +44,8 @@
45
44
  "vitest": "^2.0.4"
46
45
  },
47
46
  "dependencies": {
48
- "@aa-sdk/core": "^4.0.0-beta.9",
47
+ "@aa-sdk/core": "^4.0.0",
48
+ "@account-kit/logging": "^4.0.0",
49
49
  "eventemitter3": "^5.0.1",
50
50
  "zod": "^3.22.4"
51
51
  },
@@ -64,7 +64,7 @@
64
64
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
65
65
  },
66
66
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
67
- "gitHead": "6c5f0ff3863587178909a4df689df3d8379b1851",
67
+ "gitHead": "f3489aa0739d3ff497c3fc1194c96778a1adfbad",
68
68
  "optionalDependencies": {
69
69
  "alchemy-sdk": "^3.0.0"
70
70
  }
@@ -1,11 +1,26 @@
1
- import type {
2
- SendUserOperationParameters,
3
- SmartContractAccount,
4
- UserOperationContext,
1
+ import {
2
+ isSmartAccountWithSigner,
3
+ sendTransaction,
4
+ sendTransactions,
5
+ sendUserOperation,
6
+ type GetEntryPointFromAccount,
7
+ type SendTransactionsParameters,
8
+ type SendUserOperationParameters,
9
+ type SendUserOperationResult,
10
+ type SmartContractAccount,
11
+ type UserOperationContext,
12
+ type UserOperationOverrides,
5
13
  } from "@aa-sdk/core";
6
- import type { Chain, Client, Transport } from "viem";
14
+ import type {
15
+ Chain,
16
+ Client,
17
+ Hex,
18
+ SendTransactionParameters,
19
+ Transport,
20
+ } from "viem";
7
21
  import { simulateUserOperationChanges } from "../../actions/simulateUserOperationChanges.js";
8
22
  import type { SimulateUserOperationAssetChangesResponse } from "../../actions/types.js";
23
+ import { InfraLogger } from "../../metrics.js";
9
24
 
10
25
  export type AlchemySmartAccountClientActions<
11
26
  TAccount extends SmartContractAccount | undefined =
@@ -13,11 +28,28 @@ export type AlchemySmartAccountClientActions<
13
28
  | undefined,
14
29
  TContext extends UserOperationContext | undefined =
15
30
  | UserOperationContext
16
- | undefined
31
+ | undefined,
32
+ TChain extends Chain | undefined = Chain | undefined,
33
+ TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>
17
34
  > = {
18
35
  simulateUserOperation: (
19
36
  args: SendUserOperationParameters<TAccount, TContext>
20
37
  ) => Promise<SimulateUserOperationAssetChangesResponse>;
38
+ sendUserOperation: (
39
+ args: SendUserOperationParameters<
40
+ TAccount,
41
+ TContext,
42
+ GetEntryPointFromAccount<TAccount>
43
+ >
44
+ ) => Promise<SendUserOperationResult<TEntryPointVersion>>;
45
+ sendTransaction: <TChainOverride extends Chain | undefined = undefined>(
46
+ args: SendTransactionParameters<TChain, TAccount, TChainOverride>,
47
+ overrides?: UserOperationOverrides<TEntryPointVersion>,
48
+ context?: TContext
49
+ ) => Promise<Hex>;
50
+ sendTransactions: (
51
+ args: SendTransactionsParameters<TAccount, TContext>
52
+ ) => Promise<Hex>;
21
53
  };
22
54
 
23
55
  /**
@@ -46,7 +78,45 @@ export const alchemyActions: <
46
78
  | undefined
47
79
  >(
48
80
  client: Client<TTransport, TChain, TAccount>
49
- ) => AlchemySmartAccountClientActions<TAccount, TContext> = (client) => ({
81
+ ) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (
82
+ client
83
+ ) => ({
50
84
  simulateUserOperation: async (args) =>
51
85
  simulateUserOperationChanges(client, args),
86
+ sendUserOperation: async (args) => {
87
+ const { account = client.account } = args;
88
+
89
+ const result = sendUserOperation(client, args);
90
+ logSendUoEvent(client.chain!.id, account!);
91
+ return result;
92
+ },
93
+ sendTransaction: async (args, overrides, context) => {
94
+ const { account = client.account } = args;
95
+
96
+ const result = await sendTransaction(client, args, overrides, context);
97
+ logSendUoEvent(client.chain!.id, account as SmartContractAccount);
98
+ return result;
99
+ },
100
+ async sendTransactions(args) {
101
+ const { account = client.account } = args;
102
+
103
+ const result = sendTransactions(client, args);
104
+ logSendUoEvent(client.chain!.id, account!);
105
+ return result;
106
+ },
52
107
  });
108
+
109
+ function logSendUoEvent(chainId: number, account: SmartContractAccount) {
110
+ const signerType = isSmartAccountWithSigner(account)
111
+ ? account.getSigner().signerType
112
+ : "unknown";
113
+
114
+ InfraLogger.trackEvent({
115
+ name: "client_send_uo",
116
+ data: {
117
+ chainId,
118
+ signerType: signerType,
119
+ entryPoint: account.getEntryPoint().address,
120
+ },
121
+ });
122
+ }
package/src/metrics.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { createLogger } from "@account-kit/logging";
2
+ import type { Address } from "viem";
3
+ import { VERSION } from "./version.js";
4
+
5
+ export type InfraEventsSchema = [
6
+ {
7
+ EventName: "client_send_uo";
8
+ EventData: {
9
+ signerType: string;
10
+ chainId: number;
11
+ entryPoint: Address;
12
+ };
13
+ }
14
+ ];
15
+
16
+ export const InfraLogger = createLogger<InfraEventsSchema>({
17
+ package: "@account-kit/infra",
18
+ version: VERSION,
19
+ });
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.0.0-beta.8";
3
+ export const VERSION = "4.0.0-beta.10";