| calculateBufferAmountFromState |
Calculate the account funding buffer for transaction execution delay. |
| calculateLastProofDate |
Calculate when the last proof should have been submitted based on current time |
| calculateRunwayAmountFromState |
Calculate extra account funding for the requested post-upload runway. |
| calculateUploadCosts |
Calculate upload costs from already-resolved pricing, account, and data-set state. |
| capabilitiesListToObject |
Convert capability arrays to object map |
| claimTokens |
- |
| clientFromTransport |
Create a Viem public client from a transport configuration |
| createLimit |
Create a limit that runs at most concurrency tasks at a time, in call order. |
| createPieceUrl |
Create a piece URL for the CDN or PDP API |
| createPieceUrlFilBeam |
Create a piece URL for FilBeam. |
| createPieceUrlPDP |
Create a piece URL for the PDP API |
| datasetMetadataObjectToEntry |
Convert a dataset metadata object to an array of metadata entries to be signed. |
| dateToEpoch |
Convert a JavaScript Date to a Filecoin epoch |
| decodeAddressCapability |
Matches the behavior of address(uint160(BigEndian.decode(values[i]))) |
| decodePDPCapabilities |
Decode PDP capabilities from keys/values arrays into a PDPOffering object. Based on Curio’s capabilitiesToOffering function. |
| decodePDPError |
- |
| decodePDPOffering |
Decode the PDP offering from the provider. |
| dedupePieces |
Remove inputs whose PieceCID already appeared earlier in the array. |
| encodePDPCapabilities |
Encode a PDPOffering plus optional user-supplied extras into the (keys[], values[]) tuple consumed by registerProvider / addProduct / updateProduct on ServiceProviderRegistry. |
| epochsToDays |
Convert a number of epochs to whole days (floor division). |
| epochsToHours |
Convert a number of epochs to whole hours (floor division). |
| epochToDate |
Convert a Filecoin epoch to a JavaScript Date |
| fallbackRandIndex |
- |
| fallbackRandU256 |
- |
| formatBalance |
- |
| formatFraction |
- |
| formatUnits |
- |
| getPayerAddress |
Get the address that pays for an account’s storage: a session key signs as itself, but its root wallet pays. |
| isAsyncIterable |
Type guard to check if a value is an AsyncIterable |
| isProviderExistsRevert |
Check whether the given error is a revert emitted by the ServiceProviderRegistry.providerExists modifier (i.e. the provider ID is out of range or maps to an unoccupied storage slot). |
| isReadableStream |
Type guard to check if a value is a ReadableStream |
| isUint8Array |
Check if value is Uint8Array |
| isViemError |
Check if the error is a viem error |
| leafCountToRawSize |
Convert a PDP data-bearing leaf count to the byte size used by FWSS pricing. |
| mapWithLimit |
Like Promise.all(items.map(fn)), but runs at most concurrency calls at a time. |
| metadataArrayToObject |
- |
| parseUnits |
Parse a value to a bigint. |
| pieceMetadataObjectToEntry |
Convert a dataset metadata object to an array of metadata entries to be signed. |
| pieceSizesToLeafCount |
Sum the PDP data-bearing leaves produced by known raw piece sizes. |
| randIndex |
Provides a random index into an array of supplied length (0 <= index < length) |
| randU256 |
- |
| rawSizeToLeafCount |
Calculate the PDP data-bearing leaf count for a known raw piece size. |
| stringErrorEquals |
Check if the error message equals the expected string |
| supportsStreamingFetchBody |
Detect whether the current environment supports ReadableStream as a fetch request body. Firefox stringifies the stream to “[object ReadableStream]” instead of consuming it, and Safari silently ignores the stream body and the duplex option. This check catches both: a browser that stringifies will set Content-Type to text/plain (string body), and one that ignores duplex will fail the duplexAccessed gate. The try/catch handles any future browser that throws on the Request constructor. |
| timeUntilEpoch |
Calculate the time until a future epoch |
| transportFromTransportConfig |
Create a Viem public client from a transport configuration |
| validatePieceSizes |
Validate known raw piece sizes. |