const transaction = await rhinestoneAccount.sendTransaction({ sourceChains: [optimism], targetChain: base, sourceAssets: [ { chain: optimism, address: 'USDC', amount: parseUnits('10', 6), } ], tokenRequests: [ { // Note: no amount specified for the target token address: 'USDC', }, ], })
import { getTokenAddress } from '@rhinestone/sdk' const sourceChain = optimism const targetChain = base const publicClient = createPublicClient({ chain: sourceChain, transport: http(), }) const usdcBalance = await publicClient.readContract({ address: getTokenAddress('USDC', sourceChain.id), abi: erc20Abi, functionName: 'balanceOf', args: [address], }) const transaction = await rhinestoneAccount.sendTransaction({ sourceChains: [sourceChain], targetChain, sourceAssets: [ { chain: sourceChain, address: 'USDC', amount: usdcBalance, }, ], tokenRequests: [ { address: 'USDC', }, ], })
const transaction = await rhinestoneAccount.sendTransaction({ sourceChains: [optimism, base], targetChain: arbitrum, sourceAssets: [ { chain: optimism, address: 'USDC', amount: parseUnits('50', 6), }, { chain: base, address: 'USDC', amount: parseUnits('30', 6), }, ], tokenRequests: [ { address: 'USDC', }, ], })
Was this page helpful?