Skip to main content

Module account

Module account 

Source
Expand description

Re-export the entire miden_client crate so external projects can use a single dependency. The account module provides types and client APIs for managing accounts within the Miden network.

Accounts are foundational entities of the Miden protocol. They store assets and define rules for manipulating them. Once an account is registered with the client, its state will be updated accordingly, and validated against the network state on every sync.

§Example

To add a new account to the client’s store, you might use the Client::add_account method as follows:

let account = AccountBuilder::new(random_seed)
    .account_type(AccountType::RegularAccountImmutableCode)
    .storage_mode(AccountStorageMode::Private)
    .with_component(BasicWallet)
    .build()?;

// Add the account to the client. The account already embeds its seed information.
client.add_account(&account, false).await?;

For more details on accounts, refer to the Account documentation.

Modules§

component

Structs§

Account
An account which can store assets and define rules for manipulating them.
AccountBuilder
A convenient builder for an Account allowing for safe construction of an account by combining multiple AccountComponents.
AccountCode
The public interface of an account.
AccountComponent
An AccountComponent defines a Library of code and the initial value and types of the StorageSlots it accesses.
AccountComponentCode
A Library that has been assembled for use as component code.
AccountDelta
The AccountDelta stores the differences between two account states, which can result from one or more transaction.
AccountFile
Account file contains a complete description of an account, including the Account struct as well as account seed and account authentication info.
AccountHeader
A header of an account which contains information that succinctly describes the state of the components of the account.
AccountStorage
Account storage is composed of a variable number of name-addressable StorageSlots up to 255 slots in total.
Address
A user-facing address in Miden.
PartialAccount
A partial representation of an account.
PartialStorage
A partial representation of an account storage, containing only a subset of the storage data.
PartialStorageMap
A partial representation of a StorageMap, containing only proofs for a subset of the key-value pairs.
StorageMap
An account storage map is a sparse merkle tree of depth Self::DEPTH.
StorageSlot
An individual storage slot in AccountStorage.
StorageSlotId
The partial hash of a StorageSlotName.
StorageSlotName
The name of an account storage slot.

Enums§

AccountId
The identifier of an Account.
AccountIdError
AccountIdPrefix
The prefix of an AccountId, i.e. its first field element.
AccountStorageMode
Describes where the state of the account is stored.
AccountType
Represents the different account types recognized by the protocol.
AddressError
AddressInterface
The account interface of an Address.
AddressType
The type of an Address in Miden.
NetworkId
The identifier of a Miden network.
NetworkIdError
StorageSlotContent
Represents the contents of a StorageSlot.
StorageSlotType
The type of a storage slot.

Traits§

AccountInterfaceExt
An extension for AccountInterface that allows instantiation from higher-level types.

Functions§

build_wallet_id
Builds an regular account ID from the provided parameters. The ID may be used along Client::import_account_by_id to import a public account from the network (provided that the used seed is known).