@alchemy/smart-accounts 0.0.0-alpha.2 → 0.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/light-account/accounts/base.d.ts +1 -1
- package/dist/esm/light-account/accounts/base.js +1 -1
- package/dist/esm/light-account/accounts/base.js.map +1 -1
- package/dist/esm/light-account/decorators/multiOwner.js +2 -1
- package/dist/esm/light-account/decorators/multiOwner.js.map +1 -1
- package/dist/esm/light-account/decorators/singleOwner.js +1 -1
- package/dist/esm/light-account/decorators/singleOwner.js.map +1 -1
- package/dist/esm/light-account/registry.d.ts +1 -1
- package/dist/esm/light-account/registry.js.map +1 -1
- package/dist/esm/light-account/utils.js +1 -1
- package/dist/esm/light-account/utils.js.map +1 -1
- package/dist/esm/ma-v1/accounts/base.d.ts +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/decorators/multiOwner.js +2 -1
- package/dist/esm/ma-v1/decorators/multiOwner.js.map +1 -1
- package/dist/esm/ma-v2/accounts/base.d.ts +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/utils/account.js +2 -1
- package/dist/esm/ma-v2/utils/account.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/light-account/accounts/base.d.ts +1 -1
- package/dist/types/light-account/accounts/base.d.ts.map +1 -1
- package/dist/types/light-account/decorators/multiOwner.d.ts.map +1 -1
- package/dist/types/light-account/decorators/singleOwner.d.ts.map +1 -1
- package/dist/types/light-account/registry.d.ts +1 -1
- package/dist/types/light-account/registry.d.ts.map +1 -1
- package/dist/types/ma-v1/accounts/base.d.ts +1 -1
- package/dist/types/ma-v1/accounts/base.d.ts.map +1 -1
- package/dist/types/ma-v1/decorators/multiOwner.d.ts.map +1 -1
- package/dist/types/ma-v2/accounts/base.d.ts +1 -1
- package/dist/types/ma-v2/accounts/base.d.ts.map +1 -1
- package/dist/types/ma-v2/utils/account.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +2 -0
- package/src/light-account/accounts/base.ts +2 -2
- package/src/light-account/decorators/multiOwner.ts +4 -1
- package/src/light-account/decorators/singleOwner.ts +3 -1
- package/src/light-account/registry.ts +3 -1
- package/src/light-account/utils.ts +1 -1
- package/src/ma-v1/accounts/base.ts +2 -2
- package/src/ma-v1/decorators/multiOwner.ts +4 -1
- package/src/ma-v2/accounts/base.ts +2 -2
- package/src/ma-v2/utils/account.ts +4 -1
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAO3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAG3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAGzF,OAAO,EACL,0BAA0B,EAC1B,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,2CAA2C,CAAC;AAInD,O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AO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,SAAS;AACT,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","sourcesContent":["export type * from \"./types.js\";\n\n// LightAccount\nexport type * from \"./light-account/accounts/account.js\";\nexport { toLightAccount } from \"./light-account/accounts/account.js\";\n\nexport type * from \"./light-account/accounts/multi-owner-account.js\";\nexport { toMultiOwnerLightAccount } from \"./light-account/accounts/multi-owner-account.js\";\n\n// TODO(v5): Something to consider for v5 - can we cut the exports for the account-specific actions\n// from the public interface, and just consume these internally with account + rely on the standard\n// bundlerClient actions for performing state writes (i.e. rotating owners)? I'm not sure it's useful\n// to consumers outside of attaching to instances of a client with the right action.\nexport type * from \"./light-account/decorators/singleOwner.js\";\nexport { singleOwnerLightAccountActions } from \"./light-account/decorators/singleOwner.js\";\n\nexport type * from \"./light-account/decorators/multiOwner.js\";\nexport { multiOwnerLightAccountActions } from \"./light-account/decorators/multiOwner.js\";\n\nexport type * from \"./light-account/predictAddress.js\";\nexport {\n predictLightAccountAddress,\n predictMultiOwnerLightAccountAddress,\n} from \"./light-account/predictAddress.js\";\n\nexport { AccountVersionRegistry } from \"./light-account/registry.js\";\nexport type * from \"./light-account/registry.js\";\nexport {\n defaultLightAccountVersion,\n getLightAccountImplAddress,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n} from \"./light-account/utils.js\";\n\nexport {\n lightAccountStaticImplV1_0_1,\n lightAccountStaticImplV1_0_2,\n lightAccountStaticImplV1_1_0,\n lightAccountStaticImplV2_0_0,\n multiOwnerLightAccountStaticImplV2_0_0,\n} from \"./light-account/lightAccountStaticImpl.js\";\n\n// ModularAccountV1\nexport type * from \"./ma-v1/accounts/base.js\";\nexport { toModularAccountV1Base } from \"./ma-v1/accounts/base.js\";\n\nexport type * from \"./ma-v1/accounts/multi-owner-account.js\";\nexport { toMultiOwnerModularAccountV1 } from \"./ma-v1/accounts/multi-owner-account.js\";\n\nexport type * from \"./ma-v1/decorators/multiOwner.js\";\nexport { multiOwnerModularAccountV1Actions } from \"./ma-v1/decorators/multiOwner.js\";\n\nexport type * from \"./ma-v1/predictAddress.js\";\nexport { predictMultiOwnerModularAccountV1Address } from \"./ma-v1/predictAddress.js\";\n\nexport { multiOwnerModularAccountStaticImpl } from \"./ma-v1/mav1StaticImpl.js\";\n\nexport {\n DefaultMaV1Address,\n DefaultMaV1PluginAddress,\n} from \"./ma-v1/account.js\";\n\n// ModularAccountV2\nexport type * from \"./ma-v2/accounts/account.js\";\nexport { toModularAccountV2 } from \"./ma-v2/accounts/account.js\";\n\nexport type * from \"./ma-v2/accounts/base.js\";\nexport { toModularAccountV2Base } from \"./ma-v2/accounts/base.js\";\n\nexport type * from \"./ma-v2/decorators/deferralActions.js\";\nexport { deferralActions } from \"./ma-v2/decorators/deferralActions.js\";\n\nexport type * from \"./ma-v2/decorators/installValidation.js\";\nexport { installValidationActions } from \"./ma-v2/decorators/installValidation.js\";\n\nexport {\n semiModularAccountV2StaticImpl,\n semiModularAccount7702StaticImpl,\n webAuthnModularAccountV2StaticImpl,\n} from \"./ma-v2/mav2StaticImpl.js\";\nexport type * from \"./ma-v2/mav2StaticImpl.js\";\n\n// Modules\nexport { AllowlistModule } from \"./ma-v2/modules/allowlist-module/module.js\";\nexport { NativeTokenLimitModule } from \"./ma-v2/modules/native-token-limit-module/module.js\";\nexport { PaymasterGuardModule } from \"./ma-v2/modules/paymaster-guard-module/module.js\";\nexport { SingleSignerValidationModule } from \"./ma-v2/modules/single-signer-validation/module.js\";\nexport { TimeRangeModule } from \"./ma-v2/modules/time-range-module/module.js\";\nexport { WebAuthnValidationModule } from \"./ma-v2/modules/webauthn-validation/module.js\";\n\nexport type * from \"./ma-v2/permissionBuilder.js\";\nexport {\n PermissionBuilder,\n PermissionType,\n} from \"./ma-v2/permissionBuilder.js\";\n\nexport type * from \"./ma-v2/predictAddress.js\";\nexport { predictModularAccountV2Address } from \"./ma-v2/predictAddress.js\";\n\nexport type * from \"./ma-v2/types.js\";\n\nexport type * from \"./ma-v2/utils/account.js\";\nexport {\n DefaultAddress,\n DefaultModuleAddress,\n DEFAULT_OWNER_ENTITY_ID,\n EXECUTE_USER_OP_SELECTOR,\n getMAV2UpgradeToData,\n buildFullNonceKey,\n serializeModuleEntity,\n isModularAccountV2,\n} from \"./ma-v2/utils/account.js\";\n\nexport type * from \"./ma-v2/utils/deferredActions.js\";\nexport {\n parseDeferredAction,\n buildDeferredActionDigest,\n} from \"./ma-v2/utils/deferredActions.js\";\n\nexport type * from \"./ma-v2/utils/hooks.js\";\nexport {\n serializeValidationConfig,\n serializeHookConfig,\n} from \"./ma-v2/utils/hooks.js\";\n\nexport type * from \"./ma-v2/utils/signature.js\";\nexport {\n packUOSignature,\n pack1271Signature,\n toReplaySafeTypedData,\n toWebAuthnSignature,\n} from \"./ma-v2/utils/signature.js\";\n\n// Errors\nexport { EntityIdOverrideError } from \"./errors/EntityIdOverrideError.js\";\nexport { InvalidDeferredActionNonceError } from \"./errors/InvalidDeferredActionNonceError.js\";\nexport { InvalidEntityIdError } from \"./errors/InvalidEntityIdError.js\";\nexport { InvalidNonceKeyError } from \"./errors/InvalidNonceKeyError.js\";\nexport { InvalidOwnerError } from \"./errors/InvalidOwnerError.js\";\nexport {\n PermissionBuilderError,\n RootPermissionOnlyError,\n AccountAddressAsTargetError,\n DuplicateTargetAddressError,\n NoFunctionsProvidedError,\n ExpiredDeadlineError,\n DeadlineOverLimitError,\n ValidationConfigUnsetError,\n MultipleNativeTokenTransferError,\n ZeroAddressError,\n MultipleGasLimitError,\n UnsupportedPermissionTypeError,\n SelectorNotAllowed,\n} from \"./errors/permissionBuilderErrors.js\";\n"]}
|
|
@@ -4,7 +4,7 @@ import type { EntryPointFromAccountRegistry, LightAccountType, LightAccountVersi
|
|
|
4
4
|
import type { SignatureRequest } from "../../types.js";
|
|
5
5
|
export type BaseLightAccountImplementation<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>> = SmartAccountImplementation<EntryPointFromAccountRegistry<TLightAccountType, TLightAccountVersion>["abi"], EntryPointFromAccountRegistry<TLightAccountType, TLightAccountVersion>["version"], {
|
|
6
6
|
getLightAccountVersion: () => TLightAccountVersion;
|
|
7
|
-
|
|
7
|
+
smartAccountType: TLightAccountType;
|
|
8
8
|
encodeUpgradeToAndCall: (params: {
|
|
9
9
|
upgradeToAddress: Address;
|
|
10
10
|
upgradeToInitData: Hex;
|
|
@@ -159,7 +159,7 @@ export async function toLightAccountBase({ client, abi, accountAddress, owner, t
|
|
|
159
159
|
: signature;
|
|
160
160
|
},
|
|
161
161
|
extend: {
|
|
162
|
-
|
|
162
|
+
smartAccountType: type,
|
|
163
163
|
getLightAccountVersion: () => version,
|
|
164
164
|
encodeUpgradeToAndCall,
|
|
165
165
|
prepareSignature,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":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MAAM,EAAE;YACN,MAAM,EAAE,IAAI;YACZ,sBAAsB,EAAE,GAAG,EAAE,CAAC,OAAO;YACrC,sBAAsB;YACtB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n concat,\n concatHex,\n encodeFunctionData,\n fromHex,\n hashMessage,\n hashTypedData,\n trim,\n type Abi,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n getUserOperationHash,\n toSmartAccount,\n type SmartAccount,\n type SmartAccountImplementation,\n} from \"viem/account-abstraction\";\nimport { getStorageAt, signMessage, signTypedData } from \"viem/actions\";\nimport type {\n EntryPointFromAccountRegistry,\n LightAccountType,\n LightAccountVersion,\n} from \"../registry.js\";\nimport { EIP1967_PROXY_IMPL_STORAGE_SLOT } from \"../utils.js\";\nimport { AccountVersionRegistry } from \"../registry.js\";\nimport {\n encodeCallsLA as encodeCalls,\n decodeCallsLA as decodeCalls,\n} from \"./calldataCodec.js\";\nimport { BaseError, lowerAddress } from \"@alchemy/common\";\nimport type {\n SignatureRequest,\n StaticSmartAccountImplementation,\n} from \"../../types.js\";\nimport { getAction } from \"viem/utils\";\n\nconst SignaturePrefix = {\n EOA: \"0x00\",\n CONTRACT: \"0x01\",\n CONTRACT_WITH_ADDR: \"0x02\",\n} as const;\n\nexport type BaseLightAccountImplementation<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n> = SmartAccountImplementation<\n EntryPointFromAccountRegistry<TLightAccountType, TLightAccountVersion>[\"abi\"],\n EntryPointFromAccountRegistry<\n TLightAccountType,\n TLightAccountVersion\n >[\"version\"],\n {\n getLightAccountVersion: () => TLightAccountVersion;\n source: TLightAccountType;\n encodeUpgradeToAndCall: (params: {\n upgradeToAddress: Address;\n upgradeToInitData: Hex;\n }) => Promise<Hex>;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n false\n>;\n\nexport type LightAccountBase<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n> = SmartAccount<\n BaseLightAccountImplementation<TLightAccountType, TLightAccountVersion>\n>;\n\nexport type ToLightAccountBaseParams<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n abi: Abi;\n accountAddress: Address;\n owner: JsonRpcAccount | LocalAccount;\n type: TLightAccountType;\n version: TLightAccountVersion;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n};\n\nexport async function toLightAccountBase<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n>({\n client,\n abi,\n accountAddress,\n owner,\n type,\n version,\n getFactoryArgs,\n}: ToLightAccountBaseParams<\n TLightAccountType,\n TLightAccountVersion,\n TTransport\n>): Promise<LightAccountBase<TLightAccountType, TLightAccountVersion>> {\n const encodeUpgradeToAndCall = async ({\n upgradeToAddress,\n upgradeToInitData,\n }: {\n upgradeToAddress: Address;\n upgradeToInitData: Hex;\n }): Promise<Hex> => {\n const expectedImplAddresses = (\n Object.values(\n AccountVersionRegistry[type],\n ) as StaticSmartAccountImplementation<false>[]\n ).map((x) => x.accountImplementation);\n\n const getStorageAtAction = getAction(client, getStorageAt, \"getStorageAt\");\n // TODO(v5): This is a super fragile workflow, and we should consider not supporting this on the SmartAccount level in v5.\n const storage = await getStorageAtAction({\n address: accountAddress,\n slot: EIP1967_PROXY_IMPL_STORAGE_SLOT,\n });\n\n if (storage == null) {\n throw new BaseError(\n `Failed to get storage slot: ${EIP1967_PROXY_IMPL_STORAGE_SLOT}`,\n );\n }\n\n // Only upgrade undeployed accounts (storage 0) or deployed light accounts, else error.\n if (\n fromHex(storage, \"number\") !== 0 &&\n !expectedImplAddresses.some((x) => x === lowerAddress(trim(storage)))\n ) {\n throw new BaseError(\n `could not determine if smart account implementation is ${type} ${String(\n version,\n )}`,\n );\n }\n\n return encodeFunctionData({\n abi,\n functionName: \"upgradeToAndCall\",\n args: [upgradeToAddress, upgradeToInitData],\n });\n };\n\n const get1271Wrapper = (\n hashedMessage: Hex,\n version: string,\n ): TypedDataDefinition => {\n return {\n // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\n // https://github.com/alchemyplatform/light-account/blob/main/src/LightAccount.sol#L236\n domain: {\n chainId: client.chain.id,\n name: type,\n verifyingContract: accountAddress,\n version,\n },\n types: {\n LightAccountMessage: [{ name: \"message\", type: \"bytes\" }],\n },\n message: {\n message: hashedMessage,\n },\n primaryType: \"LightAccountMessage\",\n };\n };\n\n const prepareSignature = async (\n params: SignatureRequest,\n ): Promise<SignatureRequest> => {\n const messageHash =\n params.type === \"eth_signTypedData_v4\"\n ? hashTypedData(params.data)\n : hashMessage(params.data);\n\n switch (version) {\n case \"v1.0.1\":\n return params;\n case \"v1.0.2\":\n throw new BaseError(\n `Version ${String(version)} of LightAccount doesn't support 1271`,\n );\n case \"v1.1.0\":\n return {\n type: \"eth_signTypedData_v4\",\n data: get1271Wrapper(messageHash, \"1\"),\n };\n case \"v2.0.0\":\n return {\n type: \"eth_signTypedData_v4\",\n data: get1271Wrapper(messageHash, \"2\"),\n };\n default:\n throw new BaseError(\n `Unknown version ${String(version)} of LightAccount`,\n );\n }\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return version === \"v2.0.0\"\n ? concat([SignaturePrefix.EOA, signature])\n : signature;\n };\n\n const entryPoint = (\n AccountVersionRegistry[type][version] as StaticSmartAccountImplementation\n ).entryPoint;\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n return encodeCalls(calls);\n },\n\n async decodeCalls(data) {\n return decodeCalls(data, accountAddress);\n },\n\n async getStubSignature() {\n const signature =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n\n switch (version) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n return signature;\n case \"v2.0.0\":\n return concat([SignaturePrefix.EOA, signature]);\n default:\n throw new BaseError(`Unknown version ${type} of ${String(version)}`);\n }\n },\n\n async signMessage({ message }) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n\n const { type, data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n\n const sig =\n type === \"eth_signTypedData_v4\"\n ? await signTypedDataAction({\n ...data,\n account: owner,\n })\n : await signMessageAction({ account: owner, message: data });\n\n return formatSignature(sig);\n },\n\n async signTypedData(params) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n\n const { type, data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: params as TypedDataDefinition,\n });\n\n const sig =\n type === \"eth_signTypedData_v4\"\n ? await signTypedDataAction({\n ...data,\n account: owner,\n })\n : await signMessageAction({ account: owner, message: data });\n\n return formatSignature(sig);\n },\n\n async signUserOperation(parameters) {\n const { chainId = client.chain.id, ...userOperation } = parameters;\n const userOpHash = getUserOperationHash({\n chainId,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...userOperation,\n sender: accountAddress,\n },\n });\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n\n const signature = await signMessageAction({\n account: owner,\n message: { raw: userOpHash },\n });\n\n return version === \"v2.0.0\"\n ? concatHex([SignaturePrefix.EOA, signature])\n : signature;\n },\n\n extend: {\n source: type,\n getLightAccountVersion: () => version,\n encodeUpgradeToAndCall,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/light-account/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,aAAa,EACb,IAAI,GAUL,MAAM,MAAM,CAAC;AACd,OAAO,EACL,oBAAoB,EACpB,cAAc,GAGf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAMxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,aAAa,IAAI,WAAW,EAC5B,aAAa,IAAI,WAAW,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,MAAM;IACX,QAAQ,EAAE,MAAM;IAChB,kBAAkB,EAAE,MAAM;CAClB,CAAC;AAmDX,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAKtC,EACA,MAAM,EACN,GAAG,EACH,cAAc,EACd,KAAK,EACL,IAAI,EACJ,OAAO,EACP,cAAc,GAKf;IACC,MAAM,sBAAsB,GAAG,KAAK,EAAE,EACpC,gBAAgB,EAChB,iBAAiB,GAIlB,EAAgB,EAAE;QACjB,MAAM,qBAAqB,GACzB,MAAM,CAAC,MAAM,CACX,sBAAsB,CAAC,IAAI,CAAC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KAAK;gBACd,OAAO,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE;aAC7B,CAAC,CAAC;YAEH,OAAO,OAAO,KAAK,QAAQ;gBACzB,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBAC7C,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC;QAED,MAAM,EAAE;YACN,gBAAgB,EAAE,IAAI;YACtB,sBAAsB,EAAE,GAAG,EAAE,CAAC,OAAO;YACrC,sBAAsB;YACtB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n concat,\n concatHex,\n encodeFunctionData,\n fromHex,\n hashMessage,\n hashTypedData,\n trim,\n type Abi,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n getUserOperationHash,\n toSmartAccount,\n type SmartAccount,\n type SmartAccountImplementation,\n} from \"viem/account-abstraction\";\nimport { getStorageAt, signMessage, signTypedData } from \"viem/actions\";\nimport type {\n EntryPointFromAccountRegistry,\n LightAccountType,\n LightAccountVersion,\n} from \"../registry.js\";\nimport { EIP1967_PROXY_IMPL_STORAGE_SLOT } from \"../utils.js\";\nimport { AccountVersionRegistry } from \"../registry.js\";\nimport {\n encodeCallsLA as encodeCalls,\n decodeCallsLA as decodeCalls,\n} from \"./calldataCodec.js\";\nimport { BaseError, lowerAddress } from \"@alchemy/common\";\nimport type {\n SignatureRequest,\n StaticSmartAccountImplementation,\n} from \"../../types.js\";\nimport { getAction } from \"viem/utils\";\n\nconst SignaturePrefix = {\n EOA: \"0x00\",\n CONTRACT: \"0x01\",\n CONTRACT_WITH_ADDR: \"0x02\",\n} as const;\n\nexport type BaseLightAccountImplementation<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n> = SmartAccountImplementation<\n EntryPointFromAccountRegistry<TLightAccountType, TLightAccountVersion>[\"abi\"],\n EntryPointFromAccountRegistry<\n TLightAccountType,\n TLightAccountVersion\n >[\"version\"],\n {\n getLightAccountVersion: () => TLightAccountVersion;\n smartAccountType: TLightAccountType;\n encodeUpgradeToAndCall: (params: {\n upgradeToAddress: Address;\n upgradeToInitData: Hex;\n }) => Promise<Hex>;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n false\n>;\n\nexport type LightAccountBase<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n> = SmartAccount<\n BaseLightAccountImplementation<TLightAccountType, TLightAccountVersion>\n>;\n\nexport type ToLightAccountBaseParams<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n abi: Abi;\n accountAddress: Address;\n owner: JsonRpcAccount | LocalAccount;\n type: TLightAccountType;\n version: TLightAccountVersion;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n};\n\nexport async function toLightAccountBase<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n>({\n client,\n abi,\n accountAddress,\n owner,\n type,\n version,\n getFactoryArgs,\n}: ToLightAccountBaseParams<\n TLightAccountType,\n TLightAccountVersion,\n TTransport\n>): Promise<LightAccountBase<TLightAccountType, TLightAccountVersion>> {\n const encodeUpgradeToAndCall = async ({\n upgradeToAddress,\n upgradeToInitData,\n }: {\n upgradeToAddress: Address;\n upgradeToInitData: Hex;\n }): Promise<Hex> => {\n const expectedImplAddresses = (\n Object.values(\n AccountVersionRegistry[type],\n ) as StaticSmartAccountImplementation<false>[]\n ).map((x) => x.accountImplementation);\n\n const getStorageAtAction = getAction(client, getStorageAt, \"getStorageAt\");\n // TODO(v5): This is a super fragile workflow, and we should consider not supporting this on the SmartAccount level in v5.\n const storage = await getStorageAtAction({\n address: accountAddress,\n slot: EIP1967_PROXY_IMPL_STORAGE_SLOT,\n });\n\n if (storage == null) {\n throw new BaseError(\n `Failed to get storage slot: ${EIP1967_PROXY_IMPL_STORAGE_SLOT}`,\n );\n }\n\n // Only upgrade undeployed accounts (storage 0) or deployed light accounts, else error.\n if (\n fromHex(storage, \"number\") !== 0 &&\n !expectedImplAddresses.some((x) => x === lowerAddress(trim(storage)))\n ) {\n throw new BaseError(\n `could not determine if smart account implementation is ${type} ${String(\n version,\n )}`,\n );\n }\n\n return encodeFunctionData({\n abi,\n functionName: \"upgradeToAndCall\",\n args: [upgradeToAddress, upgradeToInitData],\n });\n };\n\n const get1271Wrapper = (\n hashedMessage: Hex,\n version: string,\n ): TypedDataDefinition => {\n return {\n // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\n // https://github.com/alchemyplatform/light-account/blob/main/src/LightAccount.sol#L236\n domain: {\n chainId: client.chain.id,\n name: type,\n verifyingContract: accountAddress,\n version,\n },\n types: {\n LightAccountMessage: [{ name: \"message\", type: \"bytes\" }],\n },\n message: {\n message: hashedMessage,\n },\n primaryType: \"LightAccountMessage\",\n };\n };\n\n const prepareSignature = async (\n params: SignatureRequest,\n ): Promise<SignatureRequest> => {\n const messageHash =\n params.type === \"eth_signTypedData_v4\"\n ? hashTypedData(params.data)\n : hashMessage(params.data);\n\n switch (version) {\n case \"v1.0.1\":\n return params;\n case \"v1.0.2\":\n throw new BaseError(\n `Version ${String(version)} of LightAccount doesn't support 1271`,\n );\n case \"v1.1.0\":\n return {\n type: \"eth_signTypedData_v4\",\n data: get1271Wrapper(messageHash, \"1\"),\n };\n case \"v2.0.0\":\n return {\n type: \"eth_signTypedData_v4\",\n data: get1271Wrapper(messageHash, \"2\"),\n };\n default:\n throw new BaseError(\n `Unknown version ${String(version)} of LightAccount`,\n );\n }\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return version === \"v2.0.0\"\n ? concat([SignaturePrefix.EOA, signature])\n : signature;\n };\n\n const entryPoint = (\n AccountVersionRegistry[type][version] as StaticSmartAccountImplementation\n ).entryPoint;\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n return encodeCalls(calls);\n },\n\n async decodeCalls(data) {\n return decodeCalls(data, accountAddress);\n },\n\n async getStubSignature() {\n const signature =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n\n switch (version) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n return signature;\n case \"v2.0.0\":\n return concat([SignaturePrefix.EOA, signature]);\n default:\n throw new BaseError(`Unknown version ${type} of ${String(version)}`);\n }\n },\n\n async signMessage({ message }) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n\n const { type, data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n\n const sig =\n type === \"eth_signTypedData_v4\"\n ? await signTypedDataAction({\n ...data,\n account: owner,\n })\n : await signMessageAction({ account: owner, message: data });\n\n return formatSignature(sig);\n },\n\n async signTypedData(params) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n\n const { type, data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: params as TypedDataDefinition,\n });\n\n const sig =\n type === \"eth_signTypedData_v4\"\n ? await signTypedDataAction({\n ...data,\n account: owner,\n })\n : await signMessageAction({ account: owner, message: data });\n\n return formatSignature(sig);\n },\n\n async signUserOperation(parameters) {\n const { chainId = client.chain.id, ...userOperation } = parameters;\n const userOpHash = getUserOperationHash({\n chainId,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...userOperation,\n sender: accountAddress,\n },\n });\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n\n const signature = await signMessageAction({\n account: owner,\n message: { raw: userOpHash },\n });\n\n return version === \"v2.0.0\"\n ? concatHex([SignaturePrefix.EOA, signature])\n : signature;\n },\n\n extend: {\n smartAccountType: type,\n getLightAccountVersion: () => version,\n encodeUpgradeToAndCall,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
|
|
@@ -2,7 +2,8 @@ import { sendUserOperation } from "viem/account-abstraction";
|
|
|
2
2
|
import { getAction } from "viem/utils";
|
|
3
3
|
import { AccountNotFoundError } from "@alchemy/common";
|
|
4
4
|
function isMultiOwnerLightAccount(account) {
|
|
5
|
-
return "
|
|
5
|
+
return ("smartAccountType" in account &&
|
|
6
|
+
account.smartAccountType === "MultiOwnerLightAccount");
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Generates client actions for a multi-owner light account, including the ability to update owners.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../src/light-account/decorators/multiOwner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAevD,SAAS,wBAAwB,CAC/B,OAAqB;IAErB,OAAO,
|
|
1
|
+
{"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../src/light-account/decorators/multiOwner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAevD,SAAS,wBAAwB,CAC/B,OAAqB;IAErB,OAAO,CACL,kBAAkB,IAAI,OAAO;QAC7B,OAAO,CAAC,gBAAgB,KAAK,wBAAwB,CACtD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAK3C,MAA4C;IAI5C,OAAO;QACL,yFAAyF;QACzF,uFAAuF;QACvF,6EAA6E;QAC7E,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;YAEvE,IAAI,CAAC,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,oBAAoB,EAAE,CAAC;YACnC,CAAC;YAED,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAErE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;YACzE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;gBAC1B,KAAK,EAAE;oBACL;wBACE,EAAE,EAAE,OAAO,CAAC,OAAO;wBACnB,IAAI;qBACL;iBACF;gBACD,OAAO;aACR,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Address, Chain, Client, Hex, IsUndefined, Transport } from \"viem\";\nimport { sendUserOperation, type SmartAccount } from \"viem/account-abstraction\";\nimport { getAction } from \"viem/utils\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multi-owner-account.js\";\nimport { AccountNotFoundError } from \"@alchemy/common\";\n\nexport type MultiOwnerLightAccountActions<\n TAccount extends MultiOwnerLightAccount | undefined =\n | MultiOwnerLightAccount\n | undefined,\n> = {\n updateOwners: (\n args: {\n ownersToAdd: Address[];\n ownersToRemove: Address[];\n } & GetAccountParameter<TAccount, MultiOwnerLightAccount>,\n ) => Promise<Hex>;\n};\n\nfunction isMultiOwnerLightAccount(\n account: SmartAccount,\n): account is MultiOwnerLightAccount {\n return (\n \"smartAccountType\" in account &&\n account.smartAccountType === \"MultiOwnerLightAccount\"\n );\n}\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance used to interact with the account\n * @returns {MultiOwnerLightAccountActions<TAccount>} An object containing the client actions specifically for a multi-owner light account\n */\nexport function multiOwnerLightAccountActions<\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): MultiOwnerLightAccountActions<\n IsUndefined<TAccount> extends true ? undefined : MultiOwnerLightAccount\n> {\n return {\n // TODO(v5): Another pattern I think we should consider deprecating for v5 - actions that\n // implicitly do a sendUserOperation internally. These are non-composable with batching\n // and have a number of other issues that are solved with viem writeContract.\n updateOwners: async (args) => {\n const { ownersToAdd, ownersToRemove, account = client.account } = args;\n\n if (!account || !isMultiOwnerLightAccount(account)) {\n throw new AccountNotFoundError();\n }\n\n const data = account.encodeUpdateOwners(ownersToAdd, ownersToRemove);\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n calls: [\n {\n to: account.address,\n data,\n },\n ],\n account,\n });\n\n return result;\n },\n };\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { AccountNotFoundError } from "@alchemy/common";
|
|
|
2
2
|
import { sendUserOperation } from "viem/account-abstraction";
|
|
3
3
|
import { getAction } from "viem/utils";
|
|
4
4
|
function isLightAccount(account) {
|
|
5
|
-
return "
|
|
5
|
+
return ("smartAccountType" in account && account.smartAccountType === "LightAccount");
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A decorator that can be used with viem's bundler client to add light account actions to the client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleOwner.js","sourceRoot":"","sources":["../../../../src/light-account/decorators/singleOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAcvC,SAAS,cAAc,CAAC,OAAqB;IAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"singleOwner.js","sourceRoot":"","sources":["../../../../src/light-account/decorators/singleOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAcvC,SAAS,cAAc,CAAC,OAAqB;IAC3C,OAAO,CACL,kBAAkB,IAAI,OAAO,IAAI,OAAO,CAAC,gBAAgB,KAAK,cAAc,CAC7E,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAK5C,MAA4C;IAI5C,OAAO;QACL,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;YAEpD,IAAI,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzC,MAAM,IAAI,oBAAoB,EAAE,CAAC;YACnC,CAAC;YAED,MAAM,IAAI,GAAG,OAAO,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAEvD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;YACzE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;gBAC1B,KAAK,EAAE;oBACL;wBACE,EAAE,EAAE,OAAO,CAAC,OAAO;wBACnB,IAAI;qBACL;iBACF;gBACD,OAAO;aACR,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { AccountNotFoundError } from \"@alchemy/common\";\nimport type { Address, Chain, Client, Hex, IsUndefined, Transport } from \"viem\";\nimport { sendUserOperation, type SmartAccount } from \"viem/account-abstraction\";\nimport { getAction } from \"viem/utils\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport type { LightAccount } from \"../accounts/account.js\";\n\nexport type LightAccountActions<\n TAccount extends LightAccount | undefined = LightAccount | undefined,\n> = {\n transferOwnership: (\n args: {\n newOwner: Address;\n } & GetAccountParameter<TAccount, LightAccount>,\n ) => Promise<Hex>;\n};\n\nfunction isLightAccount(account: SmartAccount): account is LightAccount {\n return (\n \"smartAccountType\" in account && account.smartAccountType === \"LightAccount\"\n );\n}\n\n/**\n * A decorator that can be used with viem's bundler client to add light account actions to the client\n *\n * @param {BundlerClient<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions\n * @returns {LightAccountActions<TAccount>} An object containing the available light account actions\n */\nexport function singleOwnerLightAccountActions<\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): LightAccountActions<\n IsUndefined<TAccount> extends true ? undefined : LightAccount\n> {\n return {\n transferOwnership: async (args) => {\n const { newOwner, account = client.account } = args;\n\n if (!account || !isLightAccount(account)) {\n throw new AccountNotFoundError();\n }\n\n const data = account.encodeTransferOwnership(newOwner);\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n calls: [\n {\n to: account.address,\n data,\n },\n ],\n account,\n });\n\n return result;\n },\n };\n}\n"]}
|
|
@@ -7103,7 +7103,7 @@ export declare const AccountVersionRegistry: {
|
|
|
7103
7103
|
};
|
|
7104
7104
|
export type LightAccountType = Extract<keyof typeof AccountVersionRegistry, "LightAccount" | "MultiOwnerLightAccount">;
|
|
7105
7105
|
export type LightAccountVersion<TAccountType extends LightAccountType> = keyof (typeof AccountVersionRegistry)[TAccountType];
|
|
7106
|
-
export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["
|
|
7106
|
+
export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["smartAccountType"] extends LightAccountType ? TAccount["smartAccountType"] : never;
|
|
7107
7107
|
export type LightAccountAbi<TAccountType extends LightAccountType, TAccountVersion extends LightAccountVersion<TAccountType>> = TAccountVersion extends keyof (typeof AccountVersionRegistry)[TAccountType] ? (typeof AccountVersionRegistry)[TAccountType][TAccountVersion] extends StaticSmartAccountImplementation ? (typeof AccountVersionRegistry)[TAccountType][TAccountVersion]["accountAbi"] : never : never;
|
|
7108
7108
|
/**
|
|
7109
7109
|
* Infers the EntryPoint details as a type, given the account type and version.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/light-account/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,6BAA6B,CAAC;AAGrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE;QACZ,QAAQ,EAAE,4BAA4B;QACtC,QAAQ,EAAE,4BAA4B;QACtC,QAAQ,EAAE,4BAA4B;QACtC,QAAQ,EAAE,4BAA4B;KACvC;IACD,sBAAsB,EAAE;QACtB,QAAQ,EAAE,sCAAsC;KACjD;CACyE,CAAC","sourcesContent":["import type { Abi, Address } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base.js\";\nimport {\n lightAccountStaticImplV1_0_1,\n lightAccountStaticImplV1_0_2,\n lightAccountStaticImplV1_1_0,\n lightAccountStaticImplV2_0_0,\n multiOwnerLightAccountStaticImplV2_0_0,\n} from \"./lightAccountStaticImpl.js\";\nimport type { StaticSmartAccountImplementation } from \"../types.js\";\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry = {\n LightAccount: {\n \"v1.0.1\": lightAccountStaticImplV1_0_1,\n \"v1.0.2\": lightAccountStaticImplV1_0_2,\n \"v1.1.0\": lightAccountStaticImplV1_1_0,\n \"v2.0.0\": lightAccountStaticImplV2_0_0,\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": multiOwnerLightAccountStaticImplV2_0_0,\n },\n} satisfies Record<string, Record<string, StaticSmartAccountImplementation>>;\n\nexport type LightAccountType = Extract<\n keyof typeof AccountVersionRegistry,\n \"LightAccount\" | \"MultiOwnerLightAccount\"\n>;\n\nexport type LightAccountVersion<TAccountType extends LightAccountType> =\n keyof (typeof AccountVersionRegistry)[TAccountType];\n\nexport type GetLightAccountType<TAccount extends LightAccountBase> =\n TAccount[\"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/light-account/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,6BAA6B,CAAC;AAGrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE;QACZ,QAAQ,EAAE,4BAA4B;QACtC,QAAQ,EAAE,4BAA4B;QACtC,QAAQ,EAAE,4BAA4B;QACtC,QAAQ,EAAE,4BAA4B;KACvC;IACD,sBAAsB,EAAE;QACtB,QAAQ,EAAE,sCAAsC;KACjD;CACyE,CAAC","sourcesContent":["import type { Abi, Address } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base.js\";\nimport {\n lightAccountStaticImplV1_0_1,\n lightAccountStaticImplV1_0_2,\n lightAccountStaticImplV1_1_0,\n lightAccountStaticImplV2_0_0,\n multiOwnerLightAccountStaticImplV2_0_0,\n} from \"./lightAccountStaticImpl.js\";\nimport type { StaticSmartAccountImplementation } from \"../types.js\";\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry = {\n LightAccount: {\n \"v1.0.1\": lightAccountStaticImplV1_0_1,\n \"v1.0.2\": lightAccountStaticImplV1_0_2,\n \"v1.1.0\": lightAccountStaticImplV1_1_0,\n \"v2.0.0\": lightAccountStaticImplV2_0_0,\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": multiOwnerLightAccountStaticImplV2_0_0,\n },\n} satisfies Record<string, Record<string, StaticSmartAccountImplementation>>;\n\nexport type LightAccountType = Extract<\n keyof typeof AccountVersionRegistry,\n \"LightAccount\" | \"MultiOwnerLightAccount\"\n>;\n\nexport type LightAccountVersion<TAccountType extends LightAccountType> =\n keyof (typeof AccountVersionRegistry)[TAccountType];\n\nexport type GetLightAccountType<TAccount extends LightAccountBase> =\n TAccount[\"smartAccountType\"] extends LightAccountType\n ? TAccount[\"smartAccountType\"]\n : never;\n\nexport type LightAccountAbi<\n TAccountType extends LightAccountType,\n TAccountVersion extends LightAccountVersion<TAccountType>,\n> = TAccountVersion extends keyof (typeof AccountVersionRegistry)[TAccountType]\n ? (typeof AccountVersionRegistry)[TAccountType][TAccountVersion] extends StaticSmartAccountImplementation\n ? (typeof AccountVersionRegistry)[TAccountType][TAccountVersion][\"accountAbi\"]\n : never\n : never;\n\n/**\n * Infers the EntryPoint details as a type, given the account type and version.\n */\nexport type EntryPointFromAccountRegistry<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n> =\n (typeof AccountVersionRegistry)[TLightAccountType][TLightAccountVersion] extends StaticSmartAccountImplementation<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _7702,\n infer entryPointVersion,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _factoryArgs,\n infer entryPointAbi extends Abi\n >\n ? (typeof AccountVersionRegistry)[TLightAccountType][TLightAccountVersion][\"entryPoint\"] extends {\n readonly version: entryPointVersion;\n readonly address: Address;\n readonly abi: entryPointAbi;\n }\n ? (typeof AccountVersionRegistry)[TLightAccountType][TLightAccountVersion][\"entryPoint\"]\n : never\n : never;\n"]}
|
|
@@ -46,7 +46,7 @@ export async function getLightAccountImplAddress(account) {
|
|
|
46
46
|
throw new ChainNotFoundError();
|
|
47
47
|
}
|
|
48
48
|
const version = account.getLightAccountVersion();
|
|
49
|
-
const type = account.
|
|
49
|
+
const type = account.smartAccountType;
|
|
50
50
|
const expectedImplAddresses = Object.values(AccountVersionRegistry[type]).map((x) => x.accountImplementation);
|
|
51
51
|
const getStorageAtAction = getAction(client, getStorageAt, "getStorageAt");
|
|
52
52
|
const storage = await getStorageAtAction({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/light-account/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,IAAI,EAAgB,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,8FAA8F;AAC9F,8FAA8F;AAC9F,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAEE,EAAE,CAAC,QAAQ,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,sBAA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,CAAC;IACJ,CAAC;IAED,IACE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1B,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EACrE,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,0DAA0D,IAAI,IAAI,MAAM,CACtE,OAAO,CACR,EAAE,CACJ,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import { BaseError, ChainNotFoundError, lowerAddress } from \"@alchemy/common\";\nimport { hexToNumber, trim, type Address } from \"viem\";\nimport { getStorageAt } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\nimport type { LightAccountBase } from \"./accounts/base.js\";\nimport type { LightAccountType, LightAccountVersion } from \"./registry.js\";\nimport { AccountVersionRegistry } from \"./registry.js\";\n\n// TODO(v5): The pattern of getDefaultXYZAddress(…) doesn’t really make sense as a standalone.\n// We built this expecting lots of diverging addresses per chain, but in practice we have none\n// (and we’ve turned down things that require this). Instead: we could build the\n// default-but-overridable behavior into the consuming functions themselves (i.e.\n// createLightAccount defaulting to a factory address, but make it overridable)\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @returns {LightAccountVersion<TLightAccountType>} the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType,\n>(): LightAccountVersion<TLightAccountType> => \"v2.0.0\";\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) => [x.factoryAddress]).flat(),\n);\n\nexport const EIP1967_PROXY_IMPL_STORAGE_SLOT =\n \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\";\n\n/**\n * Get the light account implementation address for the given light account\n *\n * @param {LightAccountBase} account - the light account to get the implementation address for\n * @returns {Promise<Address>} the light account implementation address for the given light account\n */\nexport async function getLightAccountImplAddress<\n TAccount extends LightAccountBase,\n>(account: TAccount): Promise<Address> {\n const client = account.client;\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n const version = account.getLightAccountVersion();\n const type = account.smartAccountType;\n\n const expectedImplAddresses = Object.values(AccountVersionRegistry[type]).map(\n (x) => x.accountImplementation,\n );\n\n const getStorageAtAction = getAction(client, getStorageAt, \"getStorageAt\");\n\n const storage = await getStorageAtAction({\n address: account.address,\n slot: EIP1967_PROXY_IMPL_STORAGE_SLOT,\n });\n\n if (storage == null) {\n throw new BaseError(\n `Failed to get storage slot: ${EIP1967_PROXY_IMPL_STORAGE_SLOT}`,\n );\n }\n\n if (\n hexToNumber(storage) !== 0 &&\n !expectedImplAddresses.some((x) => x === lowerAddress(trim(storage)))\n ) {\n throw new BaseError(\n `could not determine if smart account implementation is ${type} ${String(\n version,\n )}`,\n );\n }\n\n return trim(storage);\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { entryPoint06Abi, type SmartAccount, type SmartAccountImplementation } f
|
|
|
3
3
|
import type { SignatureRequest } from "../../types.js";
|
|
4
4
|
type MaV1AccountType = "MultiOwnerModularAccountV1";
|
|
5
5
|
export type BaseMaV1AccountImplementation = SmartAccountImplementation<typeof entryPoint06Abi, "0.6", {
|
|
6
|
-
|
|
6
|
+
smartAccountType: MaV1AccountType;
|
|
7
7
|
prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;
|
|
8
8
|
formatSignature: (signature: Hex) => Promise<Hex>;
|
|
9
9
|
}, false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ma-v1/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA+B5C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAE1C,EACA,MAAM,EACN,cAAc,EACd,KAAK,EACL,cAAc,EACd,aAAa,EACb,IAAI,GACqC;IACzC,MAAM,UAAU,GAAG;QACjB,GAAG,EAAE,eAAe;QACpB,OAAO,EAAE,mBAAmB;QAC5B,OAAO,EAAE,KAAc;KACxB,CAAC;IAEF,MAAM,gBAAgB,GAAG,KAAK,EAC5B,MAAwB,EACG,EAAE;QAC7B,MAAM,IAAI,GAAG,MAAM,aAAa,CAC9B,MAAM,CAAC,IAAI,KAAK,eAAe;YAC7B,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;YAC1B,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAC/B,CAAC;QACF,OAAO;YACL,IAAI,EAAE,sBAAsB;YAC5B,IAAI;SACL,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,KAAK,EAAE,SAAc,EAAgB,EAAE;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,OA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E,OAAO,iBAAiB,CAAC;gBACvB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE;oBACP,GAAG,EAAE,UAAU;iBAChB;aACF,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE;YACN,MAAM,EAAE,IAAI;YACZ,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n type Hash,\n type TypedDataDefinition,\n encodeFunctionData,\n} from \"viem\";\nimport {\n entryPoint06Abi,\n toSmartAccount,\n type SmartAccount,\n type SmartAccountImplementation,\n entryPoint06Address,\n getUserOperationHash,\n} from \"viem/account-abstraction\";\nimport type { SignatureRequest } from \"../../types.js\";\nimport { IStandardExecutorAbi } from \"../abis/IStandardExecutor.js\";\nimport { signMessage, signTypedData } from \"viem/actions\";\nimport {\n decodeFunctionData,\n getAction,\n hashMessage,\n hashTypedData,\n isAddressEqual,\n} from \"viem/utils\";\nimport { BaseError } from \"@alchemy/common\";\n\ntype MaV1AccountType = \"MultiOwnerModularAccountV1\"; // Currently no SDK v5 support for \"MultiSigModularAccountV1\".\n\nexport type BaseMaV1AccountImplementation = SmartAccountImplementation<\n typeof entryPoint06Abi,\n \"0.6\",\n {\n source: MaV1AccountType;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n false\n>;\n\nexport type ModularAccountV1Base = SmartAccount<BaseMaV1AccountImplementation>;\n\nexport type ToModularAccountV1BaseParams<\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n accountAddress: Address;\n owner: JsonRpcAccount | LocalAccount;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n get712Wrapper: (msg: Hash) => Promise<TypedDataDefinition>;\n type: MaV1AccountType;\n};\n\n/**\n * Creates a ModularAccountV1Base instance.\n *\n * @param {ToModularAccountV1BaseParams<TTransport>} params The parameters for creating a ModularAccountV1Base instance\n * @returns {Promise<ModularAccountV1Base>} A promise that resolves to a ModularAccountV1Base instance\n */\nexport async function toModularAccountV1Base<\n TTransport extends Transport = Transport,\n>({\n client,\n accountAddress,\n owner,\n getFactoryArgs,\n get712Wrapper,\n type,\n}: ToModularAccountV1BaseParams<TTransport>): Promise<ModularAccountV1Base> {\n const entryPoint = {\n abi: entryPoint06Abi,\n address: entryPoint06Address,\n version: \"0.6\" as const,\n };\n\n const prepareSignature = async (\n params: SignatureRequest,\n ): Promise<SignatureRequest> => {\n const data = await get712Wrapper(\n params.type === \"personal_sign\"\n ? hashMessage(params.data)\n : hashTypedData(params.data),\n );\n return {\n type: \"eth_signTypedData_v4\",\n data,\n };\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return signature;\n };\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n if (!calls.length) {\n throw new BaseError(\"No calls to encode.\");\n }\n\n if (calls.length === 1) {\n const call = calls[0];\n\n // If the call is to the account itself, we need to avoid wrapping it in an `execute` call.\n if (isAddressEqual(call.to, accountAddress)) {\n if (call.data == null) {\n throw new BaseError(\"Data is required for an account self-call.\");\n }\n\n return call.data;\n }\n\n return encodeFunctionData({\n abi: IStandardExecutorAbi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n });\n }\n\n return encodeFunctionData({\n abi: IStandardExecutorAbi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n target: call.to,\n value: call.value ?? 0n,\n data: call.data ?? \"0x\",\n })),\n ],\n });\n },\n\n // Inverse of `encodeCalls`.\n async decodeCalls(data) {\n const decoded = decodeFunctionData({\n abi: IStandardExecutorAbi,\n data,\n });\n\n if (decoded.functionName === \"execute\") {\n return [\n {\n to: decoded.args[0],\n value: decoded.args[1],\n data: decoded.args[2],\n },\n ];\n }\n\n if (decoded.functionName === \"executeBatch\") {\n return decoded.args[0].map((call) => ({\n to: call.target,\n value: call.value,\n data: call.data,\n }));\n }\n\n // If the data is not for an `execute` or `executeBatch` call, we treat it as a single call to the account itself.\n return [\n {\n to: accountAddress,\n data,\n },\n ];\n },\n\n async getStubSignature() {\n return \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n },\n\n async signMessage({ message }) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n const { type, data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n return type === \"personal_sign\"\n ? signMessageAction({ account: owner, message: data })\n : signTypedDataAction({ ...data, account: owner });\n },\n\n async signTypedData(params) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n const { type, data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: params as TypedDataDefinition, // TODO(v5): try harder to avoid this cast?\n });\n return type === \"personal_sign\"\n ? signMessageAction({ account: owner, message: data })\n : signTypedDataAction({ ...data, account: owner });\n },\n\n async signUserOperation(parameters) {\n const { chainId = client.chain.id, ...userOperation } = parameters;\n const userOpHash = getUserOperationHash({\n chainId,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...userOperation,\n sender: accountAddress,\n },\n });\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n return signMessageAction({\n account: owner,\n message: {\n raw: userOpHash,\n },\n });\n },\n\n extend: {\n source: type,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ma-v1/accounts/base.ts"],"names":[],"mappings":"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BAAgB,EAAE,IAAI;YACtB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n type Hash,\n type TypedDataDefinition,\n encodeFunctionData,\n} from \"viem\";\nimport {\n entryPoint06Abi,\n toSmartAccount,\n type SmartAccount,\n type SmartAccountImplementation,\n entryPoint06Address,\n getUserOperationHash,\n} from \"viem/account-abstraction\";\nimport type { SignatureRequest } from \"../../types.js\";\nimport { IStandardExecutorAbi } from \"../abis/IStandardExecutor.js\";\nimport { signMessage, signTypedData } from \"viem/actions\";\nimport {\n decodeFunctionData,\n getAction,\n hashMessage,\n hashTypedData,\n isAddressEqual,\n} from \"viem/utils\";\nimport { BaseError } from \"@alchemy/common\";\n\ntype MaV1AccountType = \"MultiOwnerModularAccountV1\"; // Currently no SDK v5 support for \"MultiSigModularAccountV1\".\n\nexport type BaseMaV1AccountImplementation = SmartAccountImplementation<\n typeof entryPoint06Abi,\n \"0.6\",\n {\n smartAccountType: MaV1AccountType;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n false\n>;\n\nexport type ModularAccountV1Base = SmartAccount<BaseMaV1AccountImplementation>;\n\nexport type ToModularAccountV1BaseParams<\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n accountAddress: Address;\n owner: JsonRpcAccount | LocalAccount;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n get712Wrapper: (msg: Hash) => Promise<TypedDataDefinition>;\n type: MaV1AccountType;\n};\n\n/**\n * Creates a ModularAccountV1Base instance.\n *\n * @param {ToModularAccountV1BaseParams<TTransport>} params The parameters for creating a ModularAccountV1Base instance\n * @returns {Promise<ModularAccountV1Base>} A promise that resolves to a ModularAccountV1Base instance\n */\nexport async function toModularAccountV1Base<\n TTransport extends Transport = Transport,\n>({\n client,\n accountAddress,\n owner,\n getFactoryArgs,\n get712Wrapper,\n type,\n}: ToModularAccountV1BaseParams<TTransport>): Promise<ModularAccountV1Base> {\n const entryPoint = {\n abi: entryPoint06Abi,\n address: entryPoint06Address,\n version: \"0.6\" as const,\n };\n\n const prepareSignature = async (\n params: SignatureRequest,\n ): Promise<SignatureRequest> => {\n const data = await get712Wrapper(\n params.type === \"personal_sign\"\n ? hashMessage(params.data)\n : hashTypedData(params.data),\n );\n return {\n type: \"eth_signTypedData_v4\",\n data,\n };\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return signature;\n };\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n if (!calls.length) {\n throw new BaseError(\"No calls to encode.\");\n }\n\n if (calls.length === 1) {\n const call = calls[0];\n\n // If the call is to the account itself, we need to avoid wrapping it in an `execute` call.\n if (isAddressEqual(call.to, accountAddress)) {\n if (call.data == null) {\n throw new BaseError(\"Data is required for an account self-call.\");\n }\n\n return call.data;\n }\n\n return encodeFunctionData({\n abi: IStandardExecutorAbi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n });\n }\n\n return encodeFunctionData({\n abi: IStandardExecutorAbi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n target: call.to,\n value: call.value ?? 0n,\n data: call.data ?? \"0x\",\n })),\n ],\n });\n },\n\n // Inverse of `encodeCalls`.\n async decodeCalls(data) {\n const decoded = decodeFunctionData({\n abi: IStandardExecutorAbi,\n data,\n });\n\n if (decoded.functionName === \"execute\") {\n return [\n {\n to: decoded.args[0],\n value: decoded.args[1],\n data: decoded.args[2],\n },\n ];\n }\n\n if (decoded.functionName === \"executeBatch\") {\n return decoded.args[0].map((call) => ({\n to: call.target,\n value: call.value,\n data: call.data,\n }));\n }\n\n // If the data is not for an `execute` or `executeBatch` call, we treat it as a single call to the account itself.\n return [\n {\n to: accountAddress,\n data,\n },\n ];\n },\n\n async getStubSignature() {\n return \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n },\n\n async signMessage({ message }) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n const { type, data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n return type === \"personal_sign\"\n ? signMessageAction({ account: owner, message: data })\n : signTypedDataAction({ ...data, account: owner });\n },\n\n async signTypedData(params) {\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n const signTypedDataAction = getAction(\n client,\n signTypedData,\n \"signTypedData\",\n );\n const { type, data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: params as TypedDataDefinition, // TODO(v5): try harder to avoid this cast?\n });\n return type === \"personal_sign\"\n ? signMessageAction({ account: owner, message: data })\n : signTypedDataAction({ ...data, account: owner });\n },\n\n async signUserOperation(parameters) {\n const { chainId = client.chain.id, ...userOperation } = parameters;\n const userOpHash = getUserOperationHash({\n chainId,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...userOperation,\n sender: accountAddress,\n },\n });\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n return signMessageAction({\n account: owner,\n message: {\n raw: userOpHash,\n },\n });\n },\n\n extend: {\n smartAccountType: type,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
|
|
@@ -2,7 +2,8 @@ import { sendUserOperation } from "viem/account-abstraction";
|
|
|
2
2
|
import { getAction } from "viem/utils";
|
|
3
3
|
import { AccountNotFoundError } from "@alchemy/common";
|
|
4
4
|
function isMultiOwnerModularAccountV1(account) {
|
|
5
|
-
return "
|
|
5
|
+
return ("smartAccountType" in account &&
|
|
6
|
+
account.smartAccountType === "MultiOwnerModularAccountV1");
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Generates client actions for a multi-owner MAv1 account, including the ability to update owners.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../src/ma-v1/decorators/multiOwner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAgBvD,SAAS,4BAA4B,CACnC,OAAqB;IAErB,OAAO,
|
|
1
|
+
{"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../src/ma-v1/decorators/multiOwner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAgBvD,SAAS,4BAA4B,CACnC,OAAqB;IAErB,OAAO,CACL,kBAAkB,IAAI,OAAO;QAC7B,OAAO,CAAC,gBAAgB,KAAK,4BAA4B,CAC1D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAK/C,MAA4C;IAI5C,OAAO;QACL,yFAAyF;QACzF,uFAAuF;QACvF,6EAA6E;QAC7E,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;YAEvE,IAAI,CAAC,OAAO,IAAI,CAAC,4BAA4B,CAAC,OAAO,CAAC,EAAE,CAAC;gBACvD,MAAM,IAAI,oBAAoB,EAAE,CAAC;YACnC,CAAC;YAED,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAErE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;YACzE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;gBAC1B,KAAK,EAAE;oBACL;wBACE,EAAE,EAAE,OAAO,CAAC,OAAO;wBACnB,IAAI;qBACL;iBACF;gBACD,OAAO;aACR,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Address, Chain, Client, Hex, IsUndefined, Transport } from \"viem\";\nimport { sendUserOperation, type SmartAccount } from \"viem/account-abstraction\";\nimport { getAction } from \"viem/utils\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport { AccountNotFoundError } from \"@alchemy/common\";\nimport type { MultiOwnerModularAccountV1 } from \"../accounts/multi-owner-account.js\";\n\nexport type MultiOwnerModularAccountV1Actions<\n TAccount extends MultiOwnerModularAccountV1 | undefined =\n | MultiOwnerModularAccountV1\n | undefined,\n> = {\n updateOwners: (\n args: {\n ownersToAdd: Address[];\n ownersToRemove: Address[];\n } & GetAccountParameter<TAccount, MultiOwnerModularAccountV1>,\n ) => Promise<Hex>;\n};\n\nfunction isMultiOwnerModularAccountV1(\n account: SmartAccount,\n): account is MultiOwnerModularAccountV1 {\n return (\n \"smartAccountType\" in account &&\n account.smartAccountType === \"MultiOwnerModularAccountV1\"\n );\n}\n\n/**\n * Generates client actions for a multi-owner MAv1 account, including the ability to update owners.\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance used to interact with the account\n * @returns {MultiOwnerLightAccountActions<TAccount>} An object containing the client actions specifically for a multi-owner modular account\n */\nexport function multiOwnerModularAccountV1Actions<\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): MultiOwnerModularAccountV1Actions<\n IsUndefined<TAccount> extends true ? undefined : MultiOwnerModularAccountV1\n> {\n return {\n // TODO(v5): Another pattern I think we should consider deprecating for v5 - actions that\n // implicitly do a sendUserOperation internally. These are non-composable with batching\n // and have a number of other issues that are solved with viem writeContract.\n updateOwners: async (args) => {\n const { ownersToAdd, ownersToRemove, account = client.account } = args;\n\n if (!account || !isMultiOwnerModularAccountV1(account)) {\n throw new AccountNotFoundError();\n }\n\n const data = account.encodeUpdateOwners(ownersToAdd, ownersToRemove);\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n calls: [\n {\n to: account.address,\n data,\n },\n ],\n account,\n });\n\n return result;\n },\n };\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export type ValidationDataParams = {
|
|
|
10
10
|
entityId: number;
|
|
11
11
|
};
|
|
12
12
|
export type BaseModularAccountV2Implementation = SmartAccountImplementation<typeof entryPoint07Abi, "0.7", {
|
|
13
|
-
|
|
13
|
+
smartAccountType: "ModularAccountV2";
|
|
14
14
|
signerEntity: SignerEntity;
|
|
15
15
|
encodeCallData: (callData: Hex) => Promise<Hex>;
|
|
16
16
|
getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ma-v2/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,aAAa,EAEb,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EAGf,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EAGd,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CA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D,iBAAiB,EAAE,UAAU,CAAC,OAAO;iBACtC,CAAC,CAAC;gBAEH,MAAM,MAAM,GAAG,CAAC,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;gBAE/D,wHAAwH;gBACxH,OAAO;oBACL,GAAG,QAAQ;oBACX,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,GAAG,MAAM;iBAC7D,CAAC;YACJ,CAAC;SACF;QAED,MAAM,EAAE;YACN,MAAM,EAAE,kBAA2B;YACnC,YAAY,EAAE;gBACZ,QAAQ;gBACR,kBAAkB;aACnB;YACD,cAAc;YACd,gBAAgB;YAChB,iBAAiB;YACjB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type Chain,\n type Client,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n concat,\n concatHex,\n encodeFunctionData,\n hashMessage,\n hashTypedData,\n type TypedDataDefinition,\n maxUint32,\n maxUint152,\n zeroAddress,\n} from \"viem\";\nimport {\n entryPoint07Abi,\n type SmartAccountImplementation,\n type SmartAccount,\n entryPoint07Address,\n getUserOperationHash,\n toSmartAccount,\n type WebAuthnAccount,\n type ToSmartAccountParameters,\n estimateUserOperationGas,\n type UserOperation,\n} from \"viem/account-abstraction\";\nimport {\n getCode,\n readContract,\n signMessage,\n signTypedData,\n} from \"viem/actions\";\nimport { assertNever, BaseError } from \"@alchemy/common\";\nimport {\n SignaturePrefix,\n type ExecutionDataView,\n type SignerEntity,\n type ValidationDataView,\n} from \"../types.js\";\nimport { modularAccountAbi } from \"../abis/modularAccountAbi.js\";\nimport type { SignatureRequest } from \"../../types.js\";\nimport {\n decodeFunctionData,\n getAction,\n isAddressEqual,\n sliceHex,\n} from \"viem/utils\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n DefaultModuleAddress,\n EXECUTE_USER_OP_SELECTOR,\n serializeModuleEntity,\n} from \"../utils/account.js\";\nimport { parseDeferredAction } from \"../utils/deferredActions.js\";\nimport {\n pack1271Signature,\n toWebAuthnSignature,\n toReplaySafeTypedData,\n packUOSignature,\n} from \"../utils/signature.js\";\nimport { chainHas7212 } from \"../../utils.js\";\nimport { InvalidDeferredActionNonceError } from \"../../errors/InvalidDeferredActionNonceError.js\";\nimport { InvalidNonceKeyError } from \"../../errors/InvalidNonceKeyError.js\";\nimport { InvalidEntityIdError } from \"../../errors/InvalidEntityIdError.js\";\n\nexport type ValidationDataParams =\n | {\n validationModuleAddress: Address;\n entityId?: never;\n }\n | {\n validationModuleAddress?: never;\n entityId: number;\n };\n\nexport type BaseModularAccountV2Implementation = SmartAccountImplementation<\n typeof entryPoint07Abi,\n \"0.7\",\n {\n source: \"ModularAccountV2\";\n signerEntity: SignerEntity;\n encodeCallData: (callData: Hex) => Promise<Hex>;\n getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;\n getValidationData: (\n args: ValidationDataParams,\n ) => Promise<ValidationDataView>;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n boolean\n>;\n\nexport type ModularAccountV2Base =\n SmartAccount<BaseModularAccountV2Implementation>;\n\nexport type ToModularAccountV2BaseParams<\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n owner: JsonRpcAccount | LocalAccount | WebAuthnAccount;\n accountAddress: Address;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n signerEntity?: SignerEntity;\n deferredAction?: Hex;\n authorization?: ToSmartAccountParameters[\"authorization\"];\n};\n\n/**\n * Creates a ModularAccountV2Base instance.\n *\n * @param {ToModularAccountV2BaseParams<TTransport>} params - The parameters for creating a ModularAccountV2Base instance.\n * @returns {Promise<ModularAccountV2Base>} A promise that resolves to a ModularAccountV2Base instance.\n */\nexport async function toModularAccountV2Base<\n TTransport extends Transport = Transport,\n>({\n client,\n owner,\n accountAddress,\n getFactoryArgs,\n signerEntity = {\n isGlobalValidation: true,\n entityId: DEFAULT_OWNER_ENTITY_ID,\n },\n deferredAction,\n authorization,\n}: ToModularAccountV2BaseParams<TTransport>): Promise<ModularAccountV2Base> {\n let { isGlobalValidation, entityId } = signerEntity;\n\n const entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address as Address,\n version: \"0.7\" as const,\n };\n\n if (entityId > Number(maxUint32)) {\n throw new InvalidEntityIdError(entityId);\n }\n\n const isAccountDeployed: () => Promise<boolean> = async () => {\n const action = getAction(client, getCode, \"getCode\");\n const code = await action({ address: accountAddress });\n return code != null && code !== \"0x\";\n };\n\n // These default values signal that we should not use the set deferred action nonce\n let nonce: bigint | undefined;\n let deferredActionData: Hex | undefined;\n let hasAssociatedExecHooks: boolean = false;\n\n if (deferredAction) {\n let deferredActionNonce = 0n;\n // We always update entity id and isGlobalValidation to the deferred action value since the client could be used to send multiple calls\n ({\n entityId,\n isGlobalValidation,\n nonce: deferredActionNonce,\n } = parseDeferredAction(deferredAction));\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n // Set these values if the deferred action has not been consumed. We check this with the EP.\n const nextNonceForDeferredAction: bigint = await readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, deferredActionNonce >> 64n],\n });\n\n if (deferredActionNonce === nextNonceForDeferredAction) {\n ({ nonce, deferredActionData, hasAssociatedExecHooks } =\n parseDeferredAction(deferredAction));\n } else if (deferredActionNonce > nextNonceForDeferredAction) {\n // if nonce is greater than the next nonce, its invalid, so we throw\n throw new InvalidDeferredActionNonceError();\n }\n }\n\n const getNonce = async (\n params?: { key?: bigint | undefined } | undefined,\n ): Promise<bigint> => {\n if (nonce) {\n const tempNonce = nonce;\n nonce = undefined; // set to falsy value once used\n return tempNonce;\n }\n\n const nonceKey = params?.key ?? 0n;\n\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const fullNonceKey =\n (nonceKey << 40n) +\n (BigInt(entityId) << 8n) +\n (isGlobalValidation ? 1n : 0n);\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n return readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, fullNonceKey],\n });\n };\n\n const accountContract = {\n address: accountAddress,\n abi: modularAccountAbi,\n };\n\n const getExecutionData = async (selector: Hex) => {\n if (!(await isAccountDeployed())) {\n return {\n module: zeroAddress,\n skipRuntimeValidation: false,\n allowGlobalValidation: false,\n executionHooks: [],\n };\n }\n\n return readContract(client, {\n ...accountContract,\n functionName: \"getExecutionData\",\n args: [selector],\n });\n };\n\n const getValidationData = async (args: ValidationDataParams) => {\n if (!(await isAccountDeployed())) {\n return {\n validationHooks: [],\n executionHooks: [],\n selectors: [],\n validationFlags: 0,\n };\n }\n\n const { validationModuleAddress, entityId } = args;\n const readContractAction = getAction(client, readContract, \"readContract\");\n return readContractAction({\n ...accountContract,\n functionName: \"getValidationData\",\n args: [\n serializeModuleEntity({\n moduleAddress: validationModuleAddress ?? zeroAddress,\n entityId: entityId ?? Number(maxUint32),\n }),\n ],\n });\n };\n\n const encodeCallData = async (callData: Hex): Promise<Hex> => {\n const validationData = await getValidationData({\n entityId: Number(entityId),\n });\n if (hasAssociatedExecHooks) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n if (validationData.executionHooks.length) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n return callData;\n };\n\n const prepareSignature = async (\n request: SignatureRequest,\n ): Promise<Extract<SignatureRequest, { type: \"eth_signTypedData_v4\" }>> => {\n const isDeferredAction =\n request.type === \"eth_signTypedData_v4\" &&\n request.data?.primaryType === \"DeferredAction\" &&\n request.data?.domain?.verifyingContract === accountAddress;\n\n if (isDeferredAction && entityId === DEFAULT_OWNER_ENTITY_ID) {\n return request;\n }\n\n const hash =\n request.type === \"personal_sign\"\n ? hashMessage(request.data)\n : request.type === \"eth_signTypedData_v4\"\n ? hashTypedData(request.data)\n : assertNever(request, \"Unexpected signature request type\");\n\n return {\n type: \"eth_signTypedData_v4\",\n data: toReplaySafeTypedData({\n chainId: client.chain.id,\n hash,\n ...(owner.type === \"webAuthn\"\n ? {\n address: DefaultModuleAddress.WEBAUTHN_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }\n : entityId === DEFAULT_OWNER_ENTITY_ID\n ? { address: accountAddress }\n : {\n address: DefaultModuleAddress.SINGLE_SIGNER_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }),\n }),\n };\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return pack1271Signature({\n entityId,\n validationSignaturePrefix:\n owner.type === \"webAuthn\" ? null : SignaturePrefix.EOA,\n validationSignature: signature,\n });\n };\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n getNonce,\n authorization,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n if (calls.length === 1) {\n const call = calls[0];\n\n if (isAddressEqual(call.to, accountAddress)) {\n // If the call is to the account itself, we need to avoid wrapping it in an `execute` call.\n\n if (call.data === undefined) {\n throw new BaseError(\"Data is required for an account self-call.\");\n }\n\n return encodeCallData(call.data);\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n }),\n );\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n target: call.to,\n data: call.data ?? \"0x\",\n value: call.value ?? 0n,\n })),\n ],\n }),\n );\n },\n\n async decodeCalls(data) {\n // Inverse of `encodeCalls`.\n // Trim the EXECUTE_USER_OP_SELECTOR if it is present.\n const trimmedData = data\n .toLowerCase()\n .startsWith(EXECUTE_USER_OP_SELECTOR.toLowerCase())\n ? sliceHex(data, 4)\n : data;\n\n const decoded = decodeFunctionData({\n abi: modularAccountAbi,\n data: trimmedData,\n });\n\n if (decoded.functionName === \"execute\") {\n return [\n {\n to: decoded.args[0],\n value: decoded.args[1],\n data: decoded.args[2],\n },\n ];\n }\n\n if (decoded.functionName === \"executeBatch\") {\n return decoded.args[0].map((call) => ({\n to: call.target,\n value: call.value,\n data: call.data,\n }));\n }\n\n // If the data is not for an `execute` or `executeBatch` call, we treat it as a single call to the account itself.\n return [\n {\n to: accountAddress,\n data,\n },\n ];\n },\n\n async getStubSignature() {\n if (owner.type === \"webAuthn\") {\n return \"0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000\";\n }\n\n const sig = packUOSignature({\n validationSignature:\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\",\n });\n return deferredActionData ? concatHex([deferredActionData, sig]) : sig;\n },\n\n async signMessage({ message }) {\n const { data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return formatSignature(signature);\n },\n\n async signTypedData(td) {\n const isDeferredAction =\n td.primaryType === \"DeferredAction\" &&\n td.domain &&\n typeof td.domain === \"object\" &&\n \"verifyingContract\" in td.domain &&\n td.domain.verifyingContract === accountAddress;\n\n const { data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: td as TypedDataDefinition, // TODO(v5): Try harder to satisfy this w/o casting.\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return isDeferredAction\n ? validationSignature\n : formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return isDeferredAction\n ? concat([SignaturePrefix.EOA, signature])\n : formatSignature(signature);\n },\n\n async signUserOperation(uo) {\n const hash = getUserOperationHash({\n chainId: uo.chainId ?? client.chain.id,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...uo,\n sender: accountAddress,\n },\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({\n hash: hashMessage({ raw: hash }),\n }),\n );\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, validationSignature])\n : validationSignature;\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n return concatHex([\"0xff\", signature]);\n }\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n\n const validationSignature = await signMessageAction({\n account: owner,\n message: { raw: hash },\n });\n\n const packedSignature = packUOSignature({\n validationSignature,\n });\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, packedSignature])\n : packedSignature;\n\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n\n return signature;\n },\n\n userOperation: {\n estimateGas: async (uo) => {\n if (owner.type !== \"webAuthn\") {\n // Uses the default gas estimator.\n // Note that we get 7702 support automatically from Viem.\n return undefined;\n }\n\n const estimateGasAction = getAction(\n client,\n estimateUserOperationGas,\n \"estimateUserOperationGas\",\n );\n\n const estimate = await estimateGasAction({\n ...(uo as UserOperation<typeof entryPoint.version>),\n entryPointAddress: entryPoint.address,\n });\n\n const buffer = (await chainHas7212(client)) ? 10000n : 300000n;\n\n // TODO(v4): iterate numbers. Aim to have ~1000 gas buffer to account for longer authenticatorDatas and clientDataJSONs.\n return {\n ...estimate,\n verificationGasLimit: estimate.verificationGasLimit + buffer,\n };\n },\n },\n\n extend: {\n source: \"ModularAccountV2\" as const,\n signerEntity: {\n entityId,\n isGlobalValidation,\n },\n encodeCallData,\n getExecutionData,\n getValidationData,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ma-v2/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,aAAa,EAEb,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EAGf,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EAGd,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,eAAe,GAIhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,E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,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,GAAG,MAAM;iBAC7D,CAAC;YACJ,CAAC;SACF;QAED,MAAM,EAAE;YACN,gBAAgB,EAAE,kBAA2B;YAC7C,YAAY,EAAE;gBACZ,QAAQ;gBACR,kBAAkB;aACnB;YACD,cAAc;YACd,gBAAgB;YAChB,iBAAiB;YACjB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type Chain,\n type Client,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n concat,\n concatHex,\n encodeFunctionData,\n hashMessage,\n hashTypedData,\n type TypedDataDefinition,\n maxUint32,\n maxUint152,\n zeroAddress,\n} from \"viem\";\nimport {\n entryPoint07Abi,\n type SmartAccountImplementation,\n type SmartAccount,\n entryPoint07Address,\n getUserOperationHash,\n toSmartAccount,\n type WebAuthnAccount,\n type ToSmartAccountParameters,\n estimateUserOperationGas,\n type UserOperation,\n} from \"viem/account-abstraction\";\nimport {\n getCode,\n readContract,\n signMessage,\n signTypedData,\n} from \"viem/actions\";\nimport { assertNever, BaseError } from \"@alchemy/common\";\nimport {\n SignaturePrefix,\n type ExecutionDataView,\n type SignerEntity,\n type ValidationDataView,\n} from \"../types.js\";\nimport { modularAccountAbi } from \"../abis/modularAccountAbi.js\";\nimport type { SignatureRequest } from \"../../types.js\";\nimport {\n decodeFunctionData,\n getAction,\n isAddressEqual,\n sliceHex,\n} from \"viem/utils\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n DefaultModuleAddress,\n EXECUTE_USER_OP_SELECTOR,\n serializeModuleEntity,\n} from \"../utils/account.js\";\nimport { parseDeferredAction } from \"../utils/deferredActions.js\";\nimport {\n pack1271Signature,\n toWebAuthnSignature,\n toReplaySafeTypedData,\n packUOSignature,\n} from \"../utils/signature.js\";\nimport { chainHas7212 } from \"../../utils.js\";\nimport { InvalidDeferredActionNonceError } from \"../../errors/InvalidDeferredActionNonceError.js\";\nimport { InvalidNonceKeyError } from \"../../errors/InvalidNonceKeyError.js\";\nimport { InvalidEntityIdError } from \"../../errors/InvalidEntityIdError.js\";\n\nexport type ValidationDataParams =\n | {\n validationModuleAddress: Address;\n entityId?: never;\n }\n | {\n validationModuleAddress?: never;\n entityId: number;\n };\n\nexport type BaseModularAccountV2Implementation = SmartAccountImplementation<\n typeof entryPoint07Abi,\n \"0.7\",\n {\n smartAccountType: \"ModularAccountV2\";\n signerEntity: SignerEntity;\n encodeCallData: (callData: Hex) => Promise<Hex>;\n getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;\n getValidationData: (\n args: ValidationDataParams,\n ) => Promise<ValidationDataView>;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n boolean\n>;\n\nexport type ModularAccountV2Base =\n SmartAccount<BaseModularAccountV2Implementation>;\n\nexport type ToModularAccountV2BaseParams<\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n owner: JsonRpcAccount | LocalAccount | WebAuthnAccount;\n accountAddress: Address;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n signerEntity?: SignerEntity;\n deferredAction?: Hex;\n authorization?: ToSmartAccountParameters[\"authorization\"];\n};\n\n/**\n * Creates a ModularAccountV2Base instance.\n *\n * @param {ToModularAccountV2BaseParams<TTransport>} params - The parameters for creating a ModularAccountV2Base instance.\n * @returns {Promise<ModularAccountV2Base>} A promise that resolves to a ModularAccountV2Base instance.\n */\nexport async function toModularAccountV2Base<\n TTransport extends Transport = Transport,\n>({\n client,\n owner,\n accountAddress,\n getFactoryArgs,\n signerEntity = {\n isGlobalValidation: true,\n entityId: DEFAULT_OWNER_ENTITY_ID,\n },\n deferredAction,\n authorization,\n}: ToModularAccountV2BaseParams<TTransport>): Promise<ModularAccountV2Base> {\n let { isGlobalValidation, entityId } = signerEntity;\n\n const entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address as Address,\n version: \"0.7\" as const,\n };\n\n if (entityId > Number(maxUint32)) {\n throw new InvalidEntityIdError(entityId);\n }\n\n const isAccountDeployed: () => Promise<boolean> = async () => {\n const action = getAction(client, getCode, \"getCode\");\n const code = await action({ address: accountAddress });\n return code != null && code !== \"0x\";\n };\n\n // These default values signal that we should not use the set deferred action nonce\n let nonce: bigint | undefined;\n let deferredActionData: Hex | undefined;\n let hasAssociatedExecHooks: boolean = false;\n\n if (deferredAction) {\n let deferredActionNonce = 0n;\n // We always update entity id and isGlobalValidation to the deferred action value since the client could be used to send multiple calls\n ({\n entityId,\n isGlobalValidation,\n nonce: deferredActionNonce,\n } = parseDeferredAction(deferredAction));\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n // Set these values if the deferred action has not been consumed. We check this with the EP.\n const nextNonceForDeferredAction: bigint = await readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, deferredActionNonce >> 64n],\n });\n\n if (deferredActionNonce === nextNonceForDeferredAction) {\n ({ nonce, deferredActionData, hasAssociatedExecHooks } =\n parseDeferredAction(deferredAction));\n } else if (deferredActionNonce > nextNonceForDeferredAction) {\n // if nonce is greater than the next nonce, its invalid, so we throw\n throw new InvalidDeferredActionNonceError();\n }\n }\n\n const getNonce = async (\n params?: { key?: bigint | undefined } | undefined,\n ): Promise<bigint> => {\n if (nonce) {\n const tempNonce = nonce;\n nonce = undefined; // set to falsy value once used\n return tempNonce;\n }\n\n const nonceKey = params?.key ?? 0n;\n\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const fullNonceKey =\n (nonceKey << 40n) +\n (BigInt(entityId) << 8n) +\n (isGlobalValidation ? 1n : 0n);\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n return readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, fullNonceKey],\n });\n };\n\n const accountContract = {\n address: accountAddress,\n abi: modularAccountAbi,\n };\n\n const getExecutionData = async (selector: Hex) => {\n if (!(await isAccountDeployed())) {\n return {\n module: zeroAddress,\n skipRuntimeValidation: false,\n allowGlobalValidation: false,\n executionHooks: [],\n };\n }\n\n return readContract(client, {\n ...accountContract,\n functionName: \"getExecutionData\",\n args: [selector],\n });\n };\n\n const getValidationData = async (args: ValidationDataParams) => {\n if (!(await isAccountDeployed())) {\n return {\n validationHooks: [],\n executionHooks: [],\n selectors: [],\n validationFlags: 0,\n };\n }\n\n const { validationModuleAddress, entityId } = args;\n const readContractAction = getAction(client, readContract, \"readContract\");\n return readContractAction({\n ...accountContract,\n functionName: \"getValidationData\",\n args: [\n serializeModuleEntity({\n moduleAddress: validationModuleAddress ?? zeroAddress,\n entityId: entityId ?? Number(maxUint32),\n }),\n ],\n });\n };\n\n const encodeCallData = async (callData: Hex): Promise<Hex> => {\n const validationData = await getValidationData({\n entityId: Number(entityId),\n });\n if (hasAssociatedExecHooks) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n if (validationData.executionHooks.length) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n return callData;\n };\n\n const prepareSignature = async (\n request: SignatureRequest,\n ): Promise<Extract<SignatureRequest, { type: \"eth_signTypedData_v4\" }>> => {\n const isDeferredAction =\n request.type === \"eth_signTypedData_v4\" &&\n request.data?.primaryType === \"DeferredAction\" &&\n request.data?.domain?.verifyingContract === accountAddress;\n\n if (isDeferredAction && entityId === DEFAULT_OWNER_ENTITY_ID) {\n return request;\n }\n\n const hash =\n request.type === \"personal_sign\"\n ? hashMessage(request.data)\n : request.type === \"eth_signTypedData_v4\"\n ? hashTypedData(request.data)\n : assertNever(request, \"Unexpected signature request type\");\n\n return {\n type: \"eth_signTypedData_v4\",\n data: toReplaySafeTypedData({\n chainId: client.chain.id,\n hash,\n ...(owner.type === \"webAuthn\"\n ? {\n address: DefaultModuleAddress.WEBAUTHN_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }\n : entityId === DEFAULT_OWNER_ENTITY_ID\n ? { address: accountAddress }\n : {\n address: DefaultModuleAddress.SINGLE_SIGNER_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }),\n }),\n };\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return pack1271Signature({\n entityId,\n validationSignaturePrefix:\n owner.type === \"webAuthn\" ? null : SignaturePrefix.EOA,\n validationSignature: signature,\n });\n };\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n getNonce,\n authorization,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n if (calls.length === 1) {\n const call = calls[0];\n\n if (isAddressEqual(call.to, accountAddress)) {\n // If the call is to the account itself, we need to avoid wrapping it in an `execute` call.\n\n if (call.data === undefined) {\n throw new BaseError(\"Data is required for an account self-call.\");\n }\n\n return encodeCallData(call.data);\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n }),\n );\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n target: call.to,\n data: call.data ?? \"0x\",\n value: call.value ?? 0n,\n })),\n ],\n }),\n );\n },\n\n async decodeCalls(data) {\n // Inverse of `encodeCalls`.\n // Trim the EXECUTE_USER_OP_SELECTOR if it is present.\n const trimmedData = data\n .toLowerCase()\n .startsWith(EXECUTE_USER_OP_SELECTOR.toLowerCase())\n ? sliceHex(data, 4)\n : data;\n\n const decoded = decodeFunctionData({\n abi: modularAccountAbi,\n data: trimmedData,\n });\n\n if (decoded.functionName === \"execute\") {\n return [\n {\n to: decoded.args[0],\n value: decoded.args[1],\n data: decoded.args[2],\n },\n ];\n }\n\n if (decoded.functionName === \"executeBatch\") {\n return decoded.args[0].map((call) => ({\n to: call.target,\n value: call.value,\n data: call.data,\n }));\n }\n\n // If the data is not for an `execute` or `executeBatch` call, we treat it as a single call to the account itself.\n return [\n {\n to: accountAddress,\n data,\n },\n ];\n },\n\n async getStubSignature() {\n if (owner.type === \"webAuthn\") {\n return \"0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000\";\n }\n\n const sig = packUOSignature({\n validationSignature:\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\",\n });\n return deferredActionData ? concatHex([deferredActionData, sig]) : sig;\n },\n\n async signMessage({ message }) {\n const { data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return formatSignature(signature);\n },\n\n async signTypedData(td) {\n const isDeferredAction =\n td.primaryType === \"DeferredAction\" &&\n td.domain &&\n typeof td.domain === \"object\" &&\n \"verifyingContract\" in td.domain &&\n td.domain.verifyingContract === accountAddress;\n\n const { data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: td as TypedDataDefinition, // TODO(v5): Try harder to satisfy this w/o casting.\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return isDeferredAction\n ? validationSignature\n : formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return isDeferredAction\n ? concat([SignaturePrefix.EOA, signature])\n : formatSignature(signature);\n },\n\n async signUserOperation(uo) {\n const hash = getUserOperationHash({\n chainId: uo.chainId ?? client.chain.id,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...uo,\n sender: accountAddress,\n },\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({\n hash: hashMessage({ raw: hash }),\n }),\n );\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, validationSignature])\n : validationSignature;\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n return concatHex([\"0xff\", signature]);\n }\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n\n const validationSignature = await signMessageAction({\n account: owner,\n message: { raw: hash },\n });\n\n const packedSignature = packUOSignature({\n validationSignature,\n });\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, packedSignature])\n : packedSignature;\n\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n\n return signature;\n },\n\n userOperation: {\n estimateGas: async (uo) => {\n if (owner.type !== \"webAuthn\") {\n // Uses the default gas estimator.\n // Note that we get 7702 support automatically from Viem.\n return undefined;\n }\n\n const estimateGasAction = getAction(\n client,\n estimateUserOperationGas,\n \"estimateUserOperationGas\",\n );\n\n const estimate = await estimateGasAction({\n ...(uo as UserOperation<typeof entryPoint.version>),\n entryPointAddress: entryPoint.address,\n });\n\n const buffer = (await chainHas7212(client)) ? 10000n : 300000n;\n\n // TODO(v4): iterate numbers. Aim to have ~1000 gas buffer to account for longer authenticatorDatas and clientDataJSONs.\n return {\n ...estimate,\n verificationGasLimit: estimate.verificationGasLimit + buffer,\n };\n },\n },\n\n extend: {\n smartAccountType: \"ModularAccountV2\" as const,\n signerEntity: {\n entityId,\n isGlobalValidation,\n },\n encodeCallData,\n getExecutionData,\n getValidationData,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
|
|
@@ -91,6 +91,7 @@ export function serializeModuleEntity(config) {
|
|
|
91
91
|
* @returns {boolean} True if the account is a ModularAccountV2, false otherwise.
|
|
92
92
|
*/
|
|
93
93
|
export function isModularAccountV2(account) {
|
|
94
|
-
return "
|
|
94
|
+
return ("smartAccountType" in account &&
|
|
95
|
+
account.smartAccountType === "ModularAccountV2");
|
|
95
96
|
}
|
|
96
97
|
//# sourceMappingURL=account.js.map
|
|
@@ -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,qBAAqB,EAAE,4CAA4C;IACnE,cAAc,EAAE,4CAA4C;IAC5D,aAAa,EAAE,4CAA4C;IAC3D,UAAU,EAAE,4CAA4C;IACxD,IAAI,EAAE,4CAA4C;CACjB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,wBAAwB,EAAE,4CAA4C;IACtE,mBAAmB,EAAE,4CAA4C;IACjE,UAAU,EAAE,4CAA4C;IACxD,eAAe,EAAE,4CAA4C;IAC7D,kBAA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AC,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 MAV2_FACTORY_WEBAUTHN: \"0x55010E571dCf07e254994bfc88b9C1C8FAe31960\",\n SMAV2_BYTECODE: \"0x000000000000c5A9089039570Dd36455b5C07383\",\n SMAV2_STORAGE: \"0x0000000000006E2f9d80CaEc0Da6500f005EB25A\",\n SMAV2_7702: \"0x69007702764179f14F51cdce752f4f775d74E139\",\n MAV2: \"0x00000000000002377B26b1EdA7b0BC371C60DD4f\",\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 WEBAUTHN_VALIDATION: \"0x0000000000001D9d34E07D9834274dF9ae575217\",\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 // TODO(v5): do we need `createModularAccountV2FromExisting()` in the return type here like we had in v4 or no?\n // Almost certainly not, but we need to clean up other parts in SDK for client-side upgrades.\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/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAA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wB,CAAC;AAC5C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,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"}
|
|
@@ -4,7 +4,7 @@ import type { EntryPointFromAccountRegistry, LightAccountType, LightAccountVersi
|
|
|
4
4
|
import type { SignatureRequest } from "../../types.js";
|
|
5
5
|
export type BaseLightAccountImplementation<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>> = SmartAccountImplementation<EntryPointFromAccountRegistry<TLightAccountType, TLightAccountVersion>["abi"], EntryPointFromAccountRegistry<TLightAccountType, TLightAccountVersion>["version"], {
|
|
6
6
|
getLightAccountVersion: () => TLightAccountVersion;
|
|
7
|
-
|
|
7
|
+
smartAccountType: TLightAccountType;
|
|
8
8
|
encodeUpgradeToAndCall: (params: {
|
|
9
9
|
upgradeToAddress: Address;
|
|
10
10
|
upgradeToInitData: Hex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/light-account/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,MAAM,CAAC;AACd,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAChC,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAQxB,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AASxB,MAAM,MAAM,8BAA8B,CACxC,iBAAiB,SAAS,gBAAgB,GAAG,gBAAgB,EAC7D,oBAAoB,SAClB,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,IAC/E,0BAA0B,CAC5B,6BAA6B,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC,KAAK,CAAC,EAC7E,6BAA6B,CAC3B,iBAAiB,EACjB,oBAAoB,CACrB,CAAC,SAAS,CAAC,EACZ;IACE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;IACnD,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/light-account/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,MAAM,CAAC;AACd,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAChC,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB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AAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC3C,6BAA6B,CAC9B,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG,SAAS,GAAG,sBAAsB,CACxE,CA4BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleOwner.d.ts","sourceRoot":"","sources":["../../../../src/light-account/decorators/singleOwner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAChF,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,CAC7B,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IAClE;IACF,iBAAiB,EAAE,CACjB,IAAI,EAAE;QACJ,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,KAC5C,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"singleOwner.d.ts","sourceRoot":"","sources":["../../../../src/light-account/decorators/singleOwner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAChF,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,CAC7B,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IAClE;IACF,iBAAiB,EAAE,CACjB,IAAI,EAAE;QACJ,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,KAC5C,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;AAQF;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EAEpE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC3C,mBAAmB,CACpB,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG,SAAS,GAAG,YAAY,CAC9D,CAyBA"}
|
|
@@ -7103,7 +7103,7 @@ export declare const AccountVersionRegistry: {
|
|
|
7103
7103
|
};
|
|
7104
7104
|
export type LightAccountType = Extract<keyof typeof AccountVersionRegistry, "LightAccount" | "MultiOwnerLightAccount">;
|
|
7105
7105
|
export type LightAccountVersion<TAccountType extends LightAccountType> = keyof (typeof AccountVersionRegistry)[TAccountType];
|
|
7106
|
-
export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["
|
|
7106
|
+
export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["smartAccountType"] extends LightAccountType ? TAccount["smartAccountType"] : never;
|
|
7107
7107
|
export type LightAccountAbi<TAccountType extends LightAccountType, TAccountVersion extends LightAccountVersion<TAccountType>> = TAccountVersion extends keyof (typeof AccountVersionRegistry)[TAccountType] ? (typeof AccountVersionRegistry)[TAccountType][TAccountVersion] extends StaticSmartAccountImplementation ? (typeof AccountVersionRegistry)[TAccountType][TAccountVersion]["accountAbi"] : never : never;
|
|
7108
7108
|
/**
|
|
7109
7109
|
* Infers the EntryPoint details as a type, given the account type and version.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/light-account/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQ3D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AS,gBAAgB,EACrC,eAAe,SAAS,mBAAmB,CAAC,YAAY,CAAC,IACvD,eAAe,SAAS,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,GAC3E,CAAC,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,CAAC,eAAe,CAAC,SAAS,gCAAgC,GACrG,CAAC,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,CAAC,eAAe,CAAC,CAAC,YAAY,CAAC,GAC5E,KAAK,GACP,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,MAAM,6BAA6B,CACvC,iBAAiB,SAAS,gBAAgB,EAC1C,oBAAoB,SAClB,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,IAEjF,CAAC,OAAO,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,oBAAoB,CAAC,SAAS,gCAAgC,CAE/G,MAAM,KAAK,EACX,MAAM,iBAAiB,EAEvB,MAAM,YAAY,EAClB,MAAM,aAAa,SAAS,GAAG,CAChC,GACG,CAAC,OAAO,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,SAAS;IAC7F,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;CAC7B,GACC,CAAC,OAAO,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,GACtF,KAAK,GACP,KAAK,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { entryPoint06Abi, type SmartAccount, type SmartAccountImplementation } f
|
|
|
3
3
|
import type { SignatureRequest } from "../../types.js";
|
|
4
4
|
type MaV1AccountType = "MultiOwnerModularAccountV1";
|
|
5
5
|
export type BaseMaV1AccountImplementation = SmartAccountImplementation<typeof entryPoint06Abi, "0.6", {
|
|
6
|
-
|
|
6
|
+
smartAccountType: MaV1AccountType;
|
|
7
7
|
prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;
|
|
8
8
|
formatSignature: (signature: Hex) => Promise<Hex>;
|
|
9
9
|
}, false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/ma-v1/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,mBAAmB,EAEzB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EAEf,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAGhC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYvD,KAAK,eAAe,GAAG,4BAA4B,CAAC;AAEpD,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,CACpE,OAAO,eAAe,EACtB,KAAK,EACL;IACE,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/ma-v1/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,mBAAmB,EAEzB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EAEf,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAGhC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYvD,KAAK,eAAe,GAAG,4BAA4B,CAAC;AAEpD,MAAM,MAAM,6BAA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1D,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;AAWF;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EAEpE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC3C,iCAAiC,CAClC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG,SAAS,GAAG,0BAA0B,CAC5E,CA4BA"}
|
|
@@ -10,7 +10,7 @@ export type ValidationDataParams = {
|
|
|
10
10
|
entityId: number;
|
|
11
11
|
};
|
|
12
12
|
export type BaseModularAccountV2Implementation = SmartAccountImplementation<typeof entryPoint07Abi, "0.7", {
|
|
13
|
-
|
|
13
|
+
smartAccountType: "ModularAccountV2";
|
|
14
14
|
signerEntity: SignerEntity;
|
|
15
15
|
encodeCallData: (callData: Hex) => Promise<Hex>;
|
|
16
16
|
getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EAUf,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EACf,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAIjB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAG9B,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAErB,OAAO,K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,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/smart-accounts",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.3",
|
|
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,11 +39,11 @@
|
|
|
39
39
|
"test:run": "vitest run"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@alchemy/aa-infra": "0.0.0-alpha.
|
|
42
|
+
"@alchemy/aa-infra": "0.0.0-alpha.3",
|
|
43
43
|
"typescript-template": "*"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@alchemy/common": "0.0.0-alpha.
|
|
46
|
+
"@alchemy/common": "0.0.0-alpha.3",
|
|
47
47
|
"ox": "^0.9.6",
|
|
48
48
|
"viem": "^2.32.0"
|
|
49
49
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "f96c99f6cfd01d523615fa7ffe2339a95a0f4bb1"
|
|
63
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type BaseLightAccountImplementation<
|
|
|
59
59
|
>["version"],
|
|
60
60
|
{
|
|
61
61
|
getLightAccountVersion: () => TLightAccountVersion;
|
|
62
|
-
|
|
62
|
+
smartAccountType: TLightAccountType;
|
|
63
63
|
encodeUpgradeToAndCall: (params: {
|
|
64
64
|
upgradeToAddress: Address;
|
|
65
65
|
upgradeToInitData: Hex;
|
|
@@ -330,7 +330,7 @@ export async function toLightAccountBase<
|
|
|
330
330
|
},
|
|
331
331
|
|
|
332
332
|
extend: {
|
|
333
|
-
|
|
333
|
+
smartAccountType: type,
|
|
334
334
|
getLightAccountVersion: () => version,
|
|
335
335
|
encodeUpgradeToAndCall,
|
|
336
336
|
prepareSignature,
|
|
@@ -21,7 +21,10 @@ export type MultiOwnerLightAccountActions<
|
|
|
21
21
|
function isMultiOwnerLightAccount(
|
|
22
22
|
account: SmartAccount,
|
|
23
23
|
): account is MultiOwnerLightAccount {
|
|
24
|
-
return
|
|
24
|
+
return (
|
|
25
|
+
"smartAccountType" in account &&
|
|
26
|
+
account.smartAccountType === "MultiOwnerLightAccount"
|
|
27
|
+
);
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -16,7 +16,9 @@ export type LightAccountActions<
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
function isLightAccount(account: SmartAccount): account is LightAccount {
|
|
19
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
"smartAccountType" in account && account.smartAccountType === "LightAccount"
|
|
21
|
+
);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -35,7 +35,9 @@ export type LightAccountVersion<TAccountType extends LightAccountType> =
|
|
|
35
35
|
keyof (typeof AccountVersionRegistry)[TAccountType];
|
|
36
36
|
|
|
37
37
|
export type GetLightAccountType<TAccount extends LightAccountBase> =
|
|
38
|
-
TAccount["
|
|
38
|
+
TAccount["smartAccountType"] extends LightAccountType
|
|
39
|
+
? TAccount["smartAccountType"]
|
|
40
|
+
: never;
|
|
39
41
|
|
|
40
42
|
export type LightAccountAbi<
|
|
41
43
|
TAccountType extends LightAccountType,
|
|
@@ -61,7 +61,7 @@ export async function getLightAccountImplAddress<
|
|
|
61
61
|
throw new ChainNotFoundError();
|
|
62
62
|
}
|
|
63
63
|
const version = account.getLightAccountVersion();
|
|
64
|
-
const type = account.
|
|
64
|
+
const type = account.smartAccountType;
|
|
65
65
|
|
|
66
66
|
const expectedImplAddresses = Object.values(AccountVersionRegistry[type]).map(
|
|
67
67
|
(x) => x.accountImplementation,
|
|
@@ -36,7 +36,7 @@ export type BaseMaV1AccountImplementation = SmartAccountImplementation<
|
|
|
36
36
|
typeof entryPoint06Abi,
|
|
37
37
|
"0.6",
|
|
38
38
|
{
|
|
39
|
-
|
|
39
|
+
smartAccountType: MaV1AccountType;
|
|
40
40
|
prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;
|
|
41
41
|
formatSignature: (signature: Hex) => Promise<Hex>;
|
|
42
42
|
},
|
|
@@ -237,7 +237,7 @@ export async function toModularAccountV1Base<
|
|
|
237
237
|
},
|
|
238
238
|
|
|
239
239
|
extend: {
|
|
240
|
-
|
|
240
|
+
smartAccountType: type,
|
|
241
241
|
prepareSignature,
|
|
242
242
|
formatSignature,
|
|
243
243
|
},
|
|
@@ -21,7 +21,10 @@ export type MultiOwnerModularAccountV1Actions<
|
|
|
21
21
|
function isMultiOwnerModularAccountV1(
|
|
22
22
|
account: SmartAccount,
|
|
23
23
|
): account is MultiOwnerModularAccountV1 {
|
|
24
|
-
return
|
|
24
|
+
return (
|
|
25
|
+
"smartAccountType" in account &&
|
|
26
|
+
account.smartAccountType === "MultiOwnerModularAccountV1"
|
|
27
|
+
);
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -81,7 +81,7 @@ export type BaseModularAccountV2Implementation = SmartAccountImplementation<
|
|
|
81
81
|
typeof entryPoint07Abi,
|
|
82
82
|
"0.7",
|
|
83
83
|
{
|
|
84
|
-
|
|
84
|
+
smartAccountType: "ModularAccountV2";
|
|
85
85
|
signerEntity: SignerEntity;
|
|
86
86
|
encodeCallData: (callData: Hex) => Promise<Hex>;
|
|
87
87
|
getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;
|
|
@@ -554,7 +554,7 @@ export async function toModularAccountV2Base<
|
|
|
554
554
|
},
|
|
555
555
|
|
|
556
556
|
extend: {
|
|
557
|
-
|
|
557
|
+
smartAccountType: "ModularAccountV2" as const,
|
|
558
558
|
signerEntity: {
|
|
559
559
|
entityId,
|
|
560
560
|
isGlobalValidation,
|
|
@@ -133,5 +133,8 @@ export function serializeModuleEntity(config: ModuleEntity): Hex {
|
|
|
133
133
|
export function isModularAccountV2(
|
|
134
134
|
account: SmartAccount,
|
|
135
135
|
): account is ModularAccountV2Base {
|
|
136
|
-
return
|
|
136
|
+
return (
|
|
137
|
+
"smartAccountType" in account &&
|
|
138
|
+
account.smartAccountType === "ModularAccountV2"
|
|
139
|
+
);
|
|
137
140
|
}
|