pub struct MultisigWallet {
pub signers: HashMap<String, bool>,
pub threshold: usize,
pub signed_count: usize,
}
Fields§
§signers: HashMap<String, bool>
§threshold: usize
§signed_count: usize
Implementations§
Source§impl MultisigWallet
impl MultisigWallet
Sourcepub fn sign(
&mut self,
signer: &String,
signature: &str,
) -> Result<(), &'static str>
pub fn sign( &mut self, signer: &String, signature: &str, ) -> Result<(), &'static str>
Adds a signature to the wallet if the signer is valid and the signature is verified.
§Arguments
signer
- The signer’s address.signature
- The cryptographic signature of the signer.
§Returns
Ok(())
if the signature is successfully added.Err
if the signature is invalid or the signer has already signed.
Sourcepub fn add_signer(&mut self, signer: String)
pub fn add_signer(&mut self, signer: String)
Sourcepub fn remove_signer(&mut self, signer: &String)
pub fn remove_signer(&mut self, signer: &String)
Removes a signer from the wallet and updates the signature count if necessary.
§Arguments
signer
- The signer’s address to be removed.
Sourcepub fn collect_signatures(&self) -> bool
pub fn collect_signatures(&self) -> bool
Checks if the number of valid signatures meets or exceeds the threshold.
§Returns
true
if the required number of signatures is met.
Auto Trait Implementations§
impl Freeze for MultisigWallet
impl RefUnwindSafe for MultisigWallet
impl Send for MultisigWallet
impl Sync for MultisigWallet
impl Unpin for MultisigWallet
impl UnwindSafe for MultisigWallet
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
Mutably borrows from an owned value. Read more