Skip to content
A fixed delegation lets a user approve another wallet or service to pull up to a fixed token amount. Each successful transfer reduces the remaining allowance. Use expiryTs = 0 for no expiry. This guide keeps the flow visible. Each snippet uses the SDK functions directly so you can see which account is derived, which instruction is sent, and which signer pays or authorizes each step. To run these snippets on a local network, first set up a local environment.

​Install

@solana/subscriptions 0.5.0 declares a peer dependency on @solana/kit 7, so the install commands pin the matching @solana/kit, plugin and token program versions. Installing the latest of each pulls in @solana/kit 8 and fails with ERESOLVE under npm.

​Create The Delegation

The setup has four parts:
  1. Create a client with the user signer and subscriptions plugin.
  2. Derive the user’s token account and Subscription Authority PDA.
  3. Initialize the Subscription Authority if it does not exist yet.
  4. Create the fixed delegation and derive its PDA for later transfers.

​Transfer From The Delegation

The delegatee signs the transfer. The SDK needs the same delegation PDA, the user’s token account, and the receiver token account.

​Revoke The Delegation

The delegator can revoke the delegation at any time. Revoking closes the delegation PDA and returns its rent to the signer.

​Notes

  • The user’s token account must exist before initialization.
  • Amounts are in base units. For a 6-decimal token, 1_000_000 means 1 token.
  • Run initSubscriptionAuthority only when the Subscription Authority account does not already exist.
  • expiryTs is a hard stop: once it passes, transfers fail and the sponsor can recover rent. There is no spend-time grace period.
  • The user signs setup and revoke transactions. The delegatee signs transfers.