TridentAccount#
Trident Account is a wrapper around AccountMeta
, SnapshotAccount
and AccountId
.
AccountMeta
is type which is used within Transaction
, it specifies account address, isSigner
and isWritable
flags.
SnapshotAccount
is Trident's custom type which is used to capture account state before and after the transaction.
AccountId
is randomly generated number which is used to identify account within its corresponding AccountStorage
.
#[derive(Debug, Clone)]
pub struct TridentAccount {
pub account_id: AccountId,
account_meta: Option<AccountMeta>,
snapshot_before: Option<SnapshotAccount>,
snapshot_after: Option<SnapshotAccount>,
}
Implemented Methods#
The following section contains the methods that are available for the TridentAccount
struct.
set_account_meta
#
Sets the account metadata with specified address and flags.
get_snapshot_before
#
Returns the account snapshot taken before transaction execution.
get_snapshot_after
#
Returns the account snapshot taken after transaction execution.
set_is_signer
#
Sets the account as a signer.
set_is_writable
#
Sets the account as writable.
set_address
#
Sets the account's address.
pubkey
#
Returns the account's public key.
capture_before
#
Internal Method
This method is internal and should not be used directly.
Captures the account state before transaction execution.
capture_after
#
Internal Method
This method is internal and should not be used directly.
Captures the account state after transaction execution.
to_account_meta
#
Internal Method
This method is internal and should not be used directly.
Returns the AccountMeta
if set, panics if not set.
is_account_meta_set
#
Internal Method
This method is internal and should not be used directly.
Returns whether the account meta has been set.