Skip to main content

Chain Abstraction

Overview​

note

πŸ’‘ Support for Chain Abstraction is currently in experimental phase.

Chain abstraction simplifies interactions across different blockchains, allowing users to transact seamlessly without worrying about network-specific tokens.

To fully leverage chain abstraction, wallets need to support its implementation, and minor adjustments are required on the Dapp side.

Dapps may not always be aware of the balances across different chains or accounts that wallets can access. Therefore, it’s crucial to ensure that the call does not fail on the Dapp side.

This guide focuses on the most common ways Dapps interact with wallets using the Wagmi library.

Implementations​

note

To ensure compatibility and optimal performance with the Chain Abstraction feature, please use Wagmi 2.13.0 or later.

useSendTransaction​

The useSendTransaction hook attempts to estimate gas on the Dapp side before forwarding the call to the wallet. However, gas estimation might fail because the Dapp may not account for all the funds available to the wallet across different chains.

To ensure the call is sent successfully, the wallet must handle gas estimation. You need to pass gas: null to the sendTransaction method.

import { useSendTransaction } from 'wagmi'
import { parseEther } from 'viem'

function App() {
const { sendTransaction } = useSendTransaction()

return (
<button
onClick={() =>
sendTransaction({
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('0.01'),
gas: null // <- Add this
})
}
>
Send transaction
</button>
)
}