KardiaChain JS SDK
  • Overview
  • Getting Started
  • Guides
    • Connecting to KardiaChain
      • Front-end
      • Back-end
    • Working with wallet
    • Sending your first transaction
    • Smart Contract: decentralize application
    • KRC20 tokens
    • KAI Chain module
    • Utilities
  • Reference
    • KardiaClient
    • Account
    • Transaction
    • KAI Chain
    • Smart contract
    • KRC20
    • Objects reference
Powered by GitBook
On this page
  • constructor
  • Methods
  • getBlockNumber
  • isValidator
  • getValidators
  • getBlockByBlockNumber
  • getBlockByHash
  • getBlockHeaderByBlockNumber
  • getBlockHeaderByHash
  • newFilter
  • newBlockFilter
  • uninstallFilter
  • getFilterChanges
  • getFilterLogs
  • getLogs
  • getGasPrice
  • Static method
  • KAIFromHydro
  • HydroFromKAI

Was this helpful?

  1. Reference

KAI Chain

constructor

Params

Name

Type

Required

Description

client

Client

RPC client that will be used to interact with KardiaChain

Return

Return a KAIChain instance .

Methods

getBlockNumber

Get current block number

Params

None

Return

Current block number

isValidator

Check if an address is a validator or not

Params

Name

Type

Required

Description

address

string

Required

Address to check

Return

True if given address is address of validator, otherwise false.

getValidators

Get list of current validators

Params

Name

Type

Required

Description

withDelegators

boolean

Indicate if return with each validator list of delegators.

Return

getBlockByBlockNumber

Get block by number

Params

Name

Type

Required

Description

blockNumber

number

Required

Block number (block height) to get data

Return

getBlockByHash

Get block by number

Params

Name

Type

Required

Description

blockHash

string

Required

Block hash to get data

Return

getBlockHeaderByBlockNumber

Params

Name

Type

Required

Description

blockNumber

string

Required

Block number (block height) to get header

Return

getBlockHeaderByHash

Params

Name

Type

Required

Description

blockHash

string

Required

Block hash to get header

Return

newFilter

Create a new filter to watch for smart contract's events

Params

Name

Type

Required

Description

obj

object

Required

obj.fromBlock

number | 'latest'

Block number to start filter

obj.toBlock

number | 'latest'

Block number to end filter

address

string

Smart contract's address

topics

string[]

List of topics to filter.

Return

Fitler ID

newBlockFilter

Create a new filter to watch for new block

Params

None

Return

Filter ID

uninstallFilter

Uninstalls a filter with given id. Should always be called when watch is no longer needed.

Params

Name

Type

Required

Description

filterID

string

Required

ID of filter to uninstall

Return

True if the filter was successfully uninstalled, otherwise false.

getFilterChanges

Polling method for a filter, which returns an array of logs which occurred since last poll.

Params

Name

Type

Required

Description

filterID

string

Required

ID of filter to get changes

Return

An array of logs which occurred since last poll.

For filters created with kai_newBlockFilter the return are block hashes, e.g ["0x3454645634534..."]

getFilterLogs

Returns an array of all logs matching filter with given id.

Params

Name

Type

Required

Description

filterID

string

Required

ID of filter to get changes

Return

getLogs

Returns an array of all logs matching a given filter object.

Params

Name

Type

Required

Description

obj

object

Required

obj.fromBlock

number | 'latest'

Block number to start filter

obj.toBlock

number | 'latest'

Block number to end filter

address

string

Smart contract's address

topics

string[]

List of topics to filter.

Return

getGasPrice

Get optimized gas price

Params

None

Return

Optimized gas price in HYDRO

Static method

KAIFromHydro

Convert Hydro to KAI

Params

Name

Type

Required

Description

hydroValue

string

Required

Hydro value to convert

Return

Value in KAI

HydroFromKAI

Convert KAI to Hydro

Params

Name

Type

Required

Description

kaiValue

string

Required

KAI value to convert

Return

Value in Hydro

PreviousTransactionNextSmart contract

Last updated 3 years ago

Was this helpful?

List of current

object

object

object

object

For filters created with kai_newFilter, return array of

See

Array of

getFilterChanges
validators
Block
Block
Block header
Block header
Log
Log