Account Abstraction은 스마트 계약을 계정으로 사용할 수 있게 하여 이를 완전히 프로그래밍 가능하게 하는 블록체인 기술입니다.
이 기술은 사용자 계정을 더 유연하고 기능적으로 만들어 사용자 경험을 향상시키는 것을 목표로 합니다.
AA를 구현함으로써 개발자는 프로젝트의 사용자 경험을 향상시킬 수 있습니다. Chiliz 체인 상호작용이 간단해질수록 더 사용자 친화적인 앱이 됩니다.
import {
Hex,
createWalletClient,
encodeFunctionData,
http,
parseAbi,
zeroAddress,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { ChainId } from '@biconomy/core-types'
import { createSmartAccountClient } from "@biconomy/account";
const bundlerUrl =
"https://bundler.biconomy.io/api/v2/80001/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44"; // Found at https://dashboard.biconomy.io
export const createAccountAndMintNft = async () => {
// ----- 1. Generate EOA from private key
const account = privateKeyToAccount("0x" + "PRIVATE_KEY");
const client = createWalletClient({
account,
chainId: ChainId.CHILIZ_TESTNET, // or ChainId.CHILIZ_MAINNET,
transport: http(),
});
const eoa = client.account.address;
console.log(`EOA address: ${eoa}`);
// ------ 2. Create biconomy smart account instance
const smartAccount = await createSmartAccountClient({
signer: client,
bundlerUrl,
});
const saAddress = await smartAccount.getAccountAddress();
console.log("SA Address", saAddress);
};
createAccountAndMintNft();
또한, Biconomy를 사용할 때 Chiliz에는 메인넷과 테스트넷 모두에 대해 고유한 엔트리포인트 주소가 있습니다: 0x00000061FEfce24A79343c27127435286BB7A4E1
// CC2 has its own entrypoint address
const CHILIZ_BUNDLER_ENTRYPOINT_ADDRESS='0x00000061FEfce24A79343c27127435286BB7A4E1'
const bundler = new Bundler({
bundlerUrl: `https://bundler.biconomy.io/api/v2/${ChainId.CHILIZ_TESTNET}/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44`,
chainId: ChainId.CHILIZ_TESTNET,
entryPointAddress: CHILIZ_BUNDLER_ENTRYPOINT_ADDRESS,
})