Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Base

Hierarchy

Index

Properties

addNode

addNode: (peerId: string, address: string) => Promise<null>
method

addNode

memberof

DefaultRPC

description

attempt to add a node to the peer list and try to connect

param

the peer id of target node

param

the address of target node

returns

Type declaration

    • (peerId: string, address: string): Promise<null>
    • Parameters

      • peerId: string
      • address: string

      Returns Promise<null>

calculateDaoMaximumWithdraw

calculateDaoMaximumWithdraw: (outPoint: OutPoint, withdrawBlockHash: Hash256) => Promise<string>

Type declaration

clearBannedAddresses

clearBannedAddresses: () => Promise<null>
method

clearBannedAddresses

memberof

DefaultRPC

description

clear all banned IPs/Subnets

returns

Type declaration

    • (): Promise<null>
    • Returns Promise<null>

clearTxPool

clearTxPool: () => Promise<null>
method

clearTxPool

memberof

DefaultRPC

description

remove all transactions from the tx pool

returns

Type declaration

    • (): Promise<null>
    • Returns Promise<null>

dryRunTransaction

dryRunTransaction: (tx: RawTransaction) => Promise<RunDryResult>
method

dryRunTransaction

memberof

DefaultRPC

description

dry run the transaction and return the execution cycles, this method will not check the transaction validaty, but only run the lock script and type script and then return the execution cycles.

param

the raw transaction whose cycles is going to be calculated

returns

dry run result, including cycles the transaction used.

Type declaration

getBannedAddresses

getBannedAddresses: () => Promise<BannedAddresses>
method

getBannedAddresses

memberof

DefaultRPC

description

Returns all banned IPs/Subnets

Type declaration

getBlock

getBlock: (hash: Hash) => Promise<Block>
method

getBlock

memberof

DefaultRPC

description

rpc to get block by its hash

param

the block hash of the target block

returns

block object

Type declaration

getBlockByNumber

getBlockByNumber: (number: BlockNumber | bigint) => Promise<Block>
method

getBlockByNumber

memberof

DefaultRPC

description

rpc to get block by its number

param

the block number of the target block

returns

block object

Type declaration

getBlockEconomicState

getBlockEconomicState: (blockHash: Hash) => Promise<BlockEconomicState>
method

getBlockEconomicState

memberof

DefaultRPC

description
param
returns

Type declaration

getBlockHash

getBlockHash: (number: BlockNumber | bigint) => Promise<Hash>
method

getBlockHash

memberof

DefaultRPC

description

rpc to get the block hash by block number

param

block hash

returns

block hash

Type declaration

getBlockchainInfo

getBlockchainInfo: () => Promise<BlockchainInfo>
method

getBlockchainInfo

memberof

DefaultRPC

description

rpc to get state info of the blockchain

returns

blockchain info, including chain name, difficulty, epoch number, is_intial_block_download, median time, warnings

Type declaration

getCellbaseOutputCapacityDetails

getCellbaseOutputCapacityDetails: (blockHash: Hash) => Promise<CellbaseOutputCapacityDetails>
method

getCellbaseOutputCapacityDetails

memberof

DefaultRPC

description

Returns each component of the created CKB in this block's cellbase, which is issued to a block N - 1 - ProposalWindow.farthest, where this block's height is N.

param
deprecated

will be removed from v0.41.0

Type declaration

getCells

getCells: <WithData>(searchKey: GetCellsSearchKey<WithData>, order: Order, limit: Hash | bigint, cursor?: Hash256) => Promise<GetLiveCellsResult<WithData>>
method

getCells

memberof

DefaultRPC

description

rpc to get a cell by script

param
param

order cells by blocknumber "asc" or "desc"

param

limit the number of cells returned per call

param
returns

CKBComponents.GetLiveCellsResult

Type declaration

getCellsCapacity

getCellsCapacity: (searchKey: SearchKey) => Promise<CellsCapacity>
method

getCellsCapacity

memberof

DefaultRPC

