Sponsored Gas Transactions
Learn how to implement sponsored gas transactions.
With Openfort you can sponsor transactions to you users, meaning that in-game accounts don't need to have native token to execute transactions.
Note that the absence of a policy will enforce the user to have a native tokens in their account in order to pay for the transaction's gas fee.
What you'll learn:#
- How to make a sponsored transaction to mint an NFT.
1
Select the contract you want to interact with
- Import the smart contract if you have not yet
- Decide what function of the smart contract you want to use. In our case 'mint'.
2
Set up a Gas Policy
- Create s new policy and select the strategy "pay gas for user"
- Select imported contract and the function you want to sponsor
3
Create a gasless transaction
- Add chainId
- Add contract
- Add policy
- Add function you want to interact with
- Add arguments (in the case of mint, '_to' the person who receives the asset)
Note you can make a transaction happen without the need to have a registered user or account. Once you make the transaction a playerId and accountId will be created.
4
Optional: Add the Account or Player you're using
- Add player