BoardBuilder

Struct BoardBuilder 

Source
pub struct BoardBuilder<S: BuilderState> {
    pub user_pubkey: PublicKey,
    pub expiry_height: BlockHeight,
    pub server_pubkey: PublicKey,
    pub exit_delta: BlockDelta,
    /* private fields */
}
Expand description

A request for the server to cosign an board vtxo.

An object of this type is created by the user, sent to the server who will cosign the request and return his partial signature (along with public nonce) back to the user so that the user can finish the request and create a Vtxo.

Currently you can only create VTXOs with VtxoPolicy::Pubkey.

Fields§

§user_pubkey: PublicKey§expiry_height: BlockHeight§server_pubkey: PublicKey§exit_delta: BlockDelta

Implementations§

Source§

impl<S: BuilderState> BoardBuilder<S>

Source

pub fn funding_script_pubkey(&self) -> ScriptBuf

The scriptPubkey to send the board funds to.

Source§

impl BoardBuilder<Preparing>

Source

pub fn new( user_pubkey: PublicKey, expiry_height: BlockHeight, server_pubkey: PublicKey, exit_delta: BlockDelta, ) -> BoardBuilder<Preparing>

Create a new builder to construct a board vtxo.

See module-level documentation for an overview of the board flow.

Source

pub fn set_funding_details( self, amount: Amount, utxo: OutPoint, ) -> BoardBuilder<CanGenerateNonces>

Set the UTXO where the board will be funded and the board amount.

Source§

impl BoardBuilder<CanGenerateNonces>

Source

pub fn generate_user_nonces(self) -> BoardBuilder<CanFinish>

Generate user nonces.

Source§

impl<S: CanSign> BoardBuilder<S>

Source§

impl BoardBuilder<ServerCanCosign>

Source

pub fn new_for_cosign( user_pubkey: PublicKey, expiry_height: BlockHeight, server_pubkey: PublicKey, exit_delta: BlockDelta, amount: Amount, utxo: OutPoint, user_pub_nonce: PublicNonce, ) -> BoardBuilder<ServerCanCosign>

This constructor is to be used by the server with the information provided by the user.

Source

pub fn server_cosign(&self, key: &Keypair) -> BoardCosignResponse

This method is used by the server to cosign the board request.

Returns None if utxo or user_pub_nonce field is not provided.

Source§

impl BoardBuilder<CanFinish>

Source

pub fn verify_cosign_response( &self, server_cosign: &BoardCosignResponse, ) -> bool

Validate the server’s partial signature.

Source

pub fn build_vtxo( self, server_cosign: &BoardCosignResponse, user_key: &Keypair, ) -> Result<Vtxo, IncorrectSigningKeyError>

Finishes the board request and create a vtxo.

Trait Implementations§

Source§

impl<S: Debug + BuilderState> Debug for BoardBuilder<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for BoardBuilder<S>

§

impl<S> RefUnwindSafe for BoardBuilder<S>
where S: RefUnwindSafe,

§

impl<S> Send for BoardBuilder<S>
where S: Send,

§

impl<S> Sync for BoardBuilder<S>
where S: Sync,

§

impl<S> Unpin for BoardBuilder<S>
where S: Unpin,

§

impl<S> UnwindSafe for BoardBuilder<S>
where S: UnwindSafe,

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> 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<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