Create Multisig
Typescript
import * as multisig from "@sqds/multisig";
// Cluster Connection
const connection = new Connection( < your connection here > );
// Random Public Key that will be used to derive a multisig PDA
const createKey = Keypair.generate().publicKey;
// Creator should be a Keypair or a Wallet Adapter wallet
const creator = Keypair.generate();
// Derive the multisig PDA
const multisigPda = multisig.getMultisigPda({
// The createKey has to be a Public Key, see accounts reference for more info
createKey,
})[0];
await multisig.rpc.multisigCreate({
connection,
// One time random Key
createKey,
// The creator & fee payer
creator,
// 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,
// Members permissions inside the multisig
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,
});
console.log("Multisig created: ", signature);
Last updated