tx-indexer 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/{client-DdzTiKZ4.d.ts → client-xmDVjOy4.d.ts} +13 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +499 -49
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +109 -5
- package/dist/index.js +521 -52
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/{classification.types-Cn9IGtEC.d.ts → classification.types-h046WjuF.d.ts} +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as ClassifiedTransaction, k as FetchBatchOptions, l as FetchTransactionOptions, F as FetchTransactionsConfig, b as GetTransactionOptions, G as GetTransactionsOptions, I as IndexerRpcApi, N as NftMetadata, R as RetryConfig, S as SolanaClient, o as SpamFilterConfig, g as TokenAccountBalance, T as TxIndexer, a as TxIndexerOptions, W as WalletBalance, c as createIndexer, d as createSolanaClient, q as fetchNftMetadata, r as fetchNftMetadataBatch, i as fetchTransaction, j as fetchTransactionsBatch, f as fetchWalletBalance, h as fetchWalletSignatures, n as filterSpamTransactions, m as isSpamTransaction, p as parseAddress, e as parseSignature, t as transactionToLegs } from './client-
|
|
2
|
-
import { T as TxLeg, R as RawTransaction, a as TransactionClassification } from './classification.types-
|
|
3
|
-
export { f as RawTransactionSchema, k as TokenBalance, e as TokenBalanceSchema, n as TransactionClassificationSchema, j as TxCategory, d as TxCategorySchema, h as TxDirection, b as TxDirectionSchema, m as TxLegRole, g as TxLegSchema, l as TxLegSide, i as TxPrimaryType, c as TxPrimaryTypeSchema } from './classification.types-
|
|
1
|
+
export { C as ClassifiedTransaction, k as FetchBatchOptions, l as FetchTransactionOptions, F as FetchTransactionsConfig, b as GetTransactionOptions, G as GetTransactionsOptions, I as IndexerRpcApi, N as NftMetadata, R as RetryConfig, S as SolanaClient, o as SpamFilterConfig, g as TokenAccountBalance, T as TxIndexer, a as TxIndexerOptions, W as WalletBalance, c as createIndexer, d as createSolanaClient, q as fetchNftMetadata, r as fetchNftMetadataBatch, i as fetchTransaction, j as fetchTransactionsBatch, f as fetchWalletBalance, h as fetchWalletSignatures, n as filterSpamTransactions, m as isSpamTransaction, p as parseAddress, e as parseSignature, t as transactionToLegs } from './client-xmDVjOy4.js';
|
|
2
|
+
import { T as TxLeg, R as RawTransaction, a as TransactionClassification } from './classification.types-h046WjuF.js';
|
|
3
|
+
export { f as RawTransactionSchema, k as TokenBalance, e as TokenBalanceSchema, n as TransactionClassificationSchema, j as TxCategory, d as TxCategorySchema, h as TxDirection, b as TxDirectionSchema, m as TxLegRole, g as TxLegSchema, l as TxLegSide, i as TxPrimaryType, c as TxPrimaryTypeSchema } from './classification.types-h046WjuF.js';
|
|
4
4
|
import { ProtocolInfo, TokenInfo } from './types.js';
|
|
5
5
|
export { Categorization, CategorizationSchema, Counterparty, CounterpartySchema, FiatValue, MoneyAmount, ProtocolInfoSchema } from './types.js';
|
|
6
6
|
import { z } from 'zod';
|
|
@@ -191,14 +191,118 @@ declare function parseSolanaPayMemo(memo: string): SolanaPayMemo;
|
|
|
191
191
|
*/
|
|
192
192
|
declare function isSolanaPayTransaction(programIds: string[], memo: string | null | undefined): boolean;
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Well-known token mint addresses on Solana mainnet.
|
|
196
|
+
* These are used as constants throughout the codebase.
|
|
197
|
+
*/
|
|
194
198
|
declare const KNOWN_TOKENS: {
|
|
195
199
|
readonly SOL: "So11111111111111111111111111111111111111112";
|
|
196
200
|
readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
197
|
-
readonly
|
|
201
|
+
readonly USDT: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
|
|
202
|
+
readonly PYUSD: "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo";
|
|
198
203
|
readonly USDG: "2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH";
|
|
204
|
+
readonly USDC_BRIDGED: "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM";
|
|
205
|
+
readonly DAI: "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCCi3Z4dPuFhh";
|
|
206
|
+
readonly JUP: "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN";
|
|
207
|
+
readonly JTO: "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL";
|
|
208
|
+
readonly PYTH: "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3";
|
|
209
|
+
readonly BONK: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263";
|
|
210
|
+
readonly WIF: "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm";
|
|
211
|
+
readonly RENDER: "rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof";
|
|
212
|
+
readonly HNT: "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux";
|
|
213
|
+
readonly RAY: "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R";
|
|
214
|
+
readonly ORCA: "orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE";
|
|
215
|
+
readonly MNGO: "MangoCzJ36AjZyKwVj3VnYU4GTonjfVEnJmvvWaxLac";
|
|
216
|
+
readonly MSOL: "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So";
|
|
217
|
+
readonly JITOSOL: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn";
|
|
218
|
+
readonly BSOL: "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1";
|
|
219
|
+
readonly POPCAT: "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr";
|
|
220
|
+
readonly MEW: "MEW1gQWJ3nEXg2qgERiKu7FAFj79PHvQVREQUzScPP5";
|
|
221
|
+
readonly PNUT: "2qEHjDLDLbuBgRYvsxhc5D6uDWAivNFZGan56P1tpump";
|
|
222
|
+
readonly FARTCOIN: "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump";
|
|
223
|
+
readonly AI16Z: "HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC";
|
|
224
|
+
readonly WBTC: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
|
225
|
+
readonly WETH: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
|
226
|
+
readonly WSOL: "So11111111111111111111111111111111111111112";
|
|
199
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Static token metadata registry.
|
|
230
|
+
* This serves as a fallback when external APIs (like Jupiter) are unavailable.
|
|
231
|
+
*
|
|
232
|
+
* Logo URLs are from:
|
|
233
|
+
* - Solana Labs token list (legacy but still hosted)
|
|
234
|
+
* - Jupiter token list CDN
|
|
235
|
+
*/
|
|
200
236
|
declare const TOKEN_INFO: Record<string, TokenInfo>;
|
|
201
237
|
declare function getTokenInfo(mint: string): TokenInfo | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Creates an "unknown token" placeholder for tokens not in the registry.
|
|
240
|
+
* Uses the first 8 characters of the mint address as a symbol.
|
|
241
|
+
*/
|
|
242
|
+
declare function createUnknownToken(mint: string, decimals: number): TokenInfo;
|
|
243
|
+
declare const SUPPORTED_STABLECOINS: readonly ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo", "2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH", "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM", "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCCi3Z4dPuFhh"];
|
|
244
|
+
/**
|
|
245
|
+
* Liquid staking tokens that represent staked SOL
|
|
246
|
+
*/
|
|
247
|
+
declare const LIQUID_STAKING_TOKENS: readonly ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1"];
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Options for the token fetcher
|
|
251
|
+
*/
|
|
252
|
+
interface TokenFetcherOptions {
|
|
253
|
+
/**
|
|
254
|
+
* Jupiter API endpoint. Defaults to the strict list (verified tokens).
|
|
255
|
+
* Use "https://tokens.jup.ag/tokens?tags=verified" for verified tokens
|
|
256
|
+
* Use "https://tokens.jup.ag/tokens" for all tokens
|
|
257
|
+
*/
|
|
258
|
+
jupiterApiUrl?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Time-to-live for cached tokens in milliseconds.
|
|
261
|
+
* Defaults to 5 minutes.
|
|
262
|
+
*/
|
|
263
|
+
cacheTtlMs?: number;
|
|
264
|
+
/**
|
|
265
|
+
* Whether to fetch all tokens on initialization.
|
|
266
|
+
* If false, tokens will be fetched on-demand.
|
|
267
|
+
* Defaults to false.
|
|
268
|
+
*/
|
|
269
|
+
prefetch?: boolean;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Fetches and caches token metadata from Jupiter's token API.
|
|
273
|
+
*
|
|
274
|
+
* Usage:
|
|
275
|
+
* ```ts
|
|
276
|
+
* const fetcher = createTokenFetcher();
|
|
277
|
+
* const token = await fetcher.getToken("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN");
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
interface TokenFetcher {
|
|
281
|
+
/**
|
|
282
|
+
* Get token info for a single mint address.
|
|
283
|
+
* Returns from cache if available, otherwise fetches from Jupiter.
|
|
284
|
+
* Falls back to static registry, then creates unknown token placeholder.
|
|
285
|
+
*/
|
|
286
|
+
getToken(mint: string, decimals?: number): Promise<TokenInfo>;
|
|
287
|
+
/**
|
|
288
|
+
* Get token info for multiple mint addresses.
|
|
289
|
+
* More efficient than calling getToken multiple times.
|
|
290
|
+
*/
|
|
291
|
+
getTokens(mints: string[], defaultDecimals?: number): Promise<Map<string, TokenInfo>>;
|
|
292
|
+
/**
|
|
293
|
+
* Force refresh the token cache from Jupiter API.
|
|
294
|
+
*/
|
|
295
|
+
refresh(): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Get the number of tokens currently cached.
|
|
298
|
+
*/
|
|
299
|
+
getCacheSize(): number;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Creates a new token fetcher instance.
|
|
303
|
+
*/
|
|
304
|
+
declare function createTokenFetcher(options?: TokenFetcherOptions): TokenFetcher;
|
|
305
|
+
declare function getDefaultTokenFetcher(): TokenFetcher;
|
|
202
306
|
|
|
203
307
|
/**
|
|
204
308
|
* Solana Program IDs
|
|
@@ -213,4 +317,4 @@ declare const JUPITER_V6_PROGRAM_ID = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTa
|
|
|
213
317
|
declare const JUPITER_V4_PROGRAM_ID = "JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB";
|
|
214
318
|
declare function detectFacilitator(accountKeys: string[]): string | null;
|
|
215
319
|
|
|
216
|
-
export { type AccountIdType, type BuildAccountIdParams, ClassificationService, JUPITER_V4_PROGRAM_ID, JUPITER_V6_PROGRAM_ID, KNOWN_TOKENS, type LegBalanceResult, type LegTokenBalance, type ParsedAccountId, ProtocolInfo, RawTransaction, SPL_MEMO_PROGRAM_ID, SYSTEM_PROGRAM_ID, type SolanaPayMemo, TOKEN_INFO, TOKEN_PROGRAM_ID, TokenInfo, TransactionClassification, TxLeg, buildAccountId, classifyTransaction, detectFacilitator, detectProtocol, extractMemo, getTokenInfo, groupLegsByAccount, groupLegsByToken, isSolanaPayTransaction, parseAccountId, parseSolanaPayMemo, validateLegsBalance };
|
|
320
|
+
export { type AccountIdType, type BuildAccountIdParams, ClassificationService, JUPITER_V4_PROGRAM_ID, JUPITER_V6_PROGRAM_ID, KNOWN_TOKENS, LIQUID_STAKING_TOKENS, type LegBalanceResult, type LegTokenBalance, type ParsedAccountId, ProtocolInfo, RawTransaction, SPL_MEMO_PROGRAM_ID, SUPPORTED_STABLECOINS, SYSTEM_PROGRAM_ID, type SolanaPayMemo, TOKEN_INFO, TOKEN_PROGRAM_ID, type TokenFetcher, type TokenFetcherOptions, TokenInfo, TransactionClassification, TxLeg, buildAccountId, classifyTransaction, createTokenFetcher, createUnknownToken, detectFacilitator, detectProtocol, extractMemo, getDefaultTokenFetcher, getTokenInfo, groupLegsByAccount, groupLegsByToken, isSolanaPayTransaction, parseAccountId, parseSolanaPayMemo, validateLegsBalance };
|