@reflectmoney/stable.ts 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -7
- package/dist/classes/PdaClient.d.ts +112 -0
- package/dist/classes/PdaClient.js +112 -0
- package/dist/classes/ReflectAdmin.d.ts +87 -2
- package/dist/classes/ReflectAdmin.js +84 -1
- package/dist/classes/ReflectTokenisedBond.d.ts +57 -0
- package/dist/classes/ReflectTokenisedBond.js +56 -0
- package/dist/classes/Stablecoin.d.ts +139 -1
- package/dist/classes/Stablecoin.js +83 -1
- package/dist/stablecoins/LstStablecoin.d.ts +47 -0
- package/dist/stablecoins/LstStablecoin.js +46 -0
- package/package.json +1 -1
- package/dist/classes/Strategy.d.ts +0 -30
- package/dist/classes/Strategy.js +0 -196
- package/dist/generated/accounts/DriftJlpController.d.ts +0 -114
- package/dist/generated/accounts/DriftJlpController.js +0 -169
- package/dist/generated/accounts/DriftLstController.d.ts +0 -108
- package/dist/generated/accounts/DriftLstController.js +0 -165
- package/dist/generated/accounts/DriftUsdcController.d.ts +0 -102
- package/dist/generated/accounts/DriftUsdcController.js +0 -158
- package/dist/generated/accounts/Main.d.ts +0 -110
- package/dist/generated/accounts/Main.js +0 -165
- package/dist/generated/accounts/PerpMarket.d.ts +0 -226
- package/dist/generated/accounts/PerpMarket.js +0 -307
- package/dist/generated/accounts/PrelaunchOracle.d.ts +0 -130
- package/dist/generated/accounts/PrelaunchOracle.js +0 -224
- package/dist/generated/accounts/PythLazerOracle.d.ts +0 -124
- package/dist/generated/accounts/PythLazerOracle.js +0 -210
- package/dist/generated/accounts/RebalanceLst.d.ts +0 -111
- package/dist/generated/accounts/RebalanceLst.js +0 -175
- package/dist/generated/accounts/SpotMarket.d.ts +0 -377
- package/dist/generated/accounts/SpotMarket.js +0 -601
- package/dist/generated/accounts/User.d.ts +0 -221
- package/dist/generated/accounts/User.js +0 -331
- package/dist/generated/accounts/UserPermissions.d.ts +0 -106
- package/dist/generated/accounts/UserPermissions.js +0 -161
- package/dist/generated/accounts/UserStats.d.ts +0 -211
- package/dist/generated/accounts/UserStats.js +0 -323
- package/dist/generated/accounts/index.d.ts +0 -38
- package/dist/generated/accounts/index.js +0 -55
- package/dist/generated/errors/index.d.ts +0 -1024
- package/dist/generated/errors/index.js +0 -1761
- package/dist/generated/index.d.ts +0 -19
- package/dist/generated/index.js +0 -36
- package/dist/generated/instructions/addLstDrift.d.ts +0 -49
- package/dist/generated/instructions/addLstDrift.js +0 -106
- package/dist/generated/instructions/addSubAccount.d.ts +0 -54
- package/dist/generated/instructions/addSubAccount.js +0 -121
- package/dist/generated/instructions/adjustHedgeS2.d.ts +0 -69
- package/dist/generated/instructions/adjustHedgeS2.js +0 -157
- package/dist/generated/instructions/captureSpreadDrift.d.ts +0 -56
- package/dist/generated/instructions/captureSpreadDrift.js +0 -120
- package/dist/generated/instructions/createAdminAccount.d.ts +0 -53
- package/dist/generated/instructions/createAdminAccount.js +0 -95
- package/dist/generated/instructions/createUserStatsAccount.d.ts +0 -54
- package/dist/generated/instructions/createUserStatsAccount.js +0 -121
- package/dist/generated/instructions/depositDrift.d.ts +0 -73
- package/dist/generated/instructions/depositDrift.js +0 -142
- package/dist/generated/instructions/freezeProgram.d.ts +0 -54
- package/dist/generated/instructions/freezeProgram.js +0 -95
- package/dist/generated/instructions/freezeProtocolAction.d.ts +0 -55
- package/dist/generated/instructions/freezeProtocolAction.js +0 -96
- package/dist/generated/instructions/freezeStrategyAction.d.ts +0 -58
- package/dist/generated/instructions/freezeStrategyAction.js +0 -102
- package/dist/generated/instructions/index.d.ts +0 -41
- package/dist/generated/instructions/index.js +0 -57
- package/dist/generated/instructions/initDriftAccountsS1.d.ts +0 -56
- package/dist/generated/instructions/initDriftAccountsS1.js +0 -126
- package/dist/generated/instructions/initDriftControllerS1.d.ts +0 -60
- package/dist/generated/instructions/initDriftControllerS1.js +0 -108
- package/dist/generated/instructions/initDriftControllerS2.d.ts +0 -66
- package/dist/generated/instructions/initDriftControllerS2.js +0 -125
- package/dist/generated/instructions/initDriftControllerS3.d.ts +0 -58
- package/dist/generated/instructions/initDriftControllerS3.js +0 -103
- package/dist/generated/instructions/initMain.d.ts +0 -43
- package/dist/generated/instructions/initMain.js +0 -91
- package/dist/generated/instructions/mintDriftS1.d.ts +0 -90
- package/dist/generated/instructions/mintDriftS1.js +0 -184
- package/dist/generated/instructions/mintDriftS2.d.ts +0 -80
- package/dist/generated/instructions/mintDriftS2.js +0 -161
- package/dist/generated/instructions/mintDriftS3.d.ts +0 -86
- package/dist/generated/instructions/mintDriftS3.js +0 -174
- package/dist/generated/instructions/processSwapDeposit.d.ts +0 -79
- package/dist/generated/instructions/processSwapDeposit.js +0 -161
- package/dist/generated/instructions/processSwapDepositIntrospection.d.ts +0 -79
- package/dist/generated/instructions/processSwapDepositIntrospection.js +0 -161
- package/dist/generated/instructions/processSwapWithdraw.d.ts +0 -68
- package/dist/generated/instructions/processSwapWithdraw.js +0 -157
- package/dist/generated/instructions/processSwapWithdrawIntrospection.d.ts +0 -68
- package/dist/generated/instructions/processSwapWithdrawIntrospection.js +0 -157
- package/dist/generated/instructions/rebalanceJlp.d.ts +0 -81
- package/dist/generated/instructions/rebalanceJlp.js +0 -187
- package/dist/generated/instructions/redeem2DriftS2.d.ts +0 -80
- package/dist/generated/instructions/redeem2DriftS2.js +0 -161
- package/dist/generated/instructions/redeemDriftS1.d.ts +0 -91
- package/dist/generated/instructions/redeemDriftS1.js +0 -185
- package/dist/generated/instructions/redeemDriftS2.d.ts +0 -80
- package/dist/generated/instructions/redeemDriftS2.js +0 -161
- package/dist/generated/instructions/redeemDriftS3.d.ts +0 -87
- package/dist/generated/instructions/redeemDriftS3.js +0 -175
- package/dist/generated/instructions/settlePnl.d.ts +0 -55
- package/dist/generated/instructions/settlePnl.js +0 -114
- package/dist/generated/instructions/settlePnlMulti.d.ts +0 -65
- package/dist/generated/instructions/settlePnlMulti.js +0 -117
- package/dist/generated/instructions/suspendLstProtocol.d.ts +0 -54
- package/dist/generated/instructions/suspendLstProtocol.js +0 -96
- package/dist/generated/instructions/suspendLstStrategy.d.ts +0 -56
- package/dist/generated/instructions/suspendLstStrategy.js +0 -101
- package/dist/generated/instructions/swapOrca.d.ts +0 -78
- package/dist/generated/instructions/swapOrca.js +0 -153
- package/dist/generated/instructions/swapOrcaTwoHop.d.ts +0 -98
- package/dist/generated/instructions/swapOrcaTwoHop.js +0 -200
- package/dist/generated/instructions/updateActionRoleProtocol.d.ts +0 -58
- package/dist/generated/instructions/updateActionRoleProtocol.js +0 -99
- package/dist/generated/instructions/updateActionRoleStrategy.d.ts +0 -61
- package/dist/generated/instructions/updateActionRoleStrategy.js +0 -105
- package/dist/generated/instructions/updateAttenuation.d.ts +0 -56
- package/dist/generated/instructions/updateAttenuation.js +0 -100
- package/dist/generated/instructions/updateCap.d.ts +0 -55
- package/dist/generated/instructions/updateCap.js +0 -99
- package/dist/generated/instructions/updateRebalanceSlippage.d.ts +0 -55
- package/dist/generated/instructions/updateRebalanceSlippage.js +0 -99
- package/dist/generated/instructions/updateRecipients.d.ts +0 -56
- package/dist/generated/instructions/updateRecipients.js +0 -101
- package/dist/generated/instructions/updateRoleHolderProtocol.d.ts +0 -61
- package/dist/generated/instructions/updateRoleHolderProtocol.js +0 -109
- package/dist/generated/instructions/updateRoleHolderStrategy.d.ts +0 -62
- package/dist/generated/instructions/updateRoleHolderStrategy.js +0 -110
- package/dist/generated/types/AMM.d.ts +0 -102
- package/dist/generated/types/AMM.js +0 -127
- package/dist/generated/types/AccKey.d.ts +0 -15
- package/dist/generated/types/AccKey.js +0 -38
- package/dist/generated/types/AccessControl.d.ts +0 -18
- package/dist/generated/types/AccessControl.js +0 -43
- package/dist/generated/types/AccessMap.d.ts +0 -17
- package/dist/generated/types/AccessMap.js +0 -42
- package/dist/generated/types/Action.d.ts +0 -36
- package/dist/generated/types/Action.js +0 -63
- package/dist/generated/types/ActionMapping.d.ts +0 -19
- package/dist/generated/types/ActionMapping.js +0 -44
- package/dist/generated/types/AssetTier.d.ts +0 -23
- package/dist/generated/types/AssetTier.js +0 -50
- package/dist/generated/types/Attenuation.d.ts +0 -16
- package/dist/generated/types/Attenuation.js +0 -41
- package/dist/generated/types/BalanceType.d.ts +0 -20
- package/dist/generated/types/BalanceType.js +0 -47
- package/dist/generated/types/ContractTier.d.ts +0 -24
- package/dist/generated/types/ContractTier.js +0 -51
- package/dist/generated/types/ContractType.d.ts +0 -20
- package/dist/generated/types/ContractType.js +0 -47
- package/dist/generated/types/CorpAction.d.ts +0 -19
- package/dist/generated/types/CorpAction.js +0 -46
- package/dist/generated/types/CustodyInfo.d.ts +0 -20
- package/dist/generated/types/CustodyInfo.js +0 -45
- package/dist/generated/types/DirectionCollateral.d.ts +0 -20
- package/dist/generated/types/DirectionCollateral.js +0 -47
- package/dist/generated/types/DirectionPosition.d.ts +0 -20
- package/dist/generated/types/DirectionPosition.js +0 -47
- package/dist/generated/types/DriftControllerBase.d.ts +0 -15
- package/dist/generated/types/DriftControllerBase.js +0 -38
- package/dist/generated/types/DriftJlpControllerFixedAccounts.d.ts +0 -18
- package/dist/generated/types/DriftJlpControllerFixedAccounts.js +0 -43
- package/dist/generated/types/DriftLstData.d.ts +0 -17
- package/dist/generated/types/DriftLstData.js +0 -42
- package/dist/generated/types/Ema.d.ts +0 -17
- package/dist/generated/types/Ema.js +0 -42
- package/dist/generated/types/Externals.d.ts +0 -16
- package/dist/generated/types/Externals.js +0 -39
- package/dist/generated/types/HistoricalIndexData.d.ts +0 -19
- package/dist/generated/types/HistoricalIndexData.js +0 -44
- package/dist/generated/types/HistoricalOracleData.d.ts +0 -20
- package/dist/generated/types/HistoricalOracleData.js +0 -45
- package/dist/generated/types/Holding.d.ts +0 -21
- package/dist/generated/types/Holding.js +0 -46
- package/dist/generated/types/Holdings.d.ts +0 -17
- package/dist/generated/types/Holdings.js +0 -42
- package/dist/generated/types/InitControllerS2Args.d.ts +0 -23
- package/dist/generated/types/InitControllerS2Args.js +0 -48
- package/dist/generated/types/InsuranceClaim.d.ts +0 -19
- package/dist/generated/types/InsuranceClaim.js +0 -44
- package/dist/generated/types/InsuranceFund.d.ts +0 -24
- package/dist/generated/types/InsuranceFund.js +0 -49
- package/dist/generated/types/JlpRebalanceSettings.d.ts +0 -15
- package/dist/generated/types/JlpRebalanceSettings.js +0 -38
- package/dist/generated/types/KillSwitch.d.ts +0 -15
- package/dist/generated/types/KillSwitch.js +0 -38
- package/dist/generated/types/LevelRoles.d.ts +0 -16
- package/dist/generated/types/LevelRoles.js +0 -39
- package/dist/generated/types/MarketStatus.d.ts +0 -27
- package/dist/generated/types/MarketStatus.js +0 -54
- package/dist/generated/types/MarketType.d.ts +0 -20
- package/dist/generated/types/MarketType.js +0 -47
- package/dist/generated/types/MintJlpArgs.d.ts +0 -15
- package/dist/generated/types/MintJlpArgs.js +0 -38
- package/dist/generated/types/ModifyOrderParams.d.ts +0 -32
- package/dist/generated/types/ModifyOrderParams.js +0 -57
- package/dist/generated/types/ModifyOrderPolicy.d.ts +0 -20
- package/dist/generated/types/ModifyOrderPolicy.js +0 -47
- package/dist/generated/types/Movements.d.ts +0 -19
- package/dist/generated/types/Movements.js +0 -44
- package/dist/generated/types/OracleGuardRails.d.ts +0 -18
- package/dist/generated/types/OracleGuardRails.js +0 -43
- package/dist/generated/types/OracleSource.d.ts +0 -34
- package/dist/generated/types/OracleSource.js +0 -61
- package/dist/generated/types/OracleValidity.d.ts +0 -25
- package/dist/generated/types/OracleValidity.js +0 -52
- package/dist/generated/types/Order.d.ts +0 -43
- package/dist/generated/types/Order.js +0 -68
- package/dist/generated/types/OrderDirection.d.ts +0 -20
- package/dist/generated/types/OrderDirection.js +0 -47
- package/dist/generated/types/OrderParams.d.ts +0 -36
- package/dist/generated/types/OrderParams.js +0 -61
- package/dist/generated/types/OrderStatus.d.ts +0 -22
- package/dist/generated/types/OrderStatus.js +0 -49
- package/dist/generated/types/OrderTriggerCondition.d.ts +0 -22
- package/dist/generated/types/OrderTriggerCondition.js +0 -49
- package/dist/generated/types/OrderType.d.ts +0 -23
- package/dist/generated/types/OrderType.js +0 -50
- package/dist/generated/types/PermissionLevel.d.ts +0 -45
- package/dist/generated/types/PermissionLevel.js +0 -48
- package/dist/generated/types/PerpHedge.d.ts +0 -17
- package/dist/generated/types/PerpHedge.js +0 -42
- package/dist/generated/types/PerpPosition.d.ts +0 -29
- package/dist/generated/types/PerpPosition.js +0 -54
- package/dist/generated/types/PoolBalance.d.ts +0 -17
- package/dist/generated/types/PoolBalance.js +0 -42
- package/dist/generated/types/Position.d.ts +0 -20
- package/dist/generated/types/Position.js +0 -45
- package/dist/generated/types/PositionDirection.d.ts +0 -20
- package/dist/generated/types/PositionDirection.js +0 -47
- package/dist/generated/types/PositionDrift.d.ts +0 -18
- package/dist/generated/types/PositionDrift.js +0 -43
- package/dist/generated/types/PostOnlyParam.d.ts +0 -22
- package/dist/generated/types/PostOnlyParam.js +0 -49
- package/dist/generated/types/Price.d.ts +0 -41
- package/dist/generated/types/Price.js +0 -66
- package/dist/generated/types/PriceComp.d.ts +0 -19
- package/dist/generated/types/PriceComp.js +0 -44
- package/dist/generated/types/PriceDivergenceGuardRails.d.ts +0 -16
- package/dist/generated/types/PriceDivergenceGuardRails.js +0 -41
- package/dist/generated/types/PriceInfo.d.ts +0 -21
- package/dist/generated/types/PriceInfo.js +0 -46
- package/dist/generated/types/PriceStatus.d.ts +0 -22
- package/dist/generated/types/PriceStatus.js +0 -49
- package/dist/generated/types/PriceType.d.ts +0 -20
- package/dist/generated/types/PriceType.js +0 -47
- package/dist/generated/types/ProcessSwapDepositArgs.d.ts +0 -15
- package/dist/generated/types/ProcessSwapDepositArgs.js +0 -38
- package/dist/generated/types/ProcessSwapDepositIntrospectionArgs.d.ts +0 -15
- package/dist/generated/types/ProcessSwapDepositIntrospectionArgs.js +0 -38
- package/dist/generated/types/Program.d.ts +0 -19
- package/dist/generated/types/Program.js +0 -44
- package/dist/generated/types/ProgramStatus.d.ts +0 -20
- package/dist/generated/types/ProgramStatus.js +0 -47
- package/dist/generated/types/RebalanceConfig.d.ts +0 -15
- package/dist/generated/types/RebalanceConfig.js +0 -38
- package/dist/generated/types/Recipient.d.ts +0 -17
- package/dist/generated/types/Recipient.js +0 -42
- package/dist/generated/types/Recipients.d.ts +0 -17
- package/dist/generated/types/Recipients.js +0 -42
- package/dist/generated/types/RedeemJlpArgs.d.ts +0 -15
- package/dist/generated/types/RedeemJlpArgs.js +0 -38
- package/dist/generated/types/Role.d.ts +0 -25
- package/dist/generated/types/Role.js +0 -52
- package/dist/generated/types/ShiftCollateral.d.ts +0 -19
- package/dist/generated/types/ShiftCollateral.js +0 -44
- package/dist/generated/types/ShiftPosition.d.ts +0 -17
- package/dist/generated/types/ShiftPosition.js +0 -42
- package/dist/generated/types/ShortHolding.d.ts +0 -17
- package/dist/generated/types/ShortHolding.js +0 -42
- package/dist/generated/types/SplBase.d.ts +0 -17
- package/dist/generated/types/SplBase.js +0 -42
- package/dist/generated/types/SplMain.d.ts +0 -22
- package/dist/generated/types/SplMain.js +0 -47
- package/dist/generated/types/Spls.d.ts +0 -17
- package/dist/generated/types/Spls.js +0 -42
- package/dist/generated/types/SpotBalanceType.d.ts +0 -20
- package/dist/generated/types/SpotBalanceType.js +0 -47
- package/dist/generated/types/SpotPosition.d.ts +0 -23
- package/dist/generated/types/SpotPosition.js +0 -48
- package/dist/generated/types/Status.d.ts +0 -20
- package/dist/generated/types/Status.js +0 -47
- package/dist/generated/types/Strategy.d.ts +0 -31
- package/dist/generated/types/Strategy.js +0 -56
- package/dist/generated/types/StrategyRoleEntry.d.ts +0 -17
- package/dist/generated/types/StrategyRoleEntry.js +0 -42
- package/dist/generated/types/SubAccount.d.ts +0 -17
- package/dist/generated/types/SubAccount.js +0 -42
- package/dist/generated/types/Update.d.ts +0 -20
- package/dist/generated/types/Update.js +0 -47
- package/dist/generated/types/UserFees.d.ts +0 -20
- package/dist/generated/types/UserFees.js +0 -45
- package/dist/generated/types/ValidityGuardRails.d.ts +0 -18
- package/dist/generated/types/ValidityGuardRails.js +0 -43
- package/dist/generated/types/index.d.ts +0 -83
- package/dist/generated/types/index.js +0 -99
- package/dist/strategies/JlpStrategy.d.ts +0 -17
- package/dist/strategies/JlpStrategy.js +0 -337
- package/dist/strategies/LstStrategy.d.ts +0 -19
- package/dist/strategies/LstStrategy.js +0 -169
- package/dist/strategies/UsdcStrategy.d.ts +0 -12
- package/dist/strategies/UsdcStrategy.js +0 -89
- package/dist/strategies/index.d.ts +0 -3
- package/dist/strategies/index.js +0 -19
package/README.md
CHANGED
|
@@ -1,9 +1,180 @@
|
|
|
1
|
-
# Reflect SDK
|
|
1
|
+
# Reflect Money Stable.ts SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A comprehensive TypeScript SDK for interacting with the Reflect Protocol Delta-Neutral Program on Solana. This SDK provides high-level abstractions for managing stablecoins, administrative operations, and protocol integrations.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Reflect Protocol SDK enables developers to interact with three main Reflect stablecoins:
|
|
8
|
+
|
|
9
|
+
1. **USDC+ (Strategy 0)**: Stablecoin backed by USDC deployed in money markets
|
|
10
|
+
2. **JLP Hedged (Strategy 1)**: Stablecoin backed by the JLP token, neutralised with perpetual hedging strategies
|
|
11
|
+
3. **LST Delta-Neutral (Strategy 2)**: Stablecoin backed by hedged LSTs
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
The SDK is organized into several key components:
|
|
16
|
+
|
|
17
|
+
### Core Classes
|
|
18
|
+
|
|
19
|
+
#### `Stablecoin` (Abstract Base Class)
|
|
20
|
+
The foundation for all stablecoin implementations. Provides common interface for:
|
|
21
|
+
- minting,
|
|
22
|
+
- redemption,
|
|
23
|
+
- administrative operations.
|
|
24
|
+
|
|
25
|
+
**Key Methods:**
|
|
26
|
+
- `initialize()` - Initialize the stablecoin strategy (admin-only)
|
|
27
|
+
- `mint()` - Create mint instructions
|
|
28
|
+
- `redeem()` - Create redemption instructions
|
|
29
|
+
- `rebalance()` - Create rebalancing instructions (admin-only)
|
|
30
|
+
- `updateCap()` - Update supply cap (admin-only)
|
|
31
|
+
- `updateRecipients()` - Update fee recipients (admin-only)
|
|
32
|
+
|
|
33
|
+
#### `ReflectAdmin`
|
|
34
|
+
Administrative client for protocol-level operations:
|
|
35
|
+
- Protocol initialization
|
|
36
|
+
- Role and permission management
|
|
37
|
+
- Action freezing/unfreezing
|
|
38
|
+
- Admin account creation
|
|
39
|
+
|
|
40
|
+
**Key Methods:**
|
|
41
|
+
- `initializeMain()` - Initialize the main program account
|
|
42
|
+
- `freezeProtocolAction()` - Freeze/unfreeze protocol actions
|
|
43
|
+
- `updateRoleHolderProtocol()` - Update protocol-level permissions
|
|
44
|
+
- `createAdminAccount()` - Create new admin accounts
|
|
45
|
+
|
|
46
|
+
#### `PdaClient`
|
|
47
|
+
Utility class for deriving Program Derived Addresses (PDAs):
|
|
48
|
+
- Main program accounts
|
|
49
|
+
- Controller accounts
|
|
50
|
+
- Permission accounts
|
|
51
|
+
- External protocol integrations (Drift, Jupiter)
|
|
52
|
+
|
|
53
|
+
#### `ReflectTokenisedBond`
|
|
54
|
+
Client for tokenized bonds program, allowing for wrapping base stablecoins into yield-bearing receipts. Allows for:
|
|
55
|
+
- Vault creation and management
|
|
56
|
+
- Receipt token generation
|
|
57
|
+
- Deposit and withdrawal operations
|
|
58
|
+
|
|
59
|
+
### Stablecoin Implementations
|
|
60
|
+
|
|
61
|
+
#### `UsdcStablecoin`
|
|
62
|
+
Simple USDC-backed stablecoin implementation:
|
|
63
|
+
- Strategy ID: 0
|
|
64
|
+
- Collateral: USDC
|
|
65
|
+
- Integrated with tokenised bonds program on the protocol level
|
|
66
|
+
|
|
67
|
+
#### `JlpStablecoin`
|
|
68
|
+
Jupiter LP token with perpetual hedging:
|
|
69
|
+
- Strategy ID: 1
|
|
70
|
+
- Collateral: JLP (Jupiter LP tokens)
|
|
71
|
+
|
|
72
|
+
#### `LstStablecoin`
|
|
73
|
+
Liquid staking token delta-neutral strategy:
|
|
74
|
+
- Strategy ID: 2
|
|
75
|
+
- Collateral: Various LSTs (mSOL, jitoSOL, etc.)
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install @reflectmoney/stable.ts
|
|
81
|
+
# or
|
|
82
|
+
yarn add @reflectmoney/stable.ts
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
### Minting Stablecoins
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { LstStablecoin } from '@reflectmoney/stable.ts';
|
|
91
|
+
import { PublicKey } from '@solana/web3.js';
|
|
92
|
+
import BN from 'bn.js';
|
|
93
|
+
|
|
94
|
+
const lstStablecoin = new LstStablecoin(connection);
|
|
95
|
+
|
|
96
|
+
// Load controller data
|
|
97
|
+
await lstStablecoin.load(connection);
|
|
98
|
+
|
|
99
|
+
// Mint stablecoins against LST collateral
|
|
100
|
+
const mintInstructions = await lstStablecoin.mint(
|
|
101
|
+
userPublicKey,
|
|
102
|
+
new BN(1000000), // 1 USDC (6 decimals)
|
|
103
|
+
new BN(999000), // Minimum received (slippage protection)
|
|
104
|
+
new PublicKey("<jitoSOL mint>") // LST mint address
|
|
105
|
+
);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Administrative Operations
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { ReflectAdmin } from '@reflectmoney/stable.ts';
|
|
112
|
+
|
|
113
|
+
const admin = new ReflectAdmin({
|
|
114
|
+
admin: adminPublicKey,
|
|
115
|
+
connection
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Freeze minting operations
|
|
119
|
+
const freezeIx = await admin.freezeProtocolAction(true, Action.Mint);
|
|
120
|
+
|
|
121
|
+
// Update supply cap
|
|
122
|
+
const updateCapIx = await usdcStablecoin.updateCap(adminPublicKey, new BN(1000000000));
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Advanced Usage
|
|
126
|
+
|
|
127
|
+
### Custom Stablecoin Implementation
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { Stablecoin } from '@reflectmoney/stable.ts';
|
|
131
|
+
|
|
132
|
+
class CustomStablecoin extends Stablecoin {
|
|
133
|
+
constructor(connection: Connection) {
|
|
134
|
+
super(3, "Custom Strategy", connection);
|
|
135
|
+
this.collaterals = [{ mint: customMint, oracle: customOracle }];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async initialize(signer: PublicKey, ...args: any[]): Promise<TransactionInstruction[]> {
|
|
139
|
+
// Custom initialization logic
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async mint(signer: PublicKey, amount: BN, minimumReceived: BN, ...args: any[]): Promise<TransactionInstruction[]> {
|
|
143
|
+
// Custom minting logic
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async redeem(signer: PublicKey, amount: BN, minimumReceived: BN, ...args: any[]): Promise<TransactionInstruction[]> {
|
|
147
|
+
// Custom redemption logic
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async rebalance(signer: PublicKey): Promise<TransactionInstruction[]> {
|
|
151
|
+
// Custom rebalancing logic
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async constructAccounts<T>(signer: PublicKey, ...args: any[]): Promise<T> {
|
|
155
|
+
// Custom account construction
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async constructRemainingAccounts(): Promise<AccountMeta[]> {
|
|
159
|
+
// Custom remaining accounts
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Integration with External Protocols
|
|
165
|
+
|
|
166
|
+
The SDK is built in integration with:
|
|
167
|
+
- **Drift Protocol**: For perpetual futures and spot trading
|
|
168
|
+
- **Jupiter Protocol**: For LP token operations and swaps
|
|
169
|
+
- **Pyth Network**: For price oracle data
|
|
170
|
+
- **Tokenized Bonds**: For yield generation
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
This SDK is licensed under the MIT License.
|
|
175
|
+
|
|
176
|
+
## Support
|
|
177
|
+
|
|
178
|
+
For support and questions:
|
|
179
|
+
- Documentation: [docs.reflect.money](https://docs.reflect.money)
|
|
180
|
+
- GitHub Issues: [github.com/palindrome-eng/reflect-delta-neutral](https://github.com/palindrome-eng/reflect-delta-neutral)
|
|
@@ -1,19 +1,131 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for deriving Program Derived Addresses (PDAs) used throughout the Reflect protocol.
|
|
4
|
+
* Provides static methods to generate deterministic addresses for various program accounts
|
|
5
|
+
* including main program accounts, controllers, permissions, and external protocol integrations.
|
|
6
|
+
*/
|
|
2
7
|
export declare class PdaClient {
|
|
8
|
+
/**
|
|
9
|
+
* Derives the main program account address.
|
|
10
|
+
* This is the primary account that stores global protocol state.
|
|
11
|
+
*
|
|
12
|
+
* @returns PublicKey of the main program account
|
|
13
|
+
*/
|
|
3
14
|
static deriveMain(): PublicKey;
|
|
15
|
+
/**
|
|
16
|
+
* Derives the permissions account address for a specific user.
|
|
17
|
+
* This account stores the user's role-based permissions within the protocol.
|
|
18
|
+
*
|
|
19
|
+
* @param user - Public key of the user
|
|
20
|
+
* @returns PublicKey of the user's permissions account
|
|
21
|
+
*/
|
|
4
22
|
static derivePermissions(user: PublicKey): PublicKey;
|
|
23
|
+
/**
|
|
24
|
+
* Derives the controller account address for a specific strategy.
|
|
25
|
+
* Each stablecoin strategy has its own controller account.
|
|
26
|
+
*
|
|
27
|
+
* @param strategy - Strategy index (0: USDC+, 1: JLP, 2: LST)
|
|
28
|
+
* @returns PublicKey of the strategy controller account
|
|
29
|
+
*/
|
|
5
30
|
static deriveController(strategy: number): PublicKey;
|
|
31
|
+
/**
|
|
32
|
+
* Derives the controller account address with bump seed for a specific strategy.
|
|
33
|
+
* Returns both the public key and the bump seed.
|
|
34
|
+
*
|
|
35
|
+
* @param strategy - Strategy index (0: USDC+, 1: JLP, 2: LST)
|
|
36
|
+
* @returns Array containing [PublicKey, number] where number is the bump seed
|
|
37
|
+
*/
|
|
6
38
|
static deriveControllerWithBump(strategy: number): [PublicKey, number];
|
|
39
|
+
/**
|
|
40
|
+
* Derives the rebalance details account address for a specific strategy.
|
|
41
|
+
* This account stores information about rebalancing operations.
|
|
42
|
+
*
|
|
43
|
+
* @param strategy - Strategy index (0: USDC+, 1: JLP, 2: LST)
|
|
44
|
+
* @returns PublicKey of the rebalance details account
|
|
45
|
+
*/
|
|
7
46
|
static deriveRebalanceDetails(strategy: number): PublicKey;
|
|
47
|
+
/**
|
|
48
|
+
* Derives the Jupiter Perpetuals program account address.
|
|
49
|
+
* Used for integration with Jupiter's perpetuals protocol.
|
|
50
|
+
*
|
|
51
|
+
* @returns PublicKey of the Jupiter Perpetuals account
|
|
52
|
+
*/
|
|
8
53
|
static deriveJupiterPerpetuals(): PublicKey;
|
|
54
|
+
/**
|
|
55
|
+
* Derives the Jupiter LP pool account address.
|
|
56
|
+
* Used for JLP (Jupiter LP) token operations.
|
|
57
|
+
*
|
|
58
|
+
* @returns PublicKey of the JLP pool account
|
|
59
|
+
*/
|
|
9
60
|
static deriveJlpPool(): PublicKey;
|
|
61
|
+
/**
|
|
62
|
+
* Derives the Jupiter event authority account address.
|
|
63
|
+
* Used for event emission in Jupiter protocol interactions.
|
|
64
|
+
*
|
|
65
|
+
* @returns PublicKey of the Jupiter event authority account
|
|
66
|
+
*/
|
|
10
67
|
static deriveEventAuthority(): PublicKey;
|
|
68
|
+
/**
|
|
69
|
+
* Derives the Jupiter transfer authority account address.
|
|
70
|
+
* Used for token transfer operations in Jupiter protocol.
|
|
71
|
+
*
|
|
72
|
+
* @returns PublicKey of the Jupiter transfer authority account
|
|
73
|
+
*/
|
|
11
74
|
static deriveTransferAuthority(): PublicKey;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the Drift vault address for a specific mint.
|
|
77
|
+
* Looks up the market index for the mint and derives the corresponding vault address.
|
|
78
|
+
*
|
|
79
|
+
* @param mint - Public key of the token mint
|
|
80
|
+
* @returns Promise resolving to the PublicKey of the Drift vault account
|
|
81
|
+
*/
|
|
12
82
|
static getDriftVaultFromMint(mint: PublicKey): Promise<PublicKey>;
|
|
83
|
+
/**
|
|
84
|
+
* Derives the token metadata account address for a mint.
|
|
85
|
+
* Used for storing token metadata information.
|
|
86
|
+
*
|
|
87
|
+
* @param mint - Public key of the token mint
|
|
88
|
+
* @returns PublicKey of the metadata account
|
|
89
|
+
*/
|
|
13
90
|
static deriveMetadataAccount(mint: PublicKey): PublicKey;
|
|
91
|
+
/**
|
|
92
|
+
* Derives the custody account address for a pool and token combination.
|
|
93
|
+
* Used in Jupiter protocol for token custody management.
|
|
94
|
+
*
|
|
95
|
+
* @param pool - Public key of the pool
|
|
96
|
+
* @param token - Public key of the token
|
|
97
|
+
* @returns PublicKey of the custody account
|
|
98
|
+
*/
|
|
14
99
|
static deriveCustody(pool: PublicKey, token: PublicKey): PublicKey;
|
|
100
|
+
/**
|
|
101
|
+
* Derives the LP config account address.
|
|
102
|
+
* Used for tokenized bonds program configuration.
|
|
103
|
+
*
|
|
104
|
+
* @returns PublicKey of the LP config account
|
|
105
|
+
*/
|
|
15
106
|
static deriveLpConfig(): PublicKey;
|
|
107
|
+
/**
|
|
108
|
+
* Derives the LP admin account address for a specific admin.
|
|
109
|
+
* Used for tokenized bonds program administration.
|
|
110
|
+
*
|
|
111
|
+
* @param admin - Public key of the admin
|
|
112
|
+
* @returns PublicKey of the LP admin account
|
|
113
|
+
*/
|
|
16
114
|
static deriveLpAdmin(admin: PublicKey): PublicKey;
|
|
115
|
+
/**
|
|
116
|
+
* Derives the LP vault account address for a specific vault ID.
|
|
117
|
+
* Used for tokenized bonds vault management.
|
|
118
|
+
*
|
|
119
|
+
* @param vaultId - Numeric identifier for the vault
|
|
120
|
+
* @returns PublicKey of the LP vault account
|
|
121
|
+
*/
|
|
17
122
|
static deriveLpVault(vaultId: number): PublicKey;
|
|
123
|
+
/**
|
|
124
|
+
* Derives the LP vault pool account address for a specific vault ID.
|
|
125
|
+
* Used for tokenized bonds vault pool management.
|
|
126
|
+
*
|
|
127
|
+
* @param vaultId - Numeric identifier for the vault
|
|
128
|
+
* @returns PublicKey of the LP vault pool account
|
|
129
|
+
*/
|
|
18
130
|
static deriveLpVaultPool(vaultId: number): PublicKey;
|
|
19
131
|
}
|
|
@@ -20,11 +20,29 @@ const constants_1 = require("../constants");
|
|
|
20
20
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
21
21
|
const sdk_1 = require("@drift-labs/sdk");
|
|
22
22
|
const mpl_token_metadata_1 = require("@metaplex-foundation/mpl-token-metadata");
|
|
23
|
+
/**
|
|
24
|
+
* Utility class for deriving Program Derived Addresses (PDAs) used throughout the Reflect protocol.
|
|
25
|
+
* Provides static methods to generate deterministic addresses for various program accounts
|
|
26
|
+
* including main program accounts, controllers, permissions, and external protocol integrations.
|
|
27
|
+
*/
|
|
23
28
|
class PdaClient {
|
|
29
|
+
/**
|
|
30
|
+
* Derives the main program account address.
|
|
31
|
+
* This is the primary account that stores global protocol state.
|
|
32
|
+
*
|
|
33
|
+
* @returns PublicKey of the main program account
|
|
34
|
+
*/
|
|
24
35
|
static deriveMain() {
|
|
25
36
|
const [main] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("main")], reflect_main_1.PROGRAM_ID);
|
|
26
37
|
return main;
|
|
27
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Derives the permissions account address for a specific user.
|
|
41
|
+
* This account stores the user's role-based permissions within the protocol.
|
|
42
|
+
*
|
|
43
|
+
* @param user - Public key of the user
|
|
44
|
+
* @returns PublicKey of the user's permissions account
|
|
45
|
+
*/
|
|
28
46
|
static derivePermissions(user) {
|
|
29
47
|
const [permissions] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
30
48
|
Buffer.from("user_permission"),
|
|
@@ -32,6 +50,13 @@ class PdaClient {
|
|
|
32
50
|
], reflect_main_1.PROGRAM_ID);
|
|
33
51
|
return permissions;
|
|
34
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Derives the controller account address for a specific strategy.
|
|
55
|
+
* Each stablecoin strategy has its own controller account.
|
|
56
|
+
*
|
|
57
|
+
* @param strategy - Strategy index (0: USDC+, 1: JLP, 2: LST)
|
|
58
|
+
* @returns PublicKey of the strategy controller account
|
|
59
|
+
*/
|
|
35
60
|
static deriveController(strategy) {
|
|
36
61
|
const [controller] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
37
62
|
Buffer.from("dex_controller"),
|
|
@@ -39,12 +64,26 @@ class PdaClient {
|
|
|
39
64
|
], reflect_main_1.PROGRAM_ID);
|
|
40
65
|
return controller;
|
|
41
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Derives the controller account address with bump seed for a specific strategy.
|
|
69
|
+
* Returns both the public key and the bump seed.
|
|
70
|
+
*
|
|
71
|
+
* @param strategy - Strategy index (0: USDC+, 1: JLP, 2: LST)
|
|
72
|
+
* @returns Array containing [PublicKey, number] where number is the bump seed
|
|
73
|
+
*/
|
|
42
74
|
static deriveControllerWithBump(strategy) {
|
|
43
75
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
44
76
|
Buffer.from("dex_controller"),
|
|
45
77
|
Buffer.from([strategy])
|
|
46
78
|
], reflect_main_1.PROGRAM_ID);
|
|
47
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Derives the rebalance details account address for a specific strategy.
|
|
82
|
+
* This account stores information about rebalancing operations.
|
|
83
|
+
*
|
|
84
|
+
* @param strategy - Strategy index (0: USDC+, 1: JLP, 2: LST)
|
|
85
|
+
* @returns PublicKey of the rebalance details account
|
|
86
|
+
*/
|
|
48
87
|
static deriveRebalanceDetails(strategy) {
|
|
49
88
|
const [rebalanceDetails] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
50
89
|
Buffer.from("rebalance_details"),
|
|
@@ -52,12 +91,24 @@ class PdaClient {
|
|
|
52
91
|
], reflect_main_1.PROGRAM_ID);
|
|
53
92
|
return rebalanceDetails;
|
|
54
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Derives the Jupiter Perpetuals program account address.
|
|
96
|
+
* Used for integration with Jupiter's perpetuals protocol.
|
|
97
|
+
*
|
|
98
|
+
* @returns PublicKey of the Jupiter Perpetuals account
|
|
99
|
+
*/
|
|
55
100
|
static deriveJupiterPerpetuals() {
|
|
56
101
|
const [perpetuals] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
57
102
|
Buffer.from("perpetuals")
|
|
58
103
|
], constants_1.JUPITER_PROGRAM_ID);
|
|
59
104
|
return perpetuals;
|
|
60
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Derives the Jupiter LP pool account address.
|
|
108
|
+
* Used for JLP (Jupiter LP) token operations.
|
|
109
|
+
*
|
|
110
|
+
* @returns PublicKey of the JLP pool account
|
|
111
|
+
*/
|
|
61
112
|
static deriveJlpPool() {
|
|
62
113
|
const [jlpPool] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
63
114
|
Buffer.from("pool"),
|
|
@@ -65,18 +116,37 @@ class PdaClient {
|
|
|
65
116
|
], constants_1.JUPITER_PROGRAM_ID);
|
|
66
117
|
return jlpPool;
|
|
67
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Derives the Jupiter event authority account address.
|
|
121
|
+
* Used for event emission in Jupiter protocol interactions.
|
|
122
|
+
*
|
|
123
|
+
* @returns PublicKey of the Jupiter event authority account
|
|
124
|
+
*/
|
|
68
125
|
static deriveEventAuthority() {
|
|
69
126
|
const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
70
127
|
Buffer.from("__event_authority"),
|
|
71
128
|
], constants_1.JUPITER_PROGRAM_ID);
|
|
72
129
|
return eventAuthority;
|
|
73
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Derives the Jupiter transfer authority account address.
|
|
133
|
+
* Used for token transfer operations in Jupiter protocol.
|
|
134
|
+
*
|
|
135
|
+
* @returns PublicKey of the Jupiter transfer authority account
|
|
136
|
+
*/
|
|
74
137
|
static deriveTransferAuthority() {
|
|
75
138
|
const [transferAuthority] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
76
139
|
Buffer.from("transfer_authority"),
|
|
77
140
|
], constants_1.JUPITER_PROGRAM_ID);
|
|
78
141
|
return transferAuthority;
|
|
79
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets the Drift vault address for a specific mint.
|
|
145
|
+
* Looks up the market index for the mint and derives the corresponding vault address.
|
|
146
|
+
*
|
|
147
|
+
* @param mint - Public key of the token mint
|
|
148
|
+
* @returns Promise resolving to the PublicKey of the Drift vault account
|
|
149
|
+
*/
|
|
80
150
|
static getDriftVaultFromMint(mint) {
|
|
81
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
152
|
const { marketIndex } = sdk_1.SpotMarkets["mainnet-beta"]
|
|
@@ -84,6 +154,13 @@ class PdaClient {
|
|
|
84
154
|
return yield (0, sdk_1.getSpotMarketVaultPublicKey)(constants_1.DRIFT_PROGRAM_ID, marketIndex);
|
|
85
155
|
});
|
|
86
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Derives the token metadata account address for a mint.
|
|
159
|
+
* Used for storing token metadata information.
|
|
160
|
+
*
|
|
161
|
+
* @param mint - Public key of the token mint
|
|
162
|
+
* @returns PublicKey of the metadata account
|
|
163
|
+
*/
|
|
87
164
|
static deriveMetadataAccount(mint) {
|
|
88
165
|
const [metadata] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
89
166
|
Buffer.from("metadata"),
|
|
@@ -92,6 +169,14 @@ class PdaClient {
|
|
|
92
169
|
], mpl_token_metadata_1.PROGRAM_ID);
|
|
93
170
|
return metadata;
|
|
94
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Derives the custody account address for a pool and token combination.
|
|
174
|
+
* Used in Jupiter protocol for token custody management.
|
|
175
|
+
*
|
|
176
|
+
* @param pool - Public key of the pool
|
|
177
|
+
* @param token - Public key of the token
|
|
178
|
+
* @returns PublicKey of the custody account
|
|
179
|
+
*/
|
|
95
180
|
static deriveCustody(pool, token) {
|
|
96
181
|
const [custody] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
97
182
|
Buffer.from("custody"),
|
|
@@ -100,12 +185,25 @@ class PdaClient {
|
|
|
100
185
|
], constants_1.JUPITER_PROGRAM_ID);
|
|
101
186
|
return custody;
|
|
102
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Derives the LP config account address.
|
|
190
|
+
* Used for tokenized bonds program configuration.
|
|
191
|
+
*
|
|
192
|
+
* @returns PublicKey of the LP config account
|
|
193
|
+
*/
|
|
103
194
|
static deriveLpConfig() {
|
|
104
195
|
const [config] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
105
196
|
Buffer.from("config")
|
|
106
197
|
], reflect_tokenised_bonds_1.PROGRAM_ID);
|
|
107
198
|
return config;
|
|
108
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Derives the LP admin account address for a specific admin.
|
|
202
|
+
* Used for tokenized bonds program administration.
|
|
203
|
+
*
|
|
204
|
+
* @param admin - Public key of the admin
|
|
205
|
+
* @returns PublicKey of the LP admin account
|
|
206
|
+
*/
|
|
109
207
|
static deriveLpAdmin(admin) {
|
|
110
208
|
const [adminPda] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
111
209
|
Buffer.from("admin"),
|
|
@@ -113,6 +211,13 @@ class PdaClient {
|
|
|
113
211
|
], reflect_tokenised_bonds_1.PROGRAM_ID);
|
|
114
212
|
return adminPda;
|
|
115
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Derives the LP vault account address for a specific vault ID.
|
|
216
|
+
* Used for tokenized bonds vault management.
|
|
217
|
+
*
|
|
218
|
+
* @param vaultId - Numeric identifier for the vault
|
|
219
|
+
* @returns PublicKey of the LP vault account
|
|
220
|
+
*/
|
|
116
221
|
static deriveLpVault(vaultId) {
|
|
117
222
|
const [vault] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
118
223
|
Buffer.from("vault"),
|
|
@@ -120,6 +225,13 @@ class PdaClient {
|
|
|
120
225
|
], reflect_tokenised_bonds_1.PROGRAM_ID);
|
|
121
226
|
return vault;
|
|
122
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Derives the LP vault pool account address for a specific vault ID.
|
|
230
|
+
* Used for tokenized bonds vault pool management.
|
|
231
|
+
*
|
|
232
|
+
* @param vaultId - Numeric identifier for the vault
|
|
233
|
+
* @returns PublicKey of the LP vault pool account
|
|
234
|
+
*/
|
|
123
235
|
static deriveLpVaultPool(vaultId) {
|
|
124
236
|
const [pool] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
125
237
|
Buffer.from("vault_pool"),
|
|
@@ -1,19 +1,104 @@
|
|
|
1
1
|
import { Connection, PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { Action, Role, Update } from "../generated/reflect_main";
|
|
3
|
+
/**
|
|
4
|
+
* Administrative client for the Reflect protocol.
|
|
5
|
+
* Provides functionality for protocol-level administration including:
|
|
6
|
+
* - Protocol initialization and setup
|
|
7
|
+
* - Role and permission management
|
|
8
|
+
* - Action freezing/unfreezing
|
|
9
|
+
* - Admin account creation and management
|
|
10
|
+
*
|
|
11
|
+
* This class is used by protocol administrators to manage global settings,
|
|
12
|
+
* user permissions, and protocol-wide configurations.
|
|
13
|
+
*/
|
|
3
14
|
export declare class ReflectAdmin {
|
|
15
|
+
/** Public key of the admin user */
|
|
4
16
|
private admin;
|
|
17
|
+
/** Public key of the main program account */
|
|
5
18
|
private main;
|
|
19
|
+
/** Solana connection instance for RPC communication */
|
|
6
20
|
private connection;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new ReflectAdmin instance.
|
|
23
|
+
*
|
|
24
|
+
* @param admin - Public key of the admin user
|
|
25
|
+
* @param connection - Solana connection instance
|
|
26
|
+
*/
|
|
7
27
|
constructor({ admin, connection }: {
|
|
8
28
|
admin: PublicKey;
|
|
9
29
|
connection: Connection;
|
|
10
30
|
});
|
|
31
|
+
/**
|
|
32
|
+
* Creates the main program account. This is the initial step of protocol setup.
|
|
33
|
+
*
|
|
34
|
+
* @param admin - Public key of the initial admin
|
|
35
|
+
* @returns TransactionInstruction for initializing the main account
|
|
36
|
+
*/
|
|
11
37
|
static initializeMain(admin: PublicKey): import("@solana/web3.js").TransactionInstruction;
|
|
38
|
+
/**
|
|
39
|
+
* Freezes or unfreezes a specific protocol action.
|
|
40
|
+
*
|
|
41
|
+
* @param freeze - Whether to freeze (true) or unfreeze (false) the action
|
|
42
|
+
* @param action - The action to freeze/unfreeze
|
|
43
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
44
|
+
*/
|
|
12
45
|
freezeProtocolAction(freeze: boolean, action: Action): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
13
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Freezes or unfreezes a specific DEX program.
|
|
48
|
+
*
|
|
49
|
+
* @param freeze - Whether to freeze (true) or unfreeze (false) the program
|
|
50
|
+
* @param programIndex - Index of the program to freeze/unfreeze
|
|
51
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
52
|
+
*/
|
|
53
|
+
freezeDex(freeze: boolean, programIndex: number): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new admin account with specified permissions.
|
|
56
|
+
*
|
|
57
|
+
* @param signer - Public key of the caller (must be existing admin)
|
|
58
|
+
* @param newAdmin - Public key of the new admin to create
|
|
59
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
60
|
+
*/
|
|
14
61
|
createAdminAccount(signer: PublicKey, newAdmin: PublicKey): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
62
|
+
/**
|
|
63
|
+
* Updates role holder permissions at the protocol level.
|
|
64
|
+
*
|
|
65
|
+
* @param signer - Public key of the admin signer
|
|
66
|
+
* @param adminToUpdate - Public key of the admin whose permissions are being updated
|
|
67
|
+
* @param affectedRole - The role being modified
|
|
68
|
+
* @param update - The type of update (Grant or Revoke)
|
|
69
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
70
|
+
*/
|
|
15
71
|
updateRoleHolderProtocol(signer: PublicKey, adminToUpdate: PublicKey, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
72
|
+
/**
|
|
73
|
+
* Updates role holder permissions for a specific strategy.
|
|
74
|
+
*
|
|
75
|
+
* @param signer - Public key of the admin signer
|
|
76
|
+
* @param strategyId - ID of the strategy to update permissions for
|
|
77
|
+
* @param adminToUpdate - Public key of the admin whose permissions are being updated
|
|
78
|
+
* @param affectedRole - The role being modified
|
|
79
|
+
* @param update - The type of update (Grant or Revoke)
|
|
80
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
81
|
+
*/
|
|
16
82
|
updateRoleHolderStrategy(signer: PublicKey, strategyId: number, adminToUpdate: PublicKey, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
17
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Updates action role permissions for a specific strategy.
|
|
85
|
+
*
|
|
86
|
+
* @param signer - Public key of the admin signer
|
|
87
|
+
* @param strategyId - ID of the strategy to update permissions for
|
|
88
|
+
* @param action - The action being modified
|
|
89
|
+
* @param affectedRole - The role being modified
|
|
90
|
+
* @param update - The type of update (Grant or Revoke)
|
|
91
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
92
|
+
*/
|
|
93
|
+
updateActionRoleStrategy(signer: PublicKey, strategyId: number, action: Action, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
94
|
+
/**
|
|
95
|
+
* Updates action role permissions at the protocol level.
|
|
96
|
+
*
|
|
97
|
+
* @param signer - Public key of the admin signer
|
|
98
|
+
* @param action - The action being modified
|
|
99
|
+
* @param affectedRole - The role being modified
|
|
100
|
+
* @param update - The type of update (Grant or Revoke)
|
|
101
|
+
* @returns Promise resolving to a TransactionInstruction
|
|
102
|
+
*/
|
|
18
103
|
updateActionRoleProtocol(signer: PublicKey, action: Action, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
|
|
19
104
|
}
|