Skip to main content
The SwigWallet is an abstraction for interacting with Swig wallets on chain. It provides a user-friendly interface for managing wallets, authorities, and transactions.

Overview

The Wallet SDK builds upon the instruction builder to provide comprehensive Swig wallet management. It handles RPC communication, transaction building, and wallet state management.

Core Components

SwigWallet Structure

Core Functions

Creating a New Wallet

Creates a new Swig wallet or initializes an existing one.

Authority Management

Adding Authorities

Adds a new authority to the wallet with specified permissions.

Removing Authorities

Removes an existing authority from the wallet.

Replacing Authorities

Replaces an existing authority with a new one.

Transaction Management

Signing Transactions

Signs and sends a transaction containing the provided instructions.

Session Management

Creating Sessions

Creates a new session for temporary authority delegation.

Wallet Information

Displaying Wallet Details

Displays detailed information about the wallet, including:
  • Account address
  • Total roles
  • Balance
  • Authority details
  • Permissions

Getting Wallet Balance

Returns the SOL balance of the Swig account.

Getting Authority Permissions

Retrieves the current authority’s permissions from the Swig account.

Utility Functions

Switching Authority

Switches to a different authority for the wallet.

Switching Fee Payer

Updates the fee payer for the wallet.

Examples

Creating a New Wallet

Adding an Authority with Permissions

Creating a Session

Signing a Transaction