Disclaimer: This function can only be used by controlled multisigs, meaning the multisig has a config authority.
If you have an autonomous multisig, you should create a Config Transaction.
Typescript
import*as multisig from"@sqds/multisig";// Cluster Connectionconstconnection=newConnection( < yourrpcurl > );// Fee payer is the a signer that pays the transaction feesconstfeePayer=Keypair.generate();// Derive the multisig PDAconstmultisigPda=multisig.getMultisigPda({// The createKey has to be a Public Key, see accounts reference for more info createKey,})[0];// Public Key of the new memberconstmember=newPublicKey("");awaitmultisig.rpc.multisigAddMember({ connection, feePayer,// The public key of the multisig account multisigPda,// Specify the config authority Public Key if there is one, else set to null configAuthority:null,// Account paying for the rent of the additional account space needed by adding a member rentPayer: feePayer, newMember: {// Public Key of the new member to be added key:members.almighty.publicKey,// Permissions that the new member will have, check the reference for more info permissions:Permissions.all(), },});