Skip to main content
The SwigInstructionBuilder is a fundamental component of the Swig SDK that handles the creation and management of Solana instructions for the Swig protocol.

Overview

The instruction builder provides low-level functionality for creating various types of instructions needed to interact with Swig wallets on the Solana blockchain.

Core Components

AuthorityManager

The AuthorityManager enum represents different types of signing authorities supported by the Swig protocol.

SwigInstructionBuilder

Core Functions

Creating a New Instance

Creates a new instance of the instruction builder with the specified parameters.

Building a Swig Account

Creates an instruction to initialize a new Swig account on-chain.

Signing Instructions

Creates signed instructions for the provided transaction instructions.

Authority Management

Adding Authorities

Creates an instruction to add a new authority with specified permissions.

Removing Authorities

Creates an instruction to remove an existing authority.

Replacing Authorities

Creates instructions to replace an existing authority with a new one.

Session Management

Creating Sessions

Creates an instruction to create a new session for temporary authority delegation.

Utility Functions

Getting the Swig Account

Returns the public key of the Swig account.

Getting the Role ID

Returns the current role ID of the Swig account.

Switching Authority

Switches the current authority and role ID.

Examples

Creating a New Swig Account

Adding a New Authority