@alchemy/smart-accounts 5.0.0-beta.4 → 5.0.0-beta.6
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/README.md +0 -2
- package/dist/esm/index.d.ts +0 -6
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/light-account/accounts/base.js +0 -1
- package/dist/esm/light-account/accounts/base.js.map +1 -1
- package/dist/esm/light-account/utils.js +0 -5
- package/dist/esm/light-account/utils.js.map +1 -1
- package/dist/esm/ma-v1/accounts/base.js +1 -1
- package/dist/esm/ma-v1/accounts/base.js.map +1 -1
- package/dist/esm/ma-v1/mav1StaticImpl.d.ts +0 -2
- package/dist/esm/ma-v1/mav1StaticImpl.js +0 -2
- package/dist/esm/ma-v1/mav1StaticImpl.js.map +1 -1
- package/dist/esm/ma-v2/accounts/account.js +1 -1
- package/dist/esm/ma-v2/accounts/account.js.map +1 -1
- package/dist/esm/ma-v2/accounts/base.js +1 -1
- package/dist/esm/ma-v2/accounts/base.js.map +1 -1
- package/dist/esm/ma-v2/decorators/installValidation.d.ts +8 -20
- package/dist/esm/ma-v2/decorators/installValidation.js +7 -58
- package/dist/esm/ma-v2/decorators/installValidation.js.map +1 -1
- package/dist/esm/ma-v2/mav2StaticImpl.d.ts +0 -4
- package/dist/esm/ma-v2/mav2StaticImpl.js +0 -4
- package/dist/esm/ma-v2/mav2StaticImpl.js.map +1 -1
- package/dist/esm/ma-v2/utils/account.js +0 -2
- package/dist/esm/ma-v2/utils/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/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/light-account/accounts/base.d.ts.map +1 -1
- package/dist/types/light-account/utils.d.ts.map +1 -1
- package/dist/types/ma-v1/mav1StaticImpl.d.ts +0 -2
- package/dist/types/ma-v1/mav1StaticImpl.d.ts.map +1 -1
- package/dist/types/ma-v2/decorators/installValidation.d.ts +8 -20
- package/dist/types/ma-v2/decorators/installValidation.d.ts.map +1 -1
- package/dist/types/ma-v2/mav2StaticImpl.d.ts +0 -4
- package/dist/types/ma-v2/mav2StaticImpl.d.ts.map +1 -1
- package/dist/types/ma-v2/utils/account.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/index.ts +0 -13
- package/src/light-account/accounts/base.ts +0 -1
- package/src/light-account/utils.ts +0 -6
- package/src/ma-v1/accounts/base.ts +1 -1
- package/src/ma-v1/mav1StaticImpl.ts +0 -2
- package/src/ma-v2/accounts/account.ts +2 -2
- package/src/ma-v2/accounts/base.ts +1 -1
- package/src/ma-v2/decorators/installValidation.ts +8 -83
- package/src/ma-v2/mav2StaticImpl.ts +0 -4
- package/src/ma-v2/utils/account.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/esm/light-account/decorators/multiOwner.d.ts +0 -17
- package/dist/esm/light-account/decorators/multiOwner.js +0 -39
- package/dist/esm/light-account/decorators/multiOwner.js.map +0 -1
- package/dist/esm/light-account/decorators/singleOwner.d.ts +0 -16
- package/dist/esm/light-account/decorators/singleOwner.js +0 -35
- package/dist/esm/light-account/decorators/singleOwner.js.map +0 -1
- package/dist/esm/ma-v1/decorators/multiOwner.d.ts +0 -17
- package/dist/esm/ma-v1/decorators/multiOwner.js +0 -39
- package/dist/esm/ma-v1/decorators/multiOwner.js.map +0 -1
- package/dist/types/light-account/decorators/multiOwner.d.ts +0 -18
- package/dist/types/light-account/decorators/multiOwner.d.ts.map +0 -1
- package/dist/types/light-account/decorators/singleOwner.d.ts +0 -17
- package/dist/types/light-account/decorators/singleOwner.d.ts.map +0 -1
- package/dist/types/ma-v1/decorators/multiOwner.d.ts +0 -18
- package/dist/types/ma-v1/decorators/multiOwner.d.ts.map +0 -1
- package/src/light-account/decorators/multiOwner.ts +0 -72
- package/src/light-account/decorators/singleOwner.ts +0 -63
- package/src/ma-v1/decorators/multiOwner.ts +0 -72
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import { zeroAddress, concatHex, encodeFunctionData, } from "viem";
|
|
2
2
|
import { semiModularAccountBytecodeAbi } from "../abis/semiModularAccountBytecodeAbi.js";
|
|
3
|
-
import { sendUserOperation } from "viem/account-abstraction";
|
|
4
|
-
import { getAction } from "viem/utils";
|
|
5
3
|
import { AccountNotFoundError } from "@alchemy/common";
|
|
6
4
|
import { EntityIdOverrideError } from "../../errors/EntityIdOverrideError.js";
|
|
7
5
|
import { serializeHookConfig, serializeValidationConfig, } from "../utils/hooks.js";
|
|
8
6
|
import { DEFAULT_OWNER_ENTITY_ID, isModularAccountV2, serializeModuleEntity, } from "../utils/account.js";
|
|
9
|
-
// TODO(v5): update jsdoc
|
|
10
7
|
/**
|
|
11
|
-
* Provides validation installation and uninstallation functionalities for a MA v2 client
|
|
8
|
+
* Provides validation installation and uninstallation encoding functionalities for a MA v2 client.
|
|
12
9
|
*
|
|
13
10
|
* @example
|
|
14
11
|
* ```ts
|
|
15
|
-
* import {
|
|
12
|
+
* import { installValidationActions, SingleSignerValidationModule } from "@alchemy/smart-accounts";
|
|
16
13
|
* import { Address } from "viem";
|
|
17
14
|
*
|
|
18
15
|
* const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);
|
|
19
16
|
* const sessionKeyAddress: Address = "0x1234";
|
|
20
17
|
* const sessionKeyEntityId: number = 1;
|
|
21
18
|
*
|
|
22
|
-
* await client.
|
|
19
|
+
* const callData = await client.encodeInstallValidation({
|
|
23
20
|
* validationConfig: {
|
|
24
|
-
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(
|
|
25
|
-
* client.chain
|
|
26
|
-
* ),
|
|
21
|
+
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(client.chain),
|
|
27
22
|
* entityId: sessionKeyEntityId,
|
|
28
23
|
* isGlobal: true,
|
|
29
24
|
* isSignatureValidation: false,
|
|
@@ -37,19 +32,11 @@ import { DEFAULT_OWNER_ENTITY_ID, isModularAccountV2, serializeModuleEntity, } f
|
|
|
37
32
|
* hooks: [],
|
|
38
33
|
* });
|
|
39
34
|
*
|
|
40
|
-
* await client.
|
|
41
|
-
* moduleAddress: sessionKeyAddress,
|
|
42
|
-
* entityId: sessionKeyEntityId,
|
|
43
|
-
* uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
|
|
44
|
-
* entityId: sessionKeyEntityId,
|
|
45
|
-
* }),
|
|
46
|
-
* hookUninstallDatas: [],
|
|
47
|
-
* });
|
|
48
|
-
*
|
|
35
|
+
* await client.sendUserOperation({ callData, account });
|
|
49
36
|
* ```
|
|
50
37
|
*
|
|
51
|
-
* @param {object} client - The client instance which provides account
|
|
52
|
-
* @returns {object} - An object containing
|
|
38
|
+
* @param {object} client - The client instance which provides account functionality.
|
|
39
|
+
* @returns {object} - An object containing `encodeInstallValidation` and `encodeUninstallValidation`.
|
|
53
40
|
*/
|
|
54
41
|
export function installValidationActions(client) {
|
|
55
42
|
const encodeInstallValidation = async (args) => {
|
|
@@ -94,44 +81,6 @@ export function installValidationActions(client) {
|
|
|
94
81
|
return {
|
|
95
82
|
encodeInstallValidation,
|
|
96
83
|
encodeUninstallValidation,
|
|
97
|
-
installValidation: async (args) => {
|
|
98
|
-
const { validationConfig, selectors, installData, hooks, account = client.account, } = args;
|
|
99
|
-
if (!account || !isModularAccountV2(account)) {
|
|
100
|
-
throw new AccountNotFoundError();
|
|
101
|
-
}
|
|
102
|
-
const callData = await encodeInstallValidation({
|
|
103
|
-
validationConfig,
|
|
104
|
-
selectors,
|
|
105
|
-
installData,
|
|
106
|
-
hooks,
|
|
107
|
-
account,
|
|
108
|
-
});
|
|
109
|
-
const action = getAction(client, sendUserOperation, "sendUserOperation");
|
|
110
|
-
const result = await action({
|
|
111
|
-
callData,
|
|
112
|
-
account,
|
|
113
|
-
});
|
|
114
|
-
return result;
|
|
115
|
-
},
|
|
116
|
-
uninstallValidation: async (args) => {
|
|
117
|
-
const { moduleAddress, entityId, uninstallData, hookUninstallDatas, account = client.account, } = args;
|
|
118
|
-
if (!account || !isModularAccountV2(account)) {
|
|
119
|
-
throw new AccountNotFoundError();
|
|
120
|
-
}
|
|
121
|
-
const callData = await encodeUninstallValidation({
|
|
122
|
-
moduleAddress,
|
|
123
|
-
entityId,
|
|
124
|
-
uninstallData,
|
|
125
|
-
hookUninstallDatas,
|
|
126
|
-
account,
|
|
127
|
-
});
|
|
128
|
-
const action = getAction(client, sendUserOperation, "sendUserOperation");
|
|
129
|
-
const result = await action({
|
|
130
|
-
callData,
|
|
131
|
-
account,
|
|
132
|
-
});
|
|
133
|
-
return result;
|
|
134
|
-
},
|
|
135
84
|
};
|
|
136
85
|
}
|
|
137
86
|
//# sourceMappingURL=installValidation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installValidation.js","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,WAAW,EACX,SAAS,EACT,kBAAkB,GACnB,MAAM,MAAM,CAAC;AAId,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAqB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAsC7B,yBAAyB;AACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,wBAAwB,CAKtC,MAA4C;IAI5C,MAAM,uBAAuB,GAAG,KAAK,EACn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AEH,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;YACzE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;gBAC1B,QAAQ;gBACR,OAAO;aACR,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n type Address,\n type Client,\n type Hex,\n type IsUndefined,\n type Chain,\n type Transport,\n zeroAddress,\n concatHex,\n encodeFunctionData,\n} from \"viem\";\nimport type { HookConfig, ValidationConfig } from \"../types.js\";\nimport type { ModularAccountV2 } from \"../accounts/account.js\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport { semiModularAccountBytecodeAbi } from \"../abis/semiModularAccountBytecodeAbi.js\";\nimport { type SmartAccount, sendUserOperation } from \"viem/account-abstraction\";\nimport { getAction } from \"viem/utils\";\nimport { AccountNotFoundError } from \"@alchemy/common\";\nimport { EntityIdOverrideError } from \"../../errors/EntityIdOverrideError.js\";\nimport {\n serializeHookConfig,\n serializeValidationConfig,\n} from \"../utils/hooks.js\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n isModularAccountV2,\n serializeModuleEntity,\n} from \"../utils/account.js\";\n\nexport type InstallValidationParams<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n validationConfig: ValidationConfig;\n selectors: Hex[];\n installData: Hex;\n hooks: {\n hookConfig: HookConfig;\n initData: Hex;\n }[];\n} & GetAccountParameter<TAccount, ModularAccountV2>;\n\nexport type UninstallValidationParams<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n moduleAddress: Address;\n entityId: number;\n uninstallData: Hex;\n hookUninstallDatas: Hex[];\n} & GetAccountParameter<TAccount, ModularAccountV2>;\n\nexport type InstallValidationActions<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n encodeInstallValidation: (\n args: InstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n installValidation: (args: InstallValidationParams<TAccount>) => Promise<Hex>;\n encodeUninstallValidation: (\n args: UninstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n uninstallValidation: (\n args: UninstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n};\n\n// TODO(v5): update jsdoc\n/**\n * Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.\n *\n * @example\n * ```ts\n * import { createModularAccountV2Client, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from \"@alchemy/smart-accounts\";\n * import { Address } from \"viem\";\n *\n * const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);\n * const sessionKeyAddress: Address = \"0x1234\";\n * const sessionKeyEntityId: number = 1;\n *\n * await client.installValidation({\n * validationConfig: {\n * moduleAddress: getDefaultSingleSignerValidationModuleAddress(\n * client.chain\n * ),\n * entityId: sessionKeyEntityId,\n * isGlobal: true,\n * isSignatureValidation: false,\n * isUserOpValidation: true,\n * },\n * selectors: [],\n * installData: SingleSignerValidationModule.encodeOnInstallData({\n * entityId: sessionKeyEntityId,\n * signer: sessionKeyAddress,\n * }),\n * hooks: [],\n * });\n *\n * await client.uninstallValidation({\n * moduleAddress: sessionKeyAddress,\n * entityId: sessionKeyEntityId,\n * uninstallData: SingleSignerValidationModule.encodeOnUninstallData({\n * entityId: sessionKeyEntityId,\n * }),\n * hookUninstallDatas: [],\n * });\n *\n * ```\n *\n * @param {object} client - The client instance which provides account and sendUserOperation functionality.\n * @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.\n */\nexport function installValidationActions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): InstallValidationActions<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n> {\n const encodeInstallValidation = async (\n args: InstallValidationParams<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n >,\n ) => {\n const {\n validationConfig,\n selectors,\n installData,\n hooks,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n // An entityId of zero is only allowed if we're installing or uninstalling hooks on the fallback validation.\n if (\n validationConfig.entityId === DEFAULT_OWNER_ENTITY_ID &&\n validationConfig.moduleAddress !== zeroAddress\n ) {\n throw new EntityIdOverrideError();\n }\n\n return account.encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"installValidation\",\n args: [\n serializeValidationConfig(validationConfig),\n selectors,\n installData,\n hooks.map((hook: { hookConfig: HookConfig; initData: Hex }) =>\n concatHex([serializeHookConfig(hook.hookConfig), hook.initData]),\n ),\n ],\n }),\n );\n };\n\n const encodeUninstallValidation = async (\n args: UninstallValidationParams<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n >,\n ) => {\n const {\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n return account.encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"uninstallValidation\",\n args: [\n serializeModuleEntity({\n moduleAddress,\n entityId,\n }),\n uninstallData,\n hookUninstallDatas,\n ],\n }),\n );\n };\n\n return {\n encodeInstallValidation,\n encodeUninstallValidation,\n installValidation: async (args) => {\n const {\n validationConfig,\n selectors,\n installData,\n hooks,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n const callData = await encodeInstallValidation({\n validationConfig,\n selectors,\n installData,\n hooks,\n account,\n });\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n callData,\n account,\n });\n\n return result;\n },\n\n uninstallValidation: async (args) => {\n const {\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n const callData = await encodeUninstallValidation({\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account,\n });\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n callData,\n account,\n });\n\n return result;\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"installValidation.js","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,WAAW,EACX,SAAS,EACT,kBAAkB,GACnB,MAAM,MAAM,CAAC;AAId,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAkC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,wBAAwB,CAKtC,MAA4C;IAI5C,MAAM,uBAAuB,GAAG,KAAK,EACnC,IAEC,EACD,EAAE;QACF,MAAM,EACJ,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,KAAK,EACL,OAAO,GAAG,MAAM,CAAC,OAAO,GACzB,GAAG,IAAI,CAAC;QAET,IAAI,CAAC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,4GAA4G;QAC5G,IACE,gBAAgB,CAAC,QAAQ,KAAK,uBAAuB;YACrD,gBAAgB,CAAC,aAAa,KAAK,WAAW,EAC9C,CAAC;YACD,MAAM,IAAI,qBAAqB,EAAE,CAAC;QACpC,CAAC;QAED,OAAO,OAAO,CAAC,cAAc,CAC3B,kBAAkB,CAAC;YACjB,GAAG,EAAE,6BAA6B;YAClC,YAAY,EAAE,mBAAmB;YACjC,IAAI,EAAE;gBACJ,yBAAyB,CAAC,gBAAgB,CAAC;gBAC3C,SAAS;gBACT,WAAW;gBACX,KAAK,CAAC,GAAG,CAAC,CAAC,IAA+C,EAAE,EAAE,CAC5D,SAAS,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CACjE;aACF;SACF,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,yBAAyB,GAAG,KAAK,EACrC,IAEC,EACD,EAAE;QACF,MAAM,EACJ,aAAa,EACb,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,OAAO,GAAG,MAAM,CAAC,OAAO,GACzB,GAAG,IAAI,CAAC;QAET,IAAI,CAAC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,OAAO,OAAO,CAAC,cAAc,CAC3B,kBAAkB,CAAC;YACjB,GAAG,EAAE,6BAA6B;YAClC,YAAY,EAAE,qBAAqB;YACnC,IAAI,EAAE;gBACJ,qBAAqB,CAAC;oBACpB,aAAa;oBACb,QAAQ;iBACT,CAAC;gBACF,aAAa;gBACb,kBAAkB;aACnB;SACF,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,uBAAuB;QACvB,yBAAyB;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["import {\n type Address,\n type Client,\n type Hex,\n type IsUndefined,\n type Chain,\n type Transport,\n zeroAddress,\n concatHex,\n encodeFunctionData,\n} from \"viem\";\nimport type { HookConfig, ValidationConfig } from \"../types.js\";\nimport type { ModularAccountV2 } from \"../accounts/account.js\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport { semiModularAccountBytecodeAbi } from \"../abis/semiModularAccountBytecodeAbi.js\";\nimport type { SmartAccount } from \"viem/account-abstraction\";\nimport { AccountNotFoundError } from \"@alchemy/common\";\nimport { EntityIdOverrideError } from \"../../errors/EntityIdOverrideError.js\";\nimport {\n serializeHookConfig,\n serializeValidationConfig,\n} from \"../utils/hooks.js\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n isModularAccountV2,\n serializeModuleEntity,\n} from \"../utils/account.js\";\n\nexport type InstallValidationParams<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n validationConfig: ValidationConfig;\n selectors: Hex[];\n installData: Hex;\n hooks: {\n hookConfig: HookConfig;\n initData: Hex;\n }[];\n} & GetAccountParameter<TAccount, ModularAccountV2>;\n\nexport type UninstallValidationParams<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n moduleAddress: Address;\n entityId: number;\n uninstallData: Hex;\n hookUninstallDatas: Hex[];\n} & GetAccountParameter<TAccount, ModularAccountV2>;\n\nexport type InstallValidationActions<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n encodeInstallValidation: (\n args: InstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n encodeUninstallValidation: (\n args: UninstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n};\n\n/**\n * Provides validation installation and uninstallation encoding functionalities for a MA v2 client.\n *\n * @example\n * ```ts\n * import { installValidationActions, SingleSignerValidationModule } from \"@alchemy/smart-accounts\";\n * import { Address } from \"viem\";\n *\n * const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);\n * const sessionKeyAddress: Address = \"0x1234\";\n * const sessionKeyEntityId: number = 1;\n *\n * const callData = await client.encodeInstallValidation({\n * validationConfig: {\n * moduleAddress: getDefaultSingleSignerValidationModuleAddress(client.chain),\n * entityId: sessionKeyEntityId,\n * isGlobal: true,\n * isSignatureValidation: false,\n * isUserOpValidation: true,\n * },\n * selectors: [],\n * installData: SingleSignerValidationModule.encodeOnInstallData({\n * entityId: sessionKeyEntityId,\n * signer: sessionKeyAddress,\n * }),\n * hooks: [],\n * });\n *\n * await client.sendUserOperation({ callData, account });\n * ```\n *\n * @param {object} client - The client instance which provides account functionality.\n * @returns {object} - An object containing `encodeInstallValidation` and `encodeUninstallValidation`.\n */\nexport function installValidationActions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): InstallValidationActions<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n> {\n const encodeInstallValidation = async (\n args: InstallValidationParams<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n >,\n ) => {\n const {\n validationConfig,\n selectors,\n installData,\n hooks,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n // An entityId of zero is only allowed if we're installing or uninstalling hooks on the fallback validation.\n if (\n validationConfig.entityId === DEFAULT_OWNER_ENTITY_ID &&\n validationConfig.moduleAddress !== zeroAddress\n ) {\n throw new EntityIdOverrideError();\n }\n\n return account.encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"installValidation\",\n args: [\n serializeValidationConfig(validationConfig),\n selectors,\n installData,\n hooks.map((hook: { hookConfig: HookConfig; initData: Hex }) =>\n concatHex([serializeHookConfig(hook.hookConfig), hook.initData]),\n ),\n ],\n }),\n );\n };\n\n const encodeUninstallValidation = async (\n args: UninstallValidationParams<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n >,\n ) => {\n const {\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n return account.encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"uninstallValidation\",\n args: [\n serializeModuleEntity({\n moduleAddress,\n entityId,\n }),\n uninstallData,\n hookUninstallDatas,\n ],\n }),\n );\n };\n\n return {\n encodeInstallValidation,\n encodeUninstallValidation,\n };\n}\n"]}
|
|
@@ -10,14 +10,10 @@ export type SemiModularAccountV2FactoryArgs = {
|
|
|
10
10
|
export type SemiModularAccountV2StaticImpl = StaticSmartAccountImplementation<false, "0.7", SemiModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof semiModularAccountBytecodeAbi, typeof accountFactoryAbi>;
|
|
11
11
|
/**
|
|
12
12
|
* Static implementation logic for SemiModularAccountV2.
|
|
13
|
-
*
|
|
14
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
15
13
|
*/
|
|
16
14
|
export declare const semiModularAccountV2StaticImpl: SemiModularAccountV2StaticImpl;
|
|
17
15
|
export type SemiModularAccount7702StaticImpl = StaticSmartAccountImplementation<true, "0.7", SemiModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof semiModularAccountBytecodeAbi, typeof accountFactoryAbi>;
|
|
18
16
|
/**
|
|
19
17
|
* Static implementation logic for SemiModularAccount7702.
|
|
20
|
-
*
|
|
21
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
22
18
|
*/
|
|
23
19
|
export declare const semiModularAccount7702StaticImpl: SemiModularAccount7702StaticImpl;
|
|
@@ -18,8 +18,6 @@ const semiModularAccountBase = {
|
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Static implementation logic for SemiModularAccountV2.
|
|
21
|
-
*
|
|
22
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
23
21
|
*/
|
|
24
22
|
export const semiModularAccountV2StaticImpl = {
|
|
25
23
|
...semiModularAccountBase,
|
|
@@ -45,8 +43,6 @@ export const semiModularAccountV2StaticImpl = {
|
|
|
45
43
|
};
|
|
46
44
|
/**
|
|
47
45
|
* Static implementation logic for SemiModularAccount7702.
|
|
48
|
-
*
|
|
49
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
50
46
|
*/
|
|
51
47
|
export const semiModularAccount7702StaticImpl = {
|
|
52
48
|
...semiModularAccountBase,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mav2StaticImpl.js","sourceRoot":"","sources":["../../../src/ma-v2/mav2StaticImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAgBrE,gFAAgF;AAChF,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,eAAe;IACpB,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,KAAK;CACN,CAAC;AAEX,sEAAsE;AACtE,MAAM,sBAAsB,GAAG;IAC7B,UAAU;IACV,UAAU,EAAE,6BAA6B;CACQ,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"mav2StaticImpl.js","sourceRoot":"","sources":["../../../src/ma-v2/mav2StaticImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAgBrE,gFAAgF;AAChF,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,eAAe;IACpB,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,KAAK;CACN,CAAC;AAEX,sEAAsE;AACtE,MAAM,sBAAsB,GAAG;IAC7B,UAAU;IACV,UAAU,EAAE,6BAA6B;CACQ,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAmC;IAC5E,GAAG,sBAAsB;IACzB,qBAAqB,EAAE,YAAY,CAAC,kBAAkB,CAAC,cAAc,CAAC;IACtE,cAAc,EAAE,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC;IAC7D,UAAU,EAAE,iBAAiB;IAC7B,cAAc,EAAE,CAAC,IAAqC,EAAE,EAAE;QACxD,OAAO,kBAAkB,CAAC;YACxB,GAAG,EAAE,iBAAiB;YACtB,YAAY,EAAE,0BAA0B;YACxC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC;SAC9B,CAAC,CAAC;IACL,CAAC;IACD,qBAAqB,EAAE,CAAC,IAAqC,EAAE,EAAE;QAC/D,OAAO,8BAA8B,CAAC;YACpC,cAAc,EAAE,kBAAkB,CAAC,YAAY;YAC/C,qBAAqB,EAAE,kBAAkB,CAAC,cAAc;YACxD,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,KAAK;SACzB,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAWF;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C;IACE,GAAG,sBAAsB;IACzB,iBAAiB,EAAE,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC;CAC/D,CAAC","sourcesContent":["import { encodeFunctionData, type Address } from \"viem\";\nimport { entryPoint07Abi, entryPoint07Address } from \"viem/account-abstraction\";\nimport { lowerAddress } from \"@alchemy/common\";\nimport type { StaticSmartAccountImplementation } from \"../types.js\";\nimport { semiModularAccountBytecodeAbi } from \"./abis/semiModularAccountBytecodeAbi.js\";\nimport { accountFactoryAbi } from \"./abis/accountFactoryAbi.js\";\nimport { DefaultAddress as DefaultMAV2Address } from \"./utils/account.js\";\nimport { predictModularAccountV2Address } from \"./predictAddress.js\";\n\nexport type SemiModularAccountV2FactoryArgs = {\n owner: Address;\n salt: bigint;\n};\n\nexport type SemiModularAccountV2StaticImpl = StaticSmartAccountImplementation<\n false,\n \"0.7\",\n SemiModularAccountV2FactoryArgs,\n typeof entryPoint07Abi,\n typeof semiModularAccountBytecodeAbi,\n typeof accountFactoryAbi\n>;\n\n// Shared entryPoint configuration across all modular account v2 implementations\nconst entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address,\n version: \"0.7\",\n} as const;\n\n// Shared base for semi-modular account implementations (SMA and 7702)\nconst semiModularAccountBase = {\n entryPoint,\n accountAbi: semiModularAccountBytecodeAbi,\n} satisfies Partial<SemiModularAccountV2StaticImpl>;\n\n/**\n * Static implementation logic for SemiModularAccountV2.\n */\nexport const semiModularAccountV2StaticImpl: SemiModularAccountV2StaticImpl = {\n ...semiModularAccountBase,\n accountImplementation: lowerAddress(DefaultMAV2Address.SMAV2_BYTECODE),\n factoryAddress: lowerAddress(DefaultMAV2Address.MAV2_FACTORY),\n factoryAbi: accountFactoryAbi,\n getFactoryData: (args: SemiModularAccountV2FactoryArgs) => {\n return encodeFunctionData({\n abi: accountFactoryAbi,\n functionName: \"createSemiModularAccount\",\n args: [args.owner, args.salt],\n });\n },\n predictAccountAddress: (args: SemiModularAccountV2FactoryArgs) => {\n return predictModularAccountV2Address({\n factoryAddress: DefaultMAV2Address.MAV2_FACTORY,\n implementationAddress: DefaultMAV2Address.SMAV2_BYTECODE,\n type: \"SMA\",\n salt: args.salt,\n ownerAddress: args.owner,\n });\n },\n};\n\nexport type SemiModularAccount7702StaticImpl = StaticSmartAccountImplementation<\n true,\n \"0.7\",\n SemiModularAccountV2FactoryArgs,\n typeof entryPoint07Abi,\n typeof semiModularAccountBytecodeAbi,\n typeof accountFactoryAbi\n>;\n\n/**\n * Static implementation logic for SemiModularAccount7702.\n */\nexport const semiModularAccount7702StaticImpl: SemiModularAccount7702StaticImpl =\n {\n ...semiModularAccountBase,\n delegationAddress: lowerAddress(DefaultMAV2Address.SMAV2_7702),\n };\n"]}
|
|
@@ -42,8 +42,6 @@ export async function getMAV2UpgradeToData(ownerAddress) {
|
|
|
42
42
|
return {
|
|
43
43
|
implAddress: DefaultAddress.SMAV2_STORAGE,
|
|
44
44
|
initializationData: initData,
|
|
45
|
-
// TODO(v5): do we need `createModularAccountV2FromExisting()` in the return type here like we had in v4 or no?
|
|
46
|
-
// Almost certainly not, but we need to clean up other parts in SDK for client-side upgrades.
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/ma-v2/utils/account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,GAGN,MAAM,MAAM,CAAC;AAId,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAGvF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY,EAAE,4CAA4C;IAC1D,cAAc,EAAE,4CAA4C;IAC5D,aAAa,EAAE,4CAA4C;IAC3D,UAAU,EAAE,4CAA4C;CACvB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,wBAAwB,EAAE,4CAA4C;IACtE,UAAU,EAAE,4CAA4C;IACxD,eAAe,EAAE,4CAA4C;IAC7D,kBAAkB,EAAE,4CAA4C;IAChE,SAAS,EAAE,4CAA4C;CACtB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC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AAE,CAAC,YAAY,CAAC;KACrB,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,cAAc,CAAC,aAAa;QACzC,kBAAkB,EAAE,QAAQ;KAC7B,CAAC;AACJ,CAAC;AAUD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,CAAC,EACZ,kBAAkB,GAAG,IAAI,EACzB,gBAAgB,GAAG,KAAK,GACP,EAAU,EAAE;IAC7B,OAAO,CACL,CAAC,QAAQ,IAAI,GAAG,CAAC;QACjB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/B,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACxD,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAqB;IAErB,OAAO,CACL,kBAAkB,IAAI,OAAO;QAC7B,OAAO,CAAC,gBAAgB,KAAK,kBAAkB,CAChD,CAAC;AACJ,CAAC","sourcesContent":["import {\n concatHex,\n encodeFunctionData,\n toHex,\n type Address,\n type Hex,\n} from \"viem\";\nimport type { SmartAccount } from \"viem/account-abstraction\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport type { ModuleEntity, UpgradeToData } from \"../types.js\";\nimport { semiModularAccountStorageAbi } from \"../abis/semiModularAccountStorageAbi.js\";\nimport type { ModularAccountV2Base } from \"../accounts/base.js\";\n\n/**\n * A mapping of default addresses for the ModularAccountV2.\n */\nexport const DefaultAddress = {\n MAV2_FACTORY: \"0x00000000000017c61b5bEe81050EC8eFc9c6fecd\",\n SMAV2_BYTECODE: \"0x000000000000c5A9089039570Dd36455b5C07383\",\n SMAV2_STORAGE: \"0x0000000000006E2f9d80CaEc0Da6500f005EB25A\",\n SMAV2_7702: \"0x69007702764179f14F51cdce752f4f775d74E139\",\n} satisfies Record<string, Address>;\n\n/**\n * A mapping of default addresses for the ModularAccountV2 modules.\n */\nexport const DefaultModuleAddress = {\n SINGLE_SIGNER_VALIDATION: \"0x00000000000099DE0BF6fA90dEB851E2A2df7d83\",\n TIME_RANGE: \"0x00000000000082B8e2012be914dFA4f62A0573eA\",\n PAYMASTER_GUARD: \"0x0000000000001aA7A7F7E29abe0be06c72FD42A1\",\n NATIVE_TOKEN_LIMIT: \"0x00000000000001e541f0D090868FBe24b59Fbe06\",\n ALLOWLIST: \"0x00000000003e826473a313e600b5b9b791f5a59a\",\n} satisfies Record<string, Address>;\n\n/**\n * The default owner entity ID.\n */\nexport const DEFAULT_OWNER_ENTITY_ID = 0;\n\n/**\n * The selector for the execute user operation function.\n */\nexport const EXECUTE_USER_OP_SELECTOR: Hex = \"0x8DD7712F\";\n\nexport type GetMAV2UpgradeToData<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = GetAccountParameter<TAccount>;\n\n/**\n * Gets the upgrade to data for the ModularAccountV2.\n *\n * @param {Address} ownerAddress - The address of the owner.\n * @returns {Promise<UpgradeToData>} The upgrade to data.\n */\nexport async function getMAV2UpgradeToData(\n ownerAddress: Address,\n): Promise<UpgradeToData> {\n const initData = encodeFunctionData({\n abi: semiModularAccountStorageAbi,\n functionName: \"initialize\",\n args: [ownerAddress],\n });\n\n return {\n implAddress: DefaultAddress.SMAV2_STORAGE,\n initializationData: initData,\n };\n}\n\nexport type BuildNonceParams = {\n nonceKey?: bigint;\n entityId?: number;\n isGlobalValidation?: boolean;\n isDeferredAction?: boolean;\n isDirectCallValidation?: boolean;\n};\n\n/**\n * Builds a full nonce key.\n *\n * @param {BuildNonceParams} params - The parameters for building a full nonce key.\n * @returns {bigint} The full nonce key.\n */\nexport const buildFullNonceKey = ({\n nonceKey = 0n,\n entityId = 0,\n isGlobalValidation = true,\n isDeferredAction = false,\n}: BuildNonceParams): bigint => {\n return (\n (nonceKey << 40n) +\n (BigInt(entityId) << 8n) +\n (isDeferredAction ? 2n : 0n) +\n (isGlobalValidation ? 1n : 0n)\n );\n};\n\n/**\n * Serializes a module entity into a hexadecimal format by concatenating the module address and entity ID.\n *\n * @example\n * ```ts\n * import { serializeModuleEntity } from \"@alchemy/smart-accounts\";\n * import { Address } from \"viem\";\n *\n * const moduleAddress: Address = \"0x1234\";\n * const entityId: number = 1234;\n *\n * const moduleEntityHex = serializeModuleEntity({\n * moduleAddress,\n * entityId\n * });\n * ```\n *\n * @param {ModuleEntity} config The module entity configuration containing the module address and entity ID\n * @returns {Hex} A hexadecimal string representation of the serialized module entity\n */\nexport function serializeModuleEntity(config: ModuleEntity): Hex {\n return concatHex([config.moduleAddress, toHex(config.entityId, { size: 4 })]);\n}\n\n/**\n * Checks if an account is a ModularAccountV2.\n *\n * @param {SmartAccount} account - The account to check.\n * @returns {boolean} True if the account is a ModularAccountV2, false otherwise.\n */\nexport function isModularAccountV2(\n account: SmartAccount,\n): account is ModularAccountV2Base {\n return (\n \"smartAccountType\" in account &&\n account.smartAccountType === \"ModularAccountV2\"\n );\n}\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "5.0.0-beta.
|
|
1
|
+
export declare const VERSION = "5.0.0-beta.5";
|
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,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.5\";\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,10 +3,6 @@ export type * from "./light-account/accounts/account.js";
|
|
|
3
3
|
export { toLightAccount } from "./light-account/accounts/account.js";
|
|
4
4
|
export type * from "./light-account/accounts/multi-owner-account.js";
|
|
5
5
|
export { toMultiOwnerLightAccount } from "./light-account/accounts/multi-owner-account.js";
|
|
6
|
-
export type * from "./light-account/decorators/singleOwner.js";
|
|
7
|
-
export { singleOwnerLightAccountActions } from "./light-account/decorators/singleOwner.js";
|
|
8
|
-
export type * from "./light-account/decorators/multiOwner.js";
|
|
9
|
-
export { multiOwnerLightAccountActions } from "./light-account/decorators/multiOwner.js";
|
|
10
6
|
export type * from "./light-account/predictAddress.js";
|
|
11
7
|
export { predictLightAccountAddress, predictMultiOwnerLightAccountAddress, } from "./light-account/predictAddress.js";
|
|
12
8
|
export { AccountVersionRegistry } from "./light-account/registry.js";
|
|
@@ -18,8 +14,6 @@ export type * from "./ma-v1/accounts/base.js";
|
|
|
18
14
|
export { toModularAccountV1Base } from "./ma-v1/accounts/base.js";
|
|
19
15
|
export type * from "./ma-v1/accounts/multi-owner-account.js";
|
|
20
16
|
export { toMultiOwnerModularAccountV1 } from "./ma-v1/accounts/multi-owner-account.js";
|
|
21
|
-
export type * from "./ma-v1/decorators/multiOwner.js";
|
|
22
|
-
export { multiOwnerModularAccountV1Actions } from "./ma-v1/decorators/multiOwner.js";
|
|
23
17
|
export type * from "./ma-v1/predictAddress.js";
|
|
24
18
|
export { predictMultiOwnerModularAccountV1Address } from "./ma-v1/predictAddress.js";
|
|
25
19
|
export { multiOwnerModularAccountStaticImpl } from "./ma-v1/mav1StaticImpl.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAGhC,mBAAmB,qCAAqC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,mBAAmB,iDAAiD,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAGhC,mBAAmB,qCAAqC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,mBAAmB,iDAAiD,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,mBAAmB,mCAAmC,CAAC;AACvD,OAAO,EACL,0BAA0B,EAC1B,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,mBAAmB,6BAA6B,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,aAAa,GACd,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,2CAA2C,CAAC;AAGnD,mBAAmB,0BAA0B,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B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AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,mBAAmB,kBAAkB,CAAC;AAEtC,mBAAmB,0BAA0B,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,mBAAmB,kCAAkC,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,kCAAkC,CAAC;AAE1C,mBAAmB,wBAAwB,CAAC;AAC5C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,gCAAgC,EAChC,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,EAC9B,kBAAkB,GACnB,MAAM,qCAAqC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/light-account/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,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,GAAG,OAAO,CAAC,OAAO,CAAC,CAsCrC"}
|
|
@@ -9,8 +9,6 @@ export type MultiOwnerModularAccountV1FactoryArgs = {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Static implementation logic for ModularAccountV1.
|
|
12
|
-
*
|
|
13
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
14
12
|
*/
|
|
15
13
|
export declare const multiOwnerModularAccountStaticImpl: StaticSmartAccountImplementation<false, "0.6", MultiOwnerModularAccountV1FactoryArgs, typeof entryPoint06Abi, typeof UpgradeableModularAccountAbi, typeof MultiOwnerModularAccountFactoryAbi>;
|
|
16
14
|
//# sourceMappingURL=mav1StaticImpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mav1StaticImpl.d.ts","sourceRoot":"","sources":["../../../src/ma-v1/mav1StaticImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAsB,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAuB,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,kCAAkC,EAAE,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAInF,MAAM,MAAM,qCAAqC,GAAG;IAClD,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"mav1StaticImpl.d.ts","sourceRoot":"","sources":["../../../src/ma-v1/mav1StaticImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAsB,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAuB,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,kCAAkC,EAAE,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAInF,MAAM,MAAM,qCAAqC,GAAG;IAClD,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC,EAAE,gCAAgC,CAC/E,KAAK,EACL,KAAK,EACL,qCAAqC,EACrC,OAAO,eAAe,EACtB,OAAO,4BAA4B,EACnC,OAAO,kCAAkC,CA2B1C,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type Address, type Client, type Hex, type IsUndefined, type Chain, type
|
|
|
2
2
|
import type { HookConfig, ValidationConfig } from "../types.js";
|
|
3
3
|
import type { ModularAccountV2 } from "../accounts/account.js";
|
|
4
4
|
import type { GetAccountParameter } from "../../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import type { SmartAccount } from "viem/account-abstraction";
|
|
6
6
|
export type InstallValidationParams<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
7
7
|
validationConfig: ValidationConfig;
|
|
8
8
|
selectors: Hex[];
|
|
@@ -20,27 +20,23 @@ export type UninstallValidationParams<TAccount extends SmartAccount | undefined
|
|
|
20
20
|
} & GetAccountParameter<TAccount, ModularAccountV2>;
|
|
21
21
|
export type InstallValidationActions<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
22
22
|
encodeInstallValidation: (args: InstallValidationParams<TAccount>) => Promise<Hex>;
|
|
23
|
-
installValidation: (args: InstallValidationParams<TAccount>) => Promise<Hex>;
|
|
24
23
|
encodeUninstallValidation: (args: UninstallValidationParams<TAccount>) => Promise<Hex>;
|
|
25
|
-
uninstallValidation: (args: UninstallValidationParams<TAccount>) => Promise<Hex>;
|
|
26
24
|
};
|
|
27
25
|
/**
|
|
28
|
-
* Provides validation installation and uninstallation functionalities for a MA v2 client
|
|
26
|
+
* Provides validation installation and uninstallation encoding functionalities for a MA v2 client.
|
|
29
27
|
*
|
|
30
28
|
* @example
|
|
31
29
|
* ```ts
|
|
32
|
-
* import {
|
|
30
|
+
* import { installValidationActions, SingleSignerValidationModule } from "@alchemy/smart-accounts";
|
|
33
31
|
* import { Address } from "viem";
|
|
34
32
|
*
|
|
35
33
|
* const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);
|
|
36
34
|
* const sessionKeyAddress: Address = "0x1234";
|
|
37
35
|
* const sessionKeyEntityId: number = 1;
|
|
38
36
|
*
|
|
39
|
-
* await client.
|
|
37
|
+
* const callData = await client.encodeInstallValidation({
|
|
40
38
|
* validationConfig: {
|
|
41
|
-
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(
|
|
42
|
-
* client.chain
|
|
43
|
-
* ),
|
|
39
|
+
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(client.chain),
|
|
44
40
|
* entityId: sessionKeyEntityId,
|
|
45
41
|
* isGlobal: true,
|
|
46
42
|
* isSignatureValidation: false,
|
|
@@ -54,19 +50,11 @@ export type InstallValidationActions<TAccount extends SmartAccount | undefined =
|
|
|
54
50
|
* hooks: [],
|
|
55
51
|
* });
|
|
56
52
|
*
|
|
57
|
-
* await client.
|
|
58
|
-
* moduleAddress: sessionKeyAddress,
|
|
59
|
-
* entityId: sessionKeyEntityId,
|
|
60
|
-
* uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
|
|
61
|
-
* entityId: sessionKeyEntityId,
|
|
62
|
-
* }),
|
|
63
|
-
* hookUninstallDatas: [],
|
|
64
|
-
* });
|
|
65
|
-
*
|
|
53
|
+
* await client.sendUserOperation({ callData, account });
|
|
66
54
|
* ```
|
|
67
55
|
*
|
|
68
|
-
* @param {object} client - The client instance which provides account
|
|
69
|
-
* @returns {object} - An object containing
|
|
56
|
+
* @param {object} client - The client instance which provides account functionality.
|
|
57
|
+
* @returns {object} - An object containing `encodeInstallValidation` and `encodeUninstallValidation`.
|
|
70
58
|
*/
|
|
71
59
|
export declare function installValidationActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined>(client: Client<TTransport, TChain, TAccount>): InstallValidationActions<IsUndefined<TAccount> extends true ? undefined : ModularAccountV2>;
|
|
72
60
|
//# sourceMappingURL=installValidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installValidation.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,SAAS,EAIf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"installValidation.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,SAAS,EAIf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAa7D,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,I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BAAgB,CAClE,CA+EA"}
|
|
@@ -10,15 +10,11 @@ export type SemiModularAccountV2FactoryArgs = {
|
|
|
10
10
|
export type SemiModularAccountV2StaticImpl = StaticSmartAccountImplementation<false, "0.7", SemiModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof semiModularAccountBytecodeAbi, typeof accountFactoryAbi>;
|
|
11
11
|
/**
|
|
12
12
|
* Static implementation logic for SemiModularAccountV2.
|
|
13
|
-
*
|
|
14
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
15
13
|
*/
|
|
16
14
|
export declare const semiModularAccountV2StaticImpl: SemiModularAccountV2StaticImpl;
|
|
17
15
|
export type SemiModularAccount7702StaticImpl = StaticSmartAccountImplementation<true, "0.7", SemiModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof semiModularAccountBytecodeAbi, typeof accountFactoryAbi>;
|
|
18
16
|
/**
|
|
19
17
|
* Static implementation logic for SemiModularAccount7702.
|
|
20
|
-
*
|
|
21
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
22
18
|
*/
|
|
23
19
|
export declare const semiModularAccount7702StaticImpl: SemiModularAccount7702StaticImpl;
|
|
24
20
|
//# sourceMappingURL=mav2StaticImpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mav2StaticImpl.d.ts","sourceRoot":"","sources":["../../../src/ma-v2/mav2StaticImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAuB,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,gCAAgC,CAC3E,KAAK,EACL,KAAK,EACL,+BAA+B,EAC/B,OAAO,eAAe,EACtB,OAAO,6BAA6B,EACpC,OAAO,iBAAiB,CACzB,CAAC;AAeF
|
|
1
|
+
{"version":3,"file":"mav2StaticImpl.d.ts","sourceRoot":"","sources":["../../../src/ma-v2/mav2StaticImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAuB,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,gCAAgC,CAC3E,KAAK,EACL,KAAK,EACL,+BAA+B,EAC/B,OAAO,eAAe,EACtB,OAAO,6BAA6B,EACpC,OAAO,iBAAiB,CACzB,CAAC;AAeF;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAqB5C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,gCAAgC,CAC7E,IAAI,EACJ,KAAK,EACL,+BAA+B,EAC/B,OAAO,eAAe,EACtB,OAAO,6BAA6B,EACpC,OAAO,iBAAiB,CACzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,EAAE,gCAI5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/utils/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAA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;;CAME,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,GAAkB,CAAC;AAE1D,MAAM,MAAM,oBAAoB,CAC9B,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IAClE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAElC;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,aAAa,CAAC,CAWxB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,+DAK/B,gBAAgB,KAAG,MAOrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,IAAI,oBAAoB,CAKjC"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "5.0.0-beta.
|
|
1
|
+
export declare const VERSION = "5.0.0-beta.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/smart-accounts",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.6",
|
|
4
4
|
"description": "This package contains all of the viem interfaces for Alchemy's Smart Contract Accounts",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"test:run": "vitest run"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@alchemy/aa-infra": "^5.0.0-beta.
|
|
42
|
+
"@alchemy/aa-infra": "^5.0.0-beta.6",
|
|
43
43
|
"typescript-template": "*",
|
|
44
44
|
"viem": "^2.45.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@alchemy/common": "^5.0.0-beta.
|
|
47
|
+
"@alchemy/common": "^5.0.0-beta.6"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"viem": "^2.45.0"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "6a34c5337da69e0029d8e63d6797ba818ba473d6"
|
|
65
65
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,16 +7,6 @@ export { toLightAccount } from "./light-account/accounts/account.js";
|
|
|
7
7
|
export type * from "./light-account/accounts/multi-owner-account.js";
|
|
8
8
|
export { toMultiOwnerLightAccount } from "./light-account/accounts/multi-owner-account.js";
|
|
9
9
|
|
|
10
|
-
// TODO(v5): Something to consider for v5 - can we cut the exports for the account-specific actions
|
|
11
|
-
// from the public interface, and just consume these internally with account + rely on the standard
|
|
12
|
-
// bundlerClient actions for performing state writes (i.e. rotating owners)? I'm not sure it's useful
|
|
13
|
-
// to consumers outside of attaching to instances of a client with the right action.
|
|
14
|
-
export type * from "./light-account/decorators/singleOwner.js";
|
|
15
|
-
export { singleOwnerLightAccountActions } from "./light-account/decorators/singleOwner.js";
|
|
16
|
-
|
|
17
|
-
export type * from "./light-account/decorators/multiOwner.js";
|
|
18
|
-
export { multiOwnerLightAccountActions } from "./light-account/decorators/multiOwner.js";
|
|
19
|
-
|
|
20
10
|
export type * from "./light-account/predictAddress.js";
|
|
21
11
|
export {
|
|
22
12
|
predictLightAccountAddress,
|
|
@@ -52,9 +42,6 @@ export { toModularAccountV1Base } from "./ma-v1/accounts/base.js";
|
|
|
52
42
|
export type * from "./ma-v1/accounts/multi-owner-account.js";
|
|
53
43
|
export { toMultiOwnerModularAccountV1 } from "./ma-v1/accounts/multi-owner-account.js";
|
|
54
44
|
|
|
55
|
-
export type * from "./ma-v1/decorators/multiOwner.js";
|
|
56
|
-
export { multiOwnerModularAccountV1Actions } from "./ma-v1/decorators/multiOwner.js";
|
|
57
|
-
|
|
58
45
|
export type * from "./ma-v1/predictAddress.js";
|
|
59
46
|
export { predictMultiOwnerModularAccountV1Address } from "./ma-v1/predictAddress.js";
|
|
60
47
|
|
|
@@ -128,7 +128,6 @@ export async function toLightAccountBase<
|
|
|
128
128
|
).map((x) => x.accountImplementation);
|
|
129
129
|
|
|
130
130
|
const getStorageAtAction = getAction(client, getStorageAt, "getStorageAt");
|
|
131
|
-
// TODO(v5): This is a super fragile workflow, and we should consider not supporting this on the SmartAccount level in v5.
|
|
132
131
|
const storage = await getStorageAtAction({
|
|
133
132
|
address: accountAddress,
|
|
134
133
|
slot: EIP1967_PROXY_IMPL_STORAGE_SLOT,
|
|
@@ -6,12 +6,6 @@ import type { LightAccountBase } from "./accounts/base.js";
|
|
|
6
6
|
import type { LightAccountType, LightAccountVersion } from "./registry.js";
|
|
7
7
|
import { AccountVersionRegistry } from "./registry.js";
|
|
8
8
|
|
|
9
|
-
// TODO(v5): The pattern of getDefaultXYZAddress(…) doesn’t really make sense as a standalone.
|
|
10
|
-
// We built this expecting lots of diverging addresses per chain, but in practice we have none
|
|
11
|
-
// (and we’ve turned down things that require this). Instead: we could build the
|
|
12
|
-
// default-but-overridable behavior into the consuming functions themselves (i.e.
|
|
13
|
-
// createLightAccount defaulting to a factory address, but make it overridable)
|
|
14
|
-
|
|
15
9
|
/**
|
|
16
10
|
* Get the default light account version for the given light account type
|
|
17
11
|
*
|
|
@@ -160,7 +160,7 @@ export async function toModularAccountV1Base<
|
|
|
160
160
|
);
|
|
161
161
|
const { type, data } = await prepareSignature({
|
|
162
162
|
type: "eth_signTypedData_v4",
|
|
163
|
-
data: params as TypedDataDefinition,
|
|
163
|
+
data: params as TypedDataDefinition,
|
|
164
164
|
});
|
|
165
165
|
return type === "personal_sign"
|
|
166
166
|
? signMessageAction({ account: owner, message: data })
|
|
@@ -14,8 +14,6 @@ export type MultiOwnerModularAccountV1FactoryArgs = {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Static implementation logic for ModularAccountV1.
|
|
17
|
-
*
|
|
18
|
-
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
19
17
|
*/
|
|
20
18
|
export const multiOwnerModularAccountStaticImpl: StaticSmartAccountImplementation<
|
|
21
19
|
false,
|
|
@@ -27,7 +27,7 @@ import { LOGGER } from "../../logger.js";
|
|
|
27
27
|
|
|
28
28
|
type Mode = "default" | "7702";
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// This may be extended in the future with additional MAv2-specific methods.
|
|
31
31
|
export type ModularAccountV2 = ModularAccountV2Base & {};
|
|
32
32
|
|
|
33
33
|
export type ToModularAccountV2Params<
|
|
@@ -193,6 +193,6 @@ export async function toModularAccountV2<TMode extends Mode = Mode>({
|
|
|
193
193
|
|
|
194
194
|
return {
|
|
195
195
|
...base,
|
|
196
|
-
//
|
|
196
|
+
// This may be extended in the future with additional MAv2-specific methods.
|
|
197
197
|
};
|
|
198
198
|
}
|
|
@@ -380,7 +380,7 @@ export async function toModularAccountV2Base<
|
|
|
380
380
|
|
|
381
381
|
const { data } = await prepareSignature({
|
|
382
382
|
type: "eth_signTypedData_v4",
|
|
383
|
-
data: td as TypedDataDefinition,
|
|
383
|
+
data: td as TypedDataDefinition,
|
|
384
384
|
});
|
|
385
385
|
|
|
386
386
|
const action = getAction(client, signTypedData, "signTypedData");
|