solana-priority-fees
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

ai-fee

npm package

Optimized Solana Priority Fees

The SDK determines the most efficient priority fees for Solana transactions by analyzing recent network priority fees of writable accounts. Priority fee is recommended via the Langchain framework. Reduces Solana transaction fees by up to 50%.

Note: It is currently in beta phase. While suitable for testing and evaluation purposes, it is not recommended for production environments.

How to Use

Installation

npm install solana-priority-fees

Pre-requisite

Create a .env file with the following content

XAI_API_KEY="Your XAI API KEY"

You can get the XAI_API_KEY (Grok API), by authorising your X Account. It is offering 25$ worth of credits as per December 2024.

Fetching Priority Fees

Step 1 - Initialize

import { SolanaPriorityFees } from 'ai-fee';

const priorityFees = new SolanaPriorityFees({
    xAiApiKey: process.env.XAI_API_KEY
});

Step 2 - Define the writable account addresses of your transactions

const accountKeys=['writable-account-keys-list'];

Step 3 - Get Recommended Fees

const fee = await priorityFees.getPrioritizationFees(accountKeys);

Package Sidebar

Install

npm i solana-priority-fees

Weekly Downloads

2

Version

0.0.5

License

ISC

Unpacked Size

45 kB

Total Files

12

Last publish

Collaborators

  • anamansari062
  • hrishikesh332