|
| 1 | +# @jito-foundation/stake-deposit-interceptor-sdk |
| 2 | + |
| 3 | +A TypeScript SDK for interacting with Jito's stake deposit interceptor program on Solana. This program acts as the `stake_deposit_authority` for SPL stake pools, implementing a time-decaying fee mechanism on LST (Liquid Staking Token) deposits. |
| 4 | + |
| 5 | +More information available in the [Jito governance forum](https://forum.jito.network/t/jip-9-adopt-interceptor-liquidity-defense/444). |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +```bash |
| 10 | +npm install @jito-foundation/stake-deposit-interceptor-sdk |
| 11 | +# or |
| 12 | +yarn add @jito-foundation/stake-deposit-interceptor-sdk |
| 13 | +``` |
| 14 | + |
| 15 | +## Key Features |
| 16 | + |
| 17 | +- 🛡️ **Time-Decaying Fees**: Implements fees that linearly decay to zero over a configurable period |
| 18 | +- 🔐 **Stake Pool Integration**: Acts as stake deposit authority for SPL stake pools |
| 19 | +- 🎫 **Deposit Management**: Handles stake deposits with receipt tracking |
| 20 | +- 🤖 **Automated Claims**: Permissionless cranking system for fee-free claims after cooldown |
| 21 | +- 📝 **Type Safety**: Fully typed TypeScript SDK |
| 22 | + |
| 23 | +## Important Concepts |
| 24 | + |
| 25 | +### Deposit Flow |
| 26 | +1. User deposits stake using `depositStake()` or `depositStakeWithSlippage()` |
| 27 | +2. Stake begins earning rewards immediately |
| 28 | +3. LST tokens are minted and held by the program |
| 29 | +4. User can either: |
| 30 | + - Claim LST early with a fee |
| 31 | + - Wait for cooldown and claim fee-free (can be automated by cranker) |
| 32 | + |
| 33 | +### Slippage Protection |
| 34 | +`depositStakeWithSlippage()` allows setting a minimum LST output to protect against unfavorable rate changes during transaction processing. |
| 35 | + |
| 36 | +## Program Accounts |
| 37 | + |
| 38 | +### StakePoolDepositStakeAuthority |
| 39 | +The main control account for the stake pool's deposit authority: |
| 40 | +```typescript |
| 41 | +interface StakePoolDepositStakeAuthority { |
| 42 | + base: PublicKey; |
| 43 | + stakePool: PublicKey; |
| 44 | + poolMint: PublicKey; |
| 45 | + authority: PublicKey; |
| 46 | + vault: PublicKey; |
| 47 | + stakePoolProgramId: PublicKey; |
| 48 | + coolDownSeconds: BN; |
| 49 | + initialFeeBps: number; |
| 50 | + feeWallet: PublicKey; |
| 51 | + bumpSeed: number; |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +### DepositReceipt |
| 56 | +Tracks individual stake deposits and their associated parameters: |
| 57 | +```typescript |
| 58 | +interface DepositReceipt { |
| 59 | + base: PublicKey; |
| 60 | + owner: PublicKey; |
| 61 | + stakePool: PublicKey; |
| 62 | + stakePoolDepositStakeAuthority: PublicKey; |
| 63 | + depositTime: BN; |
| 64 | + lstAmount: BN; |
| 65 | + coolDownSeconds: BN; |
| 66 | + initialFeeBps: number; |
| 67 | + bumpSeed: number; |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +## Instructions |
| 72 | + |
| 73 | +### Stake Operations |
| 74 | +- `depositStake()`: Deposit stake into the pool, creating a deposit receipt |
| 75 | +- `depositStakeWithSlippage()`: Deposit stake with added slippage protection |
| 76 | +- `claimPoolTokens()`: Claim LST tokens (with fees if before cooldown) |
| 77 | + |
| 78 | +### Authority Management |
| 79 | +- `initStakePoolDepositStakeAuthority()`: Initialize the deposit authority for a stake pool |
| 80 | +- `updateStakePoolDepositStakeAuthority()`: Update authority parameters |
| 81 | + |
| 82 | +### Receipt Management |
| 83 | +- `updateOwner()`: Transfer deposit receipt ownership to a new address |
| 84 | + |
| 85 | +## License |
| 86 | + |
| 87 | +MIT |
| 88 | + |
| 89 | +## Support |
| 90 | + |
| 91 | +For more information and support: |
| 92 | +- Governance Forum: [Jito Forum](https://forum.jito.network/t/jip-9-adopt-interceptor-liquidity-defense/444) |
| 93 | +- Issues: [GitHub Repository Issues] |
0 commit comments