import { createGelatoEvmRelayerClient } from '@gelatocloud/gasless';
const relayer = createGelatoEvmRelayerClient({
apiKey: process.env.GELATO_API_KEY,
testnet: true
});
// Send transactions to multiple chains
const taskIds = await relayer.sendTransactionMultichain([
{
// Transaction on Ethereum - pays for all transactions
chainId: 1,
to: '0x55f3a93f544e01ce4378d25e927d7c493b863bd7',
data: '0x29cb0f49',
payment: {
type: 'token',
address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e' // USDC
}
},
{
// Transaction on Base - sponsored by the payment above
chainId: 8453,
to: '0x45f3a93f544e01ce4378d25e927d7c493b863bd7',
data: '0x19ca0f49',
payment: {
type: 'sponsored'
}
},
]);
console.log('Task IDs:', taskIds);
// ['0x0e670ec6...', '0x0cf041f5...', '0x1ab234c7...']