Show / Hide Table of Contents

Interface IBlockChainStates<T>

A minimal interface to get states from a blockchain.

Note that BlockChain<T> implements this interface.

Namespace: Libplanet.Blockchain
Assembly: Libplanet.dll
Syntax
public interface IBlockChainStates<T>
    where T : IAction, new()
Type Parameters
Name Description
T

An IAction type.

Methods

| Improve this Doc View Source

GetBalance(Address, Currency, BlockHash, FungibleAssetStateCompleter<T>)

Queries address's balance of the currency in the BlockChain<T> from offset.

Declaration
FungibleAssetValue GetBalance(Address address, Currency currency, BlockHash offset, FungibleAssetStateCompleter<T> stateCompleter)
Parameters
Type Name Description
Address address

The owner Address to query.

Currency currency

The currency type to query.

BlockHash offset

The HashDigest<T> of the block to start finding the state.

FungibleAssetStateCompleter<T> stateCompleter

When the BlockChain<T> instance does not contain states dirty of the block which lastly updated states of a requested address, this delegate is called and its return value is used instead.

Recalculate makes the incomplete states recalculated and filled on the fly.

Reject makes the incomplete states (if needed) to cause IncompleteBlockStatesException instead.

Returns
Type Description
FungibleAssetValue

The address's current balance (or balance as of the given offset) of the currency.

| Improve this Doc View Source

GetStates(IReadOnlyList<Address>, BlockHash, StateCompleter<T>)

Gets multiple states associated to the specified addresses.

Declaration
IReadOnlyList<IValue?> GetStates(IReadOnlyList<Address> addresses, BlockHash offset, StateCompleter<T> stateCompleter)
Parameters
Type Name Description
IReadOnlyList<Address> addresses

Addresses of states to query.

BlockHash offset

The HashDigest<T> of the block to start finding the states.

StateCompleter<T> stateCompleter

When the BlockChain<T> instance does not contain states of the block, this delegate is called and its return values are used instead.

Recalculate makes the incomplete states recalculated and filled on the fly.

Reject makes the incomplete states (if needed) to cause IncompleteBlockStatesException instead.

Returns
Type Description
IReadOnlyList<Nullable<IValue>>

The states associated to the specified addresses. Associated values are ordered in the same way to the corresponding addresses. Absent states are represented as null.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2022 Planetarium