@aa-sdk/core 4.52.2 → 4.52.3

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.
@@ -69,7 +69,8 @@ export function createSmartAccountClient(config) {
69
69
  throw new AccountNotFoundError();
70
70
  }
71
71
  const [address, data] = params;
72
- if (address?.toLowerCase() !== client.account.address.toLowerCase()) {
72
+ if (address?.toLowerCase() !==
73
+ client.account.address.toLowerCase()) {
73
74
  throw new Error("cannot sign for address that is not the current account");
74
75
  }
75
76
  return client.signMessage({
@@ -81,7 +82,8 @@ export function createSmartAccountClient(config) {
81
82
  throw new AccountNotFoundError();
82
83
  }
83
84
  const [data, address] = params;
84
- if (address?.toLowerCase() !== client.account.address.toLowerCase()) {
85
+ if (address?.toLowerCase() !==
86
+ client.account.address.toLowerCase()) {
85
87
  throw new Error("cannot sign for address that is not the current account");
86
88
  }
87
89
  return client.signMessage({
@@ -94,7 +96,8 @@ export function createSmartAccountClient(config) {
94
96
  throw new AccountNotFoundError();
95
97
  }
96
98
  const [address, dataParams] = params;
97
- if (address?.toLowerCase() !== client.account.address.toLowerCase()) {
99
+ if (address?.toLowerCase() !==
100
+ client.account.address.toLowerCase()) {
98
101
  throw new Error("cannot sign for address that is not the current account");
99
102
  }
100
103
  try {
@@ -117,10 +120,16 @@ export function createSmartAccountClient(config) {
117
120
  default:
118
121
  // TODO: there's probably a number of methods we just don't support, will need to test most of them out
119
122
  // first let's get something working though
120
- return rpcTransport.request({ method, params });
123
+ return rpcTransport.request({ method, params },
124
+ // Retry count must be 0 here in order to respect the retry
125
+ // count that is already specified on the underlying transport.
126
+ { retryCount: 0 });
121
127
  }
122
128
  },
123
- })(opts);
129
+ },
130
+ // Retry count must be 0 here in order to respect the retry
131
+ // count that is already specified on the underlying transport.
132
+ { retryCount: 0 })(opts);
124
133
  },
125
134
  })
