diff --git a/packages/capabilities/src/filecoin/index.js b/packages/capabilities/src/filecoin/index.js index aee774398..4449c58e4 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 53f0cc4b3..84d09e3ad 100644 --- a/packages/capabilities/src/filecoin/storefront.js +++ b/packages/capabilities/src/filecoin/storefront.js @@ -13,6 +13,18 @@ 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 354665924..e3af88f0e 100644 --- a/packages/capabilities/src/types.ts +++ b/packages/capabilities/src/types.ts @@ -808,6 +808,9 @@ export interface AdminStoreInspectSuccess { } export type AdminStoreInspectFailure = Ucanto.Failure // Filecoin +export type Filecoin = InferInvokedCapability< + typeof StorefrontCaps.filecoin +> export type FilecoinOffer = InferInvokedCapability< typeof StorefrontCaps.filecoinOffer > @@ -921,6 +924,7 @@ export type ServiceAbilityArray = [ RateLimitAdd['can'], RateLimitRemove['can'], RateLimitList['can'], + Filecoin['can'], FilecoinOffer['can'], FilecoinSubmit['can'], FilecoinAccept['can'],