Overview
Swig Actions define permissions and spending limits for authorities in the Swig wallet system. Actions are composed using a builder pattern starting withActions.set() and ending with .get().
Action Categories
1. Root/Management Actions
all()
Grants unlimited permissions for all operations.
Inputs: NoneOutput:
Actions instance
Usage:
- Unlimited SOL and token spending
- Access to all programs
- Authority management
- All other operations
manageAuthority()
Grants permission to manage authorities (add/remove authorities).
Inputs: NoneOutput:
Actions instance
Usage:
- Add new authorities
- Remove existing authorities
allButManageAuthority()
Grants all permissions except authority management.
Inputs: NoneOutput:
Actions instance
Usage:
- Unlimited SOL and token spending
- Access to all programs
- All operations except authority management
2. Program Actions
programLimit(payload)
Grants permission to interact with a specific program.
Inputs:
payload.programId: SolPublicKeyData- The program ID to allow access to
Actions instance
Usage:
- Execute transactions with the specified program
programAll()
Grants permission to interact with all programs.
Inputs: NoneOutput:
Actions instance
Usage:
- Execute transactions with any program
programCurated()
Grants permission to interact with curated/whitelisted programs.
Inputs: NoneOutput:
Actions instance
Usage:
- Execute transactions with approved/curated programs
programScopeBasic(payload)
Basic program scope with specific target account.
Inputs:
payload.programId: SolPublicKeyData- Program IDpayload.targetAccount: SolPublicKeyData- Target account within the program
Actions instance
Usage:
- Access to specific program with targeted account interactions
programScopeLimit(payload)
Program scope with spending limits.
Inputs:
payload.programId: SolPublicKeyData- Program IDpayload.targetAccount: SolPublicKeyData- Target accountpayload.amount: bigint- Maximum spendable amountpayload.numericType: NumericType- Numeric type (U8, U32, U64, U128)
Actions instance
Usage:
- Limited access to specific program with amount restrictions
programScopeRecurringLimit(payload)
Program scope with recurring spending limits.
Inputs:
payload.programId: SolPublicKeyData- Program IDpayload.targetAccount: SolPublicKeyData- Target accountpayload.amount: bigint- Recurring amount limitpayload.window: bigint- Time window in slots for limit resetpayload.numericType: NumericType- Numeric type (U8, U32, U64, U128)
Actions instance
Usage:
- Recurring limited access to specific program
3. SOL Spending Actions
solLimit(payload)
One-time SOL spending limit.
Inputs:
payload.amount: bigint- Maximum SOL amount to spend (in lamports)
Actions instance
Usage:
- Spend up to the specified amount of SOL once
For a scoped role that signs a System Program SOL transfer, combine this
spending limit with
.programLimit({ programId: SystemProgram.programId }).
SignV2 checks program access and the SOL spending limit independently.solRecurringLimit(payload)
Recurring SOL spending limit.
Inputs:
payload.recurringAmount: bigint- SOL amount per window (in lamports)payload.window: bigint- Time window in slots until reset
Actions instance
Usage:
- Spend up to the specified amount of SOL per time window
solDestinationLimit(payload)
One-time SOL spending to a specific destination.
Inputs:
payload.amount: bigint- SOL amount (in lamports)payload.destination: SolPublicKeyData- Destination public key
Actions instance
Usage:
- Send up to the specified SOL amount to the specified destination once
solRecurringDestinationLimit(payload)
Recurring SOL spending to a specific destination.
Inputs:
payload.recurringAmount: bigint- SOL amount per window (in lamports)payload.window: bigint- Time window in slots until resetpayload.destination: SolPublicKeyData- Destination public key
Actions instance
Usage:
- Send up to the specified SOL amount to the destination per time window
4. Token Spending Actions
tokenLimit(payload)
One-time token spending limit.
Inputs:
payload.mint: SolPublicKeyData- Token mint public keypayload.amount: bigint- Maximum token amount to spend
Actions instance
Usage:
- Spend up to the specified amount of the token once
tokenRecurringLimit(payload)
Recurring token spending limit.
Inputs:
payload.mint: SolPublicKeyData- Token mint public keypayload.recurringAmount: bigint- Token amount per windowpayload.window: bigint- Time window in slots until reset
Actions instance
Usage:
- Spend up to the specified token amount per time window
tokenDestinationLimit(payload)
One-time token spending to a specific destination.
Inputs:
payload.mint: SolPublicKeyData- Token mint public keypayload.amount: bigint- Token amountpayload.destination: SolPublicKeyData- Destination public key
Actions instance
Usage:
- Send up to the specified token amount to the destination once
tokenRecurringDestinationLimit(payload)
Recurring token spending to a specific destination.
Inputs:
payload.mint: SolPublicKeyData- Token mint public keypayload.recurringAmount: bigint- Token amount per windowpayload.window: bigint- Time window in slots until resetpayload.destination: SolPublicKeyData- Destination public key
Actions instance
Usage:
- Send up to the specified token amount to the destination per time window
5. Staking Actions
stakeAll()
Unlimited staking permissions.
Inputs: NoneOutput:
Actions instance
Usage:
- Unlimited staking operations
stakeLimit(payload)
One-time staking limit.
Inputs:
payload.amount: bigint- Maximum stake amount
Actions instance
Usage:
- Stake up to the specified amount once
stakeRecurringLimit(payload)
Recurring staking limit.
Inputs:
payload.recurringAmount: bigint- Stake amount per windowpayload.window: bigint- Time window in slots until reset
Actions instance
Usage:
- Stake up to the specified amount per time window
6. Account Management Actions
subAccount()
Grants permission to control a subaccount.
Inputs: NoneOutput:
Actions instance
Usage:
- Control and manage subaccount operations
Action Types Reference
SolPublicKeyData
A Solana public key in various formats:
- String (base58)
- Uint8Array (32 bytes)
- PublicKey object
NumericType
Enum defining numeric types:
Combining Actions
Actions can be chained together to create complex permission sets:Return Value: Actions Object
The.get() method returns an Actions object with the following methods:
Query Methods
count: number- Number of actionsbytes(): Uint8Array- Serialized action bytesisRoot(): boolean- Check if root action presentcanManageAuthority(): boolean- Check authority management permissioncanUseProgram(programId): boolean- Check program access permissionhasProgramAction(): boolean- Check if any program action exists
SOL Spending Methods
canSpendSol(amount?): boolean- Check SOL spending permissioncanSpendSolMax(): boolean- Check unlimited SOL spendingsolSpendLimit(): bigint | null- Get SOL spending limit (null = unlimited)solSpend(): SpendController- Get SOL spend controller
Token Spending Methods
canSpendToken(mint, amount?): boolean- Check token spending permissioncanSpendTokenMax(mint): boolean- Check unlimited token spendingtokenSpendLimit(mint): bigint | null- Get token spending limittokenSpend(mint): SpendController- Get token spend controller

