// populate the relay SDK request body
const request: CallWithSyncFeeERC2771Request = {
chainId: BigInt(chainId),
target: targetContractAddress,
data: data,
user: address,
feeToken: feeToken,
isRelayContext: true,
};
// send relayRequest to Gelato Relay API
const relayResponse = await relay.callWithSyncFeeERC2771(request, client as any);
// -----------------------------------------------------------------
// the following is an alternative example using Gelato Fee Oracle,
// setting maxFee, and calling the incrementFeeCapped(maxFee) method
// populate the relay SDK request body
const requestMaxFee: CallWithSyncFeeERC2771Request = {
chainId: BigInt(chainId),
target: targetContractAddress,
data: dataMaxFee,
user: address,
feeToken: feeToken,
isRelayContext: true,
};
// send relayRequest to Gelato Relay API
const relayResponseMaxFee = await relay.callWithSyncFeeERC2771(requestMaxFee, client as any);