Wrapper class for RPC apis.

### Hierarchy

- RpcClient

## Index

### Constructors

- constructor

### Properties

- url

### Methods

- getAllowance
- getBalance
- getBlock
- getBlockCount
- getBlockHeight
- getBlockHeightByTxHash
- getBlockJson
- getContract
- getContractJson
- getGenerateBlockTime
- getMerkleProof
- getNodeCount
- getRawTransaction
- getRawTransactionJson
- getSmartCodeEvent
- getStorage
- getUrl
- makeRequest
- sendRawTransaction

## Constructors

### constructor

- new RpcClient(url?: undefined | string): RpcClient

- - Defined in network/rpc/rpcClient.ts:31

  #### Parameters

  - ##### Optional url: undefined | string

  #### Returns RpcClient

## Properties

### url

url: string

- Defined in network/rpc/rpcClient.ts:31

Url of the blockchain node

## Methods

### getAllowance

- getAllowance(asset: string, from: Address, to: Address): Promise<any>

- - Defined in network/rpc/rpcClient.ts:282

  Get allowanece

  #### Parameters

  - ##### asset: string

    Asset's type.Only ONT and ONG supported.

  - ##### from: Address

    Address of allowance's sender.

  - ##### to: Address

    Address of allowance's receiver.

  #### Returns Promise<any>

### getBalance

- getBalance(address: Address): Promise<any>

- - Defined in network/rpc/rpcClient.ts:65

  Get the balance of some address. The result contains ONT and ONG.

  #### Parameters

  - ##### address: Address

    Address

  #### Returns Promise<any>

### getBlock

- getBlock(value: string | number): Promise<any>

- - Defined in network/rpc/rpcClient.ts:208

  Get block info by block's height or hash. The result is hex encoded string.

  #### Parameters

  - ##### value: string | number

    Block's height or hash

  #### Returns Promise<any>

### getBlockCount

- getBlockCount(): Promise<any>

- - Defined in network/rpc/rpcClient.ts:155

  Get the all blocks count.

  #### Returns Promise<any>

### getBlockHeight

- getBlockHeight(): Promise<any>

- - Defined in network/rpc/rpcClient.ts:144

  Get the current block height.

  #### Returns Promise<any>

### getBlockHeightByTxHash

- getBlockHeightByTxHash(txHash: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:235

  Get block height by transaction hash

  #### Parameters

  - ##### txHash: string

    Reversed transaction hash

  #### Returns Promise<any>

### getBlockJson

- getBlockJson(value: string | number): Promise<any>

- - Defined in network/rpc/rpcClient.ts:168

  Get block info by block's height or hash. The result is json.

  #### Parameters

  - ##### value: string | number

    Block's hash or height

  #### Returns Promise<any>

### getContract

- getContract(hash: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:181

  Get contract info by contract' code hash. The result is hex encoded string.

  #### Parameters

  - ##### hash: string

    Contract's code hash.

  #### Returns Promise<any>

### getContractJson

- getContractJson(codeHash: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:194

  Get contract info by contract's code hash. The result is json.

  #### Parameters

  - ##### codeHash: string

    Contract's code hash.

  #### Returns Promise<any>

### getGenerateBlockTime

- getGenerateBlockTime(): Promise<any>

- - Defined in network/rpc/rpcClient.ts:122

  Get the generation time for each block. If the blockchain node runs in vbft, the result is null cause the time is not fixed.

  #### Returns Promise<any>

### getMerkleProof

- getMerkleProof(hash: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:263

  Get merkle proof by transaction hash.

  #### Parameters

  - ##### hash: string

    Reversed transaction hash

  #### Returns Promise<any>

### getNodeCount

- getNodeCount(): Promise<any>

- - Defined in network/rpc/rpcClient.ts:133

  Get the nodes count.

  #### Returns Promise<any>

### getRawTransaction

- getRawTransaction(txHash: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:97

  Get raw transaction by transaction hash. The result is hex encoded string.

  #### Parameters

  - ##### txHash: string

    Reversed transaction hash

  #### Returns Promise<any>

### getRawTransactionJson

- getRawTransactionJson(txHash: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:110

  Get transaction info by transaction hash. The result is json.

  #### Parameters

  - ##### txHash: string

    Reversed transaction hash.

  #### Returns Promise<any>

### getSmartCodeEvent

- getSmartCodeEvent(value: string | number): Promise<any>

- - Defined in network/rpc/rpcClient.ts:223

  Get smart contract event. If parameter is transaction's hash, the result is the event of that transaction. If parameter is block's height, the result is all the events of that block.

  #### Parameters

  - ##### value: string | number

    Transaction's hash or block's height

  #### Returns Promise<any>

### getStorage

- getStorage(codeHash: string, key: string): Promise<any>

- - Defined in network/rpc/rpcClient.ts:248

  Get stored value in smart contract by contract's code hash and the key.

  #### Parameters

  - ##### codeHash: string

    Contract's code hash

  - ##### key: string

    Key of stored value

  #### Returns Promise<any>

### getUrl

- getUrl(): string

- - Defined in network/rpc/rpcClient.ts:40

  Get the current blockchain node url.

  #### Returns string

### makeRequest

- makeRequest(method: string, ...params: any[]): object

- - Defined in network/rpc/rpcClient.ts:49

  Make request base on method and parameters

  #### Parameters

  - ##### method: string

    Method's name

  - ##### Rest ...params: any[]

    Parameters

  #### Returns object

  - ##### id: number

  - ##### jsonrpc: string

  - ##### method: string

  - ##### params: any[]

### sendRawTransaction

- sendRawTransaction(data: string, preExec?: boolean): Promise<any>

- - Defined in network/rpc/rpcClient.ts:78

  Send ran transaction to blockchain.

  #### Parameters

  - ##### data: string

    Hex encoded data.

  - ##### Default value preExec: boolean = false

    Decides if it is a pre-execute transaction.

  #### Returns Promise<any>

Generated using TypeDoc