Files
smom-dbis-138/packages/checkpoint-core/dist/tokenTransfers.d.ts

41 lines
1.5 KiB
TypeScript
Raw Normal View History

/** Blockscout ERC-20 transfer parsing (shared by aggregator + indexer). */
export interface TokenTransferSummary {
token: string;
tokenSymbol: string;
tokenDecimals: number;
from: string;
to: string;
value: bigint;
logIndex: number;
}
interface TokenTransferItem {
from?: {
hash?: string;
};
to?: {
hash?: string;
};
token?: {
address?: string;
symbol?: string;
decimals?: string;
};
total?: {
value?: string;
decimals?: string;
};
value?: string | null;
type?: string;
log_index?: number;
}
/** Largest ERC-20 transfer in a tx (legacy primary payment). */
export declare function pickPrimaryTokenTransfer(items: TokenTransferItem[]): TokenTransferSummary | null;
/** All non-zero ERC-20 transfers in a tx. */
export declare function parseAllTokenTransfers(items: TokenTransferItem[]): TokenTransferSummary[];
export declare function fetchTokenTransferItemsForTx(apiBase: string, txHash: string): Promise<TokenTransferItem[]>;
export declare function pickPrimaryFromSummaries(items: TokenTransferSummary[]): TokenTransferSummary | null;
export declare function applyPrimaryTransferToLeaf(leaf: Record<string, unknown>, primary: TokenTransferSummary | null): void;
export declare function fetchAllTokenTransfersForTx(apiBase: string, txHash: string): Promise<TokenTransferSummary[]>;
export declare function fetchPrimaryTokenTransferForTx(apiBase: string, txHash: string): Promise<TokenTransferSummary | null>;
export {};