Class Account
An internal implementation of IAccount.
Inherited Members
Namespace: Libplanet.Action.State
Assembly: Libplanet.Action.dll
Syntax
[Pure]
public class Account : IAccount, IAccountState
Constructors
| Improve this Doc View SourceAccount(IAccountState, IAccountDelta)
An internal implementation of IAccount.
Declaration
public Account(IAccountState baseState, IAccountDelta delta)
Parameters
Type | Name | Description |
---|---|---|
IAccountState | baseState | |
IAccountDelta | delta |
Account(IAccountState)
An internal implementation of IAccount.
Declaration
public Account(IAccountState baseState)
Parameters
Type | Name | Description |
---|---|---|
IAccountState | baseState |
Properties
| Improve this Doc View SourceDelta
The IAccountDelta representing the delta part of this IAccount.
Declaration
public IAccountDelta Delta { get; }
Property Value
Type | Description |
---|---|
IAccountDelta |
TotalUpdatedFungibleAssets
A set of Address and Currency pairs where each pair has its asoociated FungibleAssetValue changed since the previous Block's output states.
Declaration
public IImmutableSet<(Address, Currency)> TotalUpdatedFungibleAssets { get; }
Property Value
Type | Description |
---|---|
IImmutableSet<(T1 Item1, T2 Item2)<Address, Currency>> |
TotalUpdatedFungibles
An internal implementation of IAccount.
Declaration
public IImmutableDictionary<(Address, Currency), BigInteger> TotalUpdatedFungibles { get; }
Property Value
Type | Description |
---|---|
IImmutableDictionary<(T1 Item1, T2 Item2)<Address, Currency>, BigInteger> |
Trie
An internal implementation of IAccount.
Declaration
public ITrie Trie { get; }
Property Value
Type | Description |
---|---|
ITrie |
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]
public 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 |
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 |
GetBalance(Address, Currency)
Queries address
's balance of the currency
.
Declaration
[Pure]
public 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
[Pure]
public IValue GetState(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The Address referring the account to get its state. |
Returns
Type | Description |
---|---|
Bencodex.Types.IValue | The account state of the given |
GetStates(IReadOnlyList<Address>)
Gets multiple account states associated with the specified addresses
at once.
Declaration
[Pure]
public IReadOnlyList<IValue> GetStates(IReadOnlyList<Address> addresses)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<Address> | addresses | The Addresses associated with states to get. |
Returns
Type | Description |
---|---|
IReadOnlyList<Bencodex.Types.IValue> | The states associated to the specified |
GetTotalSupply(Currency)
Returns the total supply of a currency
.
Declaration
[Pure]
public FungibleAssetValue GetTotalSupply(Currency currency)
Parameters
Type | Name | Description |
---|---|---|
Currency | currency | The currency type to query. |
Returns
Type | Description |
---|---|
FungibleAssetValue | The total supply of the |
Exceptions
Type | Condition |
---|---|
TotalSupplyNotTrackableException | Thrown when the total supply of the
given |
See Also
| Improve this Doc View SourceGetValidatorSet()
Returns the validator set.
Declaration
[Pure]
public ValidatorSet GetValidatorSet()
Returns
Type | Description |
---|---|
ValidatorSet | The validator set of type ValidatorSet. |
MintAsset(IActionContext, Address, FungibleAssetValue)
Mints the fungible asset value
(i.e., in-game monetary),
and give it to the recipient
.
Declaration
[Pure]
public 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 |
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
|
SetState(Address, IValue)
Gets a new instance that the account state of the given
address
is set to the given
state
.
Declaration
[Pure]
public 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]
public IAccount SetValidator(Validator validator)
Parameters
Type | Name | Description |
---|---|---|
Validator | validator | The Validator instance to write. |
Returns
Type | Description |
---|---|
IAccount | A new IAccount instance with
|
TransferAsset(IActionContext, Address, Address, FungibleAssetValue, Boolean)
Transfers the fungible asset value
(i.e., in-game monetary)
from the sender
to the recipient
.
Declaration
[Pure]
public 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. |
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 |