Twine
@twine-protocol/twine-core v0.1.0 • Docs
twine-js / @twine-protocol/twine-core / Twine
Class: Twine<T>
Generic class for twine data
Extends
Block
<T
,number
,number
,Version
>
Extended by
Type Parameters
Constructors
new Twine()
new Twine<
T
>(__namedParameters
):Twine
<T
>
Create a new twine instance
This class extends the Block class from multiformats/block. So anything that reads or writes blocks can be used with this class. A twine can be created from a multi-format block too.
But generally you'll want to use the fromBytes or fromJSON functions to decode a twine instance. Or use the twine-builder package to create a twine instance.
Parameters
__namedParameters
object
__namedParameters.cid
__namedParameters.bytes
Uint8Array
__namedParameters.value
T
Returns
Twine
<T
>
Overrides
Block.Block<T, number, number, Version>.constructor
Defined in
packages/twine-core/src/twine.ts:47
Properties
isTwineInstance
public
boolean
true
is a twine instance (true)
-
isChain
public
boolean
undefined
is this a chain
-
chainCid
public
undefined
chain CID (either this CID or the pulse's chain CID)
-
cid
readonly
undefined
-
Block.Block.cid
node_modules/multiformats/dist/src/block.d.ts:10
bytes
readonly
ByteView
<T
>
undefined
-
Block.Block.bytes
node_modules/multiformats/dist/src/block.d.ts:11
value
readonly
T
undefined
-
Block.Block.value
node_modules/multiformats/dist/src/block.d.ts:12
asBlock
readonly
undefined
-
Block.Block.asBlock
node_modules/multiformats/dist/src/block.d.ts:13
Accessors
isPulse
Get Signature
get isPulse():
boolean
Is this a pulse
Returns
boolean
Defined in
packages/twine-core/src/twine.ts:82
Methods
isTwine()
static
isTwine(thing
): thing is Chain | Pulse
Check if a value is a twine
Parameters
thing
any
Returns
thing is Chain | Pulse
Defined in
packages/twine-core/src/twine.ts:31
toJSON()
toJSON():
any
Get the twine data as a DAG-JSON object
Returns
any
Defined in
packages/twine-core/src/twine.ts:89
getContentDigest()
getContentDigest():
Promise
<MultihashDigest
<number
>>
Get the twine content field hash digest
Returns
Promise
<MultihashDigest
<number
>>
Defined in
packages/twine-core/src/twine.ts:101
verifySignature()
verifySignature(
chain
?):Promise
<boolean
>
Verify the signature of this twine instance
If this is a chain, no chain instance is required. If this is a pulse, a chain instance must be provided.
Parameters
chain
?
Chain instance to use for verification
Returns
Promise
<boolean
>
Defined in
packages/twine-core/src/twine.ts:113
links()
links():
Iterable
<[string
,CID
<unknown
,number
,number
,Version
>],any
,any
>
Returns
Iterable
<[string
, CID
<unknown
, number
, number
, Version
>], any
, any
>
Inherited from
Block.Block.links
Defined in
node_modules/multiformats/dist/src/block.d.ts:19
tree()
tree():
Iterable
<string
,any
,any
>
Returns
Iterable
<string
, any
, any
>
Inherited from
Block.Block.tree
Defined in
node_modules/multiformats/dist/src/block.d.ts:20
get()
get(
path
?):BlockCursorView
<unknown
>
Parameters
path
?
string
Returns
BlockCursorView
<unknown
>
Inherited from
Block.Block.get
Defined in
node_modules/multiformats/dist/src/block.d.ts:21
Last updated