Interface IAccount
An interface to manipulate an account state with
maintaining
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 state cannot be distinguished from the Address having never been set to any state.
Inherited Members
Namespace: Libplanet.Action.State
Assembly: Libplanet.Action.dll
Syntax
public interface IAccount : IAccountState
Remarks
This interface is immutable. SetState(Address, IValue) method does not manipulate the instance, but returns a new IAccount instance with updated states.
Properties
| Improve this Doc View SourceTotalUpdatedFungibleAssets
A set of Address and Currency pairs where each pair has its asoociated FungibleAssetValue changed since the previous Block's output states.
Declaration
[Pure]
IImmutableSet<(Address, Currency)> TotalUpdatedFungibleAssets { get; }
Property Value
Type | Description |
---|---|
IImmutableSet<(T1 Item1, T2 Item2)<Address, Currency>> |
Remarks
This interface is immutable. SetState(Address, IValue) method does not manipulate the instance, but returns a new IAccount instance with updated states.
Methods
| Improve this Doc View SourceBurnAsset(IActionContext, Address, FungibleAssetValue)
Burns the fungible asset value
(i.e., in-game monetary) from
owner
's balance.
Declaration
[Pure]
IAccount BurnAsset(IActionContext context, Address owner, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
IActionContext | context | The IActionContext of the IAction executing this method. |
Address | owner | The address who owns the fungible asset to burn. |
FungibleAssetValue | value | The fungible asset |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance that the given |
Remarks
This interface is immutable. SetState(Address, IValue) method does not manipulate the instance, but returns a new IAccount instance with updated states.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
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 |
MintAsset(IActionContext, Address, FungibleAssetValue)
Mints the fungible asset value
(i.e., in-game monetary),
and give it to the recipient
.
Declaration
[Pure]
IAccount MintAsset(IActionContext context, Address recipient, FungibleAssetValue value)
Parameters
Type | Name | Description |
---|---|---|
IActionContext | context | The IActionContext of the IAction executing this method. |
Address | recipient | The address who receives the minted asset. |
FungibleAssetValue | value | The asset value to mint. |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance that the given |
Remarks
This interface is immutable. SetState(Address, IValue) method does not manipulate the instance, but returns a new IAccount instance with updated states.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
CurrencyPermissionException | Thrown when a transaction signer (or a miner in case of block actions) is not a member of the Currency's Minters. |
SupplyOverflowException | Thrown when the sum of the
|
RemoveState(Address)
Gets a new instance that the account state of the given
address
is removed.
Declaration
[Pure]
IAccount RemoveState(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The Address referring the account to remove its state. |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance that
the account state of the given |
Remarks
This method method does not manipulate the instance, but returns a new IAccount instance with updated states instead.
SetState(Address, IValue)
Gets a new instance that the account state of the given
address
is set to the given
state
.
Declaration
[Pure]
IAccount SetState(Address address, IValue state)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The Address referring the account to set its state. |
Bencodex.Types.IValue | state | The new state to fill the account with. |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance that
the account state of the given |
Remarks
This method method does not manipulate the instance, but returns a new IAccount instance with updated states instead.
SetValidator(Validator)
Sets validator
to the stored ValidatorSet.
If 0 is given as its power, removes the validator from the ValidatorSet.
Declaration
[Pure]
IAccount SetValidator(Validator validator)
Parameters
Type | Name | Description |
---|---|---|
Validator | validator | The Validator instance to write. |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance with
|
Remarks
This interface is immutable. SetState(Address, IValue) method does not manipulate the instance, but returns a new IAccount instance with updated states.
TransferAsset(IActionContext, Address, Address, FungibleAssetValue, Boolean)
Transfers the fungible asset value
(i.e., in-game monetary)
from the sender
to the recipient
.
Declaration
[Pure]
IAccount TransferAsset(IActionContext context, Address sender, Address recipient, FungibleAssetValue value, bool allowNegativeBalance = false)
Parameters
Type | Name | Description |
---|---|---|
IActionContext | context | The IActionContext of the IAction executing this method. |
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. |
System.Boolean | allowNegativeBalance | Turn on to allow |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance that the given |
Remarks
The behavior is different depending on context
's
BlockProtocolVersion. There is a bug for version 0
where this may not act as intended. Such behavior is left intact for backward
compatibility.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
InsufficientBalanceException | Thrown when the |