wagmi integration
Why sendTransactionAsync?
Basic pattern
import { createCelinaClient } from "@andrewkimjoseph/celina-sdk";
import { useSendTransaction, useAccount } from "wagmi";
const celina = createCelinaClient();
async function executePreparedFlow(
sendTransactionAsync: ReturnType<typeof useSendTransaction>["sendTransactionAsync"],
flow: Awaited<ReturnType<typeof celina.transaction.prepareSend>>,
) {
for (const step of flow.steps) {
const hash = await sendTransactionAsync({
to: step.to,
data: step.data,
value: step.value ? BigInt(step.value) : undefined,
});
// Wait for confirmation before next step — see Multi-step flows below
console.log(`Submitted: ${hash}`);
}
}React hook example
Multi-step flows
Method
Steps when approval needed
Estimates before prepare
Error handling
viem without wagmi
Related guides
Last updated
Was this helpful?