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 1.2.0 to 1.2.1

dist/cjs/light-account/provider.d.ts

16

./dist/cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultLightAccountFactoryAddress = exports.LightSmartContractAccount = exports.ValidatorMode = exports.KernelBaseValidator = exports.KernelAccountProvider = exports.KernelSmartContractAccount = exports.KernelFactoryAbi = exports.KernelAccountAbi = void 0;
exports.getDefaultNaniAccountFactoryAddress = exports.NaniAccountProviderConfigSchema = exports.NaniAccountFactoryConfigSchema = exports.createNaniAccountProvider = exports.NaniAccount = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountProviderConfigSchema = exports.LightAccountFactoryConfigSchema = exports.createLightAccountProvider = exports.LightSmartContractAccount = exports.ValidatorMode = exports.KernelBaseValidator = exports.KernelAccountProvider = exports.KernelSmartContractAccount = exports.KernelFactoryAbi = exports.KernelAccountAbi = void 0;
var KernelAccountAbi_js_1 = require("./kernel-zerodev/abis/KernelAccountAbi.js");

@@ -17,4 +17,18 @@ Object.defineProperty(exports, "KernelAccountAbi", { enumerable: true, get: function () { return KernelAccountAbi_js_1.KernelAccountAbi; } });

Object.defineProperty(exports, "LightSmartContractAccount", { enumerable: true, get: function () { return account_js_2.LightSmartContractAccount; } });
var provider_js_2 = require("./light-account/provider.js");
Object.defineProperty(exports, "createLightAccountProvider", { enumerable: true, get: function () { return provider_js_2.createLightAccountProvider; } });
var schema_js_1 = require("./light-account/schema.js");
Object.defineProperty(exports, "LightAccountFactoryConfigSchema", { enumerable: true, get: function () { return schema_js_1.LightAccountFactoryConfigSchema; } });
Object.defineProperty(exports, "LightAccountProviderConfigSchema", { enumerable: true, get: function () { return schema_js_1.LightAccountProviderConfigSchema; } });
var utils_js_1 = require("./light-account/utils.js");
Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
var account_js_3 = require("./nani-account/account.js");
Object.defineProperty(exports, "NaniAccount", { enumerable: true, get: function () { return account_js_3.NaniAccount; } });
var provider_js_3 = require("./nani-account/provider.js");
Object.defineProperty(exports, "createNaniAccountProvider", { enumerable: true, get: function () { return provider_js_3.createNaniAccountProvider; } });
var schema_js_2 = require("./nani-account/schema.js");
Object.defineProperty(exports, "NaniAccountFactoryConfigSchema", { enumerable: true, get: function () { return schema_js_2.NaniAccountFactoryConfigSchema; } });
Object.defineProperty(exports, "NaniAccountProviderConfigSchema", { enumerable: true, get: function () { return schema_js_2.NaniAccountProviderConfigSchema; } });
var utils_js_2 = require("./nani-account/utils.js");
Object.defineProperty(exports, "getDefaultNaniAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_2.getDefaultNaniAccountFactoryAddress; } });
//# sourceMappingURL=index.js.map

@@ -10,2 +10,10 @@ export { KernelAccountAbi } from "./kernel-zerodev/abis/KernelAccountAbi.js";

export { LightSmartContractAccount } from "./light-account/account.js";
export { createLightAccountProvider } from "./light-account/provider.js";
export { LightAccountFactoryConfigSchema, LightAccountProviderConfigSchema, } from "./light-account/schema.js";
export type { LightAccountProviderConfig } from "./light-account/types.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
export { NaniAccount } from "./nani-account/account.js";
export { createNaniAccountProvider } from "./nani-account/provider.js";
export { NaniAccountFactoryConfigSchema, NaniAccountProviderConfigSchema, } from "./nani-account/schema.js";
export type { NaniAccountProviderConfig } from "./nani-account/types.js";
export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultLightAccountFactoryAddress = exports.LightSmartContractAccount = exports.ValidatorMode = exports.KernelBaseValidator = exports.KernelAccountProvider = exports.KernelSmartContractAccount = exports.KernelFactoryAbi = exports.KernelAccountAbi = void 0;
exports.getDefaultNaniAccountFactoryAddress = exports.NaniAccountProviderConfigSchema = exports.NaniAccountFactoryConfigSchema = exports.createNaniAccountProvider = exports.NaniAccount = exports.getDefaultLightAccountFactoryAddress = exports.LightAccountProviderConfigSchema = exports.LightAccountFactoryConfigSchema = exports.createLightAccountProvider = exports.LightSmartContractAccount = exports.ValidatorMode = exports.KernelBaseValidator = exports.KernelAccountProvider = exports.KernelSmartContractAccount = exports.KernelFactoryAbi = exports.KernelAccountAbi = void 0;
var KernelAccountAbi_js_1 = require("./kernel-zerodev/abis/KernelAccountAbi.js");

@@ -17,4 +17,18 @@ Object.defineProperty(exports, "KernelAccountAbi", { enumerable: true, get: function () { return KernelAccountAbi_js_1.KernelAccountAbi; } });

Object.defineProperty(exports, "LightSmartContractAccount", { enumerable: true, get: function () { return account_js_2.LightSmartContractAccount; } });
var provider_js_2 = require("./light-account/provider.js");
Object.defineProperty(exports, "createLightAccountProvider", { enumerable: true, get: function () { return provider_js_2.createLightAccountProvider; } });
var schema_js_1 = require("./light-account/schema.js");
Object.defineProperty(exports, "LightAccountFactoryConfigSchema", { enumerable: true, get: function () { return schema_js_1.LightAccountFactoryConfigSchema; } });
Object.defineProperty(exports, "LightAccountProviderConfigSchema", { enumerable: true, get: function () { return schema_js_1.LightAccountProviderConfigSchema; } });
var utils_js_1 = require("./light-account/utils.js");
Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
var account_js_3 = require("./nani-account/account.js");
Object.defineProperty(exports, "NaniAccount", { enumerable: true, get: function () { return account_js_3.NaniAccount; } });
var provider_js_3 = require("./nani-account/provider.js");
Object.defineProperty(exports, "createNaniAccountProvider", { enumerable: true, get: function () { return provider_js_3.createNaniAccountProvider; } });
var schema_js_2 = require("./nani-account/schema.js");
Object.defineProperty(exports, "NaniAccountFactoryConfigSchema", { enumerable: true, get: function () { return schema_js_2.NaniAccountFactoryConfigSchema; } });
Object.defineProperty(exports, "NaniAccountProviderConfigSchema", { enumerable: true, get: function () { return schema_js_2.NaniAccountProviderConfigSchema; } });
var utils_js_2 = require("./nani-account/utils.js");
Object.defineProperty(exports, "getDefaultNaniAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_2.getDefaultNaniAccountFactoryAddress; } });
//# sourceMappingURL=index.js.map

5

dist/cjs/kernel-zerodev/types.d.ts
import type { UserOperationCallData } from "@alchemy/aa-core";
export interface KernelUserOperationCallData extends UserOperationCallData {
import type { Hex } from "viem";
export type KernelUserOperationCallData = Exclude<UserOperationCallData, Hex> & {
delegateCall?: boolean;
}
};
export type KernelBatchUserOperationCallData = KernelUserOperationCallData[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const aa_alchemy_1 = require("@alchemy/aa-alchemy");
const aa_core_1 = require("@alchemy/aa-core");

@@ -11,2 +10,3 @@ const viem_1 = require("viem");

const chain = chains_1.sepolia;
aa_core_1.Logger.setLogLevel(aa_core_1.LogLevel.DEBUG);
describe("Light Account Tests", () => {

@@ -67,3 +67,3 @@ const owner = aa_core_1.LocalAccountSigner.mnemonicToAccountSigner(constants_js_1.LIGHT_ACCOUNT_OWNER_MNEMONIC);

await expect(txnHash).resolves.not.toThrowError();
}, 50000);
}, 100000);
it("should fail to execute if account address is not deployed and not correct", async () => {

@@ -98,7 +98,2 @@ const accountAddress = "0xc33AbD9621834CA7c6Fc9f9CC3c47b9c17B03f9F";

chain,
feeOpts: {
baseFeeBufferPercent: 50n,
maxPriorityFeeBufferPercent: 50n,
preVerificationGasBufferPercent: 50n,
},
});

@@ -110,31 +105,27 @@ const throwawayOwner = aa_core_1.LocalAccountSigner.privateKeyToAccountSigner((0, accounts_1.generatePrivateKey)());

});
const fundThrowawayResult = await provider.sendUserOperation({
target: await throwawayProvider.getAddress(),
const oldOwner = await throwawayOwner.getAddress();
await provider.sendTransaction({
from: await provider.getAddress(),
to: await throwawayProvider.getAddress(),
data: "0x",
value: 10000000000000n,
value: (0, viem_1.toHex)(1000000000000000n),
});
const fundThrowawayTxnHash = provider.waitForUserOperationTransaction(fundThrowawayResult.hash);
await expect(fundThrowawayTxnHash).resolves.not.toThrowError();
const newThrowawayOwner = aa_core_1.LocalAccountSigner.privateKeyToAccountSigner((0, accounts_1.generatePrivateKey)());
const result = await index_js_1.LightSmartContractAccount.transferOwnership(throwawayProvider, newThrowawayOwner);
const txnHash = throwawayProvider.waitForUserOperationTransaction(result);
await expect(txnHash).resolves.not.toThrowError();
expect(await throwawayProvider.account.getOwnerAddress()).not.toBe(await throwawayOwner.getAddress());
expect(await throwawayProvider.account.getOwnerAddress()).toBe(await newThrowawayOwner.getAddress());
await index_js_1.LightSmartContractAccount.transferOwnership(throwawayProvider, newThrowawayOwner, true);
const newOwnerViaProvider = await throwawayProvider.account.getOwnerAddress();
const newOwner = await newThrowawayOwner.getAddress();
expect(newOwnerViaProvider).not.toBe(oldOwner);
expect(newOwnerViaProvider).toBe(newOwner);
}, 100000);
});
const givenConnectedProvider = ({ owner, chain, accountAddress, feeOpts, }) => {
const provider = new aa_alchemy_1.AlchemyProvider({
apiKey: constants_js_1.API_KEY,
const givenConnectedProvider = ({ owner, chain, accountAddress, feeOptions, }) => {
const provider = (0, index_js_1.createLightAccountProvider)({
rpcProvider: `${chain.rpcUrls.alchemy.http[0]}/${constants_js_1.API_KEY}`,
chain,
feeOpts,
}).connect((rpcClient) => new index_js_1.LightSmartContractAccount({
chain,
owner,
factoryAddress: (0, index_js_1.getDefaultLightAccountFactoryAddress)(chain),
rpcClient,
accountAddress,
}));
provider.withAlchemyGasManager({
policyId: constants_js_1.PAYMASTER_POLICY_ID,
opts: {
feeOptions,
txMaxRetries: 100,
},
});

@@ -141,0 +132,0 @@ return provider;

@@ -10,2 +10,10 @@ export { KernelAccountAbi } from "./kernel-zerodev/abis/KernelAccountAbi.js";

export { LightSmartContractAccount } from "./light-account/account.js";
export { createLightAccountProvider } from "./light-account/provider.js";
export { LightAccountFactoryConfigSchema, LightAccountProviderConfigSchema, } from "./light-account/schema.js";
export type { LightAccountProviderConfig } from "./light-account/types.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
export { NaniAccount } from "./nani-account/account.js";
export { createNaniAccountProvider } from "./nani-account/provider.js";
export { NaniAccountFactoryConfigSchema, NaniAccountProviderConfigSchema, } from "./nani-account/schema.js";
export type { NaniAccountProviderConfig } from "./nani-account/types.js";
export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";

@@ -7,3 +7,9 @@ export { KernelAccountAbi } from "./kernel-zerodev/abis/KernelAccountAbi.js";

export { LightSmartContractAccount } from "./light-account/account.js";
export { createLightAccountProvider } from "./light-account/provider.js";
export { LightAccountFactoryConfigSchema, LightAccountProviderConfigSchema, } from "./light-account/schema.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
export { NaniAccount } from "./nani-account/account.js";
export { createNaniAccountProvider } from "./nani-account/provider.js";
export { NaniAccountFactoryConfigSchema, NaniAccountProviderConfigSchema, } from "./nani-account/schema.js";
export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
//# sourceMappingURL=index.js.map
import type { UserOperationCallData } from "@alchemy/aa-core";
export interface KernelUserOperationCallData extends UserOperationCallData {
import type { Hex } from "viem";
export type KernelUserOperationCallData = Exclude<UserOperationCallData, Hex> & {
delegateCall?: boolean;
}
};
export type KernelBatchUserOperationCallData = KernelUserOperationCallData[];

@@ -1,9 +0,9 @@

import { AlchemyProvider } from "@alchemy/aa-alchemy";
import { LocalAccountSigner } from "@alchemy/aa-core";
import { isAddress, } from "viem";
import { LocalAccountSigner, Logger, LogLevel, } from "@alchemy/aa-core";
import { isAddress, toHex, } from "viem";
import { generatePrivateKey } from "viem/accounts";
import { sepolia } from "viem/chains";
import { LightSmartContractAccount, getDefaultLightAccountFactoryAddress, } from "../../index.js";
import { API_KEY, LIGHT_ACCOUNT_OWNER_MNEMONIC, PAYMASTER_POLICY_ID, UNDEPLOYED_OWNER_MNEMONIC, } from "./constants.js";
import { createLightAccountProvider, LightSmartContractAccount, } from "../../index.js";
import { API_KEY, LIGHT_ACCOUNT_OWNER_MNEMONIC, UNDEPLOYED_OWNER_MNEMONIC, } from "./constants.js";
const chain = sepolia;
Logger.setLogLevel(LogLevel.DEBUG);
describe("Light Account Tests", () => {

@@ -64,3 +64,3 @@ const owner = LocalAccountSigner.mnemonicToAccountSigner(LIGHT_ACCOUNT_OWNER_MNEMONIC);

await expect(txnHash).resolves.not.toThrowError();
}, 50000);
}, 100000);
it("should fail to execute if account address is not deployed and not correct", async () => {

@@ -95,7 +95,2 @@ const accountAddress = "0xc33AbD9621834CA7c6Fc9f9CC3c47b9c17B03f9F";

chain,
feeOpts: {
baseFeeBufferPercent: 50n,
maxPriorityFeeBufferPercent: 50n,
preVerificationGasBufferPercent: 50n,
},
});

@@ -107,31 +102,27 @@ const throwawayOwner = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());

});
const fundThrowawayResult = await provider.sendUserOperation({
target: await throwawayProvider.getAddress(),
const oldOwner = await throwawayOwner.getAddress();
await provider.sendTransaction({
from: await provider.getAddress(),
to: await throwawayProvider.getAddress(),
data: "0x",
value: 10000000000000n,
value: toHex(1000000000000000n),
});
const fundThrowawayTxnHash = provider.waitForUserOperationTransaction(fundThrowawayResult.hash);
await expect(fundThrowawayTxnHash).resolves.not.toThrowError();
const newThrowawayOwner = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
const result = await LightSmartContractAccount.transferOwnership(throwawayProvider, newThrowawayOwner);
const txnHash = throwawayProvider.waitForUserOperationTransaction(result);
await expect(txnHash).resolves.not.toThrowError();
expect(await throwawayProvider.account.getOwnerAddress()).not.toBe(await throwawayOwner.getAddress());
expect(await throwawayProvider.account.getOwnerAddress()).toBe(await newThrowawayOwner.getAddress());
await LightSmartContractAccount.transferOwnership(throwawayProvider, newThrowawayOwner, true);
const newOwnerViaProvider = await throwawayProvider.account.getOwnerAddress();
const newOwner = await newThrowawayOwner.getAddress();
expect(newOwnerViaProvider).not.toBe(oldOwner);
expect(newOwnerViaProvider).toBe(newOwner);
}, 100000);
});
const givenConnectedProvider = ({ owner, chain, accountAddress, feeOpts, }) => {
const provider = new AlchemyProvider({
apiKey: API_KEY,
const givenConnectedProvider = ({ owner, chain, accountAddress, feeOptions, }) => {
const provider = createLightAccountProvider({
rpcProvider: `${chain.rpcUrls.alchemy.http[0]}/${API_KEY}`,
chain,
feeOpts,
}).connect((rpcClient) => new LightSmartContractAccount({
chain,
owner,
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
accountAddress,
}));
provider.withAlchemyGasManager({
policyId: PAYMASTER_POLICY_ID,
opts: {
feeOptions,
txMaxRetries: 100,
},
});

@@ -138,0 +129,0 @@ return provider;

@@ -10,3 +10,11 @@ export { KernelAccountAbi } from "./kernel-zerodev/abis/KernelAccountAbi.js";

export { LightSmartContractAccount } from "./light-account/account.js";
export { createLightAccountProvider } from "./light-account/provider.js";
export { LightAccountFactoryConfigSchema, LightAccountProviderConfigSchema, } from "./light-account/schema.js";
export type { LightAccountProviderConfig } from "./light-account/types.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
export { NaniAccount } from "./nani-account/account.js";
export { createNaniAccountProvider } from "./nani-account/provider.js";
export { NaniAccountFactoryConfigSchema, NaniAccountProviderConfigSchema, } from "./nani-account/schema.js";
export type { NaniAccountProviderConfig } from "./nani-account/types.js";
export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
//# sourceMappingURL=index.d.ts.map
import type { UserOperationCallData } from "@alchemy/aa-core";
export interface KernelUserOperationCallData extends UserOperationCallData {
import type { Hex } from "viem";
export type KernelUserOperationCallData = Exclude<UserOperationCallData, Hex> & {
delegateCall?: boolean;
}
};
export type KernelBatchUserOperationCallData = KernelUserOperationCallData[];
//# sourceMappingURL=types.d.ts.map

@@ -12,3 +12,3 @@ import { SimpleSmartContractAccount, SmartAccountProvider, type SignTypedDataParams, type SmartAccountSigner } from "@alchemy/aa-core";

/**
* Encodes the transferOwnership function call using the LightAccount ABI.
* Encodes the transferOwnership function call using Light Account ABI.
*

@@ -15,0 +15,0 @@ * @param newOwner - the new owner of the account

{
"name": "@alchemy/aa-accounts",
"version": "1.2.0",
"version": "1.2.1",
"description": "A collection of ERC-4337 compliant smart contract account interfaces",

@@ -42,4 +42,3 @@ "author": "Alchemy",

"devDependencies": {
"@alchemy/aa-alchemy": "^1.2.0",
"@alchemy/aa-core": "^1.0.0",
"@alchemy/aa-core": "^1.2.0",
"typescript": "^5.0.4",

@@ -61,7 +60,7 @@ "typescript-template": "*",

"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
"gitHead": "3f24fe0daff3125a8a902a10448c33c05d10fd3a",
"gitHead": "032b2814d8804d86a6a9bb9f492f288a88b9e5df",
"dependencies": {
"@alchemy/aa-core": "^1.2.0",
"@alchemy/aa-core": "^1.2.1",
"viem": "^1.16.2"
}
}

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

export { LightSmartContractAccount } from "./light-account/account.js";
export { createLightAccountProvider } from "./light-account/provider.js";
export {
LightAccountFactoryConfigSchema,
LightAccountProviderConfigSchema,
} from "./light-account/schema.js";
export type { LightAccountProviderConfig } from "./light-account/types.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
//nani-account exports
export { NaniAccount } from "./nani-account/account.js";
export { createNaniAccountProvider } from "./nani-account/provider.js";
export {
NaniAccountFactoryConfigSchema,
NaniAccountProviderConfigSchema,
} from "./nani-account/schema.js";
export type { NaniAccountProviderConfig } from "./nani-account/types.js";
export { getDefaultNaniAccountFactoryAddress } from "./nani-account/utils.js";
import type { UserOperationCallData } from "@alchemy/aa-core";
import type { Hex } from "viem";
export interface KernelUserOperationCallData extends UserOperationCallData {
export type KernelUserOperationCallData = Exclude<
UserOperationCallData,
Hex
> & {
delegateCall?: boolean;
}
};
export type KernelBatchUserOperationCallData = KernelUserOperationCallData[];

@@ -59,3 +59,3 @@ import {

/**
* Encodes the transferOwnership function call using the LightAccount ABI.
* Encodes the transferOwnership function call using Light Account ABI.
*

@@ -62,0 +62,0 @@ * @param newOwner - the new owner of the account

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

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