Skip to main content

InitializeMultisig

Struct InitializeMultisig 

Source
pub struct InitializeMultisig<'account, 'multisig, MultisigSigner: AsRef<AccountView>>
where 'account: 'multisig,
{ pub multisig: &'account AccountView, pub rent_sysvar: &'account AccountView, pub multisig_signers: &'multisig [MultisigSigner], pub m: u8, }
Expand description

Initializes a multisignature account with N provided signers.

Multisignature accounts can used in place of any single owner/delegate accounts in any token instruction that require an owner/delegate to be present. The variant field represents the number of signers (M) required to validate this multisignature account.

The super::InitializeMultisig instruction requires no signers and MUST be included within the same Transaction as the system program’s CreateAccount instruction that creates the account being initialized. Otherwise another party can acquire ownership of the uninitialized account.

Accounts expected by this instruction:

  1. [writable] The multisignature account to initialize.
  2. [] Rent sysvar.
  3. ..+N [signer] The signer accounts, must equal to N where 1 <= N <= 11.

Fields§

§multisig: &'account AccountView

The multisignature account to initialize.

§rent_sysvar: &'account AccountView

Rent sysvar.

§multisig_signers: &'multisig [MultisigSigner]

The signer accounts.

§m: u8

The number of signers (M) required to validate this multisignature account.

Implementations§

Source§

impl<'account, 'multisig, MultisigSigner: AsRef<AccountView>> InitializeMultisig<'account, 'multisig, MultisigSigner>
where 'account: 'multisig,

Source

pub const DISCRIMINATOR: u8 = 2

Source

pub const MAX_ACCOUNTS_LEN: usize

Maximum number of accounts expected by this instruction.

The required number of accounts will depend whether the source account has a single owner or a multisignature owner.

Source

pub const DATA_LEN: usize = 2

Instruction data length:

  • discriminator (1 byte)
  • number of signers (1 byte)
Source

pub fn new( multisig: &'account AccountView, rent_sysvar: &'account AccountView, multisig_signers: &'multisig [MultisigSigner], m: u8, ) -> Self

Source

pub fn invoke(&self) -> ProgramResult

Trait Implementations§

Source§

impl<MultisigSigner: AsRef<AccountView>> CpiWriter for InitializeMultisig<'_, '_, MultisigSigner>

Source§

fn write_accounts<'cpi>( &self, accounts: &mut [MaybeUninit<CpiAccount<'cpi>>], ) -> Result<usize, ProgramError>
where Self: 'cpi,

Writes the AccountViews required by this instruction into the provided slice. Read more
Source§

fn write_instruction_accounts<'cpi>( &self, accounts: &mut [MaybeUninit<InstructionAccount<'cpi>>], ) -> Result<usize, ProgramError>
where Self: 'cpi,

Writes the InstructionAccounts required by this instruction into the provided slice. Read more
Source§

fn write_instruction_data( &self, data: &mut [MaybeUninit<u8>], ) -> Result<usize, ProgramError>

Writes the instruction data for this instruction into the provided slice. Read more
Source§

impl<MultisigSigner: AsRef<AccountView>> IntoBatch for InitializeMultisig<'_, '_, MultisigSigner>

Source§

fn into_batch<'account, 'state>( self, batch: &mut Batch<'account, 'state>, ) -> ProgramResult
where Self: 'account + 'state,

Serializes self into the provided batch.

Auto Trait Implementations§

§

impl<'account, 'multisig, MultisigSigner> Freeze for InitializeMultisig<'account, 'multisig, MultisigSigner>

§

impl<'account, 'multisig, MultisigSigner> RefUnwindSafe for InitializeMultisig<'account, 'multisig, MultisigSigner>
where MultisigSigner: RefUnwindSafe,

§

impl<'account, 'multisig, MultisigSigner> !Send for InitializeMultisig<'account, 'multisig, MultisigSigner>

§

impl<'account, 'multisig, MultisigSigner> !Sync for InitializeMultisig<'account, 'multisig, MultisigSigner>

§

impl<'account, 'multisig, MultisigSigner> Unpin for InitializeMultisig<'account, 'multisig, MultisigSigner>

§

impl<'account, 'multisig, MultisigSigner> UnsafeUnpin for InitializeMultisig<'account, 'multisig, MultisigSigner>

§

impl<'account, 'multisig, MultisigSigner> UnwindSafe for InitializeMultisig<'account, 'multisig, MultisigSigner>
where MultisigSigner: RefUnwindSafe,

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.