Twine
Last updated
Last updated
• Docs
/ / Twine
Generic class for twine data
Block
<T
, number
, number
, Version
>
new Twine<
T
>(__namedParameters
): <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.
Parameters
__namedParameters
object
__namedParameters.cid
__namedParameters.bytes
Uint8Array
__namedParameters.value
T
Returns
Overrides
Block.Block<T, number, number, Version>.constructor
Defined in
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
Get Signature
get isPulse():
boolean
Is this a pulse
Returns
boolean
Defined in
static
isTwine(thing
): thing is Chain | Pulse
Check if a value is a twine
Parameters
thing
any
Returns
thing is Chain | Pulse
Defined in
toJSON():
any
Get the twine data as a DAG-JSON object
Returns
any
Defined in
getContentDigest():
Promise
<MultihashDigest
<number
>>
Get the twine content field hash digest
Returns
Promise
<MultihashDigest
<number
>>
Defined in
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
Returns
Inherited from
Block.Block.links
Defined in
node_modules/multiformats/dist/src/block.d.ts:19
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(
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
T
extends |
But generally you'll want to use the or functions to decode a twine instance. Or use the package to create a twine instance.
<unknown
, number
, number
, Version
>
<T
>
<unknown
, number
, number
, Version
>
<T
, number
, number
, Version
>
<T
>
<>
links(): Iterable
<[string
, <unknown
, number
, number
, Version
>], any
, any
>
Iterable
<[string
, <unknown
, number
, number
, Version
>], any
, any
>