filecoin-pin
    Preparing search index...

    Variable validatePaymentCapacity

    validatePaymentCapacity: (
        synapse: Synapse,
        pieceSizeBytes: number,
    ) => Promise<PaymentCapacityCheck>

    Type Declaration

      • (synapse: Synapse, pieceSizeBytes: number): Promise<PaymentCapacityCheck>
      • Validate payment capacity for a specific piece size

        This function checks if the deposit is sufficient for the piece upload. It does not account for allowances since WarmStorage is assumed to be given full trust with max allowances.

        Note: This function will attempt to automatically set max allowances unless using session key authentication, in which case allowances must be configured separately by the owner wallet.

        Example usage:

        const fileSize = 10 * 1024 * 1024 * 1024 // 10 GiB
        const capacity = await validatePaymentCapacity(synapse, fileSize)

        if (!capacity.canUpload) {
        console.error('Cannot upload file with current payment setup')
        capacity.suggestions.forEach(s => console.log(` - ${s}`))
        }

        Parameters

        • synapse: Synapse

          Initialized Synapse instance

        • pieceSizeBytes: number

          Size of the piece (CAR, File, etc.) file in bytes

        Returns Promise<PaymentCapacityCheck>

        Capacity check result