- sessions let a role delegate execution temporarily
- sub-accounts carve out a separate balance and signer path for a role
How sessions work
CreateSessionV1 is the session bootstrap instruction.
It:
- loads a role by
role_id - checks that the role’s authority type supports sessions
- authenticates the normal authority path
- stores a session key and expiration window
Which authorities support sessions
The protocol has session-capable variants for:- Ed25519
- Secp256k1
- Secp256r1
- ProgramExec
When to use sessions
Use sessions when you want:- temporary delegated signing
- shorter-lived credentials
- reduced need to re-present the base authority on every action
How sub-accounts work
Sub-accounts are tied to a role. The key rule is thatAll alone is not enough
to create one. The role must carry a SubAccount action.
CreateSubAccountV1:
- authenticates the acting role
- requires a
SubAccountaction - derives the sub-account PDA from
swig_idandrole_id - stores the created sub-account metadata back into the
SubAccountaction
Sub-account execution flow
Once a sub-account exists:SubAccountSignV1executes with the sub-account PDA as signerWithdrawFromSubAccountV1moves assets back outToggleSubAccountV1enables or disables the sub-account
- the parent Swig ID
- the owning
role_id - the expected sub-account public key
- the enabled state
When to use sub-accounts
Use sub-accounts when you want:- a separate balance bucket for a role
- delegated execution that should not spend directly from the main wallet path
- the ability to disable a role’s balance bucket without changing the whole wallet
Common integration mistake
Do not treat a sub-account as an unrelated external account. It is still part of the parent wallet’s role model, and its validity depends on the storedSubAccount action metadata.
