spl-lib3
v2.0.6
Published
A library for retrieving token associated accounts on the Solana blockchain.
Maintainers
Readme
SPL Library
This project is a TypeScript module for interacting with the Solana blockchain, specifically for retrieving token associated accounts.
Installation
To install the module, use npm:
npm install @spl-lib3Usage
To use the getTokenAssociatedAccounts function, import it in your TypeScript or JavaScript file:
import getTokenAssociatedAccounts from '@spl-lib3';Function Signature
getTokenAssociatedAccounts(associatedToken: PublicKey, feeAccount: PublicKey, threshold?: number): Promise<Array<{ address: string; amount: number; }>>Parameters
associatedToken: The public key of the associated token.feeAccount: The public key of the fee account.threshold: An optional parameter to filter accounts based on the amount held (default is 0).
Example
const associatedToken = new PublicKey('YOUR_ASSOCIATED_TOKEN');
const feeAccount = new PublicKey('YOUR_FEE_ACCOUNT');
getTokenAssociatedAccounts(associatedToken, feeAccount, 1000)
.then(holders => {
console.log(holders);
})
.catch(error => {
console.error('Error fetching token associated accounts:', error);
});License
This project is licensed under the MIT License. See the LICENSE file for details.
