Struct grin_wallet_libwallet::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
sourceimpl Slate
impl Slate
sourcepub fn tx_or_err(&self) -> Result<&Transaction, Error>
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
sourcepub fn tx_or_err_mut(&mut self) -> Result<&mut Transaction, Error>
pub fn tx_or_err_mut(&mut self) -> Result<&mut Transaction, Error>
As above, but return mutable reference
sourcepub fn num_participants(&self) -> u8
pub fn num_participants(&self) -> u8
number of participants
sourcepub fn deserialize_upgrade(slate_json: &str) -> Result<Slate, Error>
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
sourcepub fn compact(&mut self) -> Result<(), Error>
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
sourcepub fn empty_transaction() -> Transaction
pub fn empty_transaction() -> Transaction
Build a new empty transaction. Wallet currently only supports tx with “features and commit” inputs.
sourcepub fn remove_other_sigdata<K>(
&mut self,
keychain: &K,
sec_nonce: &SecretKey,
sec_key: &SecretKey
) -> Result<(), Error> where
K: Keychain,
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
sourcepub 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,
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
sourcepub fn update_kernel(&mut self) -> Result<(), Error>
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.
sourcepub fn fill_round_1<K>(
&mut self,
keychain: &K,
context: &mut Context
) -> Result<(), Error> where
K: Keychain,
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
sourcepub fn msg_to_sign(&self) -> Result<Message, Error>
pub fn msg_to_sign(&self) -> Result<Message, Error>
This is the msg that we will sign as part of the tx kernel.
sourcepub fn fill_round_2<K>(
&mut self,
keychain: &K,
sec_key: &SecretKey,
sec_nonce: &SecretKey
) -> Result<(), Error> where
K: Keychain,
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
sourcepub fn finalize<K>(&mut self, keychain: &K) -> Result<(), Error> where
K: Keychain,
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)
sourcepub fn pub_nonce_sum(&self, secp: &Secp256k1) -> Result<PublicKey, Error>
pub fn pub_nonce_sum(&self, secp: &Secp256k1) -> Result<PublicKey, Error>
Return the sum of public nonces
sourcepub fn pub_blind_sum(&self, secp: &Secp256k1) -> Result<PublicKey, Error>
pub fn pub_blind_sum(&self, secp: &Secp256k1) -> Result<PublicKey, Error>
Return the sum of public blinding factors
sourcepub fn add_participant_info<K>(
&mut self,
keychain: &K,
context: &Context,
part_sig: Option<Signature>
) -> Result<(), Error> where
K: Keychain,
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)
sourcepub fn adjust_offset<K: Keychain>(
&mut self,
keychain: &K,
context: &Context
) -> Result<(), Error>
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
sourcepub fn calc_excess(&self, secp: &Secp256k1) -> Result<Commitment, Error>
pub fn calc_excess(&self, secp: &Secp256k1) -> Result<Commitment, Error>
Calculate the excess
Trait Implementations
sourceimpl From<VersionedSlate> for Slate
impl From<VersionedSlate> for Slate
sourcefn from(slate: VersionedSlate) -> Slate
fn from(slate: VersionedSlate) -> Slate
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for Slate
impl Send for Slate
impl Sync for Slate
impl Unpin for Slate
impl UnwindSafe for Slate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> CloneAny for T where
T: Any + Clone,
impl<T> CloneAny for T where
T: Any + Clone,
fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>
fn clone_any_send(&self) -> Box<dyn CloneAny + Send + 'static, Global> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync + 'static, Global> where
T: Sync,
fn clone_any_send_sync(
&self
) -> Box<dyn CloneAny + Sync + Send + 'static, Global> where
T: Send + Sync,
impl<'a, T> DefaultFeatures<'a> for T where
T: 'a + Send + Sync + Clone,
impl<'a, T> DefaultFeatures<'a> for T where
T: 'a + Send + Sync + Clone,
fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a, Global>
fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a, Global>
Clone this value, and then immediately put it into a Box
behind a trait object of this trait. Read more
fn self_address_mut(&mut self) -> *mut ()
fn self_address_mut(&mut self) -> *mut ()
Returns the address of self
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<'a, T> NonSyncFeatures<'a> for T where
T: 'a + Clone,
impl<'a, T> NonSyncFeatures<'a> for T where
T: 'a + Clone,
fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a, Global>
fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a, Global>
Clone this value, and then immediately put it into a Box
behind a trait object of this trait. Read more
fn self_address_mut(&mut self) -> *mut ()
fn self_address_mut(&mut self) -> *mut ()
Returns the address of self
. Read more
impl<T> SafeBorrow<T> for T where
T: ?Sized,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more