@sqds/multisig
TypeScript icon, indicating that this package has built-in type declarations

2.1.3 • Public • Published

@sqds/multisig

This is the package for the Squads v4 Typescript SDK.

DocsNPM

Installation

Add the SDK to your project with npm:

npm i @sqds/multisig

or yarn:

yarn add @sqds/multisig

Get Started

First, get the multisig account address:

import * as multisig from "@sqds/multisig";

const {
    Multisig
} = multisig.accounts;

const [multisigPda] = multisig.getMultisigPda({
    createKey,
});

/// or define it directly
const multisigPda = new PublicKey("<multisig key>");

Then get the multisig account info:

const multisigAccount = await Multisig.fromAccountAddress(
    connection,
    multisigPda
);
// Log out the multisig's members
console.log("Members", multisigAccount.members);

Once you fetch your multisig, fetch the vault account:

const [vaultPda] = multisig.getVaultPda({
    multisigPda,
    index: 0,
});

From here, you can create your first vault transaction:

const transactionIndex = 1n;

const transferInstruction = SystemProgram.transfer(
    // The transfer is being signed from the Squads Vault, that is why we use the VaultPda
    vaultPda,
    to.publicKey,
    1 * LAMPORTS_PER_SOL
);

// Here we are adding all the instructions that we want to be executed in our transaction
const testTransferMessage = new TransactionMessage({
    payerKey: vaultPda,
    recentBlockhash: (await connection.getLatestBlockhash()).blockhash,
    instructions: [transferInstruction],
});

await multisig.rpc.vaultTransactionCreate({
    connection,
    feePayer,
    multisigPda,
    transactionIndex,
    creator: feePayer.publicKey,
    vaultIndex: 0,
    ephemeralSigners: 0,
    transactionMessage: testTransferMessage,
});

Check our documentation for more information on instruction types and ancillary features.

Readme

Keywords

none

Package Sidebar

Install

npm i @sqds/multisig

Weekly Downloads

1,069

Version

2.1.3

License

MIT

Unpacked Size

12.6 MB

Total Files

928

Last publish

Collaborators

  • basedorion
  • valentinmadrid
  • vovacodes
  • bastien_squads
  • ogmedia