Safe Account Abstraction

The Safe{Core} Account Abstraction (AA) SDK aims to bring Account Abstraction to life by integrating Safe with Gelato Relay. This SDK helps developers to abstract the complexity of setting up a smart contract account.

Account Abstraction Kit The AA kit helps user ot create predeterministic smart contract wallets and execute gasless transactions with the Gelato Relay. The safe will only be deployed when the first transaction is sent.

Protocol Kit The Protocol Kit helps interact with the Safe contracts. It enables the creation of new Safe accounts, updating their configuration, and signing and executing transactions, among other features.

Relay Kit The Relay Kit relays Safe transactions, allowing you to get them sponsored by a third party or paid with any supported ERC-20 token.

Safe AA SDKs

As part of the Gelato Raas AA offerings, we have deployed a custom safe-sdk creating following packages

This project showcase how to send Gasless Transactions through a Safe sponsoring the gas with 1Balance

In following examples examples, it will be called the increment() method on this simple counter contract deployed on unreal

Quick Start

  1. Clone the safe repo

  2. Install project dependencies:

yarn install

in the package.json we have already included gelato-raas-protocol-kit, gelato-raas-account-abstraction-kit and gelato-raas-relay-kit

  "gelato-raas-account-abstraction-kit": "^1.3.7",
  "gelato-raas-protocol-kit": "^1.3.6",
  "gelato-raas-relay-kit": "^1.3.7"
  1. Create a .env file with your private config:

cp .env.example .env

You will need to input your Private Key PK and GELATO_RELAY_API_KEY for sponsored transactions, you can get it at

  1. Call the method:

  • Using 1Balance

     yarn aa1Balance

Using 1Balance

const safeTransactionData: MetaTransactionData = {
  to: targetAddress,
  data: nftContract.interface.encodeFunctionData("increment", []),
  value: "0",
  operation: OperationType.Call,

const safeAccountAbstraction = new AccountAbstraction(signer);
const sdkConfig: AccountAbstractionConfig = {
await safeAccountAbstraction.init(sdkConfig);

const txConfig = {
  TO: targetAddress,
  VALUE: "0",
  // Options:
  GAS_LIMIT: gasLimit,

const predictedSafeAddress = await safeAccountAbstraction.getSafeAddress();
console.log({ predictedSafeAddress });

const isSafeDeployed = await safeAccountAbstraction.isSafeDeployed();
console.log({ isSafeDeployed });

const safeTransactions: MetaTransactionData[] = [
    to: txConfig.TO,
    data: txConfig.DATA,
    value: txConfig.VALUE,
    operation: OperationType.Call,
const options: MetaTransactionOptions = {
  gasLimit: txConfig.GAS_LIMIT,
  isSponsored: true,

const response = await safeAccountAbstraction.relayTransaction(
console.log(`${response} `);


$ ts-node src/aa-safe-gasless/aa1Balance.ts
{ predictedSafeAddress: '0x68D60c586763879c6614e2eFA709cCae708203c4' }
{ isSafeDeployed: true }

UI integration together with Web3Auth

Please visit the deployed react mini site on with a live implementation of web3Auth and safe on unreal

The code can be found at