batua.sh

  • Easy to integrate embedded smart account secured by passkeys
  • Support for sponsoring transactions
  • Support for batching multiple transactions
  • You have the complete ownership of the code
  • Embeds into your application's theme due to shadcn
  • Works with wagmi, viem, ethers, privy, dynamic, and more

Made with ❤️ from Pimlico

Try Batua

Batua will work along side all the other injected and external wallets.

Installation

Install using the CLI

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
Copied to clipboard!

Usage

Step 1: Set up Passkey Server

Go to https://dashboard.pimlico.io/passkey-server and configure your passkey server.

Step 2: Implement Batua

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")
}
},
// optional
paymaster: {
transports: {
[sepolia.id]: http(
`https://api.pimlico.io/v2/${sepolia.id}/rpc?apikey=${pimlicoApiKey}`
)
},
// optional
context: {
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.

Customise Batua

Customise Batua

Send batch transactions

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) return
sendCalls({
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])
View on GitHub