tx-indexer 0.5.0 → 0.5.2

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as ClassifiedTransaction, F as FetchTransactionsConfig, b as GetTransactionOptions, G as GetTransactionsOptions, I as IndexerRpcApi, N as NftMetadata, S as SolanaClient, m as SpamFilterConfig, g as TokenAccountBalance, T as TxIndexer, a as TxIndexerOptions, W as WalletBalance, c as createIndexer, d as createSolanaClient, n as fetchNftMetadata, o as fetchNftMetadataBatch, i as fetchTransaction, j as fetchTransactionsBatch, f as fetchWalletBalance, h as fetchWalletSignatures, l as filterSpamTransactions, k as isSpamTransaction, p as parseAddress, e as parseSignature, t as transactionToLegs } from './client-iLW2_DnL.js';
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-DdzTiKZ4.js';
2
2
  import { T as TxLeg, R as RawTransaction, a as TransactionClassification } from './classification.types-Cn9IGtEC.js';
3
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-Cn9IGtEC.js';
4
4
  import { ProtocolInfo, TokenInfo } from './types.js';
@@ -9,6 +9,7 @@ import { Address } from '@solana/kit';
9
9
  interface ClassifierContext {
10
10
  legs: TxLeg[];
11
11
  tx: RawTransaction;
12
+ walletAddress?: string;
12
13
  }
13
14
  interface Classifier {
14
15
  name: string;
@@ -20,7 +21,7 @@ declare class ClassificationService {
20
21
  private classifiers;
21
22
  constructor();
22
23
  registerClassifier(classifier: Classifier): void;
23
- classify(legs: TxLeg[], tx: RawTransaction): TransactionClassification;
24
+ classify(legs: TxLeg[], tx: RawTransaction, walletAddress?: string): TransactionClassification;
24
25
  }
25
26
  /**
26
27
  * Classifies a transaction based on its accounting legs and context.
@@ -28,14 +29,12 @@ declare class ClassificationService {
28
29
  * Uses a priority-ordered chain of classifiers (Solana Pay > Bridge > NFT Mint > Stake Deposit > Stake Withdraw > Swap > Airdrop > Transfer > Fee-only)
29
30
  * to determine the transaction type, direction, amounts, sender, and receiver.
30
31
  *
31
- * Direction is always from the initiator's (fee payer's) perspective.
32
- * Frontend should compare connected wallet to sender/receiver for user perspective.
33
- *
34
32
  * @param legs - Transaction legs representing all balance movements
35
33
  * @param tx - Raw transaction data for additional context (protocol, memo, etc.)
34
+ * @param walletAddress - Optional wallet address for perspective-aware classification (e.g., swap direction)
36
35
  * @returns Classification result with type, amounts, sender, receiver, and confidence
37
36
  */
38
- declare function classifyTransaction(legs: TxLeg[], tx: RawTransaction): TransactionClassification;
37
+ declare function classifyTransaction(legs: TxLeg[], tx: RawTransaction, walletAddress?: string): TransactionClassification;
39
38
 
40
39
  /**
41
40
  * Detects the primary protocol used in a transaction based on its program IDs.