Show / Hide Table of Contents

Interface IWorld

An interface to manipulate an world state with maintaining Delta.

It is like a map which is virtually initialized such that every possible Address exists and is mapped to null. That means that:

  • it does not have length,
  • its index getter never throws KeyNotFoundException, but returns null instead, and
  • filling an Address with null account cannot be distinguished from the Address having never been set to any account.
Inherited Members
IWorldState.Trie
IWorldState.Legacy
IWorldState.GetAccountState(Address)
Namespace: Libplanet.Action.State
Assembly: Libplanet.Action.dll
Syntax
public interface IWorld : IWorldState
Remarks

This interface is immutable. SetAccount(Address, IAccount) method does not manipulate the instance, but returns a new IWorld instance with updated states.

Properties

| Improve this Doc View Source

Delta

The IWorld representing the delta part of this IWorld.

Declaration
[Pure]
IWorldDelta Delta { get; }
Property Value
Type Description
IWorldDelta
Remarks

This interface is immutable. SetAccount(Address, IAccount) method does not manipulate the instance, but returns a new IWorld instance with updated states.

Methods

| Improve this Doc View Source

GetAccount(Address)

Gets the IAccount of the given address.

Declaration
[Pure]
IAccount GetAccount(Address address)
Parameters
Type Name Description
Address address

The Address referring the world to get its state.

Returns
Type Description
IAccount

The IAccount of the given address. If it has never been set to any state it returns null instead.

Remarks

This interface is immutable. SetAccount(Address, IAccount) method does not manipulate the instance, but returns a new IWorld instance with updated states.

| Improve this Doc View Source

SetAccount(Address, IAccount)

Creates a new instance of IWorld with given address set to given account.

Declaration
[Pure]
IWorld SetAccount(Address address, IAccount account)
Parameters
Type Name Description
Address address

The Address for which to set given to.

IAccount account

The new IAccount to set to given address.

Returns
Type Description
IWorld

A new IWorld instance where the account state of given address is set to given account.

Remarks

This method method does not manipulate the instance, but returns a new IWorld instance with an updated world state instead.

Exceptions
Type Condition
ArgumentException

Thrown for one of the following reasons:

  • If is true and address is not LegacyAccount.
  • If address is not LegacyAccount and TotalUpdatedFungibleAssets is non-empty.
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium