pub struct DeployBuilder<'a> { /* private fields */ }Expand description
A builder for constructing a Deploy.
Implementations§
Source§impl<'a> DeployBuilder<'a>
impl<'a> DeployBuilder<'a>
Sourcepub const DEFAULT_TTL: TimeDiff
pub const DEFAULT_TTL: TimeDiff
The default time-to-live for Deploys, i.e. 30 minutes.
Sourcepub const DEFAULT_GAS_PRICE: u64 = 1u64
pub const DEFAULT_GAS_PRICE: u64 = 1u64
The default gas price for Deploys, i.e. 1.
Sourcepub fn new<C: Into<String>>(
chain_name: C,
session: ExecutableDeployItem,
) -> Self
pub fn new<C: Into<String>>( chain_name: C, session: ExecutableDeployItem, ) -> Self
Returns a new DeployBuilder.
§Note
Before calling build, you must ensure
- that an account is provided by either calling
with_accountorwith_secret_key - that payment code is provided by calling
with_payment
Sourcepub fn new_transfer<C: Into<String>, A: Into<U512>, T: Into<TransferTarget>>(
chain_name: C,
amount: A,
maybe_source: Option<URef>,
target: T,
maybe_transfer_id: Option<u64>,
) -> Self
pub fn new_transfer<C: Into<String>, A: Into<U512>, T: Into<TransferTarget>>( chain_name: C, amount: A, maybe_source: Option<URef>, target: T, maybe_transfer_id: Option<u64>, ) -> Self
Returns a new DeployBuilder with session code suitable for a transfer.
If maybe_source is None, the account’s main purse is used as the source of the transfer.
§Note
Before calling build, you must ensure
- that an account is provided by either calling
with_accountorwith_secret_key - that payment code is provided by calling
with_payment
Sourcepub fn with_account(self, account: PublicKey) -> Self
pub fn with_account(self, account: PublicKey) -> Self
Sets the account in the Deploy.
If not provided, the public key derived from the secret key used in the DeployBuilder will
be used as the account in the Deploy.
Sourcepub fn with_gas_price(self, gas_price: u64) -> Self
pub fn with_gas_price(self, gas_price: u64) -> Self
Sets the gas price in the Deploy to the provided amount.
If not provided, the Deploy will use DEFAULT_GAS_PRICE (1) as the gas price for the
deploy
Sourcepub fn with_secret_key(self, secret_key: &'a SecretKey) -> Self
pub fn with_secret_key(self, secret_key: &'a SecretKey) -> Self
Sets the secret key used to sign the Deploy on calling build.
If not provided, the Deploy can still be built, but will be unsigned and will be invalid
until subsequently signed.
Sourcepub fn with_payment(self, payment: ExecutableDeployItem) -> Self
pub fn with_payment(self, payment: ExecutableDeployItem) -> Self
Sets the payment in the Deploy.
Sourcepub fn with_timestamp(self, timestamp: Timestamp) -> Self
pub fn with_timestamp(self, timestamp: Timestamp) -> Self
Sets the timestamp in the Deploy.
If not provided, the timestamp will be set to the time when the DeployBuilder was
constructed.
Sourcepub fn with_ttl(self, ttl: TimeDiff) -> Self
pub fn with_ttl(self, ttl: TimeDiff) -> Self
Sets the ttl (time-to-live) in the Deploy.
If not provided, the ttl will be set to Self::DEFAULT_TTL.
Sourcepub fn build(self) -> Result<Deploy, DeployBuilderError>
pub fn build(self) -> Result<Deploy, DeployBuilderError>
Returns the new Deploy, or an error if
with_payment wasn’t previously called.
Auto Trait Implementations§
impl<'a> Freeze for DeployBuilder<'a>
impl<'a> RefUnwindSafe for DeployBuilder<'a>
impl<'a> Send for DeployBuilder<'a>
impl<'a> Sync for DeployBuilder<'a>
impl<'a> Unpin for DeployBuilder<'a>
impl<'a> UnwindSafe for DeployBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more