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 0.1.1 to 0.2.0

4

./dist/cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultLightAccountFactory = exports.LightSmartContractAccount = exports.ValidatorMode = exports.KernelBaseValidator = exports.KernelAccountProvider = exports.KernelSmartContractAccount = exports.KernelFactoryAbi = exports.KernelAccountAbi = void 0;
exports.getDefaultLightAccountFactoryAddress = 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");

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

var utils_js_1 = require("./light-account/utils.js");
Object.defineProperty(exports, "getDefaultLightAccountFactory", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactory; } });
Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
//# sourceMappingURL=index.js.map

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

export { LightSmartContractAccount } from "./light-account/account.js";
export { getDefaultLightAccountFactory } from "./light-account/utils.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultLightAccountFactory = exports.LightSmartContractAccount = exports.ValidatorMode = exports.KernelBaseValidator = exports.KernelAccountProvider = exports.KernelSmartContractAccount = exports.KernelFactoryAbi = exports.KernelAccountAbi = void 0;
exports.getDefaultLightAccountFactoryAddress = 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");

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

var utils_js_1 = require("./light-account/utils.js");
Object.defineProperty(exports, "getDefaultLightAccountFactory", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactory; } });
Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const aa_core_1 = require("@alchemy/aa-core");
const viem_1 = require("viem");

@@ -19,3 +20,3 @@ const accounts_1 = require("viem/accounts");

accountFactoryAddress: "0x5D006d3880645ec6e254E18C1F879DAC9Dd71A39",
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
entryPointAddress: (0, aa_core_1.getDefaultEntryPointAddress)(chains_1.polygonMumbai),
};

@@ -46,3 +47,2 @@ const ownerAccount = (0, accounts_1.mnemonicToAccount)(constants_js_1.OWNER_MNEMONIC);

rpcProvider: config.rpcProvider,
entryPointAddress: config.entryPointAddress,
chain: config.chain,

@@ -56,3 +56,2 @@ });

rpcClient: provider.rpcClient,
entryPointAddress: config.entryPointAddress,
chain: config.chain,

@@ -59,0 +58,0 @@ owner: owner,

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

functionName: "createAccount",
args: [await this.owner.getAddress(), this.index],
args: [await this.owner.getAddress(), 0n],
}),

@@ -61,0 +61,0 @@ ]);

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

