@acala-network/chopsticks-core • Docs
@acala-network/chopsticks-core / Block
Class: Block
Block class.
Examples
const block = new Block(chain, number, hash)
const block = await chain.getBlock('0x...')
block.storage()
Constructors
new Block()
new Block(
chain
,number
,hash
,parentBlock
?,block
?):Block
Parameters
• chain: Blockchain
• number: number
• hash: `0x${string}`
• parentBlock?: Block
• block?
• block.extrinsics?: `0x${string}`[]
Extrinsics
• block.header?: Header
See @polkadot/types/interfaces
Header
• block.storage?: StorageLayerProvider
Storage provider. Default to RemoteStorageLayer with chain.api as remote.
• block.storageDiff?: Record
<string
, null
| StorageValue
>
Storage diff to apply.
Returns
Defined in
packages/core/src/blockchain/block.ts:53
Properties
hash
readonly
hash: `0x${string}`
Defined in
packages/core/src/blockchain/block.ts:56
number
readonly
number:number
Defined in
packages/core/src/blockchain/block.ts:55
Accessors
chain
get
chain():Blockchain
Returns
Defined in
packages/core/src/blockchain/block.ts:97
extrinsics
get
extrinsics(): `0x${string}`[] |Promise
<`0x${string}`[]>
Returns
`0x${string}`[] | Promise
<`0x${string}`[]>
Defined in
packages/core/src/blockchain/block.ts:110
header
get
header():Header
|Promise
<Header
>
Returns
Header
| Promise
<Header
>
Defined in
packages/core/src/blockchain/block.ts:101
meta
get
meta():Promise
<DecoratedMeta
>
Returns
Promise
<DecoratedMeta
>
Defined in
packages/core/src/blockchain/block.ts:273
metadata
get
metadata():Promise
<`0x${string}`>
Returns
Promise
<`0x${string}`>
Defined in
packages/core/src/blockchain/block.ts:266
parentBlock
get
parentBlock():Promise
<undefined
|Block
>
Returns
Promise
<undefined
| Block
>
Defined in
packages/core/src/blockchain/block.ts:122
registry
get
registry():Promise
<TypeRegistry
>
Get the type registry.
See
https://polkadot.js.org/docs/api/start/types.create#why-create-types
Returns
Promise
<TypeRegistry
>
Defined in
packages/core/src/blockchain/block.ts:250
runtimeVersion
get
runtimeVersion():Promise
<RuntimeVersion
>
Returns
Promise
<RuntimeVersion
>
Defined in
packages/core/src/blockchain/block.ts:259
storage
get
storage():StorageLayerProvider
Get the block storage.
Returns
Defined in
packages/core/src/blockchain/block.ts:147
wasm
get
wasm():Promise
<`0x${string}`>
Get the wasm string.
Returns
Promise
<`0x${string}`>
Defined in
packages/core/src/blockchain/block.ts:218
Methods
call()
call(
method
,args
):Promise
<TaskCallResponse
>
Call a runtime method.
Parameters
• method: string
• args: `0x${string}`[]
Returns
Promise
<TaskCallResponse
>
Defined in
packages/core/src/blockchain/block.ts:286
get()
get(
key
):Promise
<undefined
| `0x${string}`>
Get the block storage by key.
Parameters
• key: string
Returns
Promise
<undefined
| `0x${string}`>
Defined in
packages/core/src/blockchain/block.ts:154
getKeysPaged()
getKeysPaged(
options
):Promise
<string
[]>
Get paged storage keys.
Parameters
• options
• options.pageSize: number
• options.prefix?: string
• options.startKey?: string
Returns
Promise
<string
[]>
Defined in
packages/core/src/blockchain/block.ts:178
popStorageLayer()
popStorageLayer():
void
Pop a layer from the storage stack.
Returns
void
Defined in
packages/core/src/blockchain/block.ts:198
pushStorageLayer()
pushStorageLayer():
StorageLayer
Push a layer to the storage stack.
Returns
Defined in
packages/core/src/blockchain/block.ts:189
read()
read<
T
>(type
,query
, ...args
):Promise
<undefined
|DetectCodec
<Codec
,T
>>
Type Parameters
• T extends string
Parameters
• type: T
• query: StorageEntry
• ...args: any
[]
Returns
Promise
<undefined
| DetectCodec
<Codec
, T
>>
Defined in
packages/core/src/blockchain/block.ts:164
setWasm()
setWasm(
wasm
):void
Set the runtime wasm.
Parameters
• wasm: `0x${string}`
Returns
void
Defined in
packages/core/src/blockchain/block.ts:236
storageDiff()
storageDiff():
Promise
<Record
<`0x${string}`,null
| `0x${string}`>>
Get storage diff.
Returns
Promise
<Record
<`0x${string}`, null
| `0x${string}`>>