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, Currency, BigInteger)
Burns the amount of the currency, fungible asset
(i.e., in-game monetary), from owner's balance.
Declaration
IAccountStateDelta BurnAsset(Address owner, Currency currency, BigInteger amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | owner | The address who owns the fungible asset to burn. |
| Currency | currency | The currency type to burn. |
| BigInteger | amount | The amount of the |
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 |
| InsufficientBalanceException | Thrown when the |
GetBalance(Address, Currency)
Queries address's balance of the currency.
Declaration
BigInteger 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 |
|---|---|
| BigInteger | 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 |
MintAsset(Address, Currency, BigInteger)
Mints the amount of a new currency, fungible asset
(i.e., in-game monetary), and give it to the recipient.
Declaration
IAccountStateDelta MintAsset(Address recipient, Currency currency, BigInteger amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | recipient | The address who receives the minted asset. |
| Currency | currency | The currency type to mint. |
| BigInteger | amount | The amount of the |
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 |
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, Currency, BigInteger, Boolean)
Transfers the amount of a new currency,
fungible asset (i.e., in-game monetary), from the sender
to the recipient.
Declaration
IAccountStateDelta TransferAsset(Address sender, Address recipient, Currency currency, BigInteger amount, 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 |
| Currency | currency | The currency type to transfer. |
| BigInteger | amount | The amount of the |
| Boolean | allowNegativeBalance | Turn on to allow |
Returns
| Type | Description |
|---|---|
| IAccountStateDelta | A new IAccountStateDelta instance that
the given |
Exceptions
| Type | Condition |
|---|---|
| InsufficientBalanceException | Thrown when the |