pub trait BlockTestExt: Sized {
// Required methods
fn with_authenticated_owner(
self,
authenticated_owner: Option<AccountOwner>,
) -> Self;
fn with_operation(self, operation: impl Into<Operation>) -> Self;
fn with_transfer(
self,
owner: AccountOwner,
recipient: Account,
amount: Amount,
) -> Self;
fn with_simple_transfer(self, chain_id: ChainId, amount: Amount) -> Self;
fn with_incoming_bundle(self, incoming_bundle: IncomingBundle) -> Self;
fn with_incoming_bundles(
self,
incoming_bundles: impl IntoIterator<Item = IncomingBundle>,
) -> Self;
fn with_timestamp(self, timestamp: impl Into<Timestamp>) -> Self;
fn with_epoch(self, epoch: impl Into<Epoch>) -> Self;
fn with_burn(self, amount: Amount) -> Self;
async fn into_proposal_with_round<S: Signer + ?Sized>(
self,
owner: AccountOwner,
signer: &S,
round: Round,
) -> Result<BlockProposal, S::Error>;
// Provided method
async fn into_first_proposal<S: Signer + ?Sized>(
self,
owner: AccountOwner,
signer: &S,
) -> Result<BlockProposal, S::Error> { ... }
}Expand description
A helper trait to simplify constructing blocks for tests.
Required Methods§
Sourcefn with_authenticated_owner(
self,
authenticated_owner: Option<AccountOwner>,
) -> Self
fn with_authenticated_owner( self, authenticated_owner: Option<AccountOwner>, ) -> Self
Returns the block with the given authenticated owner.
Sourcefn with_operation(self, operation: impl Into<Operation>) -> Self
fn with_operation(self, operation: impl Into<Operation>) -> Self
Returns the block with the given operation appended at the end.
Sourcefn with_transfer(
self,
owner: AccountOwner,
recipient: Account,
amount: Amount,
) -> Self
fn with_transfer( self, owner: AccountOwner, recipient: Account, amount: Amount, ) -> Self
Returns the block with a transfer operation appended at the end.
Sourcefn with_simple_transfer(self, chain_id: ChainId, amount: Amount) -> Self
fn with_simple_transfer(self, chain_id: ChainId, amount: Amount) -> Self
Returns the block with a simple transfer operation appended at the end.
Sourcefn with_incoming_bundle(self, incoming_bundle: IncomingBundle) -> Self
fn with_incoming_bundle(self, incoming_bundle: IncomingBundle) -> Self
Returns the block with the given message appended at the end.
Sourcefn with_incoming_bundles(
self,
incoming_bundles: impl IntoIterator<Item = IncomingBundle>,
) -> Self
fn with_incoming_bundles( self, incoming_bundles: impl IntoIterator<Item = IncomingBundle>, ) -> Self
Returns the block with the given messages appended at the end.
Sourcefn with_timestamp(self, timestamp: impl Into<Timestamp>) -> Self
fn with_timestamp(self, timestamp: impl Into<Timestamp>) -> Self
Returns the block with the specified timestamp.
Sourcefn with_epoch(self, epoch: impl Into<Epoch>) -> Self
fn with_epoch(self, epoch: impl Into<Epoch>) -> Self
Returns the block with the specified epoch.
Sourcefn with_burn(self, amount: Amount) -> Self
fn with_burn(self, amount: Amount) -> Self
Returns the block with the burn operation (transfer to a special address) appended at the end.
Sourceasync fn into_proposal_with_round<S: Signer + ?Sized>(
self,
owner: AccountOwner,
signer: &S,
round: Round,
) -> Result<BlockProposal, S::Error>
async fn into_proposal_with_round<S: Signer + ?Sized>( self, owner: AccountOwner, signer: &S, round: Round, ) -> Result<BlockProposal, S::Error>
Returns a block proposal without any hashed certificate values or validated block.
Provided Methods§
Sourceasync fn into_first_proposal<S: Signer + ?Sized>(
self,
owner: AccountOwner,
signer: &S,
) -> Result<BlockProposal, S::Error>
async fn into_first_proposal<S: Signer + ?Sized>( self, owner: AccountOwner, signer: &S, ) -> Result<BlockProposal, S::Error>
Returns a block proposal in the first round in a default ownership configuration
(Round::MultiLeader(0)) without any hashed certificate values or validated block.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.