diff --git a/packages/capabilities/src/filecoin/index.js b/packages/capabilities/src/filecoin/index.js index 42d09f78c..00716be48 100644 --- a/packages/capabilities/src/filecoin/index.js +++ b/packages/capabilities/src/filecoin/index.js @@ -17,4 +17,5 @@ export { filecoinSubmit as submit, filecoinAccept as accept, filecoinInfo as info, + filecoin as filecoin, } from './storefront.js' diff --git a/packages/capabilities/src/filecoin/storefront.js b/packages/capabilities/src/filecoin/storefront.js index 01dfa4074..971e3c04e 100644 --- a/packages/capabilities/src/filecoin/storefront.js +++ b/packages/capabilities/src/filecoin/storefront.js @@ -13,6 +13,19 @@ import { capability, Schema, ok } from '@ucanto/validator' import { PieceLink } from './lib.js' import { equalWith, checkLink, and } from '../utils.js' + +/** + * Top-level capability for Filecoin operations. + */ +export const filecoin = capability({ + can: 'filecoin/*', + /** + * DID of the space the content is stored in. + */ + with: Schema.did(), + derives: equalWith, +}) + /** * Capability allowing an agent to _request_ storing a content piece in * Filecoin. diff --git a/packages/capabilities/src/types.ts b/packages/capabilities/src/types.ts index 9e475c18d..673102420 100644 --- a/packages/capabilities/src/types.ts +++ b/packages/capabilities/src/types.ts @@ -812,6 +812,7 @@ export interface AdminStoreInspectSuccess { } export type AdminStoreInspectFailure = Ucanto.Failure // Filecoin +export type Filecoin = InferInvokedCapability export type FilecoinOffer = InferInvokedCapability< typeof StorefrontCaps.filecoinOffer > @@ -923,6 +924,7 @@ export type ServiceAbilityArray = [ RateLimitAdd['can'], RateLimitRemove['can'], RateLimitList['can'], + Filecoin['can'], FilecoinOffer['can'], FilecoinSubmit['can'], FilecoinAccept['can'], diff --git a/packages/w3up-client/src/client.js b/packages/w3up-client/src/client.js index 07909e3a4..d26ba9b91 100644 --- a/packages/w3up-client/src/client.js +++ b/packages/w3up-client/src/client.js @@ -324,10 +324,7 @@ export class Client extends Base { 'upload/*', 'access/*', 'usage/*', - 'filecoin/offer', - 'filecoin/info', - 'filecoin/accept', - 'filecoin/submit', + 'filecoin/*', ], expiration: Infinity, }