Sponsored Calls
This section covers the sponsored call functionality for gasless transactions.
sponsoredCall
Executes a sponsored call with token payment.
function sponsoredCall(address token, uint256 amount, bytes data, bytes extraData) external payable returns (bytes memory ret)
Parameters
token
(address): The token address for paymentamount
(uint256): The amount of tokens to paydata
(bytes): The call data to executeextraData
(bytes): Additional data for the call
Description
Executes a call that is sponsored by the caller. The caller pays for the gas and can optionally pay tokens as part of the transaction.
Example
// Execute a sponsored call
const result = await papayaContract.sponsoredCall(
tokenAddress,
ethers.utils.parseEther("10"),
callData,
extraData,
{ value: ethers.utils.parseEther("0.1") }
);
Related Errors
FailedCall: When the sponsored call fails
SafeTransferFailed: When token transfer fails
Last updated