Socket
Socket
Sign inDemoInstall

@alchemy/aa-accounts

Package Overview
Dependencies
Maintainers
2
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alchemy/aa-accounts - npm Package Compare versions

Comparing version 3.0.0-alpha.7 to 3.0.0-alpha.9

dist/cjs/src/light-account/client.d.ts

23

./dist/cjs/src/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultMultiOwnerModularAccountFactoryAddress = exports.buildSessionKeysToRemoveStruct = exports.SessionKeySigner = exports.SessionKeyPluginExecutionFunctionAbi = exports.SessionKeyPluginAbi = exports.SessionKeyPlugin = exports.SessionKeyPermissionsBuilder = exports.sessionKeyPluginActions = exports.MultiOwnerPluginExecutionFunctionAbi = exports.MultiOwnerPluginAbi = exports.MultiOwnerPlugin = exports.multiOwnerPluginActions = exports.pluginManagerActions = exports.standardExecutor = exports.createMultiOwnerModularAccount = exports.accountLoupeActions = exports.getDefaultNaniAccountFactoryAddress = exports.transferNaniAccountOwnership = exports.createNaniAccount = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountVersions = exports.LightAccountUnsupported1271Impls = exports.LightAccountUnsupported1271Factories = exports.lightAccountClientActions = exports.getLightAccountVersion = exports.createLightAccountClient = exports.transferLightAccountOwnership = exports.createLightAccount = void 0;
exports.getDefaultMultiOwnerModularAccountFactoryAddress = exports.buildSessionKeysToRemoveStruct = exports.SessionKeySigner = exports.SessionKeyPluginExecutionFunctionAbi = exports.SessionKeyPluginAbi = exports.SessionKeyPlugin = exports.SessionKeyPermissionsBuilder = exports.sessionKeyPluginActions = exports.MultiOwnerPluginExecutionFunctionAbi = exports.MultiOwnerPluginAbi = exports.MultiOwnerPlugin = exports.multiOwnerPluginActions = exports.pluginManagerActions = exports.standardExecutor = exports.createMultiOwnerModularAccount = exports.accountLoupeActions = exports.IPluginAbi = exports.getDefaultNaniAccountFactoryAddress = exports.transferNaniAccountOwnership = exports.createNaniAccount = exports.getLightAccountVersion = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountVersions = exports.LightAccountUnsupported1271Impls = exports.LightAccountUnsupported1271Factories = exports.lightAccountClientActions = exports.createLightAccountClient = exports.transferLightAccountOwnership = exports.createLightAccount = void 0;
var account_js_1 = require("./light-account/account.js");

@@ -8,8 +8,6 @@ Object.defineProperty(exports, "createLightAccount", { enumerable: true, get: function () { return account_js_1.createLightAccount; } });

Object.defineProperty(exports, "transferLightAccountOwnership", { enumerable: true, get: function () { return transferOwnership_js_1.transferOwnership; } });
var createLightAccountClient_js_1 = require("./light-account/createLightAccountClient.js");
Object.defineProperty(exports, "createLightAccountClient", { enumerable: true, get: function () { return createLightAccountClient_js_1.createLightAccountClient; } });
var getLightAccountVersion_js_1 = require("./light-account/getLightAccountVersion.js");
Object.defineProperty(exports, "getLightAccountVersion", { enumerable: true, get: function () { return getLightAccountVersion_js_1.getLightAccountVersion; } });
var lightAccountClientDecorator_js_1 = require("./light-account/lightAccountClientDecorator.js");
Object.defineProperty(exports, "lightAccountClientActions", { enumerable: true, get: function () { return lightAccountClientDecorator_js_1.lightAccountClientActions; } });
var client_js_1 = require("./light-account/client.js");
Object.defineProperty(exports, "createLightAccountClient", { enumerable: true, get: function () { return client_js_1.createLightAccountClient; } });
var decorator_js_1 = require("./light-account/decorator.js");
Object.defineProperty(exports, "lightAccountClientActions", { enumerable: true, get: function () { return decorator_js_1.lightAccountClientActions; } });
var utils_js_1 = require("./light-account/utils.js");

@@ -20,2 +18,3 @@ Object.defineProperty(exports, "LightAccountUnsupported1271Factories", { enumerable: true, get: function () { return utils_js_1.LightAccountUnsupported1271Factories; } });

Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
Object.defineProperty(exports, "getLightAccountVersion", { enumerable: true, get: function () { return utils_js_1.getLightAccountVersion; } });
var account_js_2 = require("./nani-account/account.js");

