1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
// Copyright (C) 2019-2023 Aleo Systems Inc.
// This file is part of the snarkVM library.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use super::*;
impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
/// Returns an iterator over the state roots, for all blocks in `self`.
pub fn state_roots(&self) -> impl '_ + Iterator<Item = Cow<'_, N::StateRoot>> {
self.vm.block_store().state_roots()
}
/// Returns an iterator over the puzzle commitments, for all blocks in `self`.
pub fn puzzle_commitments(&self) -> impl '_ + Iterator<Item = Cow<'_, PuzzleCommitment<N>>> {
self.vm.block_store().puzzle_commitments()
}
/* Transaction */
/// Returns an iterator over the program IDs, for all transactions in `self`.
pub fn program_ids(&self) -> impl '_ + Iterator<Item = Cow<'_, ProgramID<N>>> {
self.vm.transaction_store().program_ids()
}
/// Returns an iterator over the programs, for all transactions in `self`.
pub fn programs(&self) -> impl '_ + Iterator<Item = Cow<'_, Program<N>>> {
self.vm.transaction_store().programs()
}
/// Returns an iterator over the transaction IDs, for all transactions in `self`.
pub fn transaction_ids(&self) -> impl '_ + Iterator<Item = Cow<'_, N::TransactionID>> {
self.vm.transaction_store().transaction_ids()
}
/* Transition */
/// Returns an iterator over the transition IDs, for all transitions.
pub fn transition_ids(&self) -> impl '_ + Iterator<Item = Cow<'_, N::TransitionID>> {
self.vm.transition_store().transition_ids()
}
/* Input */
/// Returns an iterator over the input IDs, for all transition inputs.
pub fn input_ids(&self) -> impl '_ + Iterator<Item = Cow<'_, Field<N>>> {
self.vm.transition_store().input_ids()
}
/// Returns an iterator over the serial numbers, for all transition inputs that are records.
pub fn serial_numbers(&self) -> impl '_ + Iterator<Item = Cow<'_, Field<N>>> {
self.vm.transition_store().serial_numbers()
}
/// Returns an iterator over the tags, for all transition inputs that are records.
pub fn tags(&self) -> impl '_ + Iterator<Item = Cow<'_, Field<N>>> {
self.vm.transition_store().tags()
}
/* Output */
/// Returns an iterator over the output IDs, for all transition outputs that are records.
pub fn output_ids(&self) -> impl '_ + Iterator<Item = Cow<'_, Field<N>>> {
self.vm.transition_store().output_ids()
}
/// Returns an iterator over the commitments, for all transition outputs that are records.
pub fn commitments(&self) -> impl '_ + Iterator<Item = Cow<'_, Field<N>>> {
self.vm.transition_store().commitments()
}
/// Returns an iterator over the nonces, for all transition outputs that are records.
pub fn nonces(&self) -> impl '_ + Iterator<Item = Cow<'_, Group<N>>> {
self.vm.transition_store().nonces()
}
/// Returns an iterator over the `(commitment, record)` pairs, for all transition outputs that are records.
pub fn records(&self) -> impl '_ + Iterator<Item = (Cow<'_, Field<N>>, Cow<'_, Record<N, Ciphertext<N>>>)> {
self.vm.transition_store().records()
}
/* Metadata */
/// Returns an iterator over the transition public keys, for all transactions.
pub fn transition_public_keys(&self) -> impl '_ + Iterator<Item = Cow<'_, Group<N>>> {
self.vm.transition_store().tpks()
}
}