Prerequisites
Before starting, make sure you have:- Completed our TypeScript and Node.js Setup Guide.
- Got your API key from the Bags Developer Portal.
- The token mint address you want to analyze.
1. The Token Lifetime Fees Script
Here is a simple script to fetch token lifetime fees. Save this asget-token-lifetime-fees.ts
.
This script uses the updated SDK API to retrieve lifetime fees for any token and displays them in a user-friendly format.
2. Run Your Script
To analyze a token’s lifetime fees, edit thegetTokenLifetimeFees
function call at the bottom of the script with the actual mint address you want to analyze.
Then, run the script from your terminal:
What You’ll See
The script will output the total lifetime fees earned by the token in SOL, formatted with proper number localization for easy reading. Example output:Use Cases
This information is valuable for:- Token Performance Analysis: Track how much revenue a token has generated
- Investment Research: Evaluate token success based on fee generation
- Portfolio Management: Monitor earnings from tokens you’ve created or invested in
- Market Analysis: Compare performance across different tokens