@haven-fi/solauto-sdk 1.0.581 → 1.0.583

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 (268) hide show
  1. package/dist/constants/solautoConstants.d.ts +1 -0
  2. package/dist/constants/solautoConstants.d.ts.map +1 -1
  3. package/dist/constants/solautoConstants.js +4 -10
  4. package/dist/constants/switchboardConstants.d.ts.map +1 -1
  5. package/dist/constants/switchboardConstants.js +5 -5
  6. package/dist/generated/accounts/solautoPosition.js +2 -2
  7. package/dist/generated/errors/solauto.d.ts +14 -2
  8. package/dist/generated/errors/solauto.d.ts.map +1 -1
  9. package/dist/generated/errors/solauto.js +27 -5
  10. package/dist/generated/instructions/claimReferralFees.d.ts +1 -1
  11. package/dist/generated/instructions/claimReferralFees.d.ts.map +1 -1
  12. package/dist/generated/instructions/closePosition.d.ts +1 -1
  13. package/dist/generated/instructions/closePosition.d.ts.map +1 -1
  14. package/dist/generated/instructions/closePosition.js +2 -2
  15. package/dist/generated/instructions/marginfiOpenPosition.d.ts +1 -3
  16. package/dist/generated/instructions/marginfiOpenPosition.d.ts.map +1 -1
  17. package/dist/generated/instructions/marginfiOpenPosition.js +0 -1
  18. package/dist/generated/instructions/marginfiRebalance.d.ts +7 -3
  19. package/dist/generated/instructions/marginfiRebalance.d.ts.map +1 -1
  20. package/dist/generated/instructions/marginfiRebalance.js +3 -1
  21. package/dist/generated/types/index.d.ts +7 -1
  22. package/dist/generated/types/index.d.ts.map +1 -1
  23. package/dist/generated/types/index.js +7 -1
  24. package/dist/generated/types/positionData.d.ts +2 -2
  25. package/dist/generated/types/positionData.d.ts.map +1 -1
  26. package/dist/generated/types/positionData.js +1 -1
  27. package/dist/generated/types/positionState.d.ts +7 -7
  28. package/dist/generated/types/positionState.d.ts.map +1 -1
  29. package/dist/generated/types/positionState.js +3 -3
  30. package/dist/generated/types/{positionTokenUsage.d.ts → positionTokenState.d.ts} +6 -8
  31. package/dist/generated/types/positionTokenState.d.ts.map +1 -0
  32. package/dist/generated/types/{positionTokenUsage.js → positionTokenState.js} +6 -7
  33. package/dist/generated/types/rebalanceData.d.ts +7 -13
  34. package/dist/generated/types/rebalanceData.d.ts.map +1 -1
  35. package/dist/generated/types/rebalanceData.js +3 -6
  36. package/dist/generated/types/rebalanceDirection.d.ts +3 -2
  37. package/dist/generated/types/rebalanceDirection.d.ts.map +1 -1
  38. package/dist/generated/types/rebalanceDirection.js +3 -2
  39. package/dist/generated/types/rebalanceInstructionData.d.ts +27 -0
  40. package/dist/generated/types/rebalanceInstructionData.d.ts.map +1 -0
  41. package/dist/generated/types/rebalanceInstructionData.js +22 -0
  42. package/dist/generated/types/rebalanceStateValues.d.ts +27 -0
  43. package/dist/generated/types/rebalanceStateValues.d.ts.map +1 -0
  44. package/dist/generated/types/rebalanceStateValues.js +22 -0
  45. package/dist/generated/types/rebalanceStep.d.ts +15 -0
  46. package/dist/generated/types/rebalanceStep.d.ts.map +1 -0
  47. package/dist/generated/types/rebalanceStep.js +22 -0
  48. package/dist/generated/types/solautoRebalanceType.d.ts +4 -5
  49. package/dist/generated/types/solautoRebalanceType.d.ts.map +1 -1
  50. package/dist/generated/types/solautoRebalanceType.js +4 -5
  51. package/dist/generated/types/solautoSettingsParameters.d.ts +2 -15
  52. package/dist/generated/types/solautoSettingsParameters.d.ts.map +1 -1
  53. package/dist/generated/types/solautoSettingsParameters.js +1 -5
  54. package/dist/generated/types/solautoSettingsParametersInp.d.ts +1 -12
  55. package/dist/generated/types/solautoSettingsParametersInp.d.ts.map +1 -1
  56. package/dist/generated/types/solautoSettingsParametersInp.js +0 -3
  57. package/dist/generated/types/swapType.d.ts +15 -0
  58. package/dist/generated/types/swapType.d.ts.map +1 -0
  59. package/dist/generated/types/swapType.js +22 -0
  60. package/dist/generated/types/tokenBalanceChange.d.ts +21 -0
  61. package/dist/generated/types/tokenBalanceChange.d.ts.map +1 -0
  62. package/dist/generated/types/tokenBalanceChange.js +19 -0
  63. package/dist/generated/types/tokenBalanceChangeType.d.ts +18 -0
  64. package/dist/generated/types/tokenBalanceChangeType.d.ts.map +1 -0
  65. package/dist/generated/types/tokenBalanceChangeType.js +25 -0
  66. package/dist/generated/types/updatePositionData.d.ts +2 -2
  67. package/dist/generated/types/updatePositionData.d.ts.map +1 -1
  68. package/dist/generated/types/updatePositionData.js +1 -1
  69. package/dist/index.d.ts +8 -6
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +5 -5
  72. package/dist/marginfi-sdk/types/interestRateConfig.d.ts +3 -1
  73. package/dist/marginfi-sdk/types/interestRateConfig.d.ts.map +1 -1
  74. package/dist/marginfi-sdk/types/interestRateConfig.js +2 -1
  75. package/dist/services/flashLoans/flProviderAggregator.d.ts +19 -0
  76. package/dist/services/flashLoans/flProviderAggregator.d.ts.map +1 -0
  77. package/dist/services/flashLoans/flProviderAggregator.js +46 -0
  78. package/dist/services/flashLoans/flProviderBase.d.ts +23 -0
  79. package/dist/services/flashLoans/flProviderBase.d.ts.map +1 -0
  80. package/dist/services/flashLoans/flProviderBase.js +37 -0
  81. package/dist/services/flashLoans/index.d.ts +4 -0
  82. package/dist/services/flashLoans/index.d.ts.map +1 -0
  83. package/dist/services/flashLoans/index.js +19 -0
  84. package/dist/services/flashLoans/marginfiFlProvider.d.ts +25 -0
  85. package/dist/services/flashLoans/marginfiFlProvider.d.ts.map +1 -0
  86. package/dist/services/flashLoans/marginfiFlProvider.js +246 -0
  87. package/dist/services/index.d.ts +6 -0
  88. package/dist/services/index.d.ts.map +1 -0
  89. package/dist/services/index.js +21 -0
  90. package/dist/services/rebalance/index.d.ts +3 -0
  91. package/dist/services/rebalance/index.d.ts.map +1 -0
  92. package/dist/services/rebalance/index.js +18 -0
  93. package/dist/services/rebalance/rebalanceSwapManager.d.ts +30 -0
  94. package/dist/services/rebalance/rebalanceSwapManager.d.ts.map +1 -0
  95. package/dist/services/rebalance/rebalanceSwapManager.js +144 -0
  96. package/dist/services/rebalance/rebalanceTxBuilder.d.ts +22 -0
  97. package/dist/services/rebalance/rebalanceTxBuilder.d.ts.map +1 -0
  98. package/dist/services/rebalance/rebalanceTxBuilder.js +200 -0
  99. package/dist/services/rebalance/rebalanceValues.d.ts +31 -0
  100. package/dist/services/rebalance/rebalanceValues.d.ts.map +1 -0
  101. package/dist/services/rebalance/rebalanceValues.js +118 -0
  102. package/dist/services/rebalance/solautoFees.d.ts +13 -0
  103. package/dist/services/rebalance/solautoFees.d.ts.map +1 -0
  104. package/dist/services/rebalance/solautoFees.js +54 -0
  105. package/dist/services/solauto/index.d.ts +5 -0
  106. package/dist/services/solauto/index.d.ts.map +1 -0
  107. package/dist/{clients → services/solauto}/referralStateManager.d.ts +4 -5
  108. package/dist/services/solauto/referralStateManager.d.ts.map +1 -0
  109. package/dist/{clients → services/solauto}/referralStateManager.js +10 -12
  110. package/dist/services/solauto/solautoClient.d.ts +59 -0
  111. package/dist/services/solauto/solautoClient.d.ts.map +1 -0
  112. package/dist/{clients → services/solauto}/solautoClient.js +78 -109
  113. package/dist/services/solauto/solautoMarginfiClient.d.ts +34 -0
  114. package/dist/services/solauto/solautoMarginfiClient.d.ts.map +1 -0
  115. package/dist/services/solauto/solautoMarginfiClient.js +322 -0
  116. package/dist/{clients → services/solauto}/txHandler.d.ts +11 -2
  117. package/dist/services/solauto/txHandler.d.ts.map +1 -0
  118. package/dist/services/solauto/txHandler.js +38 -0
  119. package/dist/services/swap/index.d.ts +2 -0
  120. package/dist/services/swap/index.d.ts.map +1 -0
  121. package/dist/{utils/solauto → services/swap}/index.js +1 -2
  122. package/dist/services/swap/jupSwapManager.d.ts +37 -0
  123. package/dist/services/swap/jupSwapManager.d.ts.map +1 -0
  124. package/dist/services/swap/jupSwapManager.js +108 -0
  125. package/dist/services/transactions/index.d.ts.map +1 -0
  126. package/dist/{transactions → services/transactions}/transactionUtils.d.ts +3 -5
  127. package/dist/services/transactions/transactionUtils.d.ts.map +1 -0
  128. package/dist/{transactions → services/transactions}/transactionUtils.js +29 -137
  129. package/dist/{transactions → services/transactions}/transactionsManager.d.ts +4 -4
  130. package/dist/services/transactions/transactionsManager.d.ts.map +1 -0
  131. package/dist/{transactions → services/transactions}/transactionsManager.js +10 -8
  132. package/dist/solautoPosition/index.d.ts +4 -0
  133. package/dist/solautoPosition/index.d.ts.map +1 -0
  134. package/dist/solautoPosition/index.js +19 -0
  135. package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts +14 -0
  136. package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts.map +1 -0
  137. package/dist/solautoPosition/marginfiSolautoPositionEx.js +73 -0
  138. package/dist/solautoPosition/solautoPositionEx.d.ts +67 -0
  139. package/dist/solautoPosition/solautoPositionEx.d.ts.map +1 -0
  140. package/dist/solautoPosition/solautoPositionEx.js +143 -0
  141. package/dist/solautoPosition/utils.d.ts +17 -0
  142. package/dist/solautoPosition/utils.d.ts.map +1 -0
  143. package/dist/solautoPosition/utils.js +115 -0
  144. package/dist/types/solauto.d.ts +19 -1
  145. package/dist/types/solauto.d.ts.map +1 -1
  146. package/dist/utils/generalUtils.d.ts +1 -0
  147. package/dist/utils/generalUtils.d.ts.map +1 -1
  148. package/dist/utils/generalUtils.js +9 -1
  149. package/dist/utils/index.d.ts +1 -1
  150. package/dist/utils/index.d.ts.map +1 -1
  151. package/dist/utils/index.js +1 -1
  152. package/dist/utils/jitoUtils.d.ts.map +1 -1
  153. package/dist/utils/jupiterUtils.d.ts +3 -28
  154. package/dist/utils/jupiterUtils.d.ts.map +1 -1
  155. package/dist/utils/jupiterUtils.js +2 -73
  156. package/dist/utils/marginfiUtils.d.ts +4 -3
  157. package/dist/utils/marginfiUtils.d.ts.map +1 -1
  158. package/dist/utils/marginfiUtils.js +47 -18
  159. package/dist/utils/numberUtils.d.ts +3 -6
  160. package/dist/utils/numberUtils.d.ts.map +1 -1
  161. package/dist/utils/numberUtils.js +13 -48
  162. package/dist/utils/priceUtils.js +1 -1
  163. package/dist/utils/solanaUtils.js +2 -2
  164. package/dist/utils/{solauto/generalUtils.d.ts → solautoUtils.d.ts} +9 -16
  165. package/dist/utils/solautoUtils.d.ts.map +1 -0
  166. package/dist/utils/{solauto/generalUtils.js → solautoUtils.js} +48 -173
  167. package/dist/utils/switchboardUtils.d.ts +1 -1
  168. package/dist/utils/switchboardUtils.d.ts.map +1 -1
  169. package/dist/utils/switchboardUtils.js +10 -9
  170. package/local/createTokenAccounts.ts +1 -5
  171. package/local/logPositions.ts +22 -68
  172. package/local/shared.ts +29 -24
  173. package/local/txSandbox.ts +27 -0
  174. package/local/updateMarginfiLUT.ts +80 -4
  175. package/package.json +4 -7
  176. package/src/constants/solautoConstants.ts +4 -9
  177. package/src/constants/switchboardConstants.ts +10 -5
  178. package/src/generated/accounts/solautoPosition.ts +2 -2
  179. package/src/generated/errors/solauto.ts +45 -4
  180. package/src/generated/instructions/claimReferralFees.ts +1 -1
  181. package/src/generated/instructions/closePosition.ts +3 -3
  182. package/src/generated/instructions/marginfiOpenPosition.ts +0 -7
  183. package/src/generated/instructions/marginfiRebalance.ts +12 -3
  184. package/src/generated/types/index.ts +7 -1
  185. package/src/generated/types/positionData.ts +3 -3
  186. package/src/generated/types/positionState.ts +12 -12
  187. package/src/generated/types/{positionTokenUsage.ts → positionTokenState.ts} +13 -16
  188. package/src/generated/types/rebalanceData.ts +16 -27
  189. package/src/generated/types/rebalanceDirection.ts +1 -0
  190. package/src/generated/types/rebalanceInstructionData.ts +62 -0
  191. package/src/generated/types/rebalanceStateValues.ts +59 -0
  192. package/src/generated/types/rebalanceStep.ts +25 -0
  193. package/src/generated/types/solautoRebalanceType.ts +0 -1
  194. package/src/generated/types/solautoSettingsParameters.ts +4 -25
  195. package/src/generated/types/solautoSettingsParametersInp.ts +2 -24
  196. package/src/generated/types/swapType.ts +22 -0
  197. package/src/generated/types/tokenBalanceChange.ts +46 -0
  198. package/src/generated/types/tokenBalanceChangeType.ts +28 -0
  199. package/src/generated/types/updatePositionData.ts +3 -3
  200. package/src/index.ts +8 -8
  201. package/src/marginfi-sdk/types/interestRateConfig.ts +6 -2
  202. package/src/services/flashLoans/flProviderAggregator.ts +74 -0
  203. package/src/services/flashLoans/flProviderBase.ts +88 -0
  204. package/src/services/flashLoans/index.ts +3 -0
  205. package/src/services/flashLoans/marginfiFlProvider.ts +392 -0
  206. package/src/services/index.ts +5 -0
  207. package/src/services/rebalance/index.ts +2 -0
  208. package/src/services/rebalance/rebalanceSwapManager.ts +218 -0
  209. package/src/services/rebalance/rebalanceTxBuilder.ts +330 -0
  210. package/src/services/rebalance/rebalanceValues.ts +232 -0
  211. package/src/services/rebalance/solautoFees.ts +61 -0
  212. package/src/services/solauto/index.ts +4 -0
  213. package/src/{clients → services/solauto}/referralStateManager.ts +17 -31
  214. package/src/{clients → services/solauto}/solautoClient.ts +142 -205
  215. package/src/services/solauto/solautoMarginfiClient.ts +472 -0
  216. package/src/services/solauto/txHandler.ts +69 -0
  217. package/src/services/swap/index.ts +1 -0
  218. package/src/services/swap/jupSwapManager.ts +189 -0
  219. package/src/{transactions → services/transactions}/transactionUtils.ts +40 -280
  220. package/src/{transactions → services/transactions}/transactionsManager.ts +15 -10
  221. package/src/solautoPosition/index.ts +3 -0
  222. package/src/solautoPosition/marginfiSolautoPositionEx.ts +111 -0
  223. package/src/solautoPosition/solautoPositionEx.ts +281 -0
  224. package/src/solautoPosition/utils.ts +188 -0
  225. package/src/types/solauto.ts +30 -2
  226. package/src/utils/generalUtils.ts +9 -1
  227. package/src/utils/index.ts +2 -2
  228. package/src/utils/jitoUtils.ts +0 -4
  229. package/src/utils/jupiterUtils.ts +3 -164
  230. package/src/utils/marginfiUtils.ts +77 -43
  231. package/src/utils/numberUtils.ts +18 -77
  232. package/src/utils/solanaUtils.ts +1 -1
  233. package/src/utils/{solauto/generalUtils.ts → solautoUtils.ts} +66 -288
  234. package/src/utils/switchboardUtils.ts +15 -17
  235. package/tests/transactions/shared.ts +135 -0
  236. package/tests/transactions/solautoMarginfi.ts +8 -198
  237. package/tests/unit/accounts.ts +3 -10
  238. package/tests/unit/lookupTables.ts +23 -2
  239. package/tests/unit/rebalanceCalculations.ts +65 -343
  240. package/dist/clients/index.d.ts +0 -5
  241. package/dist/clients/index.d.ts.map +0 -1
  242. package/dist/clients/referralStateManager.d.ts.map +0 -1
  243. package/dist/clients/solautoClient.d.ts +0 -71
  244. package/dist/clients/solautoClient.d.ts.map +0 -1
  245. package/dist/clients/solautoMarginfiClient.d.ts +0 -51
  246. package/dist/clients/solautoMarginfiClient.d.ts.map +0 -1
  247. package/dist/clients/solautoMarginfiClient.js +0 -497
  248. package/dist/clients/txHandler.d.ts.map +0 -1
  249. package/dist/clients/txHandler.js +0 -23
  250. package/dist/generated/types/positionTokenUsage.d.ts.map +0 -1
  251. package/dist/transactions/index.d.ts.map +0 -1
  252. package/dist/transactions/transactionUtils.d.ts.map +0 -1
  253. package/dist/transactions/transactionsManager.d.ts.map +0 -1
  254. package/dist/utils/solauto/generalUtils.d.ts.map +0 -1
  255. package/dist/utils/solauto/index.d.ts +0 -3
  256. package/dist/utils/solauto/index.d.ts.map +0 -1
  257. package/dist/utils/solauto/rebalanceUtils.d.ts +0 -30
  258. package/dist/utils/solauto/rebalanceUtils.d.ts.map +0 -1
  259. package/dist/utils/solauto/rebalanceUtils.js +0 -287
  260. package/src/clients/index.ts +0 -4
  261. package/src/clients/solautoMarginfiClient.ts +0 -774
  262. package/src/clients/txHandler.ts +0 -38
  263. package/src/utils/solauto/index.ts +0 -2
  264. package/src/utils/solauto/rebalanceUtils.ts +0 -562
  265. package/dist/{clients → services/solauto}/index.js +2 -2
  266. /package/dist/{transactions → services/transactions}/index.d.ts +0 -0
  267. /package/dist/{transactions → services/transactions}/index.js +0 -0
  268. /package/src/{transactions → services/transactions}/index.ts +0 -0
