Skip to content

Commit

Permalink
chore(capabilities): top level filecoin cap
Browse files Browse the repository at this point in the history
  • Loading branch information
fforbeck committed Dec 18, 2024
1 parent 12e2e69 commit 202a0fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/capabilities/src/filecoin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export {
filecoinSubmit as submit,
filecoinAccept as accept,
filecoinInfo as info,
filecoin as filecoin,
} from './storefront.js'
12 changes: 12 additions & 0 deletions packages/capabilities/src/filecoin/storefront.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions packages/capabilities/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
>
Expand Down Expand Up @@ -921,6 +924,7 @@ export type ServiceAbilityArray = [
RateLimitAdd['can'],
RateLimitRemove['can'],
RateLimitList['can'],
Filecoin['can'],
FilecoinOffer['can'],
FilecoinSubmit['can'],
FilecoinAccept['can'],
Expand Down

0 comments on commit 202a0fd

Please sign in to comment.