@alchemy/aa-alchemy
此软件包包含 AlchemySmartAccountClient,执行 SmartAccountClient 界面定义于 aa-core。其中还包含用于访问Alchemy气体管理器的中间软件(一个 ERC-4337 (韩语) 根据Alchemy的预期估算费用 运行器 (一种ERC-4337 Bundler). 您也可发现用具方法有帮助。 这份复票由社区维持,我们欢迎捐款!
开始
如果你已经使用 @alchemy/aa-core 软件包,可以简单地安装此软件包并开始使用 AlchemySmartAccountClient。如果您没有使用 @alchemy/aa-core 然而,你可以安装它 并遵循指令在 "开始" 要开始的文件 .
yarn add @alchemy/aa-alchemy
npm i -s @alchemy/aa-alchemy
pnpm i @alchemy/aa-alchemy
使用量
您可以创建 AlchemySmartAccountClient 像这样:
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import { LocalAccountSigner, type SmartAccountSigner } from "@alchemy/aa-core";
import { sepolia } from "@alchemy/aa-core";
const chain = sepolia;
const PRIVATE_KEY = "0xYourEOAPrivateKey";
const eoaSigner: SmartAccountSigner =
LocalAccountSigner.privateKeyToAccountSigner(`0x${PRIVATE_KEY}`);
export const provider = new AlchemyProvider({
apiKey: "ALCHEMY_API_KEY", // replace with your alchemy api key of the Alchemy app associated with the Gas Manager, get yours at https://dashboard.alchemy.com/
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain,
signer: eoaSigner,
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);