Store
@twine-protocol/twine-core v0.1.0 • Docs
twine-js / @twine-protocol/twine-core / Store
Interface: Store
A store that can fetch and save twines
Extends
Methods
fetch()
fetch(
cid
):Awaitable
<null
|Twine
<TwineValue
>>
Fetch a twine from storage, returning null if it is not found
it is NOT expected that the twine signature is checked, that is for the Resolver to do.
Parameters
Returns
Awaitable
<null
| Twine
<TwineValue
>>
Defined in
packages/twine-core/src/store/types.ts:22
save()
save(
twine
):Awaitable
<void
>
Save a twine to storage
Parameters
Returns
Awaitable
<void
>
Defined in
packages/twine-core/src/store/types.ts:28
saveMany()
saveMany(
twines
):Awaitable
<void
>
Save many twines to storage
Parameters
Returns
Awaitable
<void
>
Defined in
packages/twine-core/src/store/types.ts:34
delete()
delete(
cid
):Awaitable
<void
>
Delete a twine from storage
Parameters
Returns
Awaitable
<void
>
Defined in
packages/twine-core/src/store/types.ts:40
resolve()
resolve(query, options)
resolve(
query
,options
?):Promise
<ChainResolution
>
Resolve a chain from a query
This is the main way to get a pulse or chain from somewhere and have it automatically verified.
If the input is already a successful resolution, it will be returned as is.
If the input is a chain or pulse, it will be resolved as a chain or pulse resolution.
Parameters
Returns
Promise
<ChainResolution
>
A chain or pulse resolution
Examples
Inherited from
Defined in
packages/twine-core/src/resolver/types.ts:233
resolve(query, options)
resolve(
query
,options
?):Promise
<PulseResolution
>
Resolve a pulse (with its chain) from a query
Parameters
options
?
Returns
Promise
<PulseResolution
>
Inherited from
Defined in
packages/twine-core/src/resolver/types.ts:237
resolveLatest()
resolveLatest(
chain
,options
?):Promise
<PulseResolution
>
Resolve the latest pulse of a chain
Parameters
Returns
Promise
<PulseResolution
>
A pulse resolution
Examples
Inherited from
Defined in
packages/twine-core/src/resolver/types.ts:260
resolveIndex()
resolveIndex(
chain
,index
,options
?):Promise
<PulseResolution
>
Resolve a pulse by index
Parameters
index
number
The index of the pulse to resolve
Returns
Promise
<PulseResolution
>
A pulse resolution
Example
Inherited from
Defined in
packages/twine-core/src/resolver/types.ts:278
has()
has(
cid
):Awaitable
<boolean
>
Check if a cid can be resolved
Parameters
Returns
Awaitable
<boolean
>
True if the CID can be resolved, false otherwise
Example
Inherited from
Defined in
packages/twine-core/src/resolver/types.ts:295
pulses()
pulses(
chain
,start
?,options
?):AsyncGenerator
<Pulse
,any
,any
> |Generator
<Pulse
,any
,any
> |AnyIterable
<Pulse
>
Get the pulses of a chain
Parameters
Returns
AsyncGenerator
<Pulse
, any
, any
> | Generator
<Pulse
, any
, any
> | AnyIterable
<Pulse
>
An sync/async iterable of pulses
Example
Inherited from
Defined in
packages/twine-core/src/resolver/types.ts:313
chains()
chains():
AsyncGenerator
<Chain
,any
,any
> |Generator
<Chain
,any
,any
> |AnyIterable
<Chain
>
Get the chains that are known to the resolver
Returns
AsyncGenerator
<Chain
, any
, any
> | Generator
<Chain
, any
, any
> | AnyIterable
<Chain
>
An sync/async iterable of chains
Example
Inherited from
Defined in
Last updated