Skip to main content
Warp can bridge and swap in a single transaction. Specify the token you want on the destination chain, and if it differs from what the user holds, Warp routes through solver liquidity to swap and bridge automatically.
Request ETH on the target chain via tokenRequests. If the user only holds another token there (or on the source chain), Warp swaps and bridges to cover it:
import { baseSepolia, arbitrumSepolia } from 'viem/chains'

const ethAmount = 2n
const receiver = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'

const prepared = await rhinestoneAccount.prepareTransaction({
  sourceChains: [baseSepolia],
  targetChain: arbitrumSepolia,
  calls: [
    {
      to: receiver,
      value: ethAmount,
    },
  ],
  tokenRequests: [
    {
      address: 'ETH',
      amount: ethAmount,
    },
  ],
})
const signed = await rhinestoneAccount.signTransaction(prepared)
const transaction = await rhinestoneAccount.submitTransaction(signed)
If the user has USDC on Base Sepolia, Warp will swap it to ETH, bridge to Arbitrum Sepolia, and execute the transfer.
The token address in calls and tokenRequests must correspond to the target chain.