Quick Start
Gelato Relay, as easy as 0xabc...
After reading this page:
You'll go through a decision process to understand the best way to integrate with Gelato Relay.
You'll know exactly which SDK/API method is for you.
Depending on your final destination, please click the corresponding link to find about your chosen SDK method:
Option 1: Sponsoring some/all of your users' gas
Sponsoring some of your user's gas:
Gelato Relay allows for partial sponsoring of gas based on certain conditions with developer-defined rules! For example, an app could sponsor user's gas based on a certain NFT being present in their wallet, or perhaps the NFT allows the user to have 10 gasless transactions a day. As a sponsor, you will able to customize with Gelato Relay's sponsor dashboard, coming soon™.
Sponsoring all of your user's gas:
Gelato handles user signature verification: go ahead and use
sponsoredCallERC2771
where Gelato handles user signature verification for you. In this method, you can use ERC-2771's_msgSender()
to validate your relay calls on-chain. This will require an upgrade to your target contract forERC2771Context
support, if it does not support it already.You handle user signature verification: If your app workflow already handles its security in-house (i.e. use of user signatures, replay/reentrancy protection etc.) and you do want to sponsor all of your user's gas, you are ready to use Gelato Relay without any change to your existing smart contract logic. This will be using the
sponsoredCall
method.
Option 2: Your users pay for for their own gas
If you do not want to sponsor your user's gas, you will use the callWithSyncFeeERC2771
or callWithSyncFee
SDK method with the SyncFee payment method. This will require you to deploy a new contract (or upgrade if you can) to be compatible with Gelato's relay context contracts.
Get Started
Relay-API
You can start using relay functionalities directly through the Relay API endpoints, including sending relay requests, performing oracle queries, and accessing debug endpoints for relay tasks. Learn more about using the Relay API here.
or
Relay-SDK
Installation
@gelatonetwork/relay-sdk
package v5
and above is using ethers
v6
. If you are using @gelatonetwork/relay-sdk
v4
or below, please follow this migration guide to migrate from ethers
v5
to v6
.
If you are using @gelatonetwork/relay-sdk
v3
or contracts from the package @gelatonetwork/relay-context
v2
please follow the ERC2771 Migration guide to migrate to the new versions.
Note: please make sure to use version v4.0.0 and above.
npm install @gelatonetwork/relay-sdk
or
Now Supporting Viem: The Relay SDK has expanded its capabilities to include support for Viem, providing an alternative to Ethers.
npm install @gelatonetwork/relay-sdk-viem
Dive in, and let's get started with using Relay's functionalities with Relay-SDK!
Last updated