Be sure to use multisigCreateV2, rather than the deprecated multisigCreate
This instruction will create a Multisig account with the necessary fields. This instruction requires that both the creator of the multisig, and the createKey be signers.
Example
import*as multisig from"@sqds/multisig";import { Connection, Keypair } from"@solana/web3.js";// Defines permissions enumconst { Permission,Permissions } =multisig.types;asyncfunctionmain() {// Cluster Connection// Required argument if you use the .rpc methodconstconnection=newConnection("< your rpc here >");// Random Public Key that will be used to derive a multisig PDA// This will need to be a signer on the transactionconstcreateKey=Keypair.generate().publicKey;// Creator should be a Keypair or a Wallet Adapter walletconstcreator=Keypair.generate();// Derive the multisig PDAconst [multisigPda] =multisig.getMultisigPda({ createKey, });constprogramConfigPda=multisig.getProgramConfigPda({})[0];constprogramConfig=awaitmultisig.accounts.ProgramConfig.fromAccountAddress( connection, programConfigPda );constconfigTreasury=programConfig.treasury;constix=awaitmultisig.instructions.multisigCreateV2({// Must sign the transaction, unless the .rpc method is used. createKey:createKey.publicKey,// The creator & fee payer creator:creator.publicKey,// The PDA of the multisig you are creating, derived by a random PublicKey multisigPda,// Here the config authority will be the system program configAuthority:null,// Create without any time-lock timeLock:0,// List of the members to add to the multisig members: [{// Members Public Key key:creator.publicKey,// Granted Proposer, Voter, and Executor permissions permissions:Permissions.all(), }, { key:secondMember.publicKey,// Member can only add votes to proposed transactions permissions:Permissions.fromPermissions([Permission.Vote]), }, ],// This means that there needs to be 2 votes for a transaction proposal to be approved threshold:2,// This is for the program config treasury account treasury: configTreasury,// Rent reclaim account rentCollector:null });console.log("Multisig created: ", signature)}
Notes
Must specify permissions upfront for each member
Only specify a configAuthority if you want one admin key to be able to override all config
createKey must be a signer if using methods other than .rpc