Interface IAccountStateDelta
An interface to manipulate account states with maintaining the set of UpdatedAddresses.
It is like a map which is virtually initialized such
that every possible Address exists and
is mapped to null
. That means that:
Namespace: Libplanet.Action
Assembly: Libplanet.dll
Syntax
public interface IAccountStateDelta
Remarks
This interface is immutable. SetState(Address, IValue) method does not manipulate the instance, but returns a new IAccountStateDelta instance with updated states.
Properties
| Improve this Doc View SourceStateUpdatedAddresses
Addresses of the accounts whose states have been updated since then.
Declaration
IImmutableSet<Address> StateUpdatedAddresses { get; }
Property Value
Type | Description |
---|---|
IImmutableSet<Address> |
UpdatedAddresses
Addresses of the accounts that have been updated since then.
Declaration
IImmutableSet<Address> UpdatedAddresses { get; }
Property Value
Type | Description |
---|---|
IImmutableSet<Address> |
UpdatedFungibleAssets
Addresses and sets of Currency whose fungible assets have been updated since then.
For example, if A transfers 10 FOO to B and B transfers 20 BAR to C,
UpdatedFungibleAssets become likes
{ [A] = { FOO }, [B] = { FOO, BAR }, [C] = { BAR } }
.
Declaration
IImmutableDictionary<Address, IImmutableSet<Currency>> UpdatedFungibleAssets { get; }
Property Value
Type | Description |
---|---|
IImmutableDictionary<Address, IImmutableSet<Currency>> |
Methods
| Improve this Doc View SourceBurnAsset(Address, FungibleAssetValue)
Burns the fungible asset value
(i.e., in-game monetary) from
owner
's balance.
Declaration
IAccountStateDelta BurnAsset(Address owner, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
Address | owner | The address who owns the fungible asset to burn. |
FungibleAssetValue | value | The fungible asset |
Returns
Type | Description |
---|---|
IAccountStateDelta | A new IAccountStateDelta instance that the given |
Exceptions
Type | Condition |
---|---|
CurrencyPermissionException | Thrown when a transaction signer (or a miner in case of block actions) is not a member of the Currency's Minters. |
InsufficientBalanceException | Thrown when the |
GetBalance(Address, Currency)
Queries address
's balance of the currency
.
Declaration
FungibleAssetValue GetBalance(Address address, Currency currency)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The owner address to query. |
Currency | currency | The currency type to query. |
Returns
Type | Description |
---|---|
FungibleAssetValue | The |
GetState(Address)
Gets the account state of the given address
.
Declaration
IValue? GetState(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The Address referring the account to get its state. |
Returns
Type | Description |
---|---|
Nullable<IValue> | The account state of the given |
GetStates(IReadOnlyList<Address>)
Gets multiple account states associated with the specified addresses
at once.
Declaration
IReadOnlyList<IValue?> GetStates(IReadOnlyList<Address> addresses)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<Address> | addresses | The Addresses associated with states to get. |
Returns
Type | Description |
---|---|
IReadOnlyList<Nullable<IValue>> | The states associated to the specified |
MintAsset(Address, FungibleAssetValue)
Mints the fungible asset value
(i.e., in-game monetary),
and give it to the recipient
.
Declaration
IAccountStateDelta MintAsset(Address recipient, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
Address | recipient | The address who receives the minted asset. |
FungibleAssetValue | value | The asset value to mint. |
Returns
Type | Description |
---|---|
IAccountStateDelta | A new IAccountStateDelta instance that the given |
Exceptions
Type | Condition |
---|---|
CurrencyPermissionException | Thrown when a transaction signer (or a miner in case of block actions) is not a member of the Currency's Minters. |
SetState(Address, IValue)
Gets a new instance that the account state of the given
address
is set to the given
state
.
Declaration
IAccountStateDelta SetState(Address address, IValue state)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The Address referring the account to set its state. |
IValue | state | The new state to fill the account with. |
Returns
Type | Description |
---|---|
IAccountStateDelta | A new IAccountStateDelta instance that
the account state of the given |
Remarks
This method method does not manipulate the instance, but returns a new IAccountStateDelta instance with updated states instead.
TransferAsset(Address, Address, FungibleAssetValue, Boolean)
Transfers the fungible asset value
(i.e., in-game monetary)
from the sender
to the recipient
.
Declaration
IAccountStateDelta TransferAsset(Address sender, Address recipient, FungibleAssetValue value, bool allowNegativeBalance = false)
Parameters
Type | Name | Description |
---|---|---|
Address | sender | The address who sends the fungible asset to
the |
Address | recipient | The address who receives the fungible asset from
the |
FungibleAssetValue | value | The asset value to transfer. |
Boolean | allowNegativeBalance | Turn on to allow |
Returns
Type | Description |
---|---|
IAccountStateDelta | A new IAccountStateDelta instance that the given |
Exceptions
Type | Condition |
---|---|
InsufficientBalanceException | Thrown when the |