UNPKG

filecoin-pin

Version:

Bridge IPFS content to Filecoin Onchain Cloud using familiar tools

44 lines 1.7 kB
/** * Floor pricing calculations for WarmStorage * * This module handles the minimum rate per piece (floor price) logic. * The floor price ensures that small files meet the minimum cost requirement * of 0.06 USDFC per 30 days, regardless of their actual size. * * Implementation follows the pattern from synapse-sdk PR #375: * 1. Calculate base cost from piece size * 2. Calculate floor cost (minimum per piece) * 3. Return max(base cost, floor cost) */ import type { StorageAllowances } from './types.js'; /** * Calculate floor-adjusted allowances for a piece * * This function applies the floor pricing (minimum rate per piece) to ensure * that small files meet the minimum cost requirement. * * Example usage: * ```typescript * const storageInfo = await synapse.storage.getStorageInfo() * const pricing = storageInfo.pricing.noCDN.perTiBPerEpoch * * // For a small file (1 KB) * const allowances = calculateFloorAdjustedAllowances(1024, pricing) * // Will return floor price allowances (0.06 USDFC per 30 days) * * // For a large file (10 GiB) * const allowances = calculateFloorAdjustedAllowances(10 * 1024 * 1024 * 1024, pricing) * // Will return calculated allowances based on size (floor doesn't apply) * ``` * * @param baseAllowances - Base allowances calculated from piece size * @returns Floor-adjusted allowances for the piece */ export declare function applyFloorPricing(baseAllowances: StorageAllowances): StorageAllowances; /** * Get the floor pricing allowances (minimum cost regardless of size) * * @returns Floor price allowances */ export declare function getFloorAllowances(): StorageAllowances; //# sourceMappingURL=floor-pricing.d.ts.map