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 , 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.Version
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
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
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
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 does not manipulate the instance, but returns a new IWorld instance with an updated world state instead.

Extension Methods

IWorldExtensions.BurnAsset(IWorld, IActionContext, Address, FungibleAssetValue)
IWorldExtensions.MintAsset(IWorld, IActionContext, Address, FungibleAssetValue)
IWorldExtensions.SetValidatorSet(IWorld, ValidatorSet)
IWorldExtensions.TransferAsset(IWorld, IActionContext, Address, Address, FungibleAssetValue)
IWorldExtensions.GetBalance(IWorldState, Address, Currency)
IWorldExtensions.GetTotalSupply(IWorldState, Currency)
IWorldExtensions.GetValidatorSet(IWorldState)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium