@aa-sdk/core 4.31.1 → 4.32.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.
- package/dist/esm/client/schema.d.ts +8 -2
- package/dist/esm/client/schema.js +5 -2
- package/dist/esm/client/schema.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js +3 -1
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +4 -4
- package/dist/esm/signer/local-account.js +4 -4
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/client/schema.d.ts +8 -2
- package/dist/types/client/schema.d.ts.map +1 -1
- package/dist/types/client/smartAccountClient.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +4 -4
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -3
- package/src/client/schema.ts +27 -21
- package/src/client/smartAccountClient.ts +4 -1
- package/src/signer/local-account.ts +4 -4
- package/src/version.ts +1 -1
|
@@ -2,7 +2,7 @@ import type { Transport } from "viem";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { BundlerClient } from "./bundlerClient.js";
|
|
4
4
|
export declare const createPublicErc4337ClientSchema: <TTransport extends Transport = Transport>() => z.ZodType<BundlerClient<TTransport>, z.ZodTypeDef, BundlerClient<TTransport>>;
|
|
5
|
-
export declare const ConnectionConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
5
|
+
export declare const ConnectionConfigSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
6
6
|
rpcUrl: z.ZodOptional<z.ZodNever>;
|
|
7
7
|
apiKey: z.ZodString;
|
|
8
8
|
jwt: z.ZodOptional<z.ZodNever>;
|
|
@@ -50,7 +50,13 @@ export declare const ConnectionConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
50
50
|
rpcUrl: string;
|
|
51
51
|
jwt: string;
|
|
52
52
|
apiKey?: undefined;
|
|
53
|
-
}>]
|
|
53
|
+
}>]>, z.ZodObject<{
|
|
54
|
+
chainAgnosticUrl: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
chainAgnosticUrl?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
chainAgnosticUrl?: string | undefined;
|
|
59
|
+
}>>;
|
|
54
60
|
export declare const UserOperationFeeOptionsFieldSchema: z.ZodObject<{
|
|
55
61
|
min: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>>;
|
|
56
62
|
max: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>>;
|
|
@@ -9,7 +9,8 @@ export const createPublicErc4337ClientSchema = () => z.custom((provider) => {
|
|
|
9
9
|
"name" in provider);
|
|
10
10
|
});
|
|
11
11
|
// [!region ConnectionConfigSchema]
|
|
12
|
-
|
|
12
|
+
// TODO: in v5 either remove this or simplify it (either way this should be moved out of aa-sdk/core)
|
|
13
|
+
export const ConnectionConfigSchema = z.intersection(z.union([
|
|
13
14
|
z.object({
|
|
14
15
|
rpcUrl: z.never().optional(),
|
|
15
16
|
apiKey: z.string(),
|
|
@@ -30,7 +31,9 @@ export const ConnectionConfigSchema = z.union([
|
|
|
30
31
|
apiKey: z.never().optional(),
|
|
31
32
|
jwt: z.string(),
|
|
32
33
|
}),
|
|
33
|
-
])
|
|
34
|
+
]), z.object({
|
|
35
|
+
chainAgnosticUrl: z.string().optional(),
|
|
36
|
+
}));
|
|
34
37
|
// [!endregion ConnectionConfigSchema]
|
|
35
38
|
export const UserOperationFeeOptionsFieldSchema = BigNumberishRangeSchema.merge(MultiplierSchema).partial();
|
|
36
39
|
export const UserOperationFeeOptionsSchema_v6 = z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/client/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAE3C,EAAE,CACJ,CAAC,CAAC,MAAM,CAA4B,CAAC,QAAQ,EAAE,EAAE;IAC/C,OAAO,CACL,QAAQ,IAAI,IAAI;QAChB,OAAO,QAAQ,KAAK,QAAQ;QAC5B,SAAS,IAAI,QAAQ;QACrB,MAAM,IAAI,QAAQ;QAClB,KAAK,IAAI,QAAQ;QACjB,MAAM,IAAI,QAAQ,CACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,mCAAmC;AACnC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/client/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAE3C,EAAE,CACJ,CAAC,CAAC,MAAM,CAA4B,CAAC,QAAQ,EAAE,EAAE;IAC/C,OAAO,CACL,QAAQ,IAAI,IAAI;QAChB,OAAO,QAAQ,KAAK,QAAQ;QAC5B,SAAS,IAAI,QAAQ;QACrB,MAAM,IAAI,QAAQ;QAClB,KAAK,IAAI,QAAQ;QACjB,MAAM,IAAI,QAAQ,CACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,mCAAmC;AACnC,qGAAqG;AACrG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAClD,CAAC,CAAC,KAAK,CAAC;IACN,CAAC,C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E,kCAAkC;CACvD,CAAC;KACD,OAAO,EAAE;KACT,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,gCAAgC,GAC3C,gCAAgC,CAAC,MAAM,CAAC;IACtC,6BAA6B,EAAE,kCAAkC;IACjE,uBAAuB,EAAE,kCAAkC;CAC5D,CAAC;KACC,OAAO,EAAE;KACT,MAAM,EAAE,CAAC;AAEd,MAAM,CAAC,MAAM,6BAA6B,GAAG,gCAAgC,CAAC;AAE9E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAErD;;OAEG;IACH,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAK,CAAC;IAE9D;;OAEG;IACH,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAE5D;;OAEG;IACH,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["import type { Transport } from \"viem\";\nimport { z } from \"zod\";\n\nimport { BigNumberishRangeSchema, MultiplierSchema } from \"../utils/index.js\";\nimport type { BundlerClient } from \"./bundlerClient.js\";\n\nexport const createPublicErc4337ClientSchema = <\n TTransport extends Transport = Transport\n>() =>\n z.custom<BundlerClient<TTransport>>((provider) => {\n return (\n provider != null &&\n typeof provider === \"object\" &&\n \"request\" in provider &&\n \"type\" in provider &&\n \"key\" in provider &&\n \"name\" in provider\n );\n });\n\n// [!region ConnectionConfigSchema]\n// TODO: in v5 either remove this or simplify it (either way this should be moved out of aa-sdk/core)\nexport const ConnectionConfigSchema = z.intersection(\n z.union([\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.string(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n ]),\n z.object({\n chainAgnosticUrl: z.string().optional(),\n })\n);\n// [!endregion ConnectionConfigSchema]\n\nexport const UserOperationFeeOptionsFieldSchema =\n BigNumberishRangeSchema.merge(MultiplierSchema).partial();\n\nexport const UserOperationFeeOptionsSchema_v6 = z\n .object({\n maxFeePerGas: UserOperationFeeOptionsFieldSchema,\n maxPriorityFeePerGas: UserOperationFeeOptionsFieldSchema,\n callGasLimit: UserOperationFeeOptionsFieldSchema,\n verificationGasLimit: UserOperationFeeOptionsFieldSchema,\n preVerificationGas: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema_v7 =\n UserOperationFeeOptionsSchema_v6.extend({\n paymasterVerificationGasLimit: UserOperationFeeOptionsFieldSchema,\n paymasterPostOpGasLimit: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema = UserOperationFeeOptionsSchema_v7;\n\nexport const SmartAccountClientOptsSchema = z\n .object({\n /**\n * The maximum number of times to try fetching a transaction receipt before giving up (default: 5)\n */\n txMaxRetries: z.number().min(0).optional().default(5),\n\n /**\n * The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)\n */\n txRetryIntervalMs: z.number().min(0).optional().default(2_000),\n\n /**\n * The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)\n */\n txRetryMultiplier: z.number().min(0).optional().default(1.5),\n\n /**\n * Optional user operation fee options to be set globally at the provider level\n */\n feeOptions: UserOperationFeeOptionsSchema.optional(),\n })\n .strict();\n"]}
|
|
@@ -99,8 +99,10 @@ export function createSmartAccountClient(config) {
|
|
|
99
99
|
}
|
|
100
100
|
try {
|
|
101
101
|
return client.signTypedData({
|
|
102
|
-
typedData: JSON.parse(dataParams),
|
|
103
102
|
account: client.account,
|
|
103
|
+
typedData: typeof dataParams === "string"
|
|
104
|
+
? JSON.parse(dataParams)
|
|
105
|
+
: dataParams,
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
catch {
|
|
@@ -1 +1 @@
|
|
|
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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AC;4BAAC,MAAM,CAAC;gCACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;4BAC9C,CAAC;wBACH,CAAC;wBACD,KAAK,aAAa;4BAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gCAChB,MAAM,IAAI,kBAAkB,EAAE,CAAC;4BACjC,CAAC;4BAED,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;wBACvB;4BACE,uGAAuG;4BACvG,2CAA2C;4BAC3C,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 typedData: JSON.parse(dataParams),\n account: client.account,\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,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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"]}
|
|
@@ -31,7 +31,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
31
31
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
32
32
|
* import { generatePrivateKey } from "viem";
|
|
33
33
|
*
|
|
34
|
-
* const signer = LocalAccountSigner.
|
|
34
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
35
35
|
* const signature = await signer.signMessage("Hello, world!");
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
@@ -47,7 +47,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
47
47
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
48
48
|
* import { generatePrivateKey } from "viem";
|
|
49
49
|
*
|
|
50
|
-
* const signer = LocalAccountSigner.
|
|
50
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
51
51
|
* const signature = await signer.signTypedData({
|
|
52
52
|
* domain: {},
|
|
53
53
|
* types: {},
|
|
@@ -293,7 +293,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
293
293
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
294
294
|
* import { generatePrivateKey } from "viem";
|
|
295
295
|
*
|
|
296
|
-
* const signer = LocalAccountSigner.
|
|
296
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
297
297
|
* const address = await signer.getAddress();
|
|
298
298
|
* ```
|
|
299
299
|
*
|
|
@@ -324,7 +324,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
324
324
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
325
325
|
* import { generatePrivateKey } from "viem";
|
|
326
326
|
*
|
|
327
|
-
* const signer = LocalAccountSigner.
|
|
327
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
328
328
|
* ```
|
|
329
329
|
*
|
|
330
330
|
* @param {Hex} key The private key in hexadecimal format
|
|
@@ -40,7 +40,7 @@ export class LocalAccountSigner {
|
|
|
40
40
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
41
41
|
* import { generatePrivateKey } from "viem";
|
|
42
42
|
*
|
|
43
|
-
* const signer = LocalAccountSigner.
|
|
43
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
44
44
|
* const signature = await signer.signMessage("Hello, world!");
|
|
45
45
|
* ```
|
|
46
46
|
*
|
|
@@ -63,7 +63,7 @@ export class LocalAccountSigner {
|
|
|
63
63
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
64
64
|
* import { generatePrivateKey } from "viem";
|
|
65
65
|
*
|
|
66
|
-
* const signer = LocalAccountSigner.
|
|
66
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
67
67
|
* const signature = await signer.signTypedData({
|
|
68
68
|
* domain: {},
|
|
69
69
|
* types: {},
|
|
@@ -91,7 +91,7 @@ export class LocalAccountSigner {
|
|
|
91
91
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
92
92
|
* import { generatePrivateKey } from "viem";
|
|
93
93
|
*
|
|
94
|
-
* const signer = LocalAccountSigner.
|
|
94
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
95
95
|
* const address = await signer.getAddress();
|
|
96
96
|
* ```
|
|
97
97
|
*
|
|
@@ -157,7 +157,7 @@ export class LocalAccountSigner {
|
|
|
157
157
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
158
158
|
* import { generatePrivateKey } from "viem";
|
|
159
159
|
*
|
|
160
|
-
* const signer = LocalAccountSigner.
|
|
160
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
161
161
|
* ```
|
|
162
162
|
*
|
|
163
163
|
* @param {Hex} key The private key in hexadecimal format
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,MAAM,MAAM,CAAC;AACd,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;;;;;;;;;;;;;OAcG;IACH,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAsBnB;;;;;;;;;;;;;;WAcG;QACM;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;WAmBG;QACM;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QA6BF;;;;;;;;;;;;;WAaG;QACM;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAjGA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB;IACjD,CAAC;IAoDD;;;;;;;;;;;;;;;;;;OAkBG;IAEH,iBAAiB,CAEf,qBAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,qBAAqB,CAAC,CAAC;IAC1E,CAAC;IAoBD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB;QAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n generatePrivateKey,\n mnemonicToAccount,\n privateKeyToAccount,\n} from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\nimport type { Authorization } from \"viem/experimental\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n /**\n * A function to initialize an object with an inner parameter and derive a signerType from it.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { privateKeyToAccount, generatePrivateKey } from \"viem\";\n *\n * const signer = new LocalAccountSigner(\n * privateKeyToAccount(generatePrivateKey()),\n * );\n * ```\n *\n * @param {T} inner The inner parameter containing the necessary data\n */\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n /**\n * Signs the provided message using the inner signMessage function.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.
|
|
1
|
+
{"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,MAAM,MAAM,CAAC;AACd,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;;;;;;;;;;;;;OAcG;IACH,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAsBnB;;;;;;;;;;;;;;WAcG;QACM;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;WAmBG;QACM;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QA6BF;;;;;;;;;;;;;WAaG;QACM;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAjGA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB;IACjD,CAAC;IAoDD;;;;;;;;;;;;;;;;;;OAkBG;IAEH,iBAAiB,CAEf,qBAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,qBAAqB,CAAC,CAAC;IAC1E,CAAC;IAoBD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB;QAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n generatePrivateKey,\n mnemonicToAccount,\n privateKeyToAccount,\n} from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\nimport type { Authorization } from \"viem/experimental\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n /**\n * A function to initialize an object with an inner parameter and derive a signerType from it.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { privateKeyToAccount, generatePrivateKey } from \"viem\";\n *\n * const signer = new LocalAccountSigner(\n * privateKeyToAccount(generatePrivateKey()),\n * );\n * ```\n *\n * @param {T} inner The inner parameter containing the necessary data\n */\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n /**\n * Signs the provided message using the inner signMessage function.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} message The message to be signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n /**\n * Signs typed data using the given parameters.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters defining the typed data and primary type\n * @returns {Promise<Hex>} A promise that resolves to the signed data in hexadecimal format\n */\n readonly signTypedData = async <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * Signs an unsigned authorization using the provided private key account.\n *\n * @example\n * ```ts twoslash\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem/accounts\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signedAuthorization = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 3,\n * });\n * ```\n *\n * @param {Authorization<number, false>} unsignedAuthorization - The unsigned authorization to be signed.\n * @returns {Promise<Authorization<number, true>>} A promise that resolves to the signed authorization.\n */\n\n signAuthorization(\n this: LocalAccountSigner<PrivateKeyAccount>,\n unsignedAuthorization: Authorization<number, false>\n ): Promise<Authorization<number, true>> {\n return this.inner.experimental_signAuthorization(unsignedAuthorization);\n }\n\n /**\n * Returns the address of the inner object in a specific hexadecimal format.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const address = await signer.getAddress();\n * ```\n *\n * @returns {Promise<Hex>} A promise that resolves to the address in the format `0x{string}`\n */\n readonly getAddress = async (): Promise<`0x${string}`> => {\n return this.inner.address;\n };\n\n /**\n * Creates a LocalAccountSigner using the provided mnemonic key and optional HD options.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generateMnemonic } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generateMnemonic());\n * ```\n *\n * @param {string} key The mnemonic key to derive the account from.\n * @param {HDOptions} [opts] Optional HD options for deriving the account.\n * @returns {LocalAccountSigner<HDAccount>} A LocalAccountSigner object for the derived account.\n */\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Creates a `LocalAccountSigner` instance using the provided private key.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * ```\n *\n * @param {Hex} key The private key in hexadecimal format\n * @returns {LocalAccountSigner<PrivateKeyAccount>} An instance of `LocalAccountSigner` initialized with the provided private key\n */\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Generates a new private key and creates a `LocalAccountSigner` for a `PrivateKeyAccount`.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n *\n * const signer = LocalAccountSigner.generatePrivateKeySigner();\n * ```\n *\n * @returns {LocalAccountSigner<PrivateKeyAccount>} A `LocalAccountSigner` instance initialized with the generated private key account\n */\n static generatePrivateKeySigner(): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(generatePrivateKey());\n return new LocalAccountSigner(signer);\n }\n}\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.32.0";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -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.
|
|
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.32.0\";\n"]}
|
|
@@ -2,7 +2,7 @@ import type { Transport } from "viem";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { BundlerClient } from "./bundlerClient.js";
|
|
4
4
|
export declare const createPublicErc4337ClientSchema: <TTransport extends Transport = Transport>() => z.ZodType<BundlerClient<TTransport>, z.ZodTypeDef, BundlerClient<TTransport>>;
|
|
5
|
-
export declare const ConnectionConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
5
|
+
export declare const ConnectionConfigSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
6
6
|
rpcUrl: z.ZodOptional<z.ZodNever>;
|
|
7
7
|
apiKey: z.ZodString;
|
|
8
8
|
jwt: z.ZodOptional<z.ZodNever>;
|
|
@@ -50,7 +50,13 @@ export declare const ConnectionConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
50
50
|
rpcUrl: string;
|
|
51
51
|
jwt: string;
|
|
52
52
|
apiKey?: undefined;
|
|
53
|
-
}>]
|
|
53
|
+
}>]>, z.ZodObject<{
|
|
54
|
+
chainAgnosticUrl: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
chainAgnosticUrl?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
chainAgnosticUrl?: string | undefined;
|
|
59
|
+
}>>;
|
|
54
60
|
export declare const UserOperationFeeOptionsFieldSchema: z.ZodObject<{
|
|
55
61
|
min: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>>;
|
|
56
62
|
max: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/client/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MA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D,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"}
|
|
@@ -31,7 +31,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
31
31
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
32
32
|
* import { generatePrivateKey } from "viem";
|
|
33
33
|
*
|
|
34
|
-
* const signer = LocalAccountSigner.
|
|
34
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
35
35
|
* const signature = await signer.signMessage("Hello, world!");
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
@@ -47,7 +47,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
47
47
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
48
48
|
* import { generatePrivateKey } from "viem";
|
|
49
49
|
*
|
|
50
|
-
* const signer = LocalAccountSigner.
|
|
50
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
51
51
|
* const signature = await signer.signTypedData({
|
|
52
52
|
* domain: {},
|
|
53
53
|
* types: {},
|
|
@@ -293,7 +293,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
293
293
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
294
294
|
* import { generatePrivateKey } from "viem";
|
|
295
295
|
*
|
|
296
|
-
* const signer = LocalAccountSigner.
|
|
296
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
297
297
|
* const address = await signer.getAddress();
|
|
298
298
|
* ```
|
|
299
299
|
*
|
|
@@ -324,7 +324,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
324
324
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
325
325
|
* import { generatePrivateKey } from "viem";
|
|
326
326
|
*
|
|
327
|
-
* const signer = LocalAccountSigner.
|
|
327
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
328
328
|
* ```
|
|
329
329
|
*
|
|
330
330
|
* @param {Hex} key The private key in hexadecimal format
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.32.0";
|
|
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.
|
|
4
|
+
"version": "4.32.0",
|
|
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",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"build": "yarn clean && yarn build:esm && yarn build:types",
|
|
38
38
|
"build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm",
|
|
39
39
|
"build:types": "tsc --project tsconfig.build.json --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
|
|
40
|
-
"docs:gen": "node ../../doc-gen/dist/esm/cli.js generate --in ./src/index.ts --out ../../site/pages/reference/aa-sdk/core",
|
|
41
40
|
"fern:gen": "node ../../doc-gen/dist/esm/cli.js generate --in ./src/index.ts --out ../../docs/pages/reference/aa-sdk/core --fern",
|
|
42
41
|
"clean": "rm -rf ./dist",
|
|
43
42
|
"test": "vitest",
|
|
@@ -66,5 +65,5 @@
|
|
|
66
65
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
67
66
|
},
|
|
68
67
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
69
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "efe1ba2e525ac0fc6ed0007b3d28dc9c8e063d78"
|
|
70
69
|
}
|
package/src/client/schema.ts
CHANGED
|
@@ -19,28 +19,34 @@ export const createPublicErc4337ClientSchema = <
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// [!region ConnectionConfigSchema]
|
|
22
|
-
|
|
22
|
+
// TODO: in v5 either remove this or simplify it (either way this should be moved out of aa-sdk/core)
|
|
23
|
+
export const ConnectionConfigSchema = z.intersection(
|
|
24
|
+
z.union([
|
|
25
|
+
z.object({
|
|
26
|
+
rpcUrl: z.never().optional(),
|
|
27
|
+
apiKey: z.string(),
|
|
28
|
+
jwt: z.never().optional(),
|
|
29
|
+
}),
|
|
30
|
+
z.object({
|
|
31
|
+
rpcUrl: z.never().optional(),
|
|
32
|
+
apiKey: z.never().optional(),
|
|
33
|
+
jwt: z.string(),
|
|
34
|
+
}),
|
|
35
|
+
z.object({
|
|
36
|
+
rpcUrl: z.string(),
|
|
37
|
+
apiKey: z.never().optional(),
|
|
38
|
+
jwt: z.never().optional(),
|
|
39
|
+
}),
|
|
40
|
+
z.object({
|
|
41
|
+
rpcUrl: z.string(),
|
|
42
|
+
apiKey: z.never().optional(),
|
|
43
|
+
jwt: z.string(),
|
|
44
|
+
}),
|
|
45
|
+
]),
|
|
23
46
|
z.object({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
z.object({
|
|
29
|
-
rpcUrl: z.never().optional(),
|
|
30
|
-
apiKey: z.never().optional(),
|
|
31
|
-
jwt: z.string(),
|
|
32
|
-
}),
|
|
33
|
-
z.object({
|
|
34
|
-
rpcUrl: z.string(),
|
|
35
|
-
apiKey: z.never().optional(),
|
|
36
|
-
jwt: z.never().optional(),
|
|
37
|
-
}),
|
|
38
|
-
z.object({
|
|
39
|
-
rpcUrl: z.string(),
|
|
40
|
-
apiKey: z.never().optional(),
|
|
41
|
-
jwt: z.string(),
|
|
42
|
-
}),
|
|
43
|
-
]);
|
|
47
|
+
chainAgnosticUrl: z.string().optional(),
|
|
48
|
+
})
|
|
49
|
+
);
|
|
44
50
|
// [!endregion ConnectionConfigSchema]
|
|
45
51
|
|
|
46
52
|
export const UserOperationFeeOptionsFieldSchema =
|
|
@@ -260,8 +260,11 @@ export function createSmartAccountClient(
|
|
|
260
260
|
}
|
|
261
261
|
try {
|
|
262
262
|
return client.signTypedData({
|
|
263
|
-
typedData: JSON.parse(dataParams),
|
|
264
263
|
account: client.account,
|
|
264
|
+
typedData:
|
|
265
|
+
typeof dataParams === "string"
|
|
266
|
+
? JSON.parse(dataParams)
|
|
267
|
+
: dataParams,
|
|
265
268
|
});
|
|
266
269
|
} catch {
|
|
267
270
|
throw new Error("invalid JSON data params");
|
|
@@ -54,7 +54,7 @@ export class LocalAccountSigner<
|
|
|
54
54
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
55
55
|
* import { generatePrivateKey } from "viem";
|
|
56
56
|
*
|
|
57
|
-
* const signer = LocalAccountSigner.
|
|
57
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
58
58
|
* const signature = await signer.signMessage("Hello, world!");
|
|
59
59
|
* ```
|
|
60
60
|
*
|
|
@@ -75,7 +75,7 @@ export class LocalAccountSigner<
|
|
|
75
75
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
76
76
|
* import { generatePrivateKey } from "viem";
|
|
77
77
|
*
|
|
78
|
-
* const signer = LocalAccountSigner.
|
|
78
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
79
79
|
* const signature = await signer.signTypedData({
|
|
80
80
|
* domain: {},
|
|
81
81
|
* types: {},
|
|
@@ -131,7 +131,7 @@ export class LocalAccountSigner<
|
|
|
131
131
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
132
132
|
* import { generatePrivateKey } from "viem";
|
|
133
133
|
*
|
|
134
|
-
* const signer = LocalAccountSigner.
|
|
134
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
135
135
|
* const address = await signer.getAddress();
|
|
136
136
|
* ```
|
|
137
137
|
*
|
|
@@ -172,7 +172,7 @@ export class LocalAccountSigner<
|
|
|
172
172
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
173
173
|
* import { generatePrivateKey } from "viem";
|
|
174
174
|
*
|
|
175
|
-
* const signer = LocalAccountSigner.
|
|
175
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
176
176
|
* ```
|
|
177
177
|
*
|
|
178
178
|
* @param {Hex} key The private key in hexadecimal format
|
package/src/version.ts
CHANGED