const account_js_1 = require("../account.js");
const utils_js_1 = require("../utils.js");
const constants_js_1 = require("./constants.js");
const ENTRYPOINT_ADDRESS = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
const LIGHT_ACCOUNT_FACTORY_ADDRESS = "0xDC31c846DA74400C732edb0fE888A2e4ADfBb8b1";
const chain = chains_1.sepolia;
describe("Light Account Tests", () => {
const chain = chains_1.sepolia;
const owner = aa_core_1.LocalAccountSigner.mnemonicToAccountSigner(constants_js_1.LIGHT_ACCOUNT_OWNER_MNEMONIC);
const undeployedOwner = aa_core_1.LocalAccountSigner.mnemonicToAccountSigner(constants_js_1.UNDEPLOYED_OWNER_MNEMONIC);
it("should succesfully get counterfactual address", async () => {
it("should successfully get counterfactual address", async () => {
const signer = givenConnectedProvider({ owner, chain });

@@ -111,9 +110,7 @@ expect(await signer.getAddress()).toMatchInlineSnapshot('"0x7eDdc16B15259E5541aCfdebC46929873839B872"');

rpcProvider: constants_js_1.RPC_URL != null ? constants_js_1.RPC_URL : `${chain.rpcUrls.alchemy.http[0]}/${constants_js_1.API_KEY}`,
entryPointAddress: ENTRYPOINT_ADDRESS,
chain,
}).connect((provider) => new account_js_1.LightSmartContractAccount({
entryPointAddress: ENTRYPOINT_ADDRESS,
chain,
owner,
factoryAddress: LIGHT_ACCOUNT_FACTORY_ADDRESS,
factoryAddress: (0, utils_js_1.getDefaultLightAccountFactoryAddress)(chain),
rpcClient: provider,

@@ -120,0 +117,0 @@ accountAddress,

import type { Address, Chain } from "viem";
export declare const getDefaultLightAccountFactory: (chain: Chain) => Address;
export declare const getDefaultLightAccountFactoryAddress: (chain: Chain) => Address;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultLightAccountFactory = void 0;
exports.getDefaultLightAccountFactoryAddress = void 0;
const chains_1 = require("viem/chains");
const getDefaultLightAccountFactory = (chain) => {
const getDefaultLightAccountFactoryAddress = (chain) => {
switch (chain.id) {

@@ -18,7 +18,7 @@ case chains_1.mainnet.id:

case chains_1.baseGoerli.id:
return "0x000000893a26168158fbeadd9335be5bc96592e2";
return "0x000000893A26168158fbeaDD9335Be5bC96592E2";
}
throw new Error("could not find light account factory address");
throw new Error(`no default light account factory contract exists for ${chain.name}`);
};
exports.getDefaultLightAccountFactory = getDefaultLightAccountFactory;
exports.getDefaultLightAccountFactoryAddress = getDefaultLightAccountFactoryAddress;
//# sourceMappingURL=utils.js.map

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

export { LightSmartContractAccount } from "./light-account/account.js";
export { getDefaultLightAccountFactory } from "./light-account/utils.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";

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

export { LightSmartContractAccount } from "./light-account/account.js";
export { getDefaultLightAccountFactory } from "./light-account/utils.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
//# sourceMappingURL=index.js.map

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

import {} from "@alchemy/aa-core";
import { getDefaultEntryPointAddress, } from "@alchemy/aa-core";
import { encodeAbiParameters, parseAbiParameters, toHex, } from "viem";

@@ -18,3 +18,3 @@ import { mnemonicToAccount } from "viem/accounts";

accountFactoryAddress: "0x5D006d3880645ec6e254E18C1F879DAC9Dd71A39",
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
entryPointAddress: getDefaultEntryPointAddress(polygonMumbai),
};

@@ -45,3 +45,2 @@ const ownerAccount = mnemonicToAccount(OWNER_MNEMONIC);

rpcProvider: config.rpcProvider,
entryPointAddress: config.entryPointAddress,
chain: config.chain,

@@ -55,3 +54,2 @@ });

rpcClient: provider.rpcClient,
entryPointAddress: config.entryPointAddress,
chain: config.chain,

@@ -58,0 +56,0 @@ owner: owner,

@@ -55,3 +55,3 @@ import { SimpleSmartContractAccount, SmartAccountProvider, } from "@alchemy/aa-core";

functionName: "createAccount",
args: [await this.owner.getAddress(), this.index],
args: [await this.owner.getAddress(), 0n],
}),

@@ -58,0 +58,0 @@ ]);

@@ -6,10 +6,9 @@ import { LocalAccountSigner, SmartAccountProvider, } from "@alchemy/aa-core";

import { LightSmartContractAccount } from "../account.js";
import { getDefaultLightAccountFactoryAddress } from "../utils.js";
import { API_KEY, LIGHT_ACCOUNT_OWNER_MNEMONIC, RPC_URL, UNDEPLOYED_OWNER_MNEMONIC, } from "./constants.js";
const ENTRYPOINT_ADDRESS = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
const LIGHT_ACCOUNT_FACTORY_ADDRESS = "0xDC31c846DA74400C732edb0fE888A2e4ADfBb8b1";
const chain = sepolia;
describe("Light Account Tests", () => {
const chain = sepolia;
const owner = LocalAccountSigner.mnemonicToAccountSigner(LIGHT_ACCOUNT_OWNER_MNEMONIC);
const undeployedOwner = LocalAccountSigner.mnemonicToAccountSigner(UNDEPLOYED_OWNER_MNEMONIC);
it("should succesfully get counterfactual address", async () => {
it("should successfully get counterfactual address", async () => {
const signer = givenConnectedProvider({ owner, chain });

@@ -109,9 +108,7 @@ expect(await signer.getAddress()).toMatchInlineSnapshot('"0x7eDdc16B15259E5541aCfdebC46929873839B872"');

rpcProvider: RPC_URL != null ? RPC_URL : `${chain.rpcUrls.alchemy.http[0]}/${API_KEY}`,
entryPointAddress: ENTRYPOINT_ADDRESS,
chain,
}).connect((provider) => new LightSmartContractAccount({
entryPointAddress: ENTRYPOINT_ADDRESS,
chain,
owner,
factoryAddress: LIGHT_ACCOUNT_FACTORY_ADDRESS,
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient: provider,

@@ -118,0 +115,0 @@ accountAddress,

import type { Address, Chain } from "viem";
export declare const getDefaultLightAccountFactory: (chain: Chain) => Address;
export declare const getDefaultLightAccountFactoryAddress: (chain: Chain) => Address;
import { arbitrum, arbitrumGoerli, base, baseGoerli, goerli, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia, } from "viem/chains";
export const getDefaultLightAccountFactory = (chain) => {
export const getDefaultLightAccountFactoryAddress = (chain) => {
switch (chain.id) {

@@ -15,6 +15,6 @@ case mainnet.id:

case baseGoerli.id:
return "0x000000893a26168158fbeadd9335be5bc96592e2";
return "0x000000893A26168158fbeaDD9335Be5bC96592E2";
}
throw new Error("could not find light account factory address");
throw new Error(`no default light account factory contract exists for ${chain.name}`);
};
//# sourceMappingURL=utils.js.map

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

export { LightSmartContractAccount } from "./light-account/account.js";
export { getDefaultLightAccountFactory } from "./light-account/utils.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";
//# sourceMappingURL=index.d.ts.map
import type { Address, Chain } from "viem";
/**
* Utility method returning the light account factory address given a {@link chains.Chain} object
* Utility method returning the default light account factory address given a {@link Chain} object
*
* @param chain - a {@link chains.Chain} object
* @returns a {@link abi.Address} for the given chain
* @param chain - a {@link Chain} object
* @returns a {@link Address} for the given chain
* @throws if the chain doesn't have an address currently deployed
*/
export declare const getDefaultLightAccountFactory: (chain: Chain) => Address;
export declare const getDefaultLightAccountFactoryAddress: (chain: Chain) => Address;
//# sourceMappingURL=utils.d.ts.map
{
"name": "@alchemy/aa-accounts",
"version": "0.1.1",
"version": "0.2.0",
"description": "A collection of ERC-4337 compliant smart contract account interfaces",

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

"devDependencies": {
"@alchemy/aa-core": "^0.1.0",
"@alchemy/aa-core": "^0.1.1",
"typescript": "^5.0.4",

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

"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
"gitHead": "d080df586c7b46c952b4219bf549c1e481bdada6",
"gitHead": "e9de0ca797605b04dc0a5db0764f1efed4a94610",
"dependencies": {
"@alchemy/aa-core": "^0.1.1",
"@alchemy/aa-core": "^0.2.0",
"viem": "^1.16.2"
}
}

@@ -22,2 +22,2 @@ // 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 { getDefaultLightAccountFactory } from "./light-account/utils.js";
export { getDefaultLightAccountFactoryAddress } from "./light-account/utils.js";

@@ -111,3 +111,4 @@ import {

functionName: "createAccount",
args: [await this.owner.getAddress(), this.index],
// light account does not support sub-accounts
args: [await this.owner.getAddress(), 0n],
}),

@@ -114,0 +115,0 @@ ]);

@@ -17,9 +17,9 @@ import type { Address, Chain } from "viem";

/**
* Utility method returning the light account factory address given a {@link chains.Chain} object
* Utility method returning the default light account factory address given a {@link Chain} object
*
* @param chain - a {@link chains.Chain} object
* @returns a {@link abi.Address} for the given chain
* @param chain - a {@link Chain} object
* @returns a {@link Address} for the given chain
* @throws if the chain doesn't have an address currently deployed
*/
export const getDefaultLightAccountFactory = (chain: Chain): Address => {
export const getDefaultLightAccountFactoryAddress = (chain: Chain): Address => {
switch (chain.id) {

@@ -37,5 +37,7 @@ case mainnet.id:

case baseGoerli.id:
return "0x000000893a26168158fbeadd9335be5bc96592e2";
return "0x000000893A26168158fbeaDD9335Be5bC96592E2";
}
throw new Error("could not find light account factory address");
throw new Error(
`no default light account factory contract exists for ${chain.name}`
);
};

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