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.1.0 to 1.2.0

2

dist/cjs/kernel-zerodev/e2e-tests/constants.d.ts

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

export declare const MUMBAI_RPC_URL: string | undefined;
export declare const API_KEY: string | undefined;
export declare const OWNER_MNEMONIC: string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OWNER_MNEMONIC = exports.MUMBAI_RPC_URL = void 0;
exports.MUMBAI_RPC_URL = process.env.MUMBAI_RPC_URL;
exports.OWNER_MNEMONIC = exports.API_KEY = void 0;
exports.API_KEY = process.env.API_KEY;
exports.OWNER_MNEMONIC = process.env.OWNER_MNEMONIC;
//# sourceMappingURL=constants.js.map

@@ -12,9 +12,10 @@ "use strict";

const mock_signer_js_1 = require("./mocks/mock-signer.js");
const chain = chains_1.polygonMumbai;
describe("Kernel Account Tests", () => {
const config = {
chain: chains_1.polygonMumbai,
rpcProvider: constants_js_1.MUMBAI_RPC_URL,
chain,
rpcProvider: `${chain.rpcUrls.alchemy.http[0]}/${constants_js_1.API_KEY}`,
validatorAddress: "0x180D6465F921C7E0DEA0040107D342c87455fFF5",
accountFactoryAddress: "0x5D006d3880645ec6e254E18C1F879DAC9Dd71A39",
entryPointAddress: (0, aa_core_1.getDefaultEntryPointAddress)(chains_1.polygonMumbai),
entryPointAddress: (0, aa_core_1.getDefaultEntryPointAddress)(chain),
};

@@ -21,0 +22,0 @@ const ownerAccount = (0, accounts_1.mnemonicToAccount)(constants_js_1.OWNER_MNEMONIC);

@@ -15,7 +15,7 @@ "use strict";

it("should successfully get counterfactual address", async () => {
const signer = givenConnectedProvider({ owner, chain });
expect(await signer.getAddress()).toMatchInlineSnapshot('"0xbd96C2c76dE02A75fe2909730422e05ce18f484e"');
const provider = givenConnectedProvider({ owner, chain });
expect(await provider.getAddress()).toMatchInlineSnapshot('"0x1a3a89cd46f124EF40848966c2D7074a575dbC27"');
});
it("should sign typed data successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
const provider = givenConnectedProvider({ owner, chain });
const typedData = {

@@ -30,10 +30,10 @@ types: {

};
expect(await signer.signTypedData(typedData)).toBe(await owner.signTypedData(typedData));
expect(await provider.signTypedData(typedData)).toBe(await owner.signTypedData(typedData));
});
it("should sign message successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
expect(await signer.signMessage("test")).toBe(await owner.signMessage("test"));
const provider = givenConnectedProvider({ owner, chain });
expect(await provider.signMessage("test")).toBe(await owner.signMessage("test"));
});
it("should sign typed data with 6492 successfully for undeployed account", async () => {
const undeployedSigner = givenConnectedProvider({
const undeployedProvider = givenConnectedProvider({
owner: undeployedOwner,

@@ -51,18 +51,18 @@ chain,

};
expect(await undeployedSigner.signTypedDataWith6492(typedData)).toMatchInlineSnapshot('"0x000000000000000000000000000000893a26168158fbeadd9335be5bc96592e2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041591a9422219a5f2bc87ee24a82a6d5ef9674bf7408a2a289984de258466d148e75efb65b487ffbfcb061b268b1b667d8d7d4eac2c3d9d2d0a52d49c891be567c1c000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
expect(await undeployedProvider.signTypedDataWith6492(typedData)).toMatchInlineSnapshot('"0x00000000000000000000000000000055c0b4fa41dde26a74435ff03692292fbd000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041591a9422219a5f2bc87ee24a82a6d5ef9674bf7408a2a289984de258466d148e75efb65b487ffbfcb061b268b1b667d8d7d4eac2c3d9d2d0a52d49c891be567c1c000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
});
it("should sign message with 6492 successfully for undeployed account", async () => {
const undeployedSigner = givenConnectedProvider({
const undeployedProvider = givenConnectedProvider({
owner: undeployedOwner,
chain,
});
expect(await undeployedSigner.signMessageWith6492("test")).toMatchInlineSnapshot('"0x000000000000000000000000000000893a26168158fbeadd9335be5bc96592e2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041be34ecce63c5248d5cda407e7da319be3c861e6e2c5d30c9630cd35dcb55e56205c482503552883923f79e751ea3671cbb84d65b18af33cd3034aeb7d529da9a1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
expect(await undeployedProvider.signMessageWith6492("test")).toMatchInlineSnapshot('"0x00000000000000000000000000000055c0b4fa41dde26a74435ff03692292fbd000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041be34ecce63c5248d5cda407e7da319be3c861e6e2c5d30c9630cd35dcb55e56205c482503552883923f79e751ea3671cbb84d65b18af33cd3034aeb7d529da9a1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
});
it("should execute successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
const result = await signer.sendUserOperation({
target: await signer.getAddress(),
const provider = givenConnectedProvider({ owner, chain });
const result = await provider.sendUserOperation({
target: await provider.getAddress(),
data: "0x",
});
const txnHash = signer.waitForUserOperationTransaction(result.hash);
const txnHash = provider.waitForUserOperationTransaction(result.hash);
await expect(txnHash).resolves.not.toThrowError();

@@ -72,5 +72,9 @@ }, 50000);

const accountAddress = "0xc33AbD9621834CA7c6Fc9f9CC3c47b9c17B03f9F";
const newSigner = givenConnectedProvider({ owner, chain, accountAddress });
const result = newSigner.sendUserOperation({
target: await newSigner.getAddress(),
const newProvider = givenConnectedProvider({
owner,
chain,
accountAddress,
});
const result = newProvider.sendUserOperation({
target: await newProvider.getAddress(),
data: "0x",

@@ -88,8 +92,8 @@ });

it("should get owner successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
expect(await signer.account.getOwnerAddress()).toMatchInlineSnapshot('"0x65eaA2AfDF6c97295bA44C458abb00FebFB3a5FA"');
expect(await signer.account.getOwnerAddress()).toBe(await owner.getAddress());
const provider = givenConnectedProvider({ owner, chain });
expect(await provider.account.getOwnerAddress()).toMatchInlineSnapshot('"0x65eaA2AfDF6c97295bA44C458abb00FebFB3a5FA"');
expect(await provider.account.getOwnerAddress()).toBe(await owner.getAddress());
});
it("should transfer ownership successfully", async () => {
const signer = givenConnectedProvider({
const provider = givenConnectedProvider({
owner,

@@ -104,16 +108,19 @@ chain,

const throwawayOwner = aa_core_1.LocalAccountSigner.privateKeyToAccountSigner((0, accounts_1.generatePrivateKey)());
const provider = givenConnectedProvider({ owner: throwawayOwner, chain });
const fundThrowawayResult = await signer.sendUserOperation({
target: await provider.getAddress(),
const throwawayProvider = givenConnectedProvider({
owner: throwawayOwner,
chain,
});
const fundThrowawayResult = await provider.sendUserOperation({
target: await throwawayProvider.getAddress(),
data: "0x",
value: 10000000000000n,
});
const fundThrowawayTxnHash = signer.waitForUserOperationTransaction(fundThrowawayResult.hash);
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(provider, newThrowawayOwner);
const txnHash = provider.waitForUserOperationTransaction(result);
const result = await index_js_1.LightSmartContractAccount.transferOwnership(throwawayProvider, newThrowawayOwner);
const txnHash = throwawayProvider.waitForUserOperationTransaction(result);
await expect(txnHash).resolves.not.toThrowError();
expect(await provider.account.getOwnerAddress()).not.toBe(await throwawayOwner.getAddress());
expect(await provider.account.getOwnerAddress()).toBe(await newThrowawayOwner.getAddress());
expect(await throwawayProvider.account.getOwnerAddress()).not.toBe(await throwawayOwner.getAddress());
expect(await throwawayProvider.account.getOwnerAddress()).toBe(await newThrowawayOwner.getAddress());
}, 100000);

@@ -120,0 +127,0 @@ });

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

export declare const MUMBAI_RPC_URL: string | undefined;
export declare const API_KEY: string | undefined;
export declare const OWNER_MNEMONIC: string;

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

export const MUMBAI_RPC_URL = process.env.MUMBAI_RPC_URL;
export const API_KEY = process.env.API_KEY;
export const OWNER_MNEMONIC = process.env.OWNER_MNEMONIC;
//# sourceMappingURL=constants.js.map

@@ -8,11 +8,12 @@ import { getDefaultEntryPointAddress, } from "@alchemy/aa-core";

import { KernelBaseValidator, ValidatorMode } from "../validator/base.js";
import { MUMBAI_RPC_URL, OWNER_MNEMONIC } from "./constants.js";
import { API_KEY, OWNER_MNEMONIC } from "./constants.js";
import { MockSigner } from "./mocks/mock-signer.js";
const chain = polygonMumbai;
describe("Kernel Account Tests", () => {
const config = {
chain: polygonMumbai,
rpcProvider: MUMBAI_RPC_URL,
chain,
rpcProvider: `${chain.rpcUrls.alchemy.http[0]}/${API_KEY}`,
validatorAddress: "0x180D6465F921C7E0DEA0040107D342c87455fFF5",
accountFactoryAddress: "0x5D006d3880645ec6e254E18C1F879DAC9Dd71A39",
entryPointAddress: getDefaultEntryPointAddress(polygonMumbai),
entryPointAddress: getDefaultEntryPointAddress(chain),
};

@@ -19,0 +20,0 @@ const ownerAccount = mnemonicToAccount(OWNER_MNEMONIC);

@@ -13,7 +13,7 @@ import { AlchemyProvider } from "@alchemy/aa-alchemy";

it("should successfully get counterfactual address", async () => {
const signer = givenConnectedProvider({ owner, chain });
expect(await signer.getAddress()).toMatchInlineSnapshot('"0xbd96C2c76dE02A75fe2909730422e05ce18f484e"');
const provider = givenConnectedProvider({ owner, chain });
expect(await provider.getAddress()).toMatchInlineSnapshot('"0x1a3a89cd46f124EF40848966c2D7074a575dbC27"');
});
it("should sign typed data successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
const provider = givenConnectedProvider({ owner, chain });
const typedData = {

@@ -28,10 +28,10 @@ types: {

};
expect(await signer.signTypedData(typedData)).toBe(await owner.signTypedData(typedData));
expect(await provider.signTypedData(typedData)).toBe(await owner.signTypedData(typedData));
});
it("should sign message successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
expect(await signer.signMessage("test")).toBe(await owner.signMessage("test"));
const provider = givenConnectedProvider({ owner, chain });
expect(await provider.signMessage("test")).toBe(await owner.signMessage("test"));
});
it("should sign typed data with 6492 successfully for undeployed account", async () => {
const undeployedSigner = givenConnectedProvider({
const undeployedProvider = givenConnectedProvider({
owner: undeployedOwner,

@@ -49,18 +49,18 @@ chain,

};
expect(await undeployedSigner.signTypedDataWith6492(typedData)).toMatchInlineSnapshot('"0x000000000000000000000000000000893a26168158fbeadd9335be5bc96592e2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041591a9422219a5f2bc87ee24a82a6d5ef9674bf7408a2a289984de258466d148e75efb65b487ffbfcb061b268b1b667d8d7d4eac2c3d9d2d0a52d49c891be567c1c000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
expect(await undeployedProvider.signTypedDataWith6492(typedData)).toMatchInlineSnapshot('"0x00000000000000000000000000000055c0b4fa41dde26a74435ff03692292fbd000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041591a9422219a5f2bc87ee24a82a6d5ef9674bf7408a2a289984de258466d148e75efb65b487ffbfcb061b268b1b667d8d7d4eac2c3d9d2d0a52d49c891be567c1c000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
});
it("should sign message with 6492 successfully for undeployed account", async () => {
const undeployedSigner = givenConnectedProvider({
const undeployedProvider = givenConnectedProvider({
owner: undeployedOwner,
chain,
});
expect(await undeployedSigner.signMessageWith6492("test")).toMatchInlineSnapshot('"0x000000000000000000000000000000893a26168158fbeadd9335be5bc96592e2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041be34ecce63c5248d5cda407e7da319be3c861e6e2c5d30c9630cd35dcb55e56205c482503552883923f79e751ea3671cbb84d65b18af33cd3034aeb7d529da9a1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
expect(await undeployedProvider.signMessageWith6492("test")).toMatchInlineSnapshot('"0x00000000000000000000000000000055c0b4fa41dde26a74435ff03692292fbd000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000445fbfb9cf000000000000000000000000ef9d7530d16df66481adf291dc9a12b44c7f7df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041be34ecce63c5248d5cda407e7da319be3c861e6e2c5d30c9630cd35dcb55e56205c482503552883923f79e751ea3671cbb84d65b18af33cd3034aeb7d529da9a1b000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492"');
});
it("should execute successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
const result = await signer.sendUserOperation({
target: await signer.getAddress(),
const provider = givenConnectedProvider({ owner, chain });
const result = await provider.sendUserOperation({
target: await provider.getAddress(),
data: "0x",
});
const txnHash = signer.waitForUserOperationTransaction(result.hash);
const txnHash = provider.waitForUserOperationTransaction(result.hash);
await expect(txnHash).resolves.not.toThrowError();

@@ -70,5 +70,9 @@ }, 50000);

const accountAddress = "0xc33AbD9621834CA7c6Fc9f9CC3c47b9c17B03f9F";
const newSigner = givenConnectedProvider({ owner, chain, accountAddress });
const result = newSigner.sendUserOperation({
target: await newSigner.getAddress(),
const newProvider = givenConnectedProvider({
owner,
chain,
accountAddress,
});
const result = newProvider.sendUserOperation({
target: await newProvider.getAddress(),
data: "0x",

@@ -86,8 +90,8 @@ });

it("should get owner successfully", async () => {
const signer = givenConnectedProvider({ owner, chain });
expect(await signer.account.getOwnerAddress()).toMatchInlineSnapshot('"0x65eaA2AfDF6c97295bA44C458abb00FebFB3a5FA"');
expect(await signer.account.getOwnerAddress()).toBe(await owner.getAddress());
const provider = givenConnectedProvider({ owner, chain });
expect(await provider.account.getOwnerAddress()).toMatchInlineSnapshot('"0x65eaA2AfDF6c97295bA44C458abb00FebFB3a5FA"');
expect(await provider.account.getOwnerAddress()).toBe(await owner.getAddress());
});
it("should transfer ownership successfully", async () => {
const signer = givenConnectedProvider({
const provider = givenConnectedProvider({
owner,

@@ -102,16 +106,19 @@ chain,

const throwawayOwner = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
const provider = givenConnectedProvider({ owner: throwawayOwner, chain });
const fundThrowawayResult = await signer.sendUserOperation({
target: await provider.getAddress(),
const throwawayProvider = givenConnectedProvider({
owner: throwawayOwner,
chain,
});
const fundThrowawayResult = await provider.sendUserOperation({
target: await throwawayProvider.getAddress(),
data: "0x",
value: 10000000000000n,
});
const fundThrowawayTxnHash = signer.waitForUserOperationTransaction(fundThrowawayResult.hash);
const fundThrowawayTxnHash = provider.waitForUserOperationTransaction(fundThrowawayResult.hash);
await expect(fundThrowawayTxnHash).resolves.not.toThrowError();
const newThrowawayOwner = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
const result = await LightSmartContractAccount.transferOwnership(provider, newThrowawayOwner);
const txnHash = provider.waitForUserOperationTransaction(result);
const result = await LightSmartContractAccount.transferOwnership(throwawayProvider, newThrowawayOwner);
const txnHash = throwawayProvider.waitForUserOperationTransaction(result);
await expect(txnHash).resolves.not.toThrowError();
expect(await provider.account.getOwnerAddress()).not.toBe(await throwawayOwner.getAddress());
expect(await provider.account.getOwnerAddress()).toBe(await newThrowawayOwner.getAddress());
expect(await throwawayProvider.account.getOwnerAddress()).not.toBe(await throwawayOwner.getAddress());
expect(await throwawayProvider.account.getOwnerAddress()).toBe(await newThrowawayOwner.getAddress());
}, 100000);

@@ -118,0 +125,0 @@ });

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

export declare const MUMBAI_RPC_URL: string | undefined;
export declare const API_KEY: string | undefined;
export declare const OWNER_MNEMONIC: string;
//# sourceMappingURL=constants.d.ts.map
{
"name": "@alchemy/aa-accounts",
"version": "1.1.0",
"version": "1.2.0",
"description": "A collection of ERC-4337 compliant smart contract account interfaces",

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

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

@@ -61,7 +61,7 @@ "typescript": "^5.0.4",

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

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

export const MUMBAI_RPC_URL = process.env.MUMBAI_RPC_URL;
export const API_KEY = process.env.API_KEY;
export const OWNER_MNEMONIC = process.env.OWNER_MNEMONIC!;
export const API_KEY = process.env.API_KEY!;
export const PAYMASTER_POLICY_ID = process.env.PAYMASTER_POLICY_ID!;
export const UNDEPLOYED_OWNER_MNEMONIC = process.env.UNDEPLOYED_OWNER_MNEMONIC!;
export const LIGHT_ACCOUNT_OWNER_MNEMONIC =
process.env.LIGHT_ACCOUNT_OWNER_MNEMONIC!;
// todo(ajay): replace with OWNER_MNEMONIC when light account factory address when live (accidentally moved owner account to a different mnemonic during testing)

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