@@ -27,4 +26,6 @@ Object.defineProperty(exports, "createNaniAccount", { enumerable: true, get: function () { return account_js_2.createNaniAccount; } });

Object.defineProperty(exports, "getDefaultNaniAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_2.getDefaultNaniAccountFactoryAddress; } });
var decorator_js_1 = require("./msca/account-loupe/decorator.js");
Object.defineProperty(exports, "accountLoupeActions", { enumerable: true, get: function () { return decorator_js_1.accountLoupeActions; } });
var IPlugin_js_1 = require("./msca/abis/IPlugin.js");
Object.defineProperty(exports, "IPluginAbi", { enumerable: true, get: function () { return IPlugin_js_1.IPluginAbi; } });
var decorator_js_2 = require("./msca/account-loupe/decorator.js");
Object.defineProperty(exports, "accountLoupeActions", { enumerable: true, get: function () { return decorator_js_2.accountLoupeActions; } });
var multiOwnerAccount_js_1 = require("./msca/account/multiOwnerAccount.js");

@@ -34,4 +35,4 @@ Object.defineProperty(exports, "createMultiOwnerModularAccount", { enumerable: true, get: function () { return multiOwnerAccount_js_1.createMultiOwnerModularAccount; } });

Object.defineProperty(exports, "standardExecutor", { enumerable: true, get: function () { return standardExecutor_js_1.standardExecutor; } });
var decorator_js_2 = require("./msca/plugin-manager/decorator.js");
Object.defineProperty(exports, "pluginManagerActions", { enumerable: true, get: function () { return decorator_js_2.pluginManagerActions; } });
var decorator_js_3 = require("./msca/plugin-manager/decorator.js");
Object.defineProperty(exports, "pluginManagerActions", { enumerable: true, get: function () { return decorator_js_3.pluginManagerActions; } });
var index_js_1 = require("./msca/plugins/multi-owner/index.js");

@@ -38,0 +39,0 @@ Object.defineProperty(exports, "multiOwnerPluginActions", { enumerable: true, get: function () { return index_js_1.multiOwnerPluginActions; } });

@@ -58,3 +58,3 @@ "use strict";

}
return installPlugin_(client, {

@@ -61,0 +61,0 @@ pluginAddress,

export type * from "./light-account/account.js";
export { createLightAccount } from "./light-account/account.js";
export { transferOwnership as transferLightAccountOwnership } from "./light-account/actions/transferOwnership.js";
export { createLightAccountClient } from "./light-account/createLightAccountClient.js";
export { getLightAccountVersion } from "./light-account/getLightAccountVersion.js";
export type * from "./light-account/lightAccountClientDecorator.js";
export { lightAccountClientActions } from "./light-account/lightAccountClientDecorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, type LightAccountVersion, } from "./light-account/utils.js";
export { createLightAccountClient } from "./light-account/client.js";
export type * from "./light-account/decorator.js";
export { lightAccountClientActions } from "./light-account/decorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, getLightAccountVersion, type LightAccountVersion, } from "./light-account/utils.js";
export { createNaniAccount } from "./nani-account/account.js";

@@ -13,2 +12,3 @@ export type { NaniAccount } from "./nani-account/account.js";

export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
export { IPluginAbi } from "./msca/abis/IPlugin.js";
export type * from "./msca/account-loupe/decorator.js";

@@ -15,0 +15,0 @@ export { accountLoupeActions } from "./msca/account-loupe/decorator.js";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultMultiOwnerModularAccountFactoryAddress = exports.buildSessionKeysToRemoveStruct = exports.SessionKeySigner = exports.SessionKeyPluginExecutionFunctionAbi = exports.SessionKeyPluginAbi = exports.SessionKeyPlugin = exports.SessionKeyPermissionsBuilder = exports.sessionKeyPluginActions = exports.MultiOwnerPluginExecutionFunctionAbi = exports.MultiOwnerPluginAbi = exports.MultiOwnerPlugin = exports.multiOwnerPluginActions = exports.pluginManagerActions = exports.standardExecutor = exports.createMultiOwnerModularAccount = exports.accountLoupeActions = exports.getDefaultNaniAccountFactoryAddress = exports.transferNaniAccountOwnership = exports.createNaniAccount = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountVersions = exports.LightAccountUnsupported1271Impls = exports.LightAccountUnsupported1271Factories = exports.lightAccountClientActions = exports.getLightAccountVersion = exports.createLightAccountClient = exports.transferLightAccountOwnership = exports.createLightAccount = void 0;
exports.getDefaultMultiOwnerModularAccountFactoryAddress = exports.buildSessionKeysToRemoveStruct = exports.SessionKeySigner = exports.SessionKeyPluginExecutionFunctionAbi = exports.SessionKeyPluginAbi = exports.SessionKeyPlugin = exports.SessionKeyPermissionsBuilder = exports.sessionKeyPluginActions = exports.MultiOwnerPluginExecutionFunctionAbi = exports.MultiOwnerPluginAbi = exports.MultiOwnerPlugin = exports.multiOwnerPluginActions = exports.pluginManagerActions = exports.standardExecutor = exports.createMultiOwnerModularAccount = exports.accountLoupeActions = exports.IPluginAbi = exports.getDefaultNaniAccountFactoryAddress = exports.transferNaniAccountOwnership = exports.createNaniAccount = exports.getLightAccountVersion = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountVersions = exports.LightAccountUnsupported1271Impls = exports.LightAccountUnsupported1271Factories = exports.lightAccountClientActions = exports.createLightAccountClient = exports.transferLightAccountOwnership = exports.createLightAccount = void 0;
var account_js_1 = require("./light-account/account.js");

@@ -8,8 +8,6 @@ Object.defineProperty(exports, "createLightAccount", { enumerable: true, get: function () { return account_js_1.createLightAccount; } });

Object.defineProperty(exports, "transferLightAccountOwnership", { enumerable: true, get: function () { return transferOwnership_js_1.transferOwnership; } });
var createLightAccountClient_js_1 = require("./light-account/createLightAccountClient.js");
Object.defineProperty(exports, "createLightAccountClient", { enumerable: true, get: function () { return createLightAccountClient_js_1.createLightAccountClient; } });
var getLightAccountVersion_js_1 = require("./light-account/getLightAccountVersion.js");
Object.defineProperty(exports, "getLightAccountVersion", { enumerable: true, get: function () { return getLightAccountVersion_js_1.getLightAccountVersion; } });
var lightAccountClientDecorator_js_1 = require("./light-account/lightAccountClientDecorator.js");
Object.defineProperty(exports, "lightAccountClientActions", { enumerable: true, get: function () { return lightAccountClientDecorator_js_1.lightAccountClientActions; } });
var client_js_1 = require("./light-account/client.js");
Object.defineProperty(exports, "createLightAccountClient", { enumerable: true, get: function () { return client_js_1.createLightAccountClient; } });
var decorator_js_1 = require("./light-account/decorator.js");
Object.defineProperty(exports, "lightAccountClientActions", { enumerable: true, get: function () { return decorator_js_1.lightAccountClientActions; } });
var utils_js_1 = require("./light-account/utils.js");

@@ -20,2 +18,3 @@ Object.defineProperty(exports, "LightAccountUnsupported1271Factories", { enumerable: true, get: function () { return utils_js_1.LightAccountUnsupported1271Factories; } });

Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
Object.defineProperty(exports, "getLightAccountVersion", { enumerable: true, get: function () { return utils_js_1.getLightAccountVersion; } });
var account_js_2 = require("./nani-account/account.js");

@@ -27,4 +26,6 @@ Object.defineProperty(exports, "createNaniAccount", { enumerable: true, get: function () { return account_js_2.createNaniAccount; } });

Object.defineProperty(exports, "getDefaultNaniAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_2.getDefaultNaniAccountFactoryAddress; } });
var decorator_js_1 = require("./msca/account-loupe/decorator.js");
Object.defineProperty(exports, "accountLoupeActions", { enumerable: true, get: function () { return decorator_js_1.accountLoupeActions; } });
var IPlugin_js_1 = require("./msca/abis/IPlugin.js");
Object.defineProperty(exports, "IPluginAbi", { enumerable: true, get: function () { return IPlugin_js_1.IPluginAbi; } });
var decorator_js_2 = require("./msca/account-loupe/decorator.js");
Object.defineProperty(exports, "accountLoupeActions", { enumerable: true, get: function () { return decorator_js_2.accountLoupeActions; } });
var multiOwnerAccount_js_1 = require("./msca/account/multiOwnerAccount.js");

@@ -34,4 +35,4 @@ Object.defineProperty(exports, "createMultiOwnerModularAccount", { enumerable: true, get: function () { return multiOwnerAccount_js_1.createMultiOwnerModularAccount; } });

Object.defineProperty(exports, "standardExecutor", { enumerable: true, get: function () { return standardExecutor_js_1.standardExecutor; } });
var decorator_js_2 = require("./msca/plugin-manager/decorator.js");
Object.defineProperty(exports, "pluginManagerActions", { enumerable: true, get: function () { return decorator_js_2.pluginManagerActions; } });
var decorator_js_3 = require("./msca/plugin-manager/decorator.js");
Object.defineProperty(exports, "pluginManagerActions", { enumerable: true, get: function () { return decorator_js_3.pluginManagerActions; } });
var index_js_1 = require("./msca/plugins/multi-owner/index.js");

@@ -38,0 +39,0 @@ Object.defineProperty(exports, "multiOwnerPluginActions", { enumerable: true, get: function () { return index_js_1.multiOwnerPluginActions; } });

@@ -10,8 +10,6 @@ import { type Address, type Hex, type OwnedSmartContractAccount, type SmartAccountSigner, type ToSmartContractAccountParams } from "@alchemy/aa-core";

};
export type CreateLightAccountParams<TTransport extends Transport = Transport, TOwner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<"LightAccount", TTransport>, "transport" | "chain"> & {
export type CreateLightAccountParams<TTransport extends Transport = Transport, TOwner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<"LightAccount", TTransport>, "transport" | "chain" | "entryPoint" | "accountAddress"> & {
owner: TOwner;
index?: bigint;
factoryAddress?: Address;
entryPointAddress?: Address;
accountAddress?: Address;
initCode?: Hex;

@@ -18,0 +16,0 @@ version?: LightAccountVersion;

@@ -8,5 +8,4 @@ "use strict";

const LightAccountFactoryAbi_js_1 = require("./abis/LightAccountFactoryAbi.js");
const getLightAccountVersion_js_1 = require("./getLightAccountVersion.js");
const utils_js_1 = require("./utils.js");
async function createLightAccount({ transport, chain, owner: owner_, accountAddress, initCode, version = "v1.1.0", entryPointAddress = (0, aa_core_1.getDefaultEntryPointAddress)(chain), factoryAddress = (0, utils_js_1.getDefaultLightAccountFactoryAddress)(chain, version), index: index_ = 0n, }) {
async function createLightAccount({ transport, chain, owner: owner_, initCode, version = "v1.1.0", entryPoint = (0, aa_core_1.getVersion060EntryPoint)(chain), accountAddress, factoryAddress = (0, utils_js_1.getDefaultLightAccountFactoryAddress)(chain, version), index: index_ = 0n, }) {
let owner = owner_;

@@ -34,3 +33,3 @@ const client = (0, aa_core_1.createBundlerClient)({

client,
entryPointAddress,
entryPointAddress: entryPoint.address,
accountAddress,

@@ -78,3 +77,3 @@ getAccountInitCode,

chain,
entryPoint: (0, aa_core_1.getVersion060EntryPoint)(chain, entryPointAddress),
entryPoint,
accountAddress: address,

@@ -107,3 +106,3 @@ source: "LightAccount",

async signMessage({ message }) {
const version = await (0, getLightAccountVersion_js_1.getLightAccountVersion)(account);
const version = await (0, utils_js_1.getLightAccountVersion)(account);
switch (version) {

@@ -119,3 +118,3 @@ case "v1.0.1":

async signTypedData(params) {
const version = await (0, getLightAccountVersion_js_1.getLightAccountVersion)(account);
const version = await (0, utils_js_1.getLightAccountVersion)(account);
switch (version) {

@@ -139,3 +138,3 @@ case "v1.0.1": {

source: "LightAccount",
getLightAccountVersion: async () => (0, getLightAccountVersion_js_1.getLightAccountVersion)(account),
getLightAccountVersion: async () => (0, utils_js_1.getLightAccountVersion)(account),
encodeTransferOwnership: (newOwner) => {

@@ -142,0 +141,0 @@ return (0, viem_1.encodeFunctionData)({

@@ -1,2 +0,3 @@

import type { Address, Chain } from "viem";
import { type SmartContractAccount } from "@alchemy/aa-core";
import { type Address, type Chain } from "viem";
export type LightAccountVersion = "v1.0.1" | "v1.0.2" | "v1.1.0";

@@ -13,1 +14,2 @@ export declare const LightAccountVersions: Record<LightAccountVersion, {

export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
export declare const getLightAccountVersion: <A extends SmartContractAccount>(account: A) => Promise<LightAccountVersion>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LightAccountUnsupported1271Factories = exports.LightAccountUnsupported1271Impls = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountVersions = void 0;
exports.getLightAccountVersion = exports.LightAccountUnsupported1271Factories = exports.LightAccountUnsupported1271Impls = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountVersions = void 0;
const aa_core_1 = require("@alchemy/aa-core");
const viem_1 = require("viem");
exports.LightAccountVersions = {

@@ -45,2 +46,21 @@ "v1.0.1": {

exports.LightAccountUnsupported1271Factories = new Set(exports.LightAccountUnsupported1271Impls.map((x) => x.factoryAddress));
const getLightAccountVersion = async (account) => {
const implAddress = await account.getImplementationAddress();
const implToVersion = new Map(Object.entries(exports.LightAccountVersions).map(([key, value]) => [
value.implAddress,
key,
]));
const factoryToVersion = new Map(Object.entries(exports.LightAccountVersions).map(([key, value]) => [
value.factoryAddress,
key,
]));
const version = (0, viem_1.fromHex)(implAddress, "bigint") === 0n
? factoryToVersion.get(account.getFactoryAddress().toLowerCase())
: implToVersion.get(implAddress.toLowerCase());
if (!version) {
throw new Error("Could not determine LightAccount version");
}
return version;
};
exports.getLightAccountVersion = getLightAccountVersion;
//# sourceMappingURL=utils.js.map

@@ -9,3 +9,3 @@ import type { Address, BundlerClient, SmartAccountSigner } from "@alchemy/aa-core";

}): Promise<`0x${string}`>;
signTypedData: <const typedData extends {
signTypedData: <const typedData extends Record<string, unknown> | {
[x: string]: readonly import("viem").TypedDataParameter[];

@@ -215,3 +215,3 @@ [x: `string[${string}]`]: undefined;

uint248?: undefined;
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
}, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
};

@@ -52,3 +52,3 @@ import { kebabCase } from "change-case";

}
return installPlugin_(client, {

@@ -55,0 +55,0 @@ pluginAddress,

export type * from "./light-account/account.js";
export { createLightAccount } from "./light-account/account.js";
export { transferOwnership as transferLightAccountOwnership } from "./light-account/actions/transferOwnership.js";
export { createLightAccountClient } from "./light-account/createLightAccountClient.js";
export { getLightAccountVersion } from "./light-account/getLightAccountVersion.js";
export type * from "./light-account/lightAccountClientDecorator.js";
export { lightAccountClientActions } from "./light-account/lightAccountClientDecorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, type LightAccountVersion, } from "./light-account/utils.js";
export { createLightAccountClient } from "./light-account/client.js";
export type * from "./light-account/decorator.js";
export { lightAccountClientActions } from "./light-account/decorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, getLightAccountVersion, type LightAccountVersion, } from "./light-account/utils.js";
export { createNaniAccount } from "./nani-account/account.js";

@@ -13,2 +12,3 @@ export type { NaniAccount } from "./nani-account/account.js";

export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
export { IPluginAbi } from "./msca/abis/IPlugin.js";
export type * from "./msca/account-loupe/decorator.js";

@@ -15,0 +15,0 @@ export { accountLoupeActions } from "./msca/account-loupe/decorator.js";

export { createLightAccount } from "./light-account/account.js";
export { transferOwnership as transferLightAccountOwnership } from "./light-account/actions/transferOwnership.js";
export { createLightAccountClient } from "./light-account/createLightAccountClient.js";
export { getLightAccountVersion } from "./light-account/getLightAccountVersion.js";
export { lightAccountClientActions } from "./light-account/lightAccountClientDecorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, } from "./light-account/utils.js";
export { createLightAccountClient } from "./light-account/client.js";
export { lightAccountClientActions } from "./light-account/decorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, getLightAccountVersion, } from "./light-account/utils.js";
export { createNaniAccount } from "./nani-account/account.js";
export { transferOwnership as transferNaniAccountOwnership } from "./nani-account/transferNaniAccountOwnership.js";
export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
export { IPluginAbi } from "./msca/abis/IPlugin.js";
export { accountLoupeActions } from "./msca/account-loupe/decorator.js";

@@ -11,0 +11,0 @@ export { createMultiOwnerModularAccount } from "./msca/account/multiOwnerAccount.js";

@@ -10,8 +10,6 @@ import { type Address, type Hex, type OwnedSmartContractAccount, type SmartAccountSigner, type ToSmartContractAccountParams } from "@alchemy/aa-core";

};
export type CreateLightAccountParams<TTransport extends Transport = Transport, TOwner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<"LightAccount", TTransport>, "transport" | "chain"> & {
export type CreateLightAccountParams<TTransport extends Transport = Transport, TOwner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<"LightAccount", TTransport>, "transport" | "chain" | "entryPoint" | "accountAddress"> & {
owner: TOwner;
index?: bigint;
factoryAddress?: Address;
entryPointAddress?: Address;
accountAddress?: Address;
initCode?: Hex;

@@ -18,0 +16,0 @@ version?: LightAccountVersion;

@@ -1,8 +0,7 @@

import { FailedToGetStorageSlotError, createBundlerClient, getAccountAddress, getDefaultEntryPointAddress, getVersion060EntryPoint, toSmartContractAccount, } from "@alchemy/aa-core";
import { FailedToGetStorageSlotError, createBundlerClient, getAccountAddress, getVersion060EntryPoint, toSmartContractAccount, } from "@alchemy/aa-core";
import { concatHex, encodeFunctionData, fromHex, hashMessage, hashTypedData, trim, } from "viem";
import { LightAccountAbi } from "./abis/LightAccountAbi.js";
import { LightAccountFactoryAbi } from "./abis/LightAccountFactoryAbi.js";
import { getLightAccountVersion } from "./getLightAccountVersion.js";
import { LightAccountUnsupported1271Factories, LightAccountVersions, getDefaultLightAccountFactoryAddress, } from "./utils.js";
export async function createLightAccount({ transport, chain, owner: owner_, accountAddress, initCode, version = "v1.1.0", entryPointAddress = getDefaultEntryPointAddress(chain), factoryAddress = getDefaultLightAccountFactoryAddress(chain, version), index: index_ = 0n, }) {
import { LightAccountUnsupported1271Factories, LightAccountVersions, getDefaultLightAccountFactoryAddress, getLightAccountVersion, } from "./utils.js";
export async function createLightAccount({ transport, chain, owner: owner_, initCode, version = "v1.1.0", entryPoint = getVersion060EntryPoint(chain), accountAddress, factoryAddress = getDefaultLightAccountFactoryAddress(chain, version), index: index_ = 0n, }) {
let owner = owner_;

@@ -30,3 +29,3 @@ const client = createBundlerClient({

client,
entryPointAddress,
entryPointAddress: entryPoint.address,
accountAddress,

@@ -74,3 +73,3 @@ getAccountInitCode,

chain,
entryPoint: getVersion060EntryPoint(chain, entryPointAddress),
entryPoint,
accountAddress: address,

@@ -77,0 +76,0 @@ source: "LightAccount",

@@ -1,2 +0,3 @@

import type { Address, Chain } from "viem";
import { type SmartContractAccount } from "@alchemy/aa-core";
import { type Address, type Chain } from "viem";
export type LightAccountVersion = "v1.0.1" | "v1.0.2" | "v1.1.0";

@@ -13,1 +14,2 @@ export declare const LightAccountVersions: Record<LightAccountVersion, {

export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
export declare const getLightAccountVersion: <A extends SmartContractAccount>(account: A) => Promise<LightAccountVersion>;
import { DefaultFactoryNotDefinedError, arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonMumbai, sepolia, } from "@alchemy/aa-core";
import { fromHex } from "viem";
export const LightAccountVersions = {

@@ -41,2 +42,20 @@ "v1.0.1": {

export const LightAccountUnsupported1271Factories = new Set(LightAccountUnsupported1271Impls.map((x) => x.factoryAddress));
export const getLightAccountVersion = async (account) => {
const implAddress = await account.getImplementationAddress();
const implToVersion = new Map(Object.entries(LightAccountVersions).map(([key, value]) => [
value.implAddress,
key,
]));
const factoryToVersion = new Map(Object.entries(LightAccountVersions).map(([key, value]) => [
value.factoryAddress,
key,
]));
const version = fromHex(implAddress, "bigint") === 0n
? factoryToVersion.get(account.getFactoryAddress().toLowerCase())
: implToVersion.get(implAddress.toLowerCase());
if (!version) {
throw new Error("Could not determine LightAccount version");
}
return version;
};
//# sourceMappingURL=utils.js.map

@@ -9,3 +9,3 @@ import type { Address, BundlerClient, SmartAccountSigner } from "@alchemy/aa-core";

}): Promise<`0x${string}`>;
signTypedData: <const typedData extends {
signTypedData: <const typedData extends Record<string, unknown> | {
[x: string]: readonly import("viem").TypedDataParameter[];

@@ -215,3 +215,3 @@ [x: `string[${string}]`]: undefined;

uint248?: undefined;
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
}, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
};
export type * from "./light-account/account.js";
export { createLightAccount } from "./light-account/account.js";
export { transferOwnership as transferLightAccountOwnership } from "./light-account/actions/transferOwnership.js";
export { createLightAccountClient } from "./light-account/createLightAccountClient.js";
export { getLightAccountVersion } from "./light-account/getLightAccountVersion.js";
export type * from "./light-account/lightAccountClientDecorator.js";
export { lightAccountClientActions } from "./light-account/lightAccountClientDecorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, type LightAccountVersion, } from "./light-account/utils.js";
export { createLightAccountClient } from "./light-account/client.js";
export type * from "./light-account/decorator.js";
export { lightAccountClientActions } from "./light-account/decorator.js";
export { LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, LightAccountVersions, getDefaultLightAccountFactoryAddress, getLightAccountVersion, type LightAccountVersion, } from "./light-account/utils.js";
export { createNaniAccount } from "./nani-account/account.js";

@@ -13,2 +12,3 @@ export type { NaniAccount } from "./nani-account/account.js";

export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
export { IPluginAbi } from "./msca/abis/IPlugin.js";
export type * from "./msca/account-loupe/decorator.js";

@@ -15,0 +15,0 @@ export { accountLoupeActions } from "./msca/account-loupe/decorator.js";

@@ -10,8 +10,6 @@ import { type Address, type Hex, type OwnedSmartContractAccount, type SmartAccountSigner, type ToSmartContractAccountParams } from "@alchemy/aa-core";

};
export type CreateLightAccountParams<TTransport extends Transport = Transport, TOwner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<"LightAccount", TTransport>, "transport" | "chain"> & {
export type CreateLightAccountParams<TTransport extends Transport = Transport, TOwner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<"LightAccount", TTransport>, "transport" | "chain" | "entryPoint" | "accountAddress"> & {
owner: TOwner;
index?: bigint;
factoryAddress?: Address;
entryPointAddress?: Address;
accountAddress?: Address;
initCode?: Hex;

@@ -18,0 +16,0 @@ version?: LightAccountVersion;

@@ -1,2 +0,3 @@

import type { Address, Chain } from "viem";
import { type SmartContractAccount } from "@alchemy/aa-core";
import { type Address, type Chain } from "viem";
export type LightAccountVersion =

@@ -24,2 +25,3 @@ /** @deprecated This version does not support 1271 signature validation */

export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
export declare const getLightAccountVersion: <A extends SmartContractAccount>(account: A) => Promise<LightAccountVersion>;
//# sourceMappingURL=utils.d.ts.map

@@ -9,3 +9,3 @@ import type { Address, BundlerClient, SmartAccountSigner } from "@alchemy/aa-core";

}): Promise<`0x${string}`>;
signTypedData: <const typedData extends {
signTypedData: <const typedData extends Record<string, unknown> | {
[x: string]: readonly import("viem").TypedDataParameter[];

@@ -215,4 +215,4 @@ [x: `string[${string}]`]: undefined;

uint248?: undefined;
} | Record<string, unknown>, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
}, primaryType extends "EIP712Domain" | keyof typedData = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
};
//# sourceMappingURL=signer.d.ts.map
{
"name": "@alchemy/aa-accounts",
"version": "3.0.0-alpha.7",
"version": "3.0.0-alpha.9",
"description": "A collection of ERC-4337 compliant smart contract account interfaces",

@@ -75,7 +75,7 @@ "author": "Alchemy",

"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
"gitHead": "05813cfb4ff377c71ad3d3742e863d6faaa515f0",
"gitHead": "1ea467e0385f7cfb6815aa4b055d4976a41c940b",
"dependencies": {
"@alchemy/aa-core": "^3.0.0-alpha.5",
"viem": "^2.5.0"
"@alchemy/aa-core": "^3.0.0-alpha.9",
"viem": "^2.7.8"
}
}

@@ -78,3 +78,3 @@ import { kebabCase } from "change-case";

}
return installPlugin_(client, {

@@ -81,0 +81,0 @@ pluginAddress,

@@ -7,3 +7,3 @@ # `@alchemy/aa-accounts`

If you are already using the `@alchemy/aa-core` package, you can simply install this package and start using the accounts. If you are not using `@alchemy/aa-core`, you can install it and follow the instructions in the [Getting Started](https://accountkit.alchemy.com/packages/aa-accounts/) docs to get started.
If you are already using the `@alchemy/aa-core` package, you can simply install this package and start using the accounts. If you are not using `@alchemy/aa-core`, you can install it and follow the instructions in the [Getting started](https://accountkit.alchemy.com/packages/aa-accounts/) docs to get started.

@@ -10,0 +10,0 @@ via `yarn`

@@ -8,6 +8,5 @@ // Add you exports here, make sure to export types separately from impls and use the `type` keyword when exporting them

export { transferOwnership as transferLightAccountOwnership } from "./light-account/actions/transferOwnership.js";
export { createLightAccountClient } from "./light-account/createLightAccountClient.js";
export { getLightAccountVersion } from "./light-account/getLightAccountVersion.js";
export type * from "./light-account/lightAccountClientDecorator.js";
export { lightAccountClientActions } from "./light-account/lightAccountClientDecorator.js";
export { createLightAccountClient } from "./light-account/client.js";
export type * from "./light-account/decorator.js";
export { lightAccountClientActions } from "./light-account/decorator.js";
export {

@@ -18,2 +17,3 @@ LightAccountUnsupported1271Factories,

getDefaultLightAccountFactoryAddress,
getLightAccountVersion,
type LightAccountVersion,

@@ -29,2 +29,3 @@ } from "./light-account/utils.js";

// msca exports
export { IPluginAbi } from "./msca/abis/IPlugin.js";
export type * from "./msca/account-loupe/decorator.js";

@@ -31,0 +32,0 @@ export { accountLoupeActions } from "./msca/account-loupe/decorator.js";

@@ -5,3 +5,2 @@ import {

getAccountAddress,
getDefaultEntryPointAddress,
getVersion060EntryPoint,

@@ -28,3 +27,2 @@ toSmartContractAccount,

import { LightAccountFactoryAbi } from "./abis/LightAccountFactoryAbi.js";
import { getLightAccountVersion } from "./getLightAccountVersion.js";
import {

@@ -34,2 +32,3 @@ LightAccountUnsupported1271Factories,

getDefaultLightAccountFactoryAddress,
getLightAccountVersion,
type LightAccountVersion,

@@ -54,3 +53,3 @@ } from "./utils.js";

ToSmartContractAccountParams<"LightAccount", TTransport>,
"transport" | "chain"
"transport" | "chain" | "entryPoint" | "accountAddress"
> & {

@@ -60,4 +59,2 @@ owner: TOwner;

factoryAddress?: Address;
entryPointAddress?: Address;
accountAddress?: Address;
initCode?: Hex;

@@ -78,6 +75,6 @@ version?: LightAccountVersion;

owner: owner_,
accountAddress,
initCode,
version = "v1.1.0",
entryPointAddress = getDefaultEntryPointAddress(chain),
entryPoint = getVersion060EntryPoint(chain),
accountAddress,
factoryAddress = getDefaultLightAccountFactoryAddress(chain, version),

@@ -113,3 +110,3 @@ index: index_ = 0n,

client,
entryPointAddress,
entryPointAddress: entryPoint.address,
accountAddress,

@@ -180,3 +177,3 @@ getAccountInitCode,

chain,
entryPoint: getVersion060EntryPoint(chain, entryPointAddress),
entryPoint,
accountAddress: address,

@@ -183,0 +180,0 @@ source: "LightAccount",

@@ -17,4 +17,5 @@ import {

sepolia,
type SmartContractAccount,
} from "@alchemy/aa-core";
import type { Address, Chain } from "viem";
import { fromHex, type Address, type Chain } from "viem";

@@ -95,1 +96,33 @@ export type LightAccountVersion =

);
export const getLightAccountVersion = async <A extends SmartContractAccount>(
account: A
) => {
const implAddress = await account.getImplementationAddress();
const implToVersion = new Map(
Object.entries(LightAccountVersions).map(([key, value]) => [
value.implAddress,
key as LightAccountVersion,
])
);
const factoryToVersion = new Map(
Object.entries(LightAccountVersions).map(([key, value]) => [
value.factoryAddress,
key as LightAccountVersion,
])
);
const version =
fromHex(implAddress, "bigint") === 0n
? factoryToVersion.get(
account.getFactoryAddress().toLowerCase() as Address
)
: implToVersion.get(implAddress.toLowerCase() as Address);
if (!version) {
throw new Error("Could not determine LightAccount version");
}
return version;
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc