pub struct TransactionList { /* private fields */ }
Expand description
A list contains a series of transactions and appropriate indexers.
This structure exposes a virtual merkle-tree in the following form:
0: event_hashes 1: offset 3: user_indexer 4: contract_indexer 5: token_indexer
ROOT
/ \
/ \
V V
/ \ / \
0 1 3 V
/ \
4 5
Implementations§
Source§impl TransactionList
impl TransactionList
Sourcepub fn new(contract: Principal, offset: u64) -> TransactionList
pub fn new(contract: Principal, offset: u64) -> TransactionList
Create a new list with the given global offset.
Sourcepub fn contract_id(&self) -> &Principal
pub fn contract_id(&self) -> &Principal
Return the principal id of the contract we’re storing transactions for.
Sourcepub fn get_transactions_for_user(
&self,
principal: &Principal,
page: u32,
) -> Vec<&Event>
pub fn get_transactions_for_user( &self, principal: &Principal, page: u32, ) -> Vec<&Event>
Return the transactions associated with a user’s principal id at the given page.
Sourcepub fn last_page_for_user(&self, principal: &Principal) -> u32
pub fn last_page_for_user(&self, principal: &Principal) -> u32
Return the last page number associated with the given user.
Sourcepub fn get_transactions_for_contract(
&self,
principal: &Principal,
page: u32,
) -> Vec<&Event>
pub fn get_transactions_for_contract( &self, principal: &Principal, page: u32, ) -> Vec<&Event>
Return the transactions associated with a token’s principal id at the given page.
Sourcepub fn last_page_for_contract(&self, principal: &Principal) -> u32
pub fn last_page_for_contract(&self, principal: &Principal) -> u32
Return the last page number associated with the given token contract.
Sourcepub fn get_transactions_for_token(
&self,
token_id: &u64,
page: u32,
) -> Vec<&Event>
pub fn get_transactions_for_token( &self, token_id: &u64, page: u32, ) -> Vec<&Event>
Return the transactions for a specific token.
pub fn last_page_for_token(&self, token_id: &u64) -> u32
Sourcepub fn witness_transactions_for_user(
&self,
principal: &Principal,
page: u32,
) -> HashTree<'_>
pub fn witness_transactions_for_user( &self, principal: &Principal, page: u32, ) -> HashTree<'_>
Return the witness that can be used to prove the response from get_transactions_for_user.
Sourcepub fn witness_transactions_for_contract(
&self,
principal: &Principal,
page: u32,
) -> HashTree<'_>
pub fn witness_transactions_for_contract( &self, principal: &Principal, page: u32, ) -> HashTree<'_>
Return the witness that can be used to prove the response from get_transactions_for_token.
Sourcepub fn witness_transactions_for_token(
&self,
token_id: &u64,
page: u32,
) -> HashTree<'_>
pub fn witness_transactions_for_token( &self, token_id: &u64, page: u32, ) -> HashTree<'_>
Return the witness that can be used to prove the response from get_transactions_for_token.
Sourcepub fn get_transaction(&self, id: u64) -> Option<&Event>
pub fn get_transaction(&self, id: u64) -> Option<&Event>
Return a transaction by its global id.
Sourcepub fn witness_transaction(&self, id: u64) -> HashTree<'_>
pub fn witness_transaction(&self, id: u64) -> HashTree<'_>
Return a witness which proves the response returned by get_transaction.