description

rpc to get capacities by script

param
returns

CKBComponents.CellsCapacity

Type declaration

getConsensus

getConsensus: () => Promise<Consensus>
method

getConsensus

memberof

DefaultRPC

description

return various consensus parameters.

returns

consensus parameters

Type declaration

getCurrentEpoch

getCurrentEpoch: () => Promise<Epoch>
method

getCurrentEpoch

memberof

DefaultRPC

description

rpc to get the epoch info about the current epoch

returns

epoch info, including block reward, difficulty, last_block_hash_in_previous_epoch, length, number, remainder reward, start number

Type declaration

getEpochByNumber

getEpochByNumber: (epoch: string | bigint) => Promise<Epoch>
method

getEpochByNumber

memberof

DefaultRPC

description

rpc to get the epoch info by its number

returns

epoch info

Type declaration

    • (epoch: string | bigint): Promise<Epoch>
    • Parameters

      • epoch: string | bigint

      Returns Promise<Epoch>

getHeader

getHeader: (blockHash: Hash) => Promise<BlockHeader>
method

getHeader

memberof

DefaultRPC

description

Returns the information about a block header by hash.

params

{Promise} block hash

Type declaration

getHeaderByNumber

getHeaderByNumber: (blockNumber: BlockNumber | bigint) => Promise<BlockHeader>
method

getHeaderByNumber

memberof

DefaultRPC

description

Returns the information about a block header by block number

params

{Promise} block number

Type declaration

getIndexerTip

getIndexerTip: () => Promise<Tip>
method

getIndexerTip

memberof

DefaultRPC

description

rpc to get tip info of the longest blockchain

returns

tip info, including block number, block hash

Type declaration

    • (): Promise<Tip>
    • Returns Promise<Tip>

getLiveCell

getLiveCell: (outPoint: OutPoint, withData: boolean) => Promise<{ cell: LiveCell; status: CellStatus }>
method

getLiveCell

memberof

DefaultRPC

description

rpc to get a cell by outPoint, the meaning of outPoint could be found in ckb-types, please distinguish outPoint and cellOutPoint

param

cell's outPoint

param

set withData to true to return cell data and data hash if the cell is live

returns

liveCellWithStatus

Type declaration

getPeers

getPeers: () => Promise<RemoteNodeInfo[]>
method

getPeers

memberof

DefaultRPC

description

rpc to get connected peers info

returns

peers' node info

deprecated

will be removed from v0.41.0

Type declaration

getTipBlockNumber

getTipBlockNumber: () => Promise<BlockNumber>
method

getTipBlockNumber

memberof

DefaultRPC

description

rpc to get the number of blocks in the longest blockchain

returns

block number

Type declaration

getTipHeader

getTipHeader: () => Promise<BlockHeader>
method

getTipHeader

memberof

DefaultRPC

description

rpc to get the tip header of the longeest blockchain

returns

block header

Type declaration

getTransaction

getTransaction: (hash: Hash) => Promise<TransactionWithStatus>
method

getTransaction

memberof

DefaultRPC

description

rpc to get trasnaction wtih its status by its hash

param

the transaction hash of the target transaction

returns

transaction object with transaction status

Type declaration

getTransactionProof

getTransactionProof: (transactionHashes: Hash[], blockHash?: Hash) => Promise<TransactionProof>
method

getTransactionProof

memberof

DefaultRPC

description

request merkle proof that transactions are included in a block

param

transaction hashes, all transactions must be in the same block

param

if specified, looks for transactions in the block with this hash

Type declaration

getTransactions

getTransactions: <Group>(searchKey: GetTransactionsSearchKey<Group>, order: Order, limit: Hash | bigint, cursor?: Hash256) => Promise<GetTransactionsResult<Group>>
method

getTransactions

memberof

DefaultRPC

description

rpc to get a transactions by script

param
param

order cells by blocknumber "asc" or "desc"

param

limit the number of cells returned per call

param
returns

CKBComponents.GetTransactionsResult

