1.0.0 • Published 10 months ago

@web3-storage/aggregate-client v1.0.0

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
10 months ago

About

The @web3-storage/aggregate-client package provides the "low level" client API for aggregating data uploaded with the w3up platform. It is based on web3-storage/specs/w3-aggregation.md)https://github.com/web3-storage/specs/blob/feat/filecoin-spec/w3-aggregation.md) and is not intended for web3.storage end users.

Install

Install the package using npm:

npm install @web3-storage/aggregate-client

Usage

aggregateOffer

function aggregateOffer(
  conf: InvocationConfig,
  piece: Piece,
  offer: Piece[],
): Promise<{ status: string }>

Ask the service to create an aggregate offer and put it available for Storage Providers.

More information: InvocationConfig

aggregateGet

function aggregateGet(
  conf: InvocationConfig,
  subject: PieceCID,
): Promise<unkown>

Ask the service to get deal details of an aggregate.

More information: InvocationConfig

Types

Piece

An offered CAR to be part of an Aggregate.

export interface Piece {
  link: PieceCID
  size: number
}

export type PieceCID = ReturnType<typeof CommP.toCID>

InvocationConfig

This is the configuration for the UCAN invocation. It is an object with issuer, audience, resource and proofs:

  • The issuer is the signing authority that is issuing the UCAN invocation(s).
  • The audience is the principal authority that the UCAN is delegated to.
  • The resource (with field) points to a storage space.
  • The proofs are a set of capability delegations that prove the issuer has the capability to perform the action. These might not be required.

Contributing

Feel free to join in. All welcome. Please open an issue!

License

Dual-licensed under MIT + Apache 2.0