Skip to main content

Prepare

Struct Prepare 

Source
pub struct Prepare { /* private fields */ }
Expand description

A submission to be interpreted but not authorized: the prepare half of interactive submission.

This carries what PrepareSubmissionRequest carries, and nothing else. Submit is deliberately not reused: it has a deduplication period and a workflow_id that preparation has no field for, and accepting them here would silently drop them. The de-duplication period, the transaction shape and the submission id belong to execution and are set on Executable. In the other direction, preparation has four fields a plain submission does not: verbose_hashing, max_record_time, the hashing scheme, and traffic-cost estimation.

Implementations§

Source§

impl Prepare

Source

pub fn new(act_as: impl Into<String>) -> Self

Prepare a submission acting as a single party.

Source

pub fn new_multi(act_as: Vec<String>) -> Self

Prepare a submission acting as several parties.

Each of them signs: the participant requires a signature per party in act_as, so a transaction prepared for two parties needs two.

Source

pub fn add_command(self, command: Command) -> Self

Add a command — build them with create / exercise, or from generated bindings.

Source

pub fn add_commands(self, commands: impl IntoIterator<Item = Command>) -> Self

Add several commands, executed atomically.

Source

pub fn with_command_id(self, command_id: impl Into<String>) -> Self

Set the command id, one component of the change ID the Ledger API de-duplicates on (user_id, act_as, command_id).

Left unset, a fresh UUID is generated at prepare time and carried through execution, so re-executing the same Executable is de-duplicated rather than committed twice.

Source

pub fn with_user_id(self, user_id: impl Into<String>) -> Self

Set the user id. Defaults to the one derived from the bearer token.

Source

pub fn with_read_as(self, read_as: Vec<String>) -> Self

Parties to read as, in addition to those acting.

Source

pub fn with_synchronizer_id(self, synchronizer_id: impl Into<String>) -> Self

Pin the submission to a synchronizer.

Source

pub fn with_disclosed_contracts(self, contracts: Vec<DisclosedContract>) -> Self

Attach explicitly disclosed contracts — the created_event_blob path for contracts the submitting party cannot see on its own.

Source

pub fn with_package_id_selection_preference( self, package_ids: Vec<String>, ) -> Self

Prefer these package ids when several satisfy a package-name reference.

Source

pub fn with_prefetch_contract_keys(self, keys: Vec<PrefetchContractKey>) -> Self

Fetch these contract keys into the participant’s cache before interpretation.

Source

pub fn with_min_ledger_time_abs(self, time: Timestamp) -> Self

Lower bound for the transaction’s ledger time, absolute.

Mutually exclusive with with_min_ledger_time_rel; the participant rejects both at once.

Source

pub fn with_min_ledger_time_rel(self, duration: Duration) -> Self

Lower bound for the transaction’s ledger time, relative to when the participant receives the request.

Mutually exclusive with with_min_ledger_time_abs.

Source

pub fn with_verbose_hashing(self, verbose: bool) -> Self

Ask the participant to return the hashing details it used.

For debugging a hash mismatch. The participant may refuse — it is configurable server-side — and what comes back describes internal structure, so it is off by default.

Source

pub fn with_max_record_time(self, time: Timestamp) -> Self

Bound how long the prepared transaction can be executed for.

Past this record time the participant will certainly refuse it, which is what makes preparing a fresh transaction for the same intent safe again: without a bound, “it might still commit” and “prepare another” are both true at once.

Source

pub fn with_hashing_scheme_version(self, version: HashingSchemeVersion) -> Self

Choose the hashing scheme. Defaults to V2, which this SDK asks for explicitly rather than leaving to the participant; a transaction that uses contract keys needs V3.

The scheme decides what the hash covers, so it is echoed in the response and sent back with the signature — the participant must verify under the same scheme it hashed with. Under V2 and V3 the SDK recomputes the hash from the prepared transaction and refuses a response whose hash is of something else. Any other scheme is refused unless trust_participant_hash is set.

Source

pub fn trust_participant_hash(self) -> Self

Sign the participant’s hash as it returns it, for a hashing scheme this SDK cannot recompute (anything but V2 and V3).

Without this a prepared transaction hashed under such a scheme is refused: the hash is what the signature covers, and an unchecked one signs whatever the participant hashed, which need not be the transaction it returned. Setting it accepts that for this submission. It does not switch off the check under V2 and V3.

Source

pub fn with_taps_max_passes(self, passes: u32) -> Self

Cap the topology-aware package selection passes (defaults to the participant’s configured value).

Source

pub fn without_traffic_cost_estimation(self) -> Self

Turn off the traffic-cost estimate the participant returns by default.

Source

pub fn act_as(&self) -> &[String]

The parties this will act as.

Source

pub fn read_as(&self) -> &[String]

The parties this will read as, beyond those acting.

Source

pub fn disclosed_contracts(&self) -> &[DisclosedContract]

The contracts this will disclose.

A token-standard choice is meaningless without the registry’s disclosures, so a caller assembling one wants to see them before sending, not after a rejection.

Trait Implementations§

Source§

impl Clone for Prepare

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Prepare

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more