0.0.4 • Published 2 years ago

@gelatonetwork/gasless-wallet v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Gasless Wallet

GaslessWallet is the main class where the developers can create smart contract wallets owned by their users' EOA and sponsor the transactions by using Gelato's 1Balance Service

Installation

yarn add @gelatonetwork/gasless-wallet

npm install @gelatonetwork/gasless-wallet

Usage

Imports

import {
  GaslessWallet,
  GaslessWalletConfig,
} from "@gelatonetwork/gasless-wallet";
import { ethers } from "ethers";

Initialization

const eoaProvider:
    | ethers.providers.ExternalProvider
    | ethers.providers.JsonRpcFetchFunc = ...

const gaslessWalletConfig: GaslessWalletConfig = {
    apiKey: "1BALANCE_API_KEY",
};


const gaslessWallet = new GaslessWallet(eoaProvider, gaslessWalletConfig);
await gaslessWallet.init();

Get Gasless Wallet Contract Gnosis Safe Proxy Address

const gaslessWalletContractAddress = gaslessWallet.getAddress();

Helper Functions

const isGaslessWalletAlreadyDeployed = await gaslessWallet.isDeployed();
const isGaslessWalletAlreadyInitiated = gaslessWallet.isInitiated();

Sponsor Transaction

Sponsored Transaction that is sent through EOA's Gnosis Safe Proxy

const { taskId } = await gaslessWallet.sponsorTransaction(
  TARGET_ADDRESS,
  TX_DATA
);