Struct Slate

Source
pub struct Slate {
Show 13 fields pub version_info: VersionCompatInfo, pub num_participants: u8, pub id: Uuid, pub state: SlateState, pub tx: Option<Transaction>, pub amount: u64, pub fee_fields: FeeFields, pub ttl_cutoff_height: u64, pub kernel_features: u8, pub offset: BlindingFactor, pub participant_data: Vec<ParticipantData>, pub payment_proof: Option<PaymentInfo>, pub kernel_features_args: Option<KernelFeaturesArgs>,
}
Expand description

A ‘Slate’ is passed around to all parties to build up all of the public transaction data needed to create a finalized transaction. Callers can pass the slate around by whatever means they choose, (but we can provide some binary or JSON serialization helpers here).

Fields§

§version_info: VersionCompatInfo

Versioning info

§num_participants: u8

The number of participants intended to take part in this transaction

§id: Uuid

Unique transaction ID, selected by sender

§state: SlateState

Slate state

§tx: Option<Transaction>

The core transaction data: inputs, outputs, kernels, kernel offset Optional as of V4 to allow for a compact transaction initiation

§amount: u64

base amount (excluding fee)

§fee_fields: FeeFields

fee amount and shift

§ttl_cutoff_height: u64

TTL, the block height at which wallets should refuse to process the transaction and unlock all associated outputs

§kernel_features: u8

Kernel Features flag - 0: plain 1: coinbase (invalid) 2: height_locked 3: NRD

§offset: BlindingFactor

Offset, needed when posting of transasction is deferred

§participant_data: Vec<ParticipantData>

Participant data, each participant in the transaction will insert their public data here. For now, 0 is sender and 1 is receiver, though this will change for multi-party

§payment_proof: Option<PaymentInfo>

Payment Proof

§kernel_features_args: Option<KernelFeaturesArgs>

Kernel features arguments

Implementations§

Source§

impl Slate

Source

pub fn tx_or_err(&self) -> Result<&Transaction, Error>

Return the transaction, throwing an error if it doesn’t exist to be used at points in the code where the existence of a transaction is assumed

Source

pub fn tx_or_err_mut(&mut self) -> Result<&mut Transaction, Error>

As above, but return mutable reference

Source

pub fn num_participants(&self) -> u8

number of participants

Source

pub fn deserialize_upgrade(slate_json: &str) -> Result<Slate, Error>

Recieve a slate, upgrade it to the latest version internally Throw error if this can’t be done

Source

pub fn upgrade(v_slate: VersionedSlate) -> Result<Slate, Error>

Upgrade a versioned slate

Source

pub fn compact(&mut self) -> Result<(), Error>

Compact the slate for initial sending, storing the excess + offset explicit and removing my input/output data This info must be stored in the context for repopulation later

Source

pub fn empty_transaction() -> Transaction

Build a new empty transaction. Wallet currently only supports tx with “features and commit” inputs.

Source

pub fn blank(num_participants: u8, is_invoice: bool) -> Slate

Create a new slate

Source

pub fn remove_other_sigdata<K>( &mut self, keychain: &K, sec_nonce: &SecretKey, sec_key: &SecretKey, ) -> Result<(), Error>
where K: Keychain,

Removes any signature data that isn’t mine, for compacting slates for a return journey

Source

pub fn add_transaction_elements<K, B>( &mut self, keychain: &K, builder: &B, elems: Vec<Box<Append<K, B>>>, ) -> Result<BlindingFactor, Error>
where K: Keychain, B: ProofBuild,

Adds selected inputs and outputs to the slate’s transaction Returns blinding factor

Source

pub fn update_kernel(&mut self) -> Result<(), Error>

Update the tx kernel based on kernel features derived from the current slate. The fee may change as we build a transaction and we need to update the tx kernel to reflect this during the tx building process.

Source

pub fn fill_round_1<K>( &mut self, keychain: &K, context: &mut Context, ) -> Result<(), Error>
where K: Keychain,

Completes callers part of round 1, adding public key info to the slate

Source

pub fn msg_to_sign(&self) -> Result<Message, Error>

This is the msg that we will sign as part of the tx kernel.

Source

pub fn fill_round_2<K>( &mut self, keychain: &K, sec_key: &SecretKey, sec_nonce: &SecretKey, ) -> Result<(), Error>
where K: Keychain,

Completes caller’s part of round 2, completing signatures

Source

pub fn finalize<K>(&mut self, keychain: &K) -> Result<(), Error>
where K: Keychain,

Creates the final signature, callable by either the sender or recipient (after phase 3: sender confirmation)

Source

pub fn pub_nonce_sum(&self, secp: &Secp256k1) -> Result<PublicKey, Error>

Return the sum of public nonces

Source

pub fn pub_blind_sum(&self, secp: &Secp256k1) -> Result<PublicKey, Error>

Return the sum of public blinding factors

Source

pub fn add_participant_info<K>( &mut self, keychain: &K, context: &Context, part_sig: Option<Signature>, ) -> Result<(), Error>
where K: Keychain,

Adds participants public keys to the slate data and saves participant’s transaction context sec_key can be overridden to replace the blinding factor (by whoever split the offset)

Source

pub fn adjust_offset<K: Keychain>( &mut self, keychain: &K, context: &Context, ) -> Result<(), Error>

Add our contribution to the offset based on the excess, inputs and outputs

Source

pub fn calc_excess(&self, secp: &Secp256k1) -> Result<Commitment, Error>

Calculate the excess

Trait Implementations§

Source§

impl Clone for Slate

Source§

fn clone(&self) -> Slate

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Slate

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Slate

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&Slate> for Option<Vec<CommitsV4>>

Source§

fn from(slate: &Slate) -> Self

Converts to this type from the input type.
Source§

impl From<&Slate> for SlateV4

Source§

fn from(slate: &Slate) -> SlateV4

Converts to this type from the input type.
Source§

impl From<Slate> for SlateV4

Source§

fn from(slate: Slate) -> SlateV4

Converts to this type from the input type.
Source§

impl From<SlateV4> for Slate

Source§

fn from(slate: SlateV4) -> Slate

Converts to this type from the input type.
Source§

impl From<VersionedSlate> for Slate

Source§

fn from(slate: VersionedSlate) -> Slate

Converts to this type from the input type.
Source§

impl Serialize for Slate

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Slate

§

impl RefUnwindSafe for Slate

§

impl Send for Slate

§

impl Sync for Slate

§

impl Unpin for Slate

§

impl UnwindSafe for Slate

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<T> CloneAny for T
where T: Any + Clone + Send + Sync,

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<'a, T> DefaultFeatures<'a> for T
where T: 'a + Send + Sync + Clone,

Source§

fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a>>

Clone this value, and then immediately put it into a Box behind a trait object of this trait.
Source§

fn self_address_mut(&mut self) -> *mut ()

Returns the address of self. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<'a, T> NonSyncFeatures<'a> for T
where T: 'a + Clone,

Source§

fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a>>

Clone this value, and then immediately put it into a Box behind a trait object of this trait.
Source§

fn self_address_mut(&mut self) -> *mut ()

Returns the address of self. Read more
Source§

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

Source§

fn borrow_replacement(ptr: &T) -> &T

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> DebugAny for T
where T: Any + Debug,

Source§

impl<T> UnsafeAny for T
where T: Any,