Type declaration

localNodeInfo

localNodeInfo: () => Promise<LocalNodeInfo>
method

localNodeInfo

memberof

DefaultRPC

description

rpc to get the local node information

returns

node info, including addresses, is_outbound, node id, and version

Type declaration

pingPeers

pingPeers: () => Promise<null>
method

pingPeers

memberof

DefaultRPC

description

request a ping sent to all connected peers to measure ping time

returns

Type declaration

    • (): Promise<null>
    • Returns Promise<null>

removeNode

removeNode: (peerId: string) => Promise<null>
method

removeNode

memberof

DefaultRPC

description

attempt to remove a node from the peer list and try to disconnect

param

the peer id of the target node

returns

Type declaration

    • (peerId: string): Promise<null>
    • Parameters

      • peerId: string

      Returns Promise<null>

sendTransaction

sendTransaction: (tx: RawTransaction, outputsValidator?: OutputsValidator) => Promise<Hash>
method

sendTransaction

memberof

DefaultRPC

description

rpc to send a new transaction into transaction pool

param

a raw transaction includes cell deps, inputs, outputs, version, and witnesses, detailed info could be found in ckb-types

param

Validates the transaction outputs before entering the tx-pool, an optional string parameter (enum: default | passthrough ), null and passthrough mean skipping outputs validation

returns

transaction hash

Type declaration

setBan

setBan: (address: string, command: "insert" | "delete", banTime: string | null, absolute?: undefined | false | true, reason?: undefined | string) => Promise<null>
method

setBan

memberof

DefaultRPC

description

insert or delete an IP/Subnet from the banned list

param

The IP/Subnet with an optional netmask (default is /32 = single IP)

param

insert to insert an IP/Subnet to the list, delete to delete an IP/Subnet from the list

param

Time in milliseconds how long (or until when if [absolute] is set) the IP is banned, optional parameter, null means using the default time of 24h

param

If set, the ban_time must be an absolute timestamp in milliseconds since epoch, optional parameter

param

Ban reason, optional parameter

Type declaration

    • (address: string, command: "insert" | "delete", banTime: string | null, absolute?: undefined | false | true, reason?: undefined | string): Promise<null>
    • Parameters

      • address: string
      • command: "insert" | "delete"
      • banTime: string | null
      • Optional absolute: undefined | false | true
      • Optional reason: undefined | string

      Returns Promise<null>

setNetworkActive

setNetworkActive: (state: boolean) => Promise<null>
method

setNetworkActive

memberof

DefaultRPC

description

disable/enable all p2p network activity

param

true to enable networking, false to disable

Type declaration

    • (state: boolean): Promise<null>
    • Parameters

      • state: boolean

      Returns Promise<null>

syncState

syncState: () => Promise<SyncState>
method

syncState

memberof

DefaultRPC

description

return sync state of this node

Type declaration

txPoolInfo

txPoolInfo: () => Promise<TxPoolInfo>
method

txPoolInfo

memberof

DefaultRPC

description

rpc to get pool information

returns

info of transaction pool, including last_txs_updated_at, number of orphan, number of pending, number of proposed

Type declaration

verifyTransactionProof

verifyTransactionProof: (transactionProof: TransactionProof) => Promise<Hash[]>
method

verifyTransactionProof

memberof

DefaultRPC

description

verifies that a proof points to transactions in a block, returns transactions it commits to.

param
returns

hash list of transactions committed in the block

Type declaration

Accessors

rpcProperties

  • Returns RpcPropertes

Methods

getRawTxPool

  • method

    getRawTxPool

    memberof

    DefaultRPC

    description

    Returns all transaction ids in tx pool as a json array of string transaction ids.

    Returns Promise<TxPoolIds>

    CKBComponents.RawTxPool

  • Parameters

    • verbose: true

    Returns Promise<TxPoolVerbosity>

  • Parameters

    • verbose: false | null

    Returns Promise<TxPoolIds>

Generated using TypeDoc