@avnu/gasless-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

GASLESS-SDK

gasless-sdk is a typeScript SDK allowing you to easily provide gasless transactions to your users

Installation

npm install @avnu/gasless-sdk

# or

yarn add @avnu/gasless-sdk

Usage

// First retrieve the gas token prices
const gastokenPrices = await fetchGasTokenPrices();

// Build your TX
const calls: Call[] = [
  // ...
];

// Estimate the gas cost as you want
// Example: 
const fees = await account.estimateInvokeFee(calls, { blockIdentifier: 'latest', skipValidate: true })
const estimatedGasFees = fees.overall_fee

// Make your user choose the gas token
const gasTokenAddress = gastokenPrices[0].tokenAddress

// Execute the calls
await executeCalls(account, calls, { gasTokenAddress, gasTokenPrices, estimatedGasFees })

Example

This repository includes a basic example in the [/examples](/examples) folder.

Readme

Keywords

Package Sidebar

Install

npm i @avnu/gasless-sdk

Weekly Downloads

12

Version

0.1.2

License

MIT

Unpacked Size

3.18 MB

Total Files

12

Last publish

Collaborators

  • florian-bellotti
  • mentornotapseudo