Struct cap_sdk_core::TransactionList
source · [−]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 5Implementations
sourceimpl 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, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_transactions_for_user(
&self,
principal: &Principal,
page: u32
) -> Vec<&Event, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_transactions_for_contract(
&self,
principal: &Principal,
page: u32
) -> Vec<&Event, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_transactions_for_token(
&self,
token_id: &u64,
page: u32
) -> Vec<&Event, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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.
Trait Implementations
sourceimpl AsHashTree for TransactionList
impl AsHashTree for TransactionList
sourceimpl CandidType for TransactionList
impl CandidType for TransactionList
sourceimpl<'de> Deserialize<'de> for TransactionList
impl<'de> Deserialize<'de> for TransactionList
sourcefn deserialize<D>(
deserializer: D
) -> Result<TransactionList, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<TransactionList, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Drop for TransactionList
impl Drop for TransactionList
sourceimpl Serialize for TransactionList
impl Serialize for TransactionList
sourcefn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for TransactionList
impl !Send for TransactionList
impl !Sync for TransactionList
impl Unpin for TransactionList
impl UnwindSafe for TransactionList
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more