interbtc-api

@interlay/interbtc-api / Exports / DefaultSystemAPI

Class: DefaultSystemAPI

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DefaultSystemAPI(api): DefaultSystemAPI

Parameters

Name Type
api ApiPromise

Returns

DefaultSystemAPI

Defined in

src/parachain/system.ts:57

Properties

api

Private api: ApiPromise

Defined in

src/parachain/system.ts:57

Methods

getBlockHash

getBlockHash(blockNumber): Promise<BlockHash>

Parameters

Name Type Description
blockNumber number The block number to get the hash for

Returns

Promise<BlockHash>

The block hash for the given block number

Implementation of

SystemAPI.getBlockHash

Defined in

src/parachain/system.ts:88


getCurrentActiveBlockNumber

getCurrentActiveBlockNumber(atBlock?): Promise<number>

Parameters

Name Type
atBlock? BlockHash

Returns

Promise<number>

The current active block number being processed.

Implementation of

SystemAPI.getCurrentActiveBlockNumber

Defined in

src/parachain/system.ts:63


getCurrentBlockNumber

getCurrentBlockNumber(): Promise<number>

Returns

Promise<number>

The current block number being processed.

Implementation of

SystemAPI.getCurrentBlockNumber

Defined in

src/parachain/system.ts:59


getFutureBlockNumber

getFutureBlockNumber(secondsFromNow): Promise<number>

Get number of block that will added in amount of seconds from now.

Parameters

Name Type Description
secondsFromNow number Amount of seconds in the future.

Returns

Promise<number>

Number of block added in future.

Note

Based on approximate block time of 12 seconds.

Implementation of

SystemAPI.getFutureBlockNumber

Defined in

src/parachain/system.ts:92


setCode

setCode(code): ExtrinsicData

Parameters

Name Type Description
code string Hex-encoded wasm blob

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Remarks

Upgrades runtime using sudoUncheckedWeight

Implementation of

SystemAPI.setCode

Defined in

src/parachain/system.ts:83


subscribeToCurrentBlockHeads

subscribeToCurrentBlockHeads(callback): Promise<() => void>

On every new parachain block, call the callback function with the new block header

Parameters

Name Type Description
callback (blockHeader: Header) => void Function to be called with every new unfinalized block header

Returns

Promise<() => void>

Implementation of

SystemAPI.subscribeToCurrentBlockHeads

Defined in

src/parachain/system.ts:76


subscribeToFinalizedBlockHeads

subscribeToFinalizedBlockHeads(callback): Promise<() => void>

On every new parachain block, call the callback function with the new block header

Parameters

Name Type Description
callback (blockHeader: Header) => void Function to be called with every new block header

Returns

Promise<() => void>

Implementation of

SystemAPI.subscribeToFinalizedBlockHeads

Defined in

src/parachain/system.ts:69