Made with ❤️ from Pimlico
Batua will work along side all the other injected and external wallets.
To install a registry item using the shadcn
CLI, use the add
command followed by the URL of the registry item.
pnpm dlx shadcn@latest add https://batua.sh/install
Go to https://dashboard.pimlico.io/passkey-server and configure your passkey server.
import { Batua } from "@/lib/batua"import { sepolia } from "viem/chains"import { http } from "viem/transport"const pimlicoApiKey = "your-pimlico-api-key"Batua.create({rpc: {transports: {[sepolia.id]: http("https://ethereum-sepolia-rpc.publicnode.com")}},// optionalpaymaster: {transports: {[sepolia.id]: http(`https://api.pimlico.io/v2/${sepolia.id}/rpc?apikey=${pimlicoApiKey}`)},// optionalcontext: {sponsorshipPolicyId: process.env.NEXT_PUBLIC_SPONSORSHIP_POLICY_ID}},bundler: {transports: {[sepolia.id]: http(`https://api.pimlico.io/v2/${sepolia.id}/rpc?apikey=${pimlicoApiKey}`)}}})
Note: After creating Batua, you can use your regular wagmi/ethers libraries and Batua will behave like an injected wallet compatible with EIP-6963.
import { useSendCalls } from "wagmi/experimental"const account = useAccount()const { sendCalls, data: callStatus } = useSendCalls()const { data: callReceipts } = useWaitForCallsStatus({id: callStatus?.id})const callSucceeded = callReceipts.status === "success"const callPending = callReceipts.status === "pending"if (callSucceeded) {const transactionHash = callReceipts.receipts[0].transactionHash}const sendBatchTransactionCallback = useCallback(async () => {if (!account.address) returnsendCalls({calls: [{to: TEST_ERC20_TOKEN_ADDRESS,data: encodeFunctionData({abi: erc20Abi,functionName: "transfer",args: [randomAddressOne, parseUnits("1", 6)]})},{to: TEST_ERC20_TOKEN_ADDRESS,data: encodeFunctionData({abi: erc20Abi,functionName: "transfer",args: [randomAddressTwo, parseUnits("1", 6)]})}]})}, [account.address, sendCalls])