latest
Search…
⌃K
Links

Relay Kit

The Relay Kit allows users to pay transaction fees (gas fees) using the native blockchain token or ERC-20 tokens. This allows you to pay gas fees using any ERC-20 token in your Safe, even if you don't have ETH.

Quickstart

Prerequisites

  1. 2.
    Have a Safe where only 1 signature is needed to execute transactions.
  2. 3.
    For using Gelato 1Balance you will need an API key.

Install dependencies

yarn add @safe-global/relay-kit

How to use

Currently, the Relay Kit is only compatible with the Gelato relay. There are 2 ways to use the Gelato relay:
  1. 1.
    ​Gelato SyncFee​
  2. 2.
    ​Gelato 1Balance​

Gelato SyncFee

​Gelato SyncFee is one of the most straightforward ways to use relaying. Gelato SyncFee allows you to execute a transaction and pay the gas fees directly with funds in your Safe, even if you don't have ETH or the native blockchain token.
import { GelatoRelayAdapter } from '@safe-global/relay-kit'
​
const relayAdapter = new GelatoRelayAdapter()
​
relayAdapter.relayTransaction({
target: '0x...', // the Safe address
encodedTransaction: '0x...', // Encoded Safe transaction data
chainId: 5
})

Gelato 1Balance

​Gelato 1Balance allows you to execute transactions using a prepaid deposit. This can be used to sponsor transactions to other Safes or even to use a deposit on Polygon to pay the fees for a wallet on another chain.
import { GelatoRelayAdapter, MetaTransactionOptions } from '@safe-global/relay-kit'
​
const relayAdapter = new GelatoRelayAdapter(GELATO_RELAY_API_KEY)
​
const options: MetaTransactionOptions = {
isSponsored: true // This parameter is mandatory to use the 1Balance method
}
relayAdapter.relayTransaction({
target: '0x...', // the Safe address
encodedTransaction: '0x...', // Encoded Safe transaction data
chainId: 5,
options
})