@@ -1,26 +1,15 @@
1
- import { publicKey } from "@metaplex-foundation/umi";
2
1
  import {
3
2
  buildIronforgeApiUrl,
4
- calcNetWorthUsd,
5
- calcSupplyUsd,
6
- currentUnixSeconds,
7
- eligibleForRebalance,
8
3
  fetchTokenPrices,
4
+ getPositionExBulk,
9
5
  getSolanaRpcConnection,
10
6
  getSolautoManagedPositions,
11
- PositionState,
12
- positionStateWithLatestPrices,
13
- retryWithExponentialBackoff,
14
- safeFetchAllSolautoPosition,
15
7
  safeGetPrice,
16
8
  SOLAUTO_PROD_PROGRAM,
17
- solautoStrategyName,
18
9
  } from "../src";
19
10
  import { PublicKey } from "@solana/web3.js";
20
- import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
21
11
  import path from "path";
22
12
  import { config } from "dotenv";
23
- import { getBatches } from "./shared";
24
13
 
25
14
  config({ path: path.join(__dirname, ".env") });
26
15
 
@@ -102,23 +91,12 @@ async function main(filterWhitelist: boolean) {
102
91
  );
103
92
  }
104
93
 
105
- const batches = getBatches(positions, 30);
106
-
107
- const solautoPositionsData = (
108
- await Promise.all(
109
- batches.map(async (pubkeys) => {
110
- return retryWithExponentialBackoff(
111
- async () =>
112
- await safeFetchAllSolautoPosition(
113
- umi,
114
- pubkeys.map((x) => publicKey(x.publicKey!))
115
- )
116
- );
117
- })
94
+ const positionsEx = (
95
+ await getPositionExBulk(
96
+ umi,
97
+ positions.map((x) => new PublicKey(x.publicKey!))
118
98
  )
119
- )
120
- .flat()
121
- .sort((a, b) => calcNetWorthUsd(a.state) - calcNetWorthUsd(b.state));
99
+ ).sort((a, b) => a.netWorthUsd() - b.netWorthUsd());
122
100
 
123
101
  const tokensUsed = Array.from(
124
102
  new Set(
@@ -128,49 +106,25 @@ async function main(filterWhitelist: boolean) {
128
106
  ])
129
107
  )
130
108
  );
131
-
132
- const tokenBatches = getBatches(tokensUsed, 15);
133
- await Promise.all(
134
- tokenBatches.map(async (batch) => {
135
- await fetchTokenPrices(batch.map((x) => new PublicKey(x)));
136
- })
137
- );
109
+ await fetchTokenPrices(tokensUsed.map((x) => new PublicKey(x)));
138
110
 
139
111
  console.log("\n\n");
140
112
 
141
- const latestStates: PositionState[] = [];
142
113
  let unhealthyPositions = 0;
143
114
  let awaitingBoostPositions = 0;
144
115
 
145
- for (const pos of solautoPositionsData) {
146
- const strategy = solautoStrategyName(
147
- toWeb3JsPublicKey(pos.state.supply.mint),
148
- toWeb3JsPublicKey(pos.state.debt.mint)
116
+ for (const pos of positionsEx) {
117
+ await pos.updateWithLatestPrices(
118
+ safeGetPrice(pos.state().supply.mint),
119
+ safeGetPrice(pos.state().debt.mint)
149
120
  );
150
121
 
151
- const latestState = await positionStateWithLatestPrices(
152
- pos.state,
153
- safeGetPrice(pos.state.supply.mint),
154
- safeGetPrice(pos.state.debt.mint)
155
- );
156
- latestStates.push(latestState);
157
-
158
- const actionToTake = eligibleForRebalance(
159
- latestState,
160
- pos.position.settingParams,
161
- pos.position.dca,
162
- currentUnixSeconds(),
163
- safeGetPrice(latestState.supply.mint)!,
164
- safeGetPrice(latestState.debt.mint)!,
165
- 0
166
- );
122
+ const actionToTake = pos.eligibleForRebalance(0);
167
123
 
168
- const repayFrom =
169
- pos.position.settingParams.repayToBps +
170
- pos.position.settingParams.repayGap;
124
+ const repayFrom = pos.settings()!.repayToBps + pos.settings()!.repayGap;
171
125
  const unhealthy = actionToTake === "repay";
172
126
  const healthText = unhealthy
173
- ? `(Unhealthy: ${latestState.liqUtilizationRateBps - repayFrom}bps)`
127
+ ? `(Unhealthy: ${pos.state().liqUtilizationRateBps - repayFrom}bps)`
174
128
  : "";
175
129
  if (unhealthy) {
176
130
  unhealthyPositions += 1;
@@ -184,30 +138,30 @@ async function main(filterWhitelist: boolean) {
184
138
 
185
139
  console.log(
186
140
  pos.publicKey.toString(),
187
- `(${pos.authority.toString()} ${pos.positionId})`
141
+ `(${pos.data().authority!.toString()} ${pos.data().positionId})`
188
142
  );
189
143
  console.log(
190
- `${strategy}: $${formatNumber(calcNetWorthUsd(latestState), 2, 10000, 2)} ${healthText} ${boostText}`
144
+ `${pos.strategyName()}: $${formatNumber(pos.netWorthUsd(), 2, 10000, 2)} ${healthText} ${boostText}`
191
145
  );
192
146
  }
193
147
 
194
148
  console.log(
195
149
  "\nTotal positions:",
196
- solautoPositionsData.length,
150
+ positionsEx.length,
197
151
  unhealthyPositions ? ` (unhealthy: ${unhealthyPositions})` : "",
198
152
  awaitingBoostPositions ? ` (awaiting boost: ${awaitingBoostPositions})` : ""
199
153
  );
200
154
  console.log(
201
155
  "Total users:",
202
- Array.from(new Set(solautoPositionsData.map((x) => x.authority.toString())))
156
+ Array.from(new Set(positionsEx.map((x) => x.data().authority!.toString())))
203
157
  .length
204
158
  );
205
159
 
206
- const tvl = latestStates
207
- .map((x) => calcSupplyUsd(x))
160
+ const tvl = positionsEx
161
+ .map((x) => x.supplyUsd())
208
162
  .reduce((acc, curr) => acc + curr, 0);
209
- const netWorth = latestStates
210
- .map((x) => calcNetWorthUsd(x))
163
+ const netWorth = positionsEx
164
+ .map((x) => x.netWorthUsd())
211
165
  .reduce((acc, curr) => acc + curr, 0);
212
166
 
213
167
  console.log(`TVL: $${formatNumber(tvl, 2, 10000, 2)}`);
package/local/shared.ts CHANGED
@@ -8,15 +8,11 @@ import {
8
8
  VersionedTransaction,
9
9
  PublicKey,
10
10
  } from "@solana/web3.js";
11
- import { buildHeliusApiUrl, getSolanaRpcConnection } from "../src/utils/solanaUtils";
12
-
13
- export function getBatches<T>(items: T[], batchSize: number): T[][] {
14
- const batches: T[][] = [];
15
- for (let i = 0; i < items.length; i += batchSize) {
16
- batches.push(items.slice(i, i + batchSize));
17
- }
18
- return batches;
19
- }
11
+ import {
12
+ buildHeliusApiUrl,
13
+ getSolanaRpcConnection,
14
+ } from "../src/utils/solanaUtils";
15
+ import { getBatches } from "../src";
20
16
 
21
17
  function loadSecretKey(keypairPath: string) {
22
18
  const secretKey = JSON.parse(fs.readFileSync(keypairPath, "utf8"));
@@ -30,19 +26,25 @@ export function getSecretKey(keypairFilename: string = "id"): Uint8Array {
30
26
  }
31
27
 
32
28
  const keypair = Keypair.fromSecretKey(getSecretKey("solauto-fees"));
33
- const [connection, _] = getSolanaRpcConnection(buildHeliusApiUrl(process.env.HELIUS_API_KEY ?? ""));
29
+ const [connection, _] = getSolanaRpcConnection(
30
+ buildHeliusApiUrl(process.env.HELIUS_API_KEY ?? "")
31
+ );
34
32
 
35
- async function createAndSendV0Tx(txInstructions: TransactionInstruction[]) {
33
+ export async function createAndSendV0Tx(
34
+ txInstructions: TransactionInstruction[],
35
+ payer: Keypair,
36
+ otherSigners?: Keypair[]
37
+ ) {
36
38
  let latestBlockhash = await connection.getLatestBlockhash("finalized");
37
39
 
38
40
  const messageV0 = new TransactionMessage({
39
- payerKey: keypair.publicKey,
41
+ payerKey: payer.publicKey,
40
42
  recentBlockhash: latestBlockhash.blockhash,
41
43
  instructions: txInstructions,
42
44
  }).compileToV0Message();
43
45
  const transaction = new VersionedTransaction(messageV0);
44
46
 
45
- transaction.sign([keypair]);
47
+ transaction.sign([payer, ...(otherSigners ?? [])]);
46
48
 
47
49
  const txid = await connection.sendTransaction(transaction, {
48
50
  maxRetries: 5,
@@ -67,19 +69,22 @@ async function addAddressesIfNeeded(
67
69
  const addresses = addressesToAdd
68
70
  .filter((x) => !existingAddresses.includes(x))
69
71
  .map((x) => new PublicKey(x));
70
-
72
+
71
73
  if (addresses.length > 0) {
72
74
  const batches = getBatches(addresses, 20);
73
75
  for (const addressBatch of batches) {
74
- console.log(addressBatch.map(x => x.toString()));
75
- await createAndSendV0Tx([
76
- AddressLookupTableProgram.extendLookupTable({
77
- payer: keypair.publicKey,
78
- authority: keypair.publicKey,
79
- lookupTable: lookupTableAddress,
80
- addresses: addressBatch,
81
- }),
82
- ]);
76
+ console.log(addressBatch.map((x) => x.toString()));
77
+ await createAndSendV0Tx(
78
+ [
79
+ AddressLookupTableProgram.extendLookupTable({
80
+ payer: keypair.publicKey,
81
+ authority: keypair.publicKey,
82
+ lookupTable: lookupTableAddress,
83
+ addresses: addressBatch,
84
+ }),
85
+ ],
86
+ keypair
87
+ );
83
88
  }
84
89
  }
85
90
  }
@@ -99,7 +104,7 @@ export async function updateLookupTable(
99
104
  });
100
105
  lookupTableAddress = addr;
101
106
  console.log("Lookup Table Address:", lookupTableAddress.toString());
102
- await createAndSendV0Tx([createLutIx]);
107
+ await createAndSendV0Tx([createLutIx], keypair);
103
108
  }
104
109
 
105
110
  const existingAccounts =
@@ -0,0 +1,27 @@
1
+ import { Keypair } from "@solana/web3.js";
2
+ import {
3
+ buildIronforgeApiUrl,
4
+ getSolanaRpcConnection,
5
+ SOLAUTO_PROD_PROGRAM,
6
+ SOLAUTO_TEST_PROGRAM,
7
+ } from "../src";
8
+ import { getSecretKey } from "./shared";
9
+ import { createSignerFromKeypair } from "@metaplex-foundation/umi";
10
+ import { fromWeb3JsKeypair } from "@metaplex-foundation/umi-web3js-adapters";
11
+
12
+ const testProgram = true;
13
+
14
+ export async function main() {
15
+ const [conn, umi] = getSolanaRpcConnection(
16
+ buildIronforgeApiUrl(process.env.IRONFORGE_API_KEY!),
17
+ testProgram ? SOLAUTO_TEST_PROGRAM : SOLAUTO_PROD_PROGRAM
18
+ );
19
+ const signer = createSignerFromKeypair(
20
+ umi,
21
+ fromWeb3JsKeypair(Keypair.fromSecretKey(getSecretKey()))
22
+ );
23
+
24
+
25
+ }
26
+
27
+ main();
@@ -1,13 +1,48 @@
1
- import { PublicKey } from "@solana/web3.js";
1
+ import { Keypair, PublicKey } from "@solana/web3.js";
2
2
  import { MARGINFI_ACCOUNTS_LOOKUP_TABLE } from "../src/constants/marginfiAccounts";
3
3
  import {
4
4
  MARGINFI_ACCOUNTS,
5
5
  DEFAULT_MARGINFI_GROUP,
6
6
  } from "../src/constants/marginfiAccounts";
7
- import { MARGINFI_PROGRAM_ID } from "../src/marginfi-sdk";
8
- import { updateLookupTable } from "./shared";
7
+ import {
8
+ MARGINFI_PROGRAM_ID,
9
+ marginfiAccountInitialize,
10
+ } from "../src/marginfi-sdk";
11
+ import { createAndSendV0Tx, getSecretKey, updateLookupTable } from "./shared";
12
+ import {
13
+ buildIronforgeApiUrl,
14
+ getEmptyMarginfiAccountsByAuthority,
15
+ getSolanaRpcConnection,
16
+ SOLAUTO_MANAGER,
17
+ } from "../src";
18
+ import {
19
+ createSignerFromKeypair,
20
+ publicKey,
21
+ signerIdentity,
22
+ } from "@metaplex-foundation/umi";
23
+ import {
24
+ fromWeb3JsKeypair,
25
+ toWeb3JsInstruction,
26
+ toWeb3JsKeypair,
27
+ } from "@metaplex-foundation/umi-web3js-adapters";
9
28
 
10
29
  const LOOKUP_TABLE_ADDRESS = new PublicKey(MARGINFI_ACCOUNTS_LOOKUP_TABLE);
30
+ let [, umi] = getSolanaRpcConnection(
31
+ buildIronforgeApiUrl(process.env.IRONFORGE_API_KEY!)
32
+ );
33
+ umi = umi.use(
34
+ signerIdentity(
35
+ createSignerFromKeypair(umi, umi.eddsa.generateKeypair()),
36
+ true
37
+ )
38
+ );
39
+ const solautoManagerKeypair = Keypair.fromSecretKey(
40
+ getSecretKey("solauto-manager")
41
+ );
42
+ const solautoManager = createSignerFromKeypair(
43
+ umi,
44
+ fromWeb3JsKeypair(solautoManagerKeypair)
45
+ );
11
46
 
12
47
  async function addBanks() {
13
48
  for (const group in MARGINFI_ACCOUNTS) {
@@ -27,9 +62,50 @@ async function addBanks() {
27
62
  }
28
63
  }
29
64
 
65
+ async function addImfiAccounts() {
66
+ const imfiAccounts = await getEmptyMarginfiAccountsByAuthority(
67
+ umi,
68
+ SOLAUTO_MANAGER
69
+ );
70
+
71
+ for (const group in MARGINFI_ACCOUNTS) {
72
+ const emptyAccs = imfiAccounts.filter((x) => x.group.toString() === group);
73
+ if (emptyAccs.length > 0) {
74
+ await updateLookupTable(
75
+ emptyAccs.map((x) => x.publicKey.toString()),
76
+ LOOKUP_TABLE_ADDRESS
77
+ );
78
+ } else {
79
+ console.log("Creating Imfi account for group:", group);
80
+ const iMfiAccountKeypair = umi.eddsa.generateKeypair();
81
+ const iMfiAccount = createSignerFromKeypair(umi, iMfiAccountKeypair);
82
+ const umiIx = marginfiAccountInitialize(umi, {
83
+ marginfiAccount: iMfiAccount,
84
+ marginfiGroup: publicKey(group),
85
+ authority: solautoManager,
86
+ feePayer: solautoManager,
87
+ });
88
+ const ix = toWeb3JsInstruction(umiIx.getInstructions()[0]);
89
+ await createAndSendV0Tx([ix], solautoManagerKeypair, [
90
+ toWeb3JsKeypair(iMfiAccountKeypair),
91
+ ]);
92
+ await updateLookupTable(
93
+ [iMfiAccount.publicKey.toString()],
94
+ LOOKUP_TABLE_ADDRESS
95
+ );
96
+ }
97
+ }
98
+ }
99
+
30
100
  updateLookupTable(
31
101
  [DEFAULT_MARGINFI_GROUP, MARGINFI_PROGRAM_ID],
32
102
  LOOKUP_TABLE_ADDRESS
33
103
  );
34
104
 
35
- addBanks();
105
+ addBanks().then((x) => x);
106
+
107
+ addImfiAccounts().then((x) => x);
108
+
109
+ // EoEVYjz3MnsX6fKyxrwJkRhzMCHKjj6dvnjTCHoZLMc7
110
+ // AuoepJfrCrkQF2PeUAgpnnJybRoiff82cNdwXTqyjjvm
111
+ // Bno3JybASPc1jNBZ9rnrdKVvbhk6UNMvSsYvgtitq3zb
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.581",
3
+ "version": "1.0.583",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
7
7
  "author": "Chelioso",
8
- "license": "MIT",
9
8
  "scripts": {
10
9
  "build": "rm -rf dist && npx tsc",
10
+ "test:all": "pnpm test:unit && pnpm test:txs",
11
11
  "test:txs": "ts-mocha -p ./tsconfig.json -t 1000000 tests/transactions/**/*.ts",
12
- "test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts",
13
- "test:all": "pnpm test:unit && pnpm test:txs"
12
+ "test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts"
14
13
  },
15
14
  "dependencies": {
16
15
  "@coral-xyz/anchor": "^0.30.1",
@@ -19,12 +18,10 @@
19
18
  "@metaplex-foundation/umi-bundle-defaults": "^0.9.1",
20
19
  "@metaplex-foundation/umi-signer-wallet-adapters": "^0.9.1",
21
20
  "@metaplex-foundation/umi-web3js-adapters": "^0.9.1",
22
- "@mrgnlabs/marginfi-client-v2": "^4.0.0",
23
- "@mrgnlabs/mrgn-common": "^1.8.0",
24
21
  "@solana/spl-token": "^0.4.0",
25
22
  "@solana/web3.js": "=1.95.8",
26
23
  "@switchboard-xyz/common": "=3.0.12",
27
- "@switchboard-xyz/on-demand": "=2.4.0",
24
+ "@switchboard-xyz/on-demand": "=1.2.51",
28
25
  "axios": "^1.7.8",
29
26
  "bs58": "^5.0.0",
30
27
  "cross-fetch": "^4.0.0",
@@ -20,7 +20,7 @@ export const SOLAUTO_TEST_PROGRAM = new PublicKey(
20
20
  "TesTjfQ6TbXv96Tv6fqr95XTZ1LYPxtkafmShN9PjBp"
21
21
  );
22
22
 
23
- (globalThis as any).LOCAL_TEST = false;
23
+ (globalThis as any).SHOW_LOGS = false;
24
24
 
25
25
  export const BASIS_POINTS = 10000;
26
26
 
@@ -29,6 +29,8 @@ export const MIN_REPAY_GAP_BPS = 50;
29
29
  export const MIN_BOOST_GAP_BPS = 50;
30
30
  export const MIN_USD_SUPPORTED_POSITION = 1000;
31
31
 
32
+ export const REFERRER_PERCENTAGE = 0.15;
33
+
32
34
  export const PRICES: { [key: string]: { price: number; time: number } } = {};
33
35
 
34
36
  export const JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
@@ -60,11 +62,4 @@ export const STANDARD_LUT_ACCOUNTS = [
60
62
  ].map((x) => x.toString());
61
63
 
62
64
  // TODO:
63
- export const BROKEN_TOKENS = [
64
- JUP,
65
- JLP,
66
- WETH,
67
- HNT,
68
- JTO,
69
- PYTH
70
- ]
65
+ export const BROKEN_TOKENS = [JUP, JLP, WETH, HNT, JTO, PYTH];
@@ -14,22 +14,27 @@ export const SWITCHBOARD_PRICE_FEED_IDS: { [key: string]: SwitchboardFeed } = {
14
14
  },
15
15
  [tokens.H_SOL]: {
16
16
  feedId: "1snBjCaHejZqQsAqkELAKNaqUrDNNCr7zmNX6qaQCzg",
17
- feedHash: "0x59206aa3da593cd2312bde1930cf3368f6119a650229e147060be4fc2fcd1367"
17
+ feedHash:
18
+ "0x59206aa3da593cd2312bde1930cf3368f6119a650229e147060be4fc2fcd1367",
18
19
  },
19
20
  [tokens.POPCAT]: {
20
21
  feedId: "FTcFqwCjAgv2VMaowQ9XSBcesVzFzZkaju25nKio6bki",
21
- feedHash: "0xeb4f9a43024f8f33786b7291404510af8e94a66e1acb44953a3137878ee7033f"
22
+ feedHash:
23
+ "0xeb4f9a43024f8f33786b7291404510af8e94a66e1acb44953a3137878ee7033f",
22
24
  },
23
25
  [tokens.RETARDIO]: {
24
26
  feedId: "EvPXnpMoyrj4B6P55LDP2VpSLkTBWom2SqL4486ToNhM",
25
- feedHash: "0x982d968a0608046986aec84d95ae884c4dc2140f0b3e14ed7b8161ada573d18b"
27
+ feedHash:
28
+ "0x982d968a0608046986aec84d95ae884c4dc2140f0b3e14ed7b8161ada573d18b",
26
29
  },
27
30
  [tokens.BILLY]: {
28
31
  feedId: "uBe4er4VSMgYvBNwSbFctSShRXNPkCfaPh7zHMBFeBi",
29
- feedHash: "0xbbd0d393111ff1ad7cc1a2f15ce24b61d4d6b3e99e440aa77572bd7f1da9afbe"
32
+ feedHash:
33
+ "0xbbd0d393111ff1ad7cc1a2f15ce24b61d4d6b3e99e440aa77572bd7f1da9afbe",
30
34
  },
31
35
  [tokens.HMTR]: {
32
36
  feedId: "F2hKL67W4ZDe9k7ZrJKnp2LhWrgqg2JQTkJf2dgBggRD",
33
- feedHash: "0x61999c4f8a03208b5b5b50663323b1ef8d0acbb3642ec79053b33b5768605fb5"
37
+ feedHash:
38
+ "0x61999c4f8a03208b5b5b50663323b1ef8d0acbb3642ec79053b33b5768605fb5",
34
39
  },
35
40
  };
@@ -88,7 +88,7 @@ export function getSolautoPositionAccountDataSerializer(): Serializer<
88
88
  ['position', getPositionDataSerializer()],
89
89
  ['state', getPositionStateSerializer()],
90
90
  ['rebalance', getRebalanceDataSerializer()],
91
- ['padding', array(u32(), { size: 32 })],
91
+ ['padding', array(u32(), { size: 20 })],
92
92
  ],
93
93
  { description: 'SolautoPositionAccountData' }
94
94
  ) as Serializer<SolautoPositionAccountDataArgs, SolautoPositionAccountData>;
@@ -188,7 +188,7 @@ export function getSolautoPositionGpaBuilder(
188
188
  position: [40, getPositionDataSerializer()],
189
189
  state: [360, getPositionStateSerializer()],
190
190
  rebalance: [648, getRebalanceDataSerializer()],
191
- padding: [704, array(u32(), { size: 32 })],
191
+ padding: [752, array(u32(), { size: 20 })],
192
192
  })
193
193
  .deserializeUsing<SolautoPosition>((account) =>
194
194
  deserializeSolautoPosition(account)
@@ -15,7 +15,7 @@ type ProgramErrorConstructor = new (
15
15
  const codeToErrorMap: Map<number, ProgramErrorConstructor> = new Map();
16
16
  const nameToErrorMap: Map<string, ProgramErrorConstructor> = new Map();
17
17
 
18
- /** IncorrectAccounts: Missing or incorrect accounts provided for the given instruction */
18
+ /** IncorrectAccounts: Missing or incorrect accounts provided for the given instructions */
19
19
  export class IncorrectAccountsError extends ProgramError {
20
20
  override readonly name: string = 'IncorrectAccounts';
21
21
 
@@ -23,7 +23,7 @@ export class IncorrectAccountsError extends ProgramError {
23
23
 
24
24
  constructor(program: Program, cause?: Error) {
25
25
  super(
26
- 'Missing or incorrect accounts provided for the given instruction',
26
+ 'Missing or incorrect accounts provided for the given instructions',
27
27
  program,
28
28
  cause
29
29
  );
@@ -113,14 +113,18 @@ export class InstructionIsCPIError extends ProgramError {
113
113
  codeToErrorMap.set(0x6, InstructionIsCPIError);
114
114
  nameToErrorMap.set('InstructionIsCPI', InstructionIsCPIError);
115
115
 
116
- /** IncorrectInstructions: Incorrect set of instructions in the transaction */
116
+ /** IncorrectInstructions: Incorrect set of instructions or instruction data in the transaction */
117
117
  export class IncorrectInstructionsError extends ProgramError {
118
118
  override readonly name: string = 'IncorrectInstructions';
119
119
 
120
120
  readonly code: number = 0x7; // 7
121
121
 
122
122
  constructor(program: Program, cause?: Error) {
123
- super('Incorrect set of instructions in the transaction', program, cause);
123
+ super(
124
+ 'Incorrect set of instructions or instruction data in the transaction',
125
+ program,
126
+ cause
127
+ );
124
128
  }
125
129
  }
126
130
  codeToErrorMap.set(0x7, IncorrectInstructionsError);
@@ -143,6 +147,43 @@ export class IncorrectDebtAdjustmentError extends ProgramError {
143
147
  codeToErrorMap.set(0x8, IncorrectDebtAdjustmentError);
144
148
  nameToErrorMap.set('IncorrectDebtAdjustment', IncorrectDebtAdjustmentError);
145
149
 
150
+ /** InvalidRebalanceMade: Invalid rebalance was made. Target supply USD and target debt USD was not met */
151
+ export class InvalidRebalanceMadeError extends ProgramError {
152
+ override readonly name: string = 'InvalidRebalanceMade';
153
+
154
+ readonly code: number = 0x9; // 9
155
+
156
+ constructor(program: Program, cause?: Error) {
157
+ super(
158
+ 'Invalid rebalance was made. Target supply USD and target debt USD was not met',
159
+ program,
160
+ cause
161
+ );
162
+ }
163
+ }
164
+ codeToErrorMap.set(0x9, InvalidRebalanceMadeError);
165
+ nameToErrorMap.set('InvalidRebalanceMade', InvalidRebalanceMadeError);
166
+
167
+ /** NonAuthorityProvidedTargetLTV: Cannot provide a target liquidation utilization rate if the instruction is not signed by the position authority */
168
+ export class NonAuthorityProvidedTargetLTVError extends ProgramError {
169
+ override readonly name: string = 'NonAuthorityProvidedTargetLTV';
170
+
171
+ readonly code: number = 0xa; // 10
172
+
173
+ constructor(program: Program, cause?: Error) {
174
+ super(
175
+ 'Cannot provide a target liquidation utilization rate if the instruction is not signed by the position authority',
176
+ program,
177
+ cause
178
+ );
179
+ }
180
+ }
181
+ codeToErrorMap.set(0xa, NonAuthorityProvidedTargetLTVError);
182
+ nameToErrorMap.set(
183
+ 'NonAuthorityProvidedTargetLTV',
184
+ NonAuthorityProvidedTargetLTVError
185
+ );
186
+
146
187
  /**
147
188
  * Attempts to resolve a custom program error from the provided error code.
148
189
  * @category Errors
@@ -38,7 +38,7 @@ export type ClaimReferralFeesInstructionAccounts = {
38
38
  referralState: PublicKey | Pda;
39
39
  referralFeesDestTa: PublicKey | Pda;
40
40
  referralFeesDestMint: PublicKey | Pda;
41
- referralAuthority?: PublicKey | Pda;
41
+ referralAuthority: PublicKey | Pda;
42
42
  feesDestinationTa?: PublicKey | Pda;
43
43
  };
44
44
 
@@ -33,7 +33,7 @@ export type ClosePositionInstructionAccounts = {
33
33
  tokenProgram?: PublicKey | Pda;
34
34
  ataProgram?: PublicKey | Pda;
35
35
  solautoPosition: PublicKey | Pda;
36
- protocolAccount: PublicKey | Pda;
36
+ lpUserAccount: PublicKey | Pda;
37
37
  positionSupplyTa: PublicKey | Pda;
38
38
  signerSupplyTa: PublicKey | Pda;
39
39
  positionDebtTa: PublicKey | Pda;
@@ -102,10 +102,10 @@ export function closePosition(
102
102
  isWritable: true as boolean,
103
103
  value: input.solautoPosition ?? null,
104
104
  },
105
- protocolAccount: {
105
+ lpUserAccount: {
106
106
  index: 5,
107
107
  isWritable: true as boolean,
108
- value: input.protocolAccount ?? null,
108
+ value: input.lpUserAccount ?? null,
109
109
  },
110
110
  positionSupplyTa: {
111
111
  index: 6,
@@ -8,8 +8,6 @@
8
8
 
9
9
  import {
10
10
  Context,
11
- Option,
12
- OptionOrNullable,
13
11
  Pda,
14
12
  PublicKey,
15
13
  Signer,
@@ -20,9 +18,7 @@ import {
20
18
  import {
21
19
  Serializer,
22
20
  mapSerializer,
23
- option,
24
21
  struct,
25
- u64,
26
22
  u8,
27
23
  } from '@metaplex-foundation/umi/serializers';
28
24
  import {
@@ -67,13 +63,11 @@ export type MarginfiOpenPositionInstructionData = {
67
63
  discriminator: number;
68
64
  positionType: PositionType;
69
65
  positionData: UpdatePositionData;
70
- marginfiAccountSeedIdx: Option<bigint>;
71
66
  };
72
67
 
73
68
  export type MarginfiOpenPositionInstructionDataArgs = {
74
69
  positionType: PositionTypeArgs;
75
70
  positionData: UpdatePositionDataArgs;
76
- marginfiAccountSeedIdx: OptionOrNullable<number | bigint>;
77
71
  };
78
72
 
79
73
  export function getMarginfiOpenPositionInstructionDataSerializer(): Serializer<
@@ -90,7 +84,6 @@ export function getMarginfiOpenPositionInstructionDataSerializer(): Serializer<
90
84
  ['discriminator', u8()],
91
85
  ['positionType', getPositionTypeSerializer()],
92
86
  ['positionData', getUpdatePositionDataSerializer()],
93
- ['marginfiAccountSeedIdx', option(u64())],
94
87
  ],
95
88
  { description: 'MarginfiOpenPositionInstructionData' }
96
89
  ),