126
135
  .extend(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/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OAAO,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;oBACpD,CAAC;gBACH,CAAC;aACF,CAAC,CAAC,IAAI,CAAC,CAAC;QACX,CAAC;KACF,CAAC;SACC,MAAM,CAAC,GAAG,EAAE;QACX,MAAM,cAAc,GAAG,aAAa;YAClC,CAAC,CAAC;gBACE,CAAC,cAAc,CAAC,EAAE,aAAa;aAChC;YACH,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,GAAG,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACxD,GAAG,cAAc;SAClB,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;SACjC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAErC,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAEC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\nimport { ADD_BREADCRUMB } from \"./addBreadcrumb.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n /**\n * A function that adds a breadcrumb to the current context\n * Note, most implementations will override the client with the default alchemy transport and this\n * leads to the fact that a transport could be overwritten and not known until later.\n *\n * @param crumb A crumb, or span is telling that we are in a next step part of a multi step action\n * @returns\n */\n addBreadCrumb?: <T>(crumb: string) => T;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema,\n];\n\n// [!region SmartAccountClientActions]\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n// [!endregion SmartAccountClientActions]\n\n// [!region SmartAccountClient]\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n// [!endregion SmartAccountClient]\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\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 config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>,\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig,\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n addBreadCrumb,\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom({\n name: \"SmartAccountClientTransport\",\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (\n address?.toLowerCase() !== client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (\n address?.toLowerCase() !== client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (\n address?.toLowerCase() !== client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n try {\n return client.signTypedData({\n account: client.account,\n typedData:\n typeof dataParams === \"string\"\n ? JSON.parse(dataParams)\n : dataParams,\n });\n } catch {\n throw new Error(\"invalid JSON data params\");\n }\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n })(opts);\n },\n })\n .extend(() => {\n const addBreadCrumbs = addBreadCrumb\n ? {\n [ADD_BREADCRUMB]: addBreadCrumb,\n }\n : {};\n return {\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n ...addBreadCrumbs,\n };\n })\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient },\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n },\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
1
+ {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAUP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAoHpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,MAAM,EACJ,GAAG,GAAG,SAAS,EACf,IAAI,GAAG,kBAAkB,EACzB,SAAS,EACT,IAAI,GAAG,oBAAoB,EAC3B,aAAa,EACb,GAAG,MAAM,EACV,GAAG,MAAM,CAAC;IAEX,MAAM,MAAM,GAAuB,mBAAmB,CAAC;QACrD,GAAG,MAAM;QACT,GAAG;QACH,IAAI;QACJ,2EAA2E;QAC3E,iFAAiF;QACjF,wEAAwE;QACxE,IAAI,EAAE,oBAAoB;QAC1B,gCAAgC;QAChC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAClB,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAErC,OAAO,MAAM,CACX;gBACE,IAAI,EAAE,6BAA6B;gBACnC,KAAK,CAAC,OAAO,CAA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AkB,EAAE,CAAC;4BACjC,CAAC;4BAED,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;wBACvB;4BACE,uGAAuG;4BACvG,2CAA2C;4BAC3C,OAAO,YAAY,CAAC,OAAO,CACzB,EAAE,MAAM,EAAE,MAAM,EAAE;4BAClB,2DAA2D;4BAC3D,+DAA+D;4BAC/D,EAAE,UAAU,EAAE,CAAC,EAAE,CAClB,CAAC;oBACN,CAAC;gBACH,CAAC;aACF;YACD,2DAA2D;YAC3D,+DAA+D;YAC/D,EAAE,UAAU,EAAE,CAAC,EAAE,CAClB,CAAC,IAAI,CAAC,CAAC;QACV,CAAC;KACF,CAAC;SACC,MAAM,CAAC,GAAG,EAAE;QACX,MAAM,cAAc,GAAG,aAAa;YAClC,CAAC,CAAC;gBACE,CAAC,cAAc,CAAC,EAAE,aAAa;aAChC;YACH,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,GAAG,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACxD,GAAG,cAAc;SAClB,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;SACjC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAErC,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAEC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\nimport { ADD_BREADCRUMB } from \"./addBreadcrumb.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n /**\n * A function that adds a breadcrumb to the current context\n * Note, most implementations will override the client with the default alchemy transport and this\n * leads to the fact that a transport could be overwritten and not known until later.\n *\n * @param crumb A crumb, or span is telling that we are in a next step part of a multi step action\n * @returns\n */\n addBreadCrumb?: <T>(crumb: string) => T;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema,\n];\n\n// [!region SmartAccountClientActions]\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n// [!endregion SmartAccountClientActions]\n\n// [!region SmartAccountClient]\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n// [!endregion SmartAccountClient]\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\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 config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>,\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig,\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n addBreadCrumb,\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom(\n {\n name: \"SmartAccountClientTransport\",\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n try {\n return client.signTypedData({\n account: client.account,\n typedData:\n typeof dataParams === \"string\"\n ? JSON.parse(dataParams)\n : dataParams,\n });\n } catch {\n throw new Error(\"invalid JSON data params\");\n }\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request(\n { method, params },\n // Retry count must be 0 here in order to respect the retry\n // count that is already specified on the underlying transport.\n { retryCount: 0 },\n );\n }\n },\n },\n // Retry count must be 0 here in order to respect the retry\n // count that is already specified on the underlying transport.\n { retryCount: 0 },\n )(opts);\n },\n })\n .extend(() => {\n const addBreadCrumbs = addBreadCrumb\n ? {\n [ADD_BREADCRUMB]: addBreadCrumb,\n }\n : {};\n return {\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n ...addBreadCrumbs,\n };\n })\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient },\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n },\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.52.2";
1
+ export declare const VERSION = "4.52.3";
@@ -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.52.2";
3
+ export const VERSION = "4.52.3";
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,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.52.2\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.52.3\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.d.ts","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[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AAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,GACvE,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AA4KpD,wBAAgB,oCAAoC,CAClD,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,OAAO,SAAS,aAAa,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EACrE,QAAQ,SAAS,yBAAyB,CACxC,MAAM,EACN,QAAQ,EACR,QAAQ,CACT,GAAG,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/C,UAAU,SAAS,2BAA2B,GAAG,2BAA2B,EAC5E,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,IAAI,CACV,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAC/D,WAAW,GAAG,OAAO,CACtB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACtB,kBAAkB,CACnB,eAAe,EACf,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,CACT,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.52.2";
1
+ export declare const VERSION = "4.52.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aa-sdk/core",
3
3
  "license": "MIT",
4
- "version": "4.52.2",
4
+ "version": "4.52.3",
5
5
  "description": "viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts",
6
6
  "author": "Alchemy",
7
7
  "type": "module",
@@ -62,5 +62,5 @@
62
62
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
63
63
  },
64
64
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
65
- "gitHead": "50a4668dbfd90783fb5f546132bf7f114b680580"
65
+ "gitHead": "13beb4de74788c17162a6c18e122ba8a2dd0495c"
66
66
  }
@@ -189,100 +189,113 @@ export function createSmartAccountClient(
189
189
  transport: (opts) => {
190
190
  const rpcTransport = transport(opts);
191
191
 
192
- return custom({
193
- name: "SmartAccountClientTransport",
194
- async request({ method, params }) {
195
- switch (method) {
196
- case "eth_accounts": {
197
- if (!client.account) {
198
- throw new AccountNotFoundError();
199
- }
192
+ return custom(
193
+ {
194
+ name: "SmartAccountClientTransport",
195
+ async request({ method, params }) {
196
+ switch (method) {
197
+ case "eth_accounts": {
198
+ if (!client.account) {
199
+ throw new AccountNotFoundError();
200
+ }
200
201
 
201
- return [client.account.address];
202
- }
203
- case "eth_sendTransaction":
204
- if (!client.account) {
205
- throw new AccountNotFoundError();
206
- }
207
- if (!client.chain) {
208
- throw new ChainNotFoundError();
209
- }
210
- const [tx] = params as [FormattedTransactionRequest];
211
- return client.sendTransaction({
212
- ...tx,
213
- account: client.account,
214
- chain: client.chain,
215
- });
216
- case "eth_sign":
217
- if (!client.account) {
218
- throw new AccountNotFoundError();
219
- }
220
- const [address, data] = params!;
221
- if (
222
- address?.toLowerCase() !== client.account.address.toLowerCase()
223
- ) {
224
- throw new Error(
225
- "cannot sign for address that is not the current account",
226
- );
227
- }
228
- return client.signMessage({
229
- message: data,
230
- account: client.account,
231
- });
232
- case "personal_sign": {
233
- if (!client.account) {
234
- throw new AccountNotFoundError();
235
- }
236
- const [data, address] = params!;
237
- if (
238
- address?.toLowerCase() !== client.account.address.toLowerCase()
239
- ) {
240
- throw new Error(
241
- "cannot sign for address that is not the current account",
242
- );
243
- }
244
- return client.signMessage({
245
- message: data,
246
- account: client.account,
247
- });
248
- }
249
- case "eth_signTypedData_v4": {
250
- if (!client.account) {
251
- throw new AccountNotFoundError();
202
+ return [client.account.address];
252
203
  }
253
- const [address, dataParams] = params!;
254
- if (
255
- address?.toLowerCase() !== client.account.address.toLowerCase()
256
- ) {
257
- throw new Error(
258
- "cannot sign for address that is not the current account",
259
- );
260
- }
261
- try {
262
- return client.signTypedData({
204
+ case "eth_sendTransaction":
205
+ if (!client.account) {
206
+ throw new AccountNotFoundError();
207
+ }
208
+ if (!client.chain) {
209
+ throw new ChainNotFoundError();
210
+ }
211
+ const [tx] = params as [FormattedTransactionRequest];
212
+ return client.sendTransaction({
213
+ ...tx,
214
+ account: client.account,
215
+ chain: client.chain,
216
+ });
217
+ case "eth_sign":
218
+ if (!client.account) {
219
+ throw new AccountNotFoundError();
220
+ }
221
+ const [address, data] = params!;
222
+ if (
223
+ address?.toLowerCase() !==
224
+ client.account.address.toLowerCase()
225
+ ) {
226
+ throw new Error(
227
+ "cannot sign for address that is not the current account",
228
+ );
229
+ }
230
+ return client.signMessage({
231
+ message: data,
232
+ account: client.account,
233
+ });
234
+ case "personal_sign": {
235
+ if (!client.account) {
236
+ throw new AccountNotFoundError();
237
+ }
238
+ const [data, address] = params!;
239
+ if (
240
+ address?.toLowerCase() !==
241
+ client.account.address.toLowerCase()
242
+ ) {
243
+ throw new Error(
244
+ "cannot sign for address that is not the current account",
245
+ );
246
+ }
247
+ return client.signMessage({
248
+ message: data,
263
249
  account: client.account,
264
- typedData:
265
- typeof dataParams === "string"
266
- ? JSON.parse(dataParams)
267
- : dataParams,
268
250
  });
269
- } catch {
270
- throw new Error("invalid JSON data params");
271
251
  }
272
- }
273
- case "eth_chainId":
274
- if (!opts.chain) {
275
- throw new ChainNotFoundError();
252
+ case "eth_signTypedData_v4": {
253
+ if (!client.account) {
254
+ throw new AccountNotFoundError();
255
+ }
256
+ const [address, dataParams] = params!;
257
+ if (
258
+ address?.toLowerCase() !==
259
+ client.account.address.toLowerCase()
260
+ ) {
261
+ throw new Error(
262
+ "cannot sign for address that is not the current account",
263
+ );
264
+ }
265
+ try {
266
+ return client.signTypedData({
267
+ account: client.account,
268
+ typedData:
269
+ typeof dataParams === "string"
270
+ ? JSON.parse(dataParams)
271
+ : dataParams,
272
+ });
273
+ } catch {
274
+ throw new Error("invalid JSON data params");
275
+ }
276
276
  }
277
+ case "eth_chainId":
278
+ if (!opts.chain) {
279
+ throw new ChainNotFoundError();
280
+ }
277
281
 
278
- return opts.chain.id;
279
- default:
280
- // TODO: there's probably a number of methods we just don't support, will need to test most of them out
281
- // first let's get something working though
282
- return rpcTransport.request({ method, params });
283
- }
282
+ return opts.chain.id;
283
+ default:
284
+ // TODO: there's probably a number of methods we just don't support, will need to test most of them out
285
+ // first let's get something working though
286
+ return rpcTransport.request(
287
+ { method, params },
288
+ // Retry count must be 0 here in order to respect the retry
289
+ // count that is already specified on the underlying transport.
290
+ { retryCount: 0 },
291
+ );
292
+ }
293
+ },
284
294
  },
285
- })(opts);
295
+ // Retry count must be 0 here in order to respect the retry
296
+ // count that is already specified on the underlying transport.
297
+ { retryCount: 0 },
298
+ )(opts);
286
299
  },
287
300
  })
288
301
  .extend(() => {
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.52.2";
3
+ export const VERSION = "4.52.3";