@alchemy/aa-accounts

中文文档
3.19.0发布于 2024/08/03MITTypeScriptES Module近 30 天下载 6803

A collection of ERC-4337 compliant smart contract account interfaces

原始使用文档

@alchemy/aa-accounts

This package contains various implementations of the BaseSmartContractAccount class defined in aa-core. This repo is community maintained and we welcome contributions!

Getting 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 docs to get started.

via yarn

yarn add @alchemy/aa-accounts

via npm

npm i -s @alchemy/aa-accounts

via pnpm

pnpm i @alchemy/aa-accounts

Contributing

If you are looking to add a new account type, please follow the following structure.

  1. Create a new folder in src with the name of your account type in kebab-case (we are following kebab casing for files throughout the project).
  2. Create a new file in the folder you just created called account.ts and add your implementation for BaseSmartContractAccount
  3. If needed, create a sub-folder in your account folder called abis and add your abis as .ts files. eg:
export const MyContractAbi = [] as const; // the as const is important so we can get correct typing from viem
  1. If you need to extend the SmartAccountProvider class, add a file called provider.ts and add your implementation for SmartAccountProvider.
  • Ideally, your Account impl should just work with the base provider provided by aa-core.
  • If not, consider generalizing the use case and updating SmartAccountProvider
  1. Add some tests for your account and provider (if created) by creating a subfolder in your account/my-account called __tests__ and make sure your files end with the .test.ts suffix
  2. export the classes and types you have defined in src/index.ts
  3. Open a PR and we will review it as soon as possible!

版本与发布记录

@alchemy/aa-accounts 共发布 94 个版本,首次发布于 2023/06/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.19.0latest2024/08/032 年前
3.18.22024/06/052 年前
3.18.12024/06/052 年前
3.18.02024/06/042 年前
3.17.22024/06/012 年前
3.17.12024/06/012 年前

其他发布通道:next → 3.0.0-alpha.13。

关于 @alchemy/aa-accounts 的常见问题

@alchemy/aa-accounts 是什么?

A collection of ERC-4337 compliant smart contract account interfaces

如何安装 @alchemy/aa-accounts?

在项目目录运行 npm install @alchemy/aa-accounts,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:viem(2.8.6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@alchemy/aa-accounts 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@alchemy/aa-accounts 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@alchemy/aa-accounts 可以商用吗?

@alchemy/aa-accounts 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@alchemy/aa-accounts 的下载量有多少?

根据 npm 官方下载统计,@alchemy/aa-accounts 在 2026/10/06 – 2026/11/04 这 30 天内被下载 6,803 次,日均约 227 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alchemy/aa-accounts 还在维护吗?

最新版本 3.19.0 发布于 2024/08/03(2 年前);至今共发布 94 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/06/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。