@reflectmoney/stable.ts 1.1.2 → 1.1.4

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.
Files changed (175) hide show
  1. package/dist/classes/ApiClient.d.ts +56 -0
  2. package/dist/classes/PdaClient.d.ts +131 -0
  3. package/dist/classes/Reflect.d.ts +7 -0
  4. package/dist/classes/ReflectKeeper.d.ts +105 -0
  5. package/dist/classes/ReflectTokenisedBond.d.ts +75 -0
  6. package/dist/classes/Stablecoin.d.ts +219 -0
  7. package/dist/classes/index.d.ts +4 -0
  8. package/dist/constants/drift.d.ts +6 -0
  9. package/dist/constants/index.d.ts +8 -0
  10. package/dist/constants/jupiter.d.ts +4 -0
  11. package/dist/constants/lookupTables.d.ts +4 -0
  12. package/dist/constants/lst.d.ts +3 -0
  13. package/dist/constants/pyth.d.ts +1 -0
  14. package/dist/constants/usdc.d.ts +6 -0
  15. package/dist/constants/wsol.d.ts +6 -0
  16. package/dist/errors/ReflectError.d.ts +4 -0
  17. package/dist/generated/reflect_main/accounts/DriftJlpController.d.ts +114 -0
  18. package/dist/generated/reflect_main/accounts/DriftLstController.d.ts +108 -0
  19. package/dist/generated/reflect_main/accounts/DriftUsdcController.d.ts +126 -0
  20. package/dist/generated/reflect_main/accounts/Main.d.ts +110 -0
  21. package/dist/generated/reflect_main/accounts/PerpMarket.d.ts +226 -0
  22. package/dist/generated/reflect_main/accounts/PrelaunchOracle.d.ts +130 -0
  23. package/dist/generated/reflect_main/accounts/PythLazerOracle.d.ts +124 -0
  24. package/dist/generated/reflect_main/accounts/RebalanceLst.d.ts +111 -0
  25. package/dist/generated/reflect_main/accounts/SpotMarket.d.ts +377 -0
  26. package/dist/generated/reflect_main/accounts/User.d.ts +221 -0
  27. package/dist/generated/reflect_main/accounts/UserPermissions.d.ts +106 -0
  28. package/dist/generated/reflect_main/accounts/UserStats.d.ts +211 -0
  29. package/dist/generated/reflect_main/accounts/index.d.ts +38 -0
  30. package/dist/generated/reflect_main/errors/index.d.ts +969 -0
  31. package/dist/generated/reflect_main/index.d.ts +19 -0
  32. package/dist/generated/reflect_main/instructions/addLstDrift.d.ts +49 -0
  33. package/dist/generated/reflect_main/instructions/addSubAccount.d.ts +54 -0
  34. package/dist/generated/reflect_main/instructions/captureSpreadDrift.d.ts +66 -0
  35. package/dist/generated/reflect_main/instructions/captureSpreadDriftS1.d.ts +58 -0
  36. package/dist/generated/reflect_main/instructions/createAdminAccount.d.ts +51 -0
  37. package/dist/generated/reflect_main/instructions/createUserStatsAccount.d.ts +52 -0
  38. package/dist/generated/reflect_main/instructions/depositDrift.d.ts +73 -0
  39. package/dist/generated/reflect_main/instructions/freezeProgram.d.ts +54 -0
  40. package/dist/generated/reflect_main/instructions/freezeProtocolAction.d.ts +55 -0
  41. package/dist/generated/reflect_main/instructions/freezeStrategyAction.d.ts +58 -0
  42. package/dist/generated/reflect_main/instructions/index.d.ts +34 -0
  43. package/dist/generated/reflect_main/instructions/initDriftAccountsS1.d.ts +54 -0
  44. package/dist/generated/reflect_main/instructions/initDriftControllerS1.d.ts +58 -0
  45. package/dist/generated/reflect_main/instructions/initDriftControllerS3.d.ts +58 -0
  46. package/dist/generated/reflect_main/instructions/initMain.d.ts +43 -0
  47. package/dist/generated/reflect_main/instructions/mintDriftS1.d.ts +86 -0
  48. package/dist/generated/reflect_main/instructions/mintDriftS3.d.ts +86 -0
  49. package/dist/generated/reflect_main/instructions/processSwapDeposit.d.ts +69 -0
  50. package/dist/generated/reflect_main/instructions/processSwapWithdraw.d.ts +69 -0
  51. package/dist/generated/reflect_main/instructions/redeemDriftS1.d.ts +87 -0
  52. package/dist/generated/reflect_main/instructions/redeemDriftS3.d.ts +87 -0
  53. package/dist/generated/reflect_main/instructions/settlePnl.d.ts +55 -0
  54. package/dist/generated/reflect_main/instructions/settlePnlMulti.d.ts +65 -0
  55. package/dist/generated/reflect_main/instructions/suspendSplProtocol.d.ts +54 -0
  56. package/dist/generated/reflect_main/instructions/suspendSplStrategy.d.ts +56 -0
  57. package/dist/generated/reflect_main/instructions/swapOrca.d.ts +81 -0
  58. package/dist/generated/reflect_main/instructions/swapOrcaTwoHop.d.ts +101 -0
  59. package/dist/generated/reflect_main/instructions/updateActionRoleProtocol.d.ts +58 -0
  60. package/dist/generated/reflect_main/instructions/updateActionRoleStrategy.d.ts +60 -0
  61. package/dist/generated/reflect_main/instructions/updateAttenuation.d.ts +57 -0
  62. package/dist/generated/reflect_main/instructions/updateCap.d.ts +55 -0
  63. package/dist/generated/reflect_main/instructions/updateRebalanceSlippage.d.ts +55 -0
  64. package/dist/generated/reflect_main/instructions/updateRecipients.d.ts +56 -0
  65. package/dist/generated/reflect_main/instructions/updateRoleHolderProtocol.d.ts +60 -0
  66. package/dist/generated/reflect_main/instructions/updateRoleHolderStrategy.d.ts +60 -0
  67. package/dist/generated/reflect_main/types/AMM.d.ts +102 -0
  68. package/dist/generated/reflect_main/types/AccKey.d.ts +15 -0
  69. package/dist/generated/reflect_main/types/AccessControl.d.ts +18 -0
  70. package/dist/generated/reflect_main/types/AccessMap.d.ts +17 -0
  71. package/dist/generated/reflect_main/types/Action.d.ts +35 -0
  72. package/dist/generated/reflect_main/types/ActionMapping.d.ts +19 -0
  73. package/dist/generated/reflect_main/types/AssetTier.d.ts +23 -0
  74. package/dist/generated/reflect_main/types/Attenuation.d.ts +16 -0
  75. package/dist/generated/reflect_main/types/BalanceType.d.ts +20 -0
  76. package/dist/generated/reflect_main/types/Capture.d.ts +17 -0
  77. package/dist/generated/reflect_main/types/ContractTier.d.ts +24 -0
  78. package/dist/generated/reflect_main/types/ContractType.d.ts +20 -0
  79. package/dist/generated/reflect_main/types/CorpAction.d.ts +19 -0
  80. package/dist/generated/reflect_main/types/CustodyInfo.d.ts +20 -0
  81. package/dist/generated/reflect_main/types/DirectionCollateral.d.ts +20 -0
  82. package/dist/generated/reflect_main/types/DirectionPosition.d.ts +20 -0
  83. package/dist/generated/reflect_main/types/DriftControllerBase.d.ts +15 -0
  84. package/dist/generated/reflect_main/types/DriftJlpControllerFixedAccounts.d.ts +18 -0
  85. package/dist/generated/reflect_main/types/DriftLstData.d.ts +17 -0
  86. package/dist/generated/reflect_main/types/Ema.d.ts +17 -0
  87. package/dist/generated/reflect_main/types/Externals.d.ts +16 -0
  88. package/dist/generated/reflect_main/types/FlowControl.d.ts +17 -0
  89. package/dist/generated/reflect_main/types/HistoricalIndexData.d.ts +19 -0
  90. package/dist/generated/reflect_main/types/HistoricalOracleData.d.ts +20 -0
  91. package/dist/generated/reflect_main/types/Holding.d.ts +21 -0
  92. package/dist/generated/reflect_main/types/Holdings.d.ts +17 -0
  93. package/dist/generated/reflect_main/types/InsuranceClaim.d.ts +19 -0
  94. package/dist/generated/reflect_main/types/InsuranceFund.d.ts +24 -0
  95. package/dist/generated/reflect_main/types/JlpRebalanceSettings.d.ts +15 -0
  96. package/dist/generated/reflect_main/types/KillSwitch.d.ts +15 -0
  97. package/dist/generated/reflect_main/types/LevelRoles.d.ts +16 -0
  98. package/dist/generated/reflect_main/types/MarketStatus.d.ts +27 -0
  99. package/dist/generated/reflect_main/types/MarketType.d.ts +20 -0
  100. package/dist/generated/reflect_main/types/ModifyOrderParams.d.ts +32 -0
  101. package/dist/generated/reflect_main/types/ModifyOrderPolicy.d.ts +20 -0
  102. package/dist/generated/reflect_main/types/Movements.d.ts +19 -0
  103. package/dist/generated/reflect_main/types/OracleGuardRails.d.ts +18 -0
  104. package/dist/generated/reflect_main/types/OracleSource.d.ts +34 -0
  105. package/dist/generated/reflect_main/types/OracleValidity.d.ts +25 -0
  106. package/dist/generated/reflect_main/types/Order.d.ts +43 -0
  107. package/dist/generated/reflect_main/types/OrderDirection.d.ts +20 -0
  108. package/dist/generated/reflect_main/types/OrderParams.d.ts +36 -0
  109. package/dist/generated/reflect_main/types/OrderStatus.d.ts +22 -0
  110. package/dist/generated/reflect_main/types/OrderTriggerCondition.d.ts +22 -0
  111. package/dist/generated/reflect_main/types/OrderType.d.ts +23 -0
  112. package/dist/generated/reflect_main/types/PermissionLevel.d.ts +45 -0
  113. package/dist/generated/reflect_main/types/PerpHedge.d.ts +17 -0
  114. package/dist/generated/reflect_main/types/PerpPosition.d.ts +29 -0
  115. package/dist/generated/reflect_main/types/PoolBalance.d.ts +17 -0
  116. package/dist/generated/reflect_main/types/Position.d.ts +20 -0
  117. package/dist/generated/reflect_main/types/PositionDirection.d.ts +20 -0
  118. package/dist/generated/reflect_main/types/PositionDrift.d.ts +18 -0
  119. package/dist/generated/reflect_main/types/PostOnlyParam.d.ts +22 -0
  120. package/dist/generated/reflect_main/types/Price.d.ts +41 -0
  121. package/dist/generated/reflect_main/types/PriceComp.d.ts +19 -0
  122. package/dist/generated/reflect_main/types/PriceDivergenceGuardRails.d.ts +16 -0
  123. package/dist/generated/reflect_main/types/PriceInfo.d.ts +21 -0
  124. package/dist/generated/reflect_main/types/PriceStatus.d.ts +22 -0
  125. package/dist/generated/reflect_main/types/PriceType.d.ts +20 -0
  126. package/dist/generated/reflect_main/types/Program.d.ts +19 -0
  127. package/dist/generated/reflect_main/types/ProgramStatus.d.ts +20 -0
  128. package/dist/generated/reflect_main/types/Recipient.d.ts +17 -0
  129. package/dist/generated/reflect_main/types/Recipients.d.ts +17 -0
  130. package/dist/generated/reflect_main/types/Role.d.ts +25 -0
  131. package/dist/generated/reflect_main/types/ShiftCollateral.d.ts +19 -0
  132. package/dist/generated/reflect_main/types/ShiftPosition.d.ts +17 -0
  133. package/dist/generated/reflect_main/types/ShortHolding.d.ts +17 -0
  134. package/dist/generated/reflect_main/types/SplBase.d.ts +17 -0
  135. package/dist/generated/reflect_main/types/SplMain.d.ts +22 -0
  136. package/dist/generated/reflect_main/types/Spls.d.ts +17 -0
  137. package/dist/generated/reflect_main/types/SpotBalanceType.d.ts +20 -0
  138. package/dist/generated/reflect_main/types/SpotPosition.d.ts +23 -0
  139. package/dist/generated/reflect_main/types/Status.d.ts +21 -0
  140. package/dist/generated/reflect_main/types/Strategy.d.ts +32 -0
  141. package/dist/generated/reflect_main/types/StrategyPadding.d.ts +15 -0
  142. package/dist/generated/reflect_main/types/StrategyRoleEntry.d.ts +17 -0
  143. package/dist/generated/reflect_main/types/SubAccount.d.ts +17 -0
  144. package/dist/generated/reflect_main/types/Update.d.ts +20 -0
  145. package/dist/generated/reflect_main/types/UserFees.d.ts +20 -0
  146. package/dist/generated/reflect_main/types/ValidityGuardRails.d.ts +18 -0
  147. package/dist/generated/reflect_main/types/index.d.ts +80 -0
  148. package/dist/generated/reflect_tokenised_bonds/accounts/Admin.d.ts +99 -0
  149. package/dist/generated/reflect_tokenised_bonds/accounts/Config.d.ts +106 -0
  150. package/dist/generated/reflect_tokenised_bonds/accounts/Vault.d.ts +114 -0
  151. package/dist/generated/reflect_tokenised_bonds/accounts/index.d.ts +11 -0
  152. package/dist/generated/reflect_tokenised_bonds/errors/index.d.ts +144 -0
  153. package/dist/generated/reflect_tokenised_bonds/index.d.ts +19 -0
  154. package/dist/generated/reflect_tokenised_bonds/instructions/createVault.d.ts +50 -0
  155. package/dist/generated/reflect_tokenised_bonds/instructions/deposit.d.ts +62 -0
  156. package/dist/generated/reflect_tokenised_bonds/instructions/index.d.ts +4 -0
  157. package/dist/generated/reflect_tokenised_bonds/instructions/initialize.d.ts +43 -0
  158. package/dist/generated/reflect_tokenised_bonds/instructions/withdraw.d.ts +62 -0
  159. package/dist/generated/reflect_tokenised_bonds/types/DepositArgs.d.ts +17 -0
  160. package/dist/generated/reflect_tokenised_bonds/types/Permissions.d.ts +21 -0
  161. package/dist/generated/reflect_tokenised_bonds/types/WithdrawArgs.d.ts +16 -0
  162. package/dist/generated/reflect_tokenised_bonds/types/index.d.ts +3 -0
  163. package/dist/helpers/getOrcaQuote.d.ts +3 -0
  164. package/dist/idl/perpetuals.d.ts +5771 -0
  165. package/dist/index.d.ts +9 -0
  166. package/dist/index.js +1 -0
  167. package/dist/stablecoins/LstStablecoin.d.ts +103 -0
  168. package/dist/stablecoins/UsdcPlusStablecoin.d.ts +86 -0
  169. package/dist/stablecoins/UsdjStablecoin.d.ts +1 -0
  170. package/dist/stablecoins/index.d.ts +3 -0
  171. package/dist/types/api.d.ts +1172 -0
  172. package/dist/types/api.js +6 -0
  173. package/dist/types/index.d.ts +81 -0
  174. package/dist/types/index.js +2 -0
  175. package/package.json +1 -1
@@ -0,0 +1,56 @@
1
+ import { paths } from "../types/api";
2
+ declare enum ApiEnvironment {
3
+ PROD = 0,
4
+ DEV = 1
5
+ }
6
+ declare class ApiClient {
7
+ private environment;
8
+ private url;
9
+ private supportedMarkets;
10
+ constructor(environment: ApiEnvironment);
11
+ private getUrl;
12
+ getHealth(): Promise<{
13
+ success: boolean;
14
+ message: string;
15
+ timestamp: string;
16
+ }>;
17
+ getSupportedMarkets(): Promise<string[]>;
18
+ getFundingRates(market: string, period: paths["/funding/rates"]["get"]["parameters"]["query"]["period"]): Promise<{
19
+ success: boolean;
20
+ data: import("../types/api").components["schemas"]["FundingRateData"][];
21
+ count: number;
22
+ period: "day" | "week" | "month" | "year";
23
+ market?: string;
24
+ }>;
25
+ getApySummaryForAllStrategies(strategy: paths["/apy"]["get"]["parameters"]["query"], historical: boolean): Promise<void>;
26
+ getApyForStrategy(strategy: paths["/apy/{strategy}"]["get"]["parameters"]["query"], historical: boolean): Promise<({
27
+ success: boolean;
28
+ } & {
29
+ data: import("../types/api").components["schemas"]["UsdcApyData"];
30
+ }) | ({
31
+ success: boolean;
32
+ } & {
33
+ data: import("../types/api").components["schemas"]["JlpApyData"];
34
+ }) | ({
35
+ success: boolean;
36
+ } & {
37
+ data: import("../types/api").components["schemas"]["LstApyData"];
38
+ })>;
39
+ getSupplyCapInfo(): Promise<{
40
+ success: boolean;
41
+ data: {
42
+ 0?: import("../types/api").components["schemas"]["SupplyCapInfo"];
43
+ 2?: import("../types/api").components["schemas"]["SupplyCapInfo"];
44
+ };
45
+ }>;
46
+ getStablecoinList(): Promise<{
47
+ success: boolean;
48
+ data: {
49
+ index: number;
50
+ name: string;
51
+ }[];
52
+ }>;
53
+ getStablecoinHoldersForStrategy(): Promise<void>;
54
+ getExchangeRateForStablecoin(): Promise<void>;
55
+ }
56
+ export { ApiClient };
@@ -0,0 +1,131 @@
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
130
+ static deriveLpVaultPool(vaultId: number): PublicKey;
131
+ }
@@ -0,0 +1,7 @@
1
+ import { Connection } from "@solana/web3.js";
2
+ import { Main } from "../generated/reflect_main";
3
+ export declare class Reflect {
4
+ connection: Connection;
5
+ constructor(connection: Connection);
6
+ fetchMain(): Promise<Main>;
7
+ }
@@ -0,0 +1,105 @@
1
+ import { Connection, PublicKey } from "@solana/web3.js";
2
+ import { Action, Role, Update, UserPermissions } 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
+ */
14
+ export declare class ReflectKeeper {
15
+ /** Public key of the admin user */
16
+ private admin;
17
+ /** Public key of the main program account */
18
+ private main;
19
+ /** Solana connection instance for RPC communication */
20
+ private connection;
21
+ /**
22
+ * Creates a new ReflectKeeper instance.
23
+ *
24
+ * @param admin - Public key of the admin user
25
+ * @param connection - Solana connection instance
26
+ */
27
+ constructor({ admin, connection }: {
28
+ admin: PublicKey;
29
+ connection: Connection;
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
+ */
37
+ static initializeMain(admin: PublicKey): import("@solana/web3.js").TransactionInstruction;
38
+ getPermissionAccount(): Promise<UserPermissions>;
39
+ /**
40
+ * Freezes or unfreezes a specific protocol action.
41
+ *
42
+ * @param freeze - Whether to freeze (true) or unfreeze (false) the action
43
+ * @param action - The action to freeze/unfreeze
44
+ * @returns Promise resolving to a TransactionInstruction
45
+ */
46
+ freezeProtocolAction(freeze: boolean, action: Action): Promise<import("@solana/web3.js").TransactionInstruction>;
47
+ /**
48
+ * Freezes or unfreezes a specific DEX program.
49
+ *
50
+ * @param freeze - Whether to freeze (true) or unfreeze (false) the program
51
+ * @param programIndex - Index of the program to freeze/unfreeze
52
+ * @returns Promise resolving to a TransactionInstruction
53
+ */
54
+ freezeDex(freeze: boolean, programIndex: number): Promise<import("@solana/web3.js").TransactionInstruction>;
55
+ /**
56
+ * Creates a new admin account with specified permissions.
57
+ *
58
+ * @param signer - Public key of the caller (must be existing admin)
59
+ * @param newAdmin - Public key of the new admin to create
60
+ * @returns Promise resolving to a TransactionInstruction
61
+ */
62
+ createAdminAccount(signer: PublicKey, newAdmin: PublicKey): Promise<import("@solana/web3.js").TransactionInstruction>;
63
+ /**
64
+ * Updates role holder permissions at the protocol level.
65
+ *
66
+ * @param signer - Public key of the admin signer
67
+ * @param adminToUpdate - Public key of the admin whose permissions are being updated
68
+ * @param affectedRole - The role being modified
69
+ * @param update - The type of update (Grant or Revoke)
70
+ * @returns Promise resolving to a TransactionInstruction
71
+ */
72
+ updateRoleHolderProtocol(signer: PublicKey, adminToUpdate: PublicKey, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
73
+ /**
74
+ * Updates role holder permissions for a specific strategy.
75
+ *
76
+ * @param signer - Public key of the admin signer
77
+ * @param strategyId - ID of the strategy to update permissions for
78
+ * @param adminToUpdate - Public key of the admin whose permissions are being updated
79
+ * @param affectedRole - The role being modified
80
+ * @param update - The type of update (Grant or Revoke)
81
+ * @returns Promise resolving to a TransactionInstruction
82
+ */
83
+ updateRoleHolderStrategy(signer: PublicKey, strategyId: number, adminToUpdate: PublicKey, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
84
+ /**
85
+ * Updates action role permissions for a specific strategy.
86
+ *
87
+ * @param signer - Public key of the admin signer
88
+ * @param strategyId - ID of the strategy to update permissions for
89
+ * @param action - The action being modified
90
+ * @param affectedRole - The role being modified
91
+ * @param update - The type of update (Grant or Revoke)
92
+ * @returns Promise resolving to a TransactionInstruction
93
+ */
94
+ updateActionRoleStrategy(signer: PublicKey, strategyId: number, action: Action, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
95
+ /**
96
+ * Updates action role permissions at the protocol level.
97
+ *
98
+ * @param signer - Public key of the admin signer
99
+ * @param action - The action being modified
100
+ * @param affectedRole - The role being modified
101
+ * @param update - The type of update (Grant or Revoke)
102
+ * @returns Promise resolving to a TransactionInstruction
103
+ */
104
+ updateActionRoleProtocol(signer: PublicKey, action: Action, affectedRole: Role, update: Update): Promise<import("@solana/web3.js").TransactionInstruction>;
105
+ }
@@ -0,0 +1,75 @@
1
+ import { Connection } from "@solana/web3.js";
2
+ import { Vault } from "../generated/reflect_tokenised_bonds";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ import BN from "bn.js";
5
+ import { Keypair } from "@solana/web3.js";
6
+ /**
7
+ * Client class for interacting with the Reflect Tokenised Bonds program.
8
+ * Provides functionality for creating and managing tokenized bond vaults,
9
+ * including receipt token creation, vault initialization, deposits, and withdrawals.
10
+ *
11
+ * This class handles the tokenized bonds aspect of the Reflect protocol,
12
+ * allowing users to deposit assets and receive receipt tokens representing
13
+ * their share of the vault.
14
+ */
15
+ export declare class ReflectTokenisedBond {
16
+ /** Solana connection instance for RPC communication */
17
+ connection: Connection;
18
+ /**
19
+ * Creates a new ReflectTokenisedBond instance.
20
+ *
21
+ * @param connection - Solana connection instance
22
+ */
23
+ constructor(connection: Connection);
24
+ /**
25
+ * Creates a receipt token for a vault.
26
+ * Generates a new keypair for the receipt token mint and creates the necessary instructions.
27
+ *
28
+ * @param connection - Solana connection instance
29
+ * @param signer - Public key of the transaction signer
30
+ * @param vault - Public key of the vault account
31
+ * @returns Promise resolving to an object containing instructions and signers
32
+ */
33
+ createReceiptToken(decimals: number, connection: Connection, signer: PublicKey, vault: PublicKey): Promise<{
34
+ instructions: import("@solana/web3.js").TransactionInstruction[];
35
+ signers: Keypair[];
36
+ }>;
37
+ /**
38
+ * Initializes the tokenized bonds program.
39
+ * Creates the config and admin accounts for the program.
40
+ *
41
+ * @param signer - Public key of the admin signer
42
+ * @returns Promise resolving to a TransactionInstruction
43
+ */
44
+ initialize(signer: PublicKey): Promise<import("@solana/web3.js").TransactionInstruction>;
45
+ /**
46
+ * Initializes a new vault with specified deposit and receipt mints.
47
+ *
48
+ * @param signer - Public key of the admin signer
49
+ * @param depositMint - Public key of the deposit token mint
50
+ * @param receiptMint - Public key of the receipt token mint
51
+ * @returns Promise resolving to a TransactionInstruction
52
+ */
53
+ initializeVault(signer: PublicKey, depositMint: PublicKey, receiptMint: PublicKey): Promise<import("@solana/web3.js").TransactionInstruction>;
54
+ /**
55
+ * Creates a deposit instruction for a vault.
56
+ * Allows users to deposit assets and receive receipt tokens.
57
+ *
58
+ * @param signer - Public key of the user making the deposit
59
+ * @param vaultId - Numeric identifier for the vault
60
+ * @param amount - Amount of deposit tokens to deposit
61
+ * @returns Promise resolving to a TransactionInstruction
62
+ */
63
+ deposit(signer: PublicKey, vaultId: number, amount: BN): Promise<import("@solana/web3.js").TransactionInstruction>;
64
+ /**
65
+ * Creates a withdrawal instruction for a vault.
66
+ * Allows users to burn receipt tokens and receive back their deposit tokens.
67
+ *
68
+ * @param signer - Public key of the user making the withdrawal
69
+ * @param vaultId - Numeric identifier for the vault
70
+ * @param amount - Amount of receipt tokens to burn for withdrawal
71
+ * @returns Promise resolving to a TransactionInstruction
72
+ */
73
+ withdraw(signer: PublicKey, vaultId: number, amount: BN): Promise<import("@solana/web3.js").TransactionInstruction>;
74
+ getVault(vaultId: number): Promise<Vault>;
75
+ }
@@ -0,0 +1,219 @@
1
+ import { AccountMeta, Connection, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js";
2
+ import BN from "bn.js";
3
+ import { DriftClient } from "@drift-labs/sdk";
4
+ import { Action, Strategy } from "../generated/reflect_main";
5
+ import { StablecoinMetadata, Collateral, Controller, MintContext, PythResponse } from "../types";
6
+ /**
7
+ * Abstract base class for all stablecoin implementations in the Reflect protocol.
8
+ * Provides common functionality for managing stablecoins including initialization,
9
+ * minting, redemption, rebalancing, and administrative operations.
10
+ *
11
+ * This class serves as the foundation for different stablecoins:
12
+ * - USDC+ (Index 0): Stablecoin backed by USDC deployed in money markets
13
+ * - JLP Hedged (Index 1): JLP token hedged with perpetual positions
14
+ * - LST Delta-Neutral (Index 2): Stablecoin backed by LSTs and delta-neutral strategies
15
+ */
16
+ export declare abstract class Stablecoin<T extends Controller> {
17
+ /** Unique index identifier for the stablecoin */
18
+ index: number;
19
+ /** Human-readable name of the stablecoin */
20
+ name: string;
21
+ /** Solana connection instance for communication */
22
+ connection: Connection;
23
+ /** Public key of the controller account for this stablecoin */
24
+ controllerKey: PublicKey;
25
+ /** Public key of the controller account for this stablecoin */
26
+ controller: T;
27
+ /** Public key of the controller account for this stablecoin */
28
+ strategy: Strategy;
29
+ /** Array of collateral assets backing this stablecoin */
30
+ collaterals: Collateral[];
31
+ /** Public key of the stablecoin mint */
32
+ stablecoinMint: PublicKey;
33
+ /** Optional Drift client instance for DeFi operations */
34
+ driftClient?: DriftClient;
35
+ /** Lookup table with stablecoin-specific accounts. */
36
+ lookupTable: PublicKey;
37
+ /**
38
+ * Loads the controller account for this stablecoin.
39
+ *
40
+ * @returns Promise resolving to void, sets the controller and strategy fields
41
+ */
42
+ load(schema: {
43
+ fromAccountAddress: (connection: Connection, key: PublicKey) => Promise<T>;
44
+ }): Promise<void>;
45
+ buildLookupTables<T extends MintContext>(signer: PublicKey): Promise<{
46
+ instructions: TransactionInstruction[];
47
+ lookupTable: PublicKey;
48
+ }>;
49
+ setLookupTable(address: PublicKey): void;
50
+ /**
51
+ * Creates a new Stablecoin instance.
52
+ *
53
+ * @param index - Unique strategy index (0: USDC+, 1: JLP, 2: LST)
54
+ * @param name - Human-readable name for the stablecoin
55
+ * @param connection - Solana connection instance
56
+ */
57
+ constructor(index: number, name: string, connection: Connection, lookupTable: PublicKey);
58
+ /**
59
+ * Initializes token accounts for the specified owner and mints.
60
+ * Creates associated token accounts if they don't exist.
61
+ *
62
+ * @param owner - Public key of the token account owner
63
+ * @param mints - Array of mint public keys to create accounts for
64
+ * @param signer - Public key of the transaction signer
65
+ * @returns Promise resolving to an array of TransactionInstruction objects
66
+ */
67
+ initializeTokenAccounts(owner: PublicKey, mints: PublicKey[], signer: PublicKey): Promise<TransactionInstruction[]>;
68
+ /**
69
+ * Updates the supply cap for this stablecoin strategy.
70
+ *
71
+ * @param signer - Public key of the admin signer
72
+ * @param newCap - New maximum supply cap as BN or number
73
+ * @returns Promise resolving to a TransactionInstruction
74
+ */
75
+ updateCap(signer: PublicKey, newCap: BN | number): Promise<TransactionInstruction>;
76
+ /**
77
+ * Updates the recipient addresses and their fee cuts for this stablecoin.
78
+ *
79
+ * @param signer - Public key of the admin signer
80
+ * @param recipients - Map of recipient public keys to their fee (in basepoints)
81
+ * @returns Promise resolving to a TransactionInstruction
82
+ */
83
+ updateRecipients(signer: PublicKey, recipients: Map<PublicKey, number>): Promise<TransactionInstruction>;
84
+ /**
85
+ * Initializes a Drift sub-account for this stablecoin controller.
86
+ *
87
+ * @param signer - Public key of the admin signer
88
+ * @param subAccountId - Sub-account identifier (default: 0)
89
+ * @returns Promise resolving to a TransactionInstruction
90
+ */
91
+ initializeStablecoinDriftAccount(signer: PublicKey, subAccountId?: number): Promise<TransactionInstruction>;
92
+ /**
93
+ * Initializes the Drift user stats account for this stablecoin controller.
94
+ *
95
+ * @param signer - Public key of the admin signer
96
+ * @returns Promise resolving to a TransactionInstruction
97
+ */
98
+ initializeStablecoinDriftStatsAccount(signer: PublicKey): Promise<TransactionInstruction>;
99
+ /**
100
+ * Freezes or unfreezes a specific action for this stablecoin strategy.
101
+ *
102
+ * @param signer - Public key of the admin signer
103
+ * @param freeze - Whether to freeze (true) or unfreeze (false) the action
104
+ * @param action - The action to freeze/unfreeze
105
+ * @returns Promise resolving to a TransactionInstruction
106
+ */
107
+ freeze(signer: PublicKey, freeze: boolean, action: Action): Promise<TransactionInstruction>;
108
+ /**
109
+ * Initializes the stablecoin mint with optional metadata.
110
+ *
111
+ * @param signer - Public key of the admin signer
112
+ * @param tokenKeypair - Keypair for the new mint account
113
+ * @param metadata - Optional metadata for the stablecoin
114
+ * @returns Promise resolving to an array of TransactionInstruction objects
115
+ */
116
+ initializeStablecoin(signer: PublicKey, tokenKeypair: Keypair, metadata?: StablecoinMetadata): Promise<TransactionInstruction[]>;
117
+ /**
118
+ * Updates the rebalance slippage tolerance for this stablecoin strategy.
119
+ *
120
+ * @param signer - Public key of the admin signer
121
+ * @param slippage - New slippage tolerance value
122
+ * @returns Promise resolving to a TransactionInstruction
123
+ */
124
+ updateRebalanceSlippage(signer: PublicKey, slippage: number): Promise<TransactionInstruction>;
125
+ /**
126
+ * Fetches the current price of a collateral asset from Pyth oracle.
127
+ *
128
+ * @param mint - Public key of the collateral mint
129
+ * @returns Promise resolving to the collateral price data
130
+ */
131
+ getCollateralPrice(mint: PublicKey): Promise<import("axios").AxiosResponse<PythResponse, any>>;
132
+ /**
133
+ * Converts a stablecoin amount to the equivalent collateral amount, factoring in slippage (in bips).
134
+ * All math is done using BN for safety.
135
+ * @param amount Amount of stablecoin (BN)
136
+ * @param collateralMint Collateral mint PublicKey
137
+ * @param slippageBips Slippage in bips (1 bip = 0.01%, e.g. 50 = 0.5%)
138
+ * @returns Promise resolving to the collateral amount (BN)
139
+ */
140
+ stablecoinToCollateralWithSlippage(amount: BN, collateralMint: PublicKey, slippageBips: number): Promise<BN>;
141
+ /**
142
+ * Converts a collateral amount to the equivalent stablecoin amount, factoring in slippage (in bips).
143
+ * All math is done using BN for safety.
144
+ * @param amount Amount of collateral (BN)
145
+ * @param collateralMint Collateral mint PublicKey
146
+ * @param slippageBips Slippage in bips (1 bip = 0.01%, e.g. 50 = 0.5%)
147
+ * @returns Promise resolving to the stablecoin amount (BN)
148
+ */
149
+ collateralToStablecoinWithSlippage(amount: BN, collateralMint: PublicKey, slippageBips: number): Promise<BN>;
150
+ /**
151
+ * Abstract method to construct required accounts for transactions.
152
+ * Must be implemented by concrete stablecoin classes.
153
+ *
154
+ * @param signer - Public key of the transaction signer
155
+ * @param args - Additional arguments specific to the stablecoin implementation
156
+ * @returns Promise resolving to the constructed accounts object of type T
157
+ */
158
+ abstract constructAccounts<T extends MintContext>(signer: PublicKey, ...args: any[]): Promise<T>;
159
+ /**
160
+ * Abstract method to construct remaining accounts for transactions.
161
+ * Must be implemented by concrete stablecoin classes.
162
+ *
163
+ * @returns Promise resolving to an array of AccountMeta objects
164
+ */
165
+ abstract constructRemainingAccounts(): Promise<AccountMeta[]>;
166
+ /**
167
+ * Abstract method to initialize the stablecoin strategy.
168
+ * Must be implemented by concrete stablecoin classes.
169
+ *
170
+ * @param signer - Public key of the admin signer
171
+ * @param args - Additional arguments specific to the stablecoin implementation
172
+ * @returns Promise resolving to an array of TransactionInstruction objects
173
+ */
174
+ abstract initialize(signer: PublicKey, ...args: any[]): Promise<TransactionInstruction[]>;
175
+ /**
176
+ * Abstract method to create mint instructions for the stablecoin.
177
+ * Must be implemented by concrete stablecoin classes.
178
+ *
179
+ * @param signer - Public key of the user minting stablecoins
180
+ * @param amount - Amount of stablecoins to mint
181
+ * @param minimumReceived - Minimum amount of stablecoins to receive (slippage protection)
182
+ * @param args - Additional arguments specific to the stablecoin implementation
183
+ * @returns Promise resolving to an array of TransactionInstruction objects
184
+ */
185
+ abstract mint(signer: PublicKey, amount: BN | number, minimumReceived: BN | number, ...args: any[]): Promise<TransactionInstruction[]>;
186
+ /**
187
+ * Abstract method to create redeem instructions for the stablecoin.
188
+ * Must be implemented by concrete stablecoin classes.
189
+ *
190
+ * @param signer - Public key of the user redeeming stablecoins
191
+ * @param amount - Amount of stablecoins to redeem
192
+ * @param minimumReceived - Minimum amount of collateral to receive (slippage protection)
193
+ * @param args - Additional arguments specific to the stablecoin implementation
194
+ * @returns Promise resolving to an array of TransactionInstruction objects
195
+ */
196
+ abstract redeem(signer: PublicKey, amount: BN | number, minimumReceived: BN | number, ...args: any[]): Promise<TransactionInstruction[]>;
197
+ /**
198
+ * Abstract method to create rebalance instructions for the stablecoin.
199
+ * Must be implemented by concrete stablecoin classes.
200
+ *
201
+ * @param signer - Public key of the admin signer
202
+ * @returns Promise resolving to an array of TransactionInstruction objects
203
+ */
204
+ abstract rebalance(signer: PublicKey): Promise<TransactionInstruction[]>;
205
+ /**
206
+ * Abstract method to get the USD exchange rate for the base collateral of the stablecoin.
207
+ * Must be implemented by concrete stablecoin classes.
208
+ *
209
+ * @returns Promise resolving to the USD exchange rate as a number
210
+ */
211
+ abstract getBaseUsdExchangeRate(): Promise<number>;
212
+ /**
213
+ * Abstract method to get the USD exchange rate for the receipt token of the stablecoin.
214
+ * Must be implemented by concrete stablecoin classes.
215
+ *
216
+ * @returns Promise resolving to the USD exchange rate as a number
217
+ */
218
+ abstract getReceiptUsdExchangeRate(): Promise<number>;
219
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./ReflectKeeper";
2
+ export * from "./PdaClient";
3
+ export * from "./Stablecoin";
4
+ export * from "./Reflect";
@@ -0,0 +1,6 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ declare const DRIFT_VAULT: PublicKey;
3
+ declare const DRIFT_PROGRAM_ID: PublicKey;
4
+ declare const REFERRAL_USER: PublicKey;
5
+ declare const REFERRAL_USER_STATS: PublicKey;
6
+ export { DRIFT_VAULT, REFERRAL_USER, REFERRAL_USER_STATS, DRIFT_PROGRAM_ID };
@@ -0,0 +1,8 @@
1
+ export * from "./usdc";
2
+ export * from "./drift";
3
+ export * from "./wsol";
4
+ export * from "./jupiter";
5
+ export * from "./pyth";
6
+ export * from "./lst";
7
+ export * from "./lookupTables";
8
+ export declare const EXCHANGE_RATE_PRECISION = 10000;
@@ -0,0 +1,4 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ declare const JUPITER_PROGRAM_ID: PublicKey;
3
+ declare const JLP_MINT: PublicKey;
4
+ export { JUPITER_PROGRAM_ID, JLP_MINT };
@@ -0,0 +1,4 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ export declare const USDC_PLUS_LOOKUP_TABLE: PublicKey;
3
+ export declare const JLP_LOOKUP_TABLE: PublicKey;
4
+ export declare const LST_LOOKUP_TABLE: PublicKey;
@@ -0,0 +1,3 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ declare const JITO_SOL_MINT: PublicKey;
3
+ export { JITO_SOL_MINT };
@@ -0,0 +1 @@
1
+ export declare const PYTH_API_URL = "https://hermes.pyth.network/api/latest_price_feeds?ids[]=";
@@ -0,0 +1,6 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ export declare const USDC_MINT: PublicKey;
3
+ export declare const USDC_PUSH_ORACLE: PublicKey;
4
+ export declare const USDC_PULL_ORACLE: PublicKey;
5
+ export declare const USDC_SPOT_MARKET: PublicKey;
6
+ export declare const USDC_DRIFT_VAULT: PublicKey;
@@ -0,0 +1,6 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ export declare const WSOL_PUSH_ORACLE: PublicKey;
3
+ export declare const WSOL_PULL_ORACLE: PublicKey;
4
+ export declare const WSOL_SPOT_MARKET: PublicKey;
5
+ export declare const WSOL_PERP_MARKET: PublicKey;
6
+ export declare const WSOL_MINT: PublicKey;
@@ -0,0 +1,4 @@
1
+ declare class ReflectError extends Error {
2
+ constructor(msg: string);
3
+ }
4
+ export default ReflectError;