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
impl Prepare
Sourcepub fn new_multi(act_as: Vec<String>) -> Self
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.
Sourcepub fn add_command(self, command: Command) -> Self
pub fn add_command(self, command: Command) -> Self
Sourcepub fn add_commands(self, commands: impl IntoIterator<Item = Command>) -> Self
pub fn add_commands(self, commands: impl IntoIterator<Item = Command>) -> Self
Add several commands, executed atomically.
Sourcepub fn with_command_id(self, command_id: impl Into<String>) -> Self
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.
Sourcepub fn with_user_id(self, user_id: impl Into<String>) -> Self
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.
Sourcepub fn with_read_as(self, read_as: Vec<String>) -> Self
pub fn with_read_as(self, read_as: Vec<String>) -> Self
Parties to read as, in addition to those acting.
Sourcepub fn with_synchronizer_id(self, synchronizer_id: impl Into<String>) -> Self
pub fn with_synchronizer_id(self, synchronizer_id: impl Into<String>) -> Self
Pin the submission to a synchronizer.
Sourcepub fn with_disclosed_contracts(self, contracts: Vec<DisclosedContract>) -> Self
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.
Sourcepub fn with_package_id_selection_preference(
self,
package_ids: Vec<String>,
) -> Self
pub fn with_package_id_selection_preference( self, package_ids: Vec<String>, ) -> Self
Prefer these package ids when several satisfy a package-name reference.
Sourcepub fn with_prefetch_contract_keys(self, keys: Vec<PrefetchContractKey>) -> Self
pub fn with_prefetch_contract_keys(self, keys: Vec<PrefetchContractKey>) -> Self
Fetch these contract keys into the participant’s cache before interpretation.
Sourcepub fn with_min_ledger_time_abs(self, time: Timestamp) -> Self
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.
Sourcepub fn with_min_ledger_time_rel(self, duration: Duration) -> Self
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.
Sourcepub fn with_verbose_hashing(self, verbose: bool) -> Self
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.
Sourcepub fn with_max_record_time(self, time: Timestamp) -> Self
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.
Sourcepub fn with_hashing_scheme_version(self, version: HashingSchemeVersion) -> Self
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.
Sourcepub fn trust_participant_hash(self) -> Self
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.
Sourcepub fn with_taps_max_passes(self, passes: u32) -> Self
pub fn with_taps_max_passes(self, passes: u32) -> Self
Cap the topology-aware package selection passes (defaults to the participant’s configured value).
Sourcepub fn without_traffic_cost_estimation(self) -> Self
pub fn without_traffic_cost_estimation(self) -> Self
Turn off the traffic-cost estimate the participant returns by default.
Sourcepub fn disclosed_contracts(&self) -> &[DisclosedContract]
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§
Auto Trait Implementations§
impl Freeze for Prepare
impl RefUnwindSafe for Prepare
impl Send for Prepare
impl Sync for Prepare
impl Unpin for Prepare
impl UnsafeUnpin for Prepare
impl UnwindSafe for Prepare
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request