@@ -1264,24 +1264,98 @@ pub struct PermsConst {
12641264 pub or_const : bool ,
12651265}
12661266
1267- // <https://github.com/MinaProtocol/mina/blob/1765ba6bdfd7c454e5ae836c49979fa076de1bea/src/lib/mina_base/account.ml#L368>
1267+ /// Represents a Mina account stored in the ledger.
1268+ ///
1269+ /// An account is the fundamental unit of state in the Mina ledger. Each
1270+ /// account is uniquely identified by a public key and token ID pair, and
1271+ /// contains the account's balance, transaction nonce, and various protocol
1272+ /// metadata.
1273+ ///
1274+ /// Accounts can be regular user accounts holding the native Mina token, or
1275+ /// more complex entities such as custom token accounts or zkApp accounts with
1276+ /// programmable smart contract functionality.
1277+ ///
1278+ /// The account structure is designed to support:
1279+ /// - Token transfers and balance tracking
1280+ /// - Stake delegation for consensus participation
1281+ /// - Time-locked vesting schedules
1282+ /// - Flexible permission policies for different operations
1283+ /// - Zero-knowledge application state and verification
1284+ ///
1285+ /// OCaml reference: src/lib/mina_base/account.ml L:201-224
1286+ /// Commit: fc6be4c58091c761f827c858229c2edf9519e941
1287+ /// Last verified: 2025-10-13
12681288#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
12691289#[ serde( into = "v2::MinaBaseAccountBinableArgStableV2" ) ]
12701290#[ serde( try_from = "v2::MinaBaseAccountBinableArgStableV2" ) ]
12711291pub struct Account {
1272- pub public_key : CompressedPubKey , // Public_key.Compressed.t
1273- pub token_id : TokenId , // Token_id.t
1274- /// the `token_symbol` describes a token id owned by the account id
1275- /// from this account, not the token id used by this account
1276- pub token_symbol : TokenSymbol , // Token_symbol.t
1277- pub balance : Balance , // Balance.t
1278- pub nonce : Nonce , // Nonce.t
1279- pub receipt_chain_hash : ReceiptChainHash , // Receipt.Chain_hash.t
1280- pub delegate : Option < CompressedPubKey > , // Public_key.Compressed.t option
1281- pub voting_for : VotingFor , // State_hash.t
1282- pub timing : Timing , // Timing.t
1283- pub permissions : Permissions < AuthRequired > , // Permissions.t
1284- pub zkapp : Option < Box < ZkAppAccount > > , // Zkapp_account.t
1292+ /// The public key that controls this account. This is the address used
1293+ /// to identify the account and authorize transactions.
1294+ pub public_key : CompressedPubKey ,
1295+
1296+ /// The token type this account holds. The default token (value 1)
1297+ /// represents the native Mina token. Custom tokens have different
1298+ /// values derived from their creator's account.
1299+ pub token_id : TokenId ,
1300+
1301+ /// The symbol for a custom token that this account can create or manage.
1302+ /// Note: this describes a token ID owned by this account (i.e., a token
1303+ /// this account can create), not the token type used by this account's
1304+ /// balance.
1305+ pub token_symbol : TokenSymbol ,
1306+
1307+ /// The current balance of the account in the smallest unit (nanomina for
1308+ /// the default token, or the smallest unit for custom tokens).
1309+ pub balance : Balance ,
1310+
1311+ /// The sequence number for transactions from this account. Incremented by
1312+ /// [`pay_fee_impl`](crate::scan_state::transaction_logic::transaction_partially_applied::pay_fee_impl)
1313+ /// for signed commands and by the zkApp application logic in
1314+ /// [`apply`](crate::zkapps::zkapp_logic::apply) when processing account
1315+ /// updates.
1316+ pub nonce : Nonce ,
1317+
1318+ /// A hash chain of all transaction receipts involving this account,
1319+ /// providing a tamper-evident history. Updated by
1320+ /// [`cons_signed_command_payload`](crate::scan_state::transaction_logic::transaction_union_payload::cons_signed_command_payload)
1321+ /// for signed commands and
1322+ /// [`cons_zkapp_command_commitment`](crate::scan_state::transaction_logic::transaction_union_payload::cons_zkapp_command_commitment)
1323+ /// for zkApp commands.
1324+ pub receipt_chain_hash : ReceiptChainHash ,
1325+
1326+ /// The public key of the account to which this account delegates its
1327+ /// stake for consensus. If `None`, the account delegates to itself (or
1328+ /// cannot delegate if using a custom token). Delegation allows accounts
1329+ /// to participate in consensus without running a block producer.
1330+ pub delegate : Option < CompressedPubKey > ,
1331+
1332+ /// The state hash this account is voting for in the consensus protocol.
1333+ /// Updated through zkApp account updates in
1334+ /// [`apply`](crate::zkapps::zkapp_logic::apply).
1335+ pub voting_for : VotingFor ,
1336+
1337+ /// The vesting schedule for this account's funds. Either `Untimed`
1338+ /// (fully liquid) or `Timed` with parameters defining when and how
1339+ /// tokens unlock over time. Updated by
1340+ /// [`pay_fee_impl`](crate::scan_state::transaction_logic::transaction_partially_applied::pay_fee_impl)
1341+ /// for signed commands and through zkApp account updates in
1342+ /// [`apply`](crate::zkapps::zkapp_logic::apply).
1343+ pub timing : Timing ,
1344+
1345+ /// The permissions controlling what operations can be performed on this
1346+ /// account and what authorization is required (none, signature, proof,
1347+ /// or both). Updated through zkApp account updates in
1348+ /// [`apply`](crate::zkapps::zkapp_logic::apply).
1349+ pub permissions : Permissions < AuthRequired > ,
1350+
1351+ /// zkApp-specific account data. If `Some`, this account is a zkApp
1352+ /// (zero-knowledge application) with additional state including app
1353+ /// state fields, a verification key, action state, and other zkApp
1354+ /// metadata. Regular accounts have `None`. Managed through
1355+ /// [`AccountInterface::make_zkapp`](crate::zkapps::interfaces::AccountInterface::make_zkapp)
1356+ /// and
1357+ /// [`AccountInterface::unmake_zkapp`](crate::zkapps::interfaces::AccountInterface::unmake_zkapp).
1358+ pub zkapp : Option < Box < ZkAppAccount > > ,
12851359}
12861360
12871361impl Account {
0 commit comments