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