filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
45 lines • 1.73 kB
TypeScript
import type { Synapse } from '@filoz/synapse-sdk';
import type { Logger } from 'pino';
import type { PaymentStatus, TopUpCalculation, TopUpResult } from './types.js';
/**
* Format a human-readable message for a top-up calculation
*
* @param calc - Top-up calculation result
* @returns Human-readable message explaining the top-up requirement
*/
export declare function formatTopUpReason(calc: TopUpCalculation): string;
/**
* Calculate required top-up for a specific storage scenario
*
* This function determines how much USDFC needs to be deposited to meet
* the specified storage requirements, taking into account current usage
* and the size of any upcoming upload.
*
* @param status - Current payment status
* @param options - Storage requirements
* @returns Top-up calculation with reasoning
*/
export declare function calculateRequiredTopUp(status: PaymentStatus, options: {
minStorageDays?: number | undefined;
pieceSizeBytes?: number | undefined;
pricePerTiBPerEpoch?: bigint | undefined;
}): TopUpCalculation;
/**
* Execute a top-up operation with balance limit checking
*
* This function handles the complete top-up process including:
* - Checking if top-up is needed
* - Validating against balance limits
* - Executing the deposit transaction
* - Providing detailed feedback
*
* @param synapse - Initialized Synapse instance
* @param topUpAmount - Amount of USDFC to deposit
* @param options - Options for top-up execution
* @returns Top-up execution result
*/
export declare function executeTopUp(synapse: Synapse, topUpAmount: bigint, options?: {
balanceLimit?: bigint | undefined;
logger?: Logger | undefined;
}): Promise<TopUpResult>;
//# sourceMappingURL=top-up.d.ts.map