algokit_transact::multisig

Struct MultisigSignature

Source
pub struct MultisigSignature {
    pub version: u8,
    pub threshold: u8,
    pub subsignatures: Vec<MultisigSubsignature>,
}
Expand description

Represents an Algorand multisignature signature.

A multisignature signature is defined by a version, a threshold, and a list of participating addresses. The version indicates the multisig protocol version, while the threshold specifies the minimum number of signatures required to authorize a transaction. While technically this accepts Address types, it is expected that these will be the addresses of Ed25519 public keys.

Fields§

§version: u8

Multisig version.

§threshold: u8

Minimum number of signatures required.

§subsignatures: Vec<MultisigSubsignature>

Sub-signatures

Implementations§

Source§

impl MultisigSignature

Source

pub fn from_participants( version: u8, threshold: u8, participants: Vec<Address>, ) -> Result<Self, AlgoKitTransactError>

Creates a new multisignature signature with the specified version, threshold, and participants.

§Errors

Returns [InvalidMultisigSignature] if:

  • version is zero,
  • participants is empty,
  • threshold is zero or greater than the number of participants.
Source

pub fn new( version: u8, threshold: u8, subsignatures: Vec<MultisigSubsignature>, ) -> Result<Self, AlgoKitTransactError>

Creates a new multisignature signature from a vector of subsignatures.

§Errors

Returns AlgoKitTransactError::InvalidMultisigSignature if:

  • version is zero,
  • subsignatures is empty,
  • threshold is zero or greater than the number of subsignatures.
Source

pub fn participants(&self) -> Vec<Address>

Returns the list of participant addresses in this multisignature.

Source

pub fn apply_subsignature( &self, address: Address, subsignature: [u8; 64], ) -> Result<Self, AlgoKitTransactError>

Applies a subsignature for the given address, replacing all existing signatures for that address.

Typically, an address appears in a multisignature only once which means that only one signature for a given address should be in the list of subsignatures. However, there’s a construction of “weighted” multisignatures where the same address can appear multiple times. The node checks these subsignatures agnostic to the fact that the same address might be repeated. This allows a user to effectively give a weight to a particular address. For this reason, the code is structured to apply the signature to all the instances of address.

Since ed25519 signatures are deterministic, there’s only one valid signature for a given message and public key, which also means it’s OK to apply the same signature multiple times.

§Disclaimer

This method will overwrite any existing signature for the given address.

§Errors

Returns AlgoKitTransactError::InvalidMultisigSignature if the address is not found among the participants.

Source

pub fn merge(&self, other: &Self) -> Result<Self, AlgoKitTransactError>

Merges another multisignature into this one, replacing existing signatures with those from other where present.

§Disclaimer

For each participant, the resulting signature will be taken from other if present, otherwise from self. This operation does not combine signatures; it replaces them.

§Errors

Returns AlgoKitTransactError::InvalidMultisigSignature if the version, threshold, or participants differ.

Trait Implementations§

Source§

impl Clone for MultisigSignature

Source§

fn clone(&self) -> MultisigSignature

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 MultisigSignature

Source§

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

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

impl<'de> Deserialize<'de> for MultisigSignature

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for MultisigSignature

Source§

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

Formats the MultisigSignature as a base32-encoded Algorand address string.

This uses the derived address from the multisig parameters and participants.

Source§

impl From<MultisigSignature> for Address

Source§

fn from(multisig: MultisigSignature) -> Address

Converts a MultisigSignature into an Address by hashing the domain separator, version, threshold, and all participating addresses.

Source§

impl PartialEq for MultisigSignature

Source§

fn eq(&self, other: &MultisigSignature) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MultisigSignature

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

impl StructuralPartialEq for MultisigSignature

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<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,