Skip to content
JinGyeong Jeong edited this page May 21, 2018 · 24 revisions

Structs

  • U256
  • H160, H256, H512
  • Block (header, transaction, ... )
  • Parcel (nonce, fee, action, networkId)
  • SignedParcel (Transaction, ECDSASignatures)
  • Transaction
    • Noop
    • Payment
    • SetRegularKey
    • AssetMint
    • AssetTransfer
  • AssetScheme

Supported Methods

Basic Methods

  • ping () => Promise<string>

Send a ping to codechain RPC server.

Returns a Promise that resolves with a string “pong”.

Chain Methods

  • getBlockNumber () => Promise<number>

Get latest block number.

Returns a Promise that resolves with a number.

  • getBlockHash (number) => Promise<H256>

Get the hash of the block of given number.

Returns a Promise that resolves with a H256.

  • getBlock (number | H256) => Promise<Block>

Get the block of given number or hash

Returns a Promise that resolves with a Block.

  • getParcel (H256) => Promise<Parcel>

Get the parcel of the given hash

Returns a Promise that resolves with a Parcel.

  • getParcels (number | H256) => Promise<Parcel[]>

Get the list of parcel in given block number or hash.

Returns a Promise that resolves with a list of Transaction.

  • getParcelInvoice (H256, number) => Promise<Invoice> (will be replaced with getTransactionInvoice)

Get the invoice of given parcel hash. The second parameter indicates timeout that is to wait until the parcel is included to a block.

Returns a Promise that resolves with a Invoice.

  • getParcelInvoices (H256, timeout: number) => Promise<Invoice[]>

  • getTransactionInvoice (H256, timeout: number) => Promise<Invoice>

  • getAssetScheme (address: H256) => Promise<AssetScheme>

Get the AssetScheme of the given AssetScheme's address.

Returns a Promise that resolves with a AssetScheme.

  • sendSignedParcel (SignedParcel) => Promise<H256>

  • getBalance (address: H160) => Promise<U256>

  • getNonce (address: H160) => Promise<U256>

Network Methods

  • addNode (SocketAddr) => Promise<?>

  • removeNode (SocketAddr) => Promise<?>

  • exchangeKey (SocketAddr) => Promise<?>

Node Info

  • getNodeInto () => Promise<?>

Returns a Promise that resolves with a client version, protocol, consensus, enabled extension, peer count, ... etc

Local Methods (Offline)

  • sign (private: H256) => ECDSASignature

  • blake256 (Buffer) => H256

Clone this wiki locally