Prerequisites
- A running Grat relay.
- A deployed Soroban contract on Testnet.
1
Connect to the Contract
Initialize the Grat client and your contract object.
2
Build the Invocation
Build a transaction that calls a function on your contract.
3
Simulate the Transaction
Soroban transactions require resource estimates before they can be submitted. Use Grat to simulate the call and retrieve the necessary footprint data.
4
Sponsor the Call
Sign the transaction with the user’s keypair and send it to Grat for sponsorship. Grat will pay both the base fee and the resource fees.
5
Read the Result
After the transaction is included in a ledger, you can parse the result XDR to read the return value of your contract function.
Resource Fees vs Base Fees
In Soroban, every transaction has two fee components:- Base Fee: The cost of including the transaction in a ledger (Classic).
- Resource Fee: The cost of the computation and storage used by the contract.