@fairmint/canton-node-sdk
Version:
Canton Node SDK
57 lines • 1.93 kB
TypeScript
/**
* Types for fee-related data structures
*/
import { TreeEvent } from '../../clients/ledger-json-api/schemas/api/events';
export interface BalanceChange {
party: string;
changeToInitialAmountAsOfRoundZero: string;
changeToHoldingFeesRate: string;
}
export interface FeeSummary {
holdingFees: string;
outputFees: string[];
senderChangeFee: string;
senderChangeAmount: string;
amuletPrice: string;
}
export interface FeeAnalysis {
totalFees: string;
feeBreakdown: {
holdingFees: string;
outputFees: string[];
senderChangeFee: string;
};
balanceChanges: BalanceChange[];
feeValidation: {
isBalanced: boolean;
totalBalanceChange: string;
totalFeesCalculated: string;
discrepancy?: string;
};
}
/**
* Parses fee information from an event tree (Record<string, TreeEvent>)
* @param eventTree - The event tree object
* @returns FeeAnalysis object with extracted fee information and validation
*/
export declare function parseFeesFromEventTree(eventTree: Record<string, TreeEvent>): FeeAnalysis;
/**
* Parses fee information from a TreeEvent
* @param treeEvent - The TreeEvent object
* @returns FeeAnalysis object with extracted fee information and validation
*/
export declare function parseFeesFromUpdate(treeEvent: TreeEvent): FeeAnalysis;
/**
* Formats fee amounts for display
* @param amount - The fee amount as a string
* @param decimals - Number of decimal places to show (default: 10)
* @returns Formatted fee amount
*/
export declare function formatFeeAmount(amount: string, decimals?: number): string;
/**
* Validates that all fee components are present and non-negative
* @param feeAnalysis - The fee analysis result
* @returns Array of validation errors, empty if valid
*/
export declare function validateFeeAnalysis(feeAnalysis: FeeAnalysis): string[];
//# sourceMappingURL=fee-parser.d.ts.map