
Security News
Cloudflare Introduces a Faster TypeScript Compiler Written in Rust
Cloudflare introduces tsrs, a Rust port of TypeScript’s compiler promising faster checks and lower memory use, with the TypeScript team’s help.
@layerhop/wagmi
Advanced tools
Execute LayerHop quotes with wagmi or viem: ERC-20 approval, swap and extra calls in one EIP-5792 confirmation when the wallet supports it, sequential transactions otherwise
Execute LayerHop quotes with the user's wallet through wagmi or a
viem WalletClient. It handles the ERC-20 approval (checking the allowance first), the swap,
and any extraTxs, then reports the hash to LayerHop.
When the wallet supports EIP-5792 atomic batching (wallet_getCapabilities), the approval, swap and fee transfer go
in one wallet_sendCalls confirmation. Other wallets get sequential transactions.
Never holds keys. Every transaction is confirmed by the user in their wallet.
npm install @layerhop/wagmi @layerhop/sdk wagmi viem @tanstack/react-query
# peers: wagmi ^2.19.5, viem ^2.57.7; react >= 18 and @tanstack/react-query >= 5.62.11 for the hooks
import { LayerHopProvider, useExecuteQuote, useLayerHopQuote, useOrderStatus } from "@layerhop/wagmi";
import { useAccount } from "wagmi";
// <WagmiProvider config={config}><QueryClientProvider client={qc}><LayerHopProvider options={{ integrator: "myapp" }}>…
function Swap() {
const { address } = useAccount();
const quote = useLayerHopQuote(address && {
srcChain: "base", srcToken: "USDC", amount: "25000000", // integer string, base units
dstChain: "solana", dstToken: "SOL", sender: address, recipient: "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
});
const exec = useExecuteQuote();
const best = quote.data?.best;
const order = useOrderStatus(best?.provider, exec.hash);
return <button disabled={!best || exec.isPending} onClick={() => best && exec.execute({ quote: best })}>{exec.status}</button>;
}
useExecuteQuote() → { execute, reset, status, hash, mode, approval, result, error, isPending }.
status: idle → building → (switching) → (approving) → signing → reporting → submitted | error.
mode: batch (one EIP-5792 confirmation), sequential or sandbox (test-mode placeholder, nothing sent).
useLayerHopQuote is useQuote from @layerhop/react.
@layerhop/wagmi/actionsimport { executeQuote, executeQuoteWithWalletClient } from "@layerhop/wagmi/actions";
import { LayerHop } from "@layerhop/sdk";
const lh = new LayerHop({ apiKey: process.env.LAYERHOP_API_KEY });
const { best } = await lh.quote(params);
const sent = await executeQuote(wagmiConfig, { quote: best, client: lh });
// or, with a viem WalletClient (Privy, Dynamic, thirdweb, any EIP-1193 provider):
// const sent = await executeQuoteWithWalletClient(walletClient, { quote: best, client: lh });
sent.hash; // the mined tx hash in batch mode, the main tx hash in sequential mode
sent.mode; // "batch" | "sequential" | "sandbox"
await sent.wait(); // true once confirmed
Options: batch ("auto" default, "never", "require"), tx (an already built tx), report (default true),
onStep, onApproval({ batched }), onBatchFallback, onExtraTxError.
approve is added only when the allowance is short.wallet_getCapabilities reports atomic.status supported/ready (or the older
atomicBatch.supported), all calls go in one wallet_sendCalls with atomicRequired: true. The hash comes from
wallet_getCallsStatus once the batch lands.Lower-level building blocks: sendEvmTx(driver, tx), wagmiDriver(config), walletClientDriver(walletClient),
evmCalls, supportsAtomicBatch, getAtomicBatchSupport(config, chainId).
Guide with Privy, Dynamic, thirdweb, Coinbase Smart Wallet and Reown snippets: https://docs.layerhop.com/guides/wallets.
Example: example/Swap.tsx.
MIT
FAQs
Execute LayerHop quotes with wagmi or viem: ERC-20 approval, swap and extra calls in one EIP-5792 confirmation when the wallet supports it, sequential transactions otherwise
We found that @layerhop/wagmi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare introduces tsrs, a Rust port of TypeScript’s compiler promising faster checks and lower memory use, with the TypeScript team’s help.

Security News
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.

Security News
PHP releases emergency patches for two critical RCE vulnerabilities as agencies urge organizations to take unpatched sites offline.