UNPKG

@web3-storage/w3up-client

Version:

Client for the web3.storage w3up api

44 lines 1.53 kB
import { Storefront } from '@web3-storage/filecoin-client'; import { Filecoin as FilecoinCapabilities } from '@web3-storage/capabilities'; import { Base } from '../base.js'; /** * Client for interacting with the `filecoin/*` capabilities. */ export class FilecoinClient extends Base { /** * Offer a Filecoin "piece" to the resource. * * Required delegated capabilities: * - `filecoin/offer` * * @param {import('multiformats').UnknownLink} content * @param {import('@web3-storage/capabilities/types').PieceLink} piece * @param {object} [options] * @param {string} [options.nonce] */ async offer(content, piece, options) { const conf = await this._invocationConfig([FilecoinCapabilities.offer.can]); return Storefront.filecoinOffer(conf, content, piece, { ...options, connection: this._serviceConf.filecoin, }); } /** * Request info about a content piece in Filecoin deals * * Required delegated capabilities: * - `filecoin/info` * * @param {import('@web3-storage/capabilities/types').PieceLink} piece * @param {object} [options] * @param {string} [options.nonce] */ async info(piece, options) { const conf = await this._invocationConfig([FilecoinCapabilities.info.can]); return Storefront.filecoinInfo(conf, piece, { ...options, connection: this._serviceConf.filecoin, }); } } //# sourceMappingURL=filecoin.js.map