@exponent-labs/exponent-sdk 0.0.3

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 (68) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/addressLookupTableUtil.d.ts +12 -0
  3. package/build/addressLookupTableUtil.js +32 -0
  4. package/build/addressLookupTableUtil.js.map +1 -0
  5. package/build/environment.d.ts +10 -0
  6. package/build/environment.js +13 -0
  7. package/build/environment.js.map +1 -0
  8. package/build/events.d.ts +339 -0
  9. package/build/events.js +231 -0
  10. package/build/events.js.map +1 -0
  11. package/build/flavors.d.ts +24 -0
  12. package/build/flavors.js +713 -0
  13. package/build/flavors.js.map +1 -0
  14. package/build/index.d.ts +11 -0
  15. package/build/index.js +45 -0
  16. package/build/index.js.map +1 -0
  17. package/build/lpPosition.d.ts +35 -0
  18. package/build/lpPosition.js +103 -0
  19. package/build/lpPosition.js.map +1 -0
  20. package/build/market.d.ts +567 -0
  21. package/build/market.js +1445 -0
  22. package/build/market.js.map +1 -0
  23. package/build/syPosition.d.ts +6 -0
  24. package/build/syPosition.js +115 -0
  25. package/build/syPosition.js.map +1 -0
  26. package/build/tokenUtil.d.ts +3 -0
  27. package/build/tokenUtil.js +23 -0
  28. package/build/tokenUtil.js.map +1 -0
  29. package/build/utils/altUtil.d.ts +8 -0
  30. package/build/utils/altUtil.js +35 -0
  31. package/build/utils/altUtil.js.map +1 -0
  32. package/build/utils/binSolver.d.ts +1 -0
  33. package/build/utils/binSolver.js +45 -0
  34. package/build/utils/binSolver.js.map +1 -0
  35. package/build/utils/binSolver.test.d.ts +1 -0
  36. package/build/utils/binSolver.test.js +15 -0
  37. package/build/utils/binSolver.test.js.map +1 -0
  38. package/build/utils/index.d.ts +6 -0
  39. package/build/utils/index.js +31 -0
  40. package/build/utils/index.js.map +1 -0
  41. package/build/utils/ix.d.ts +6 -0
  42. package/build/utils/ix.js +3 -0
  43. package/build/utils/ix.js.map +1 -0
  44. package/build/vault.d.ts +289 -0
  45. package/build/vault.js +615 -0
  46. package/build/vault.js.map +1 -0
  47. package/build/ytPosition.d.ts +86 -0
  48. package/build/ytPosition.js +231 -0
  49. package/build/ytPosition.js.map +1 -0
  50. package/jest.config.js +5 -0
  51. package/package.json +42 -0
  52. package/src/addressLookupTableUtil.ts +34 -0
  53. package/src/environment.ts +19 -0
  54. package/src/events.ts +595 -0
  55. package/src/flavors.ts +773 -0
  56. package/src/index.ts +11 -0
  57. package/src/lpPosition.ts +129 -0
  58. package/src/market.ts +2338 -0
  59. package/src/syPosition.ts +151 -0
  60. package/src/tokenUtil.ts +20 -0
  61. package/src/utils/altUtil.ts +47 -0
  62. package/src/utils/binSolver.test.ts +15 -0
  63. package/src/utils/binSolver.ts +44 -0
  64. package/src/utils/index.ts +32 -0
  65. package/src/utils/ix.ts +7 -0
  66. package/src/vault.ts +999 -0
  67. package/src/ytPosition.ts +313 -0
  68. package/tsconfig.json +38 -0
@@ -0,0 +1,713 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeFlavor = exports.flavorFinder = exports.makeFlavorGenericSync = exports.makeFlavorPerenaSync = exports.makeFlavorJitoRestakingSync = exports.makeFlavorKaminoSync = exports.makeFlavorMarginfiSync = exports.deserializeFlavorGeneric = exports.deserializeFlavorParena = exports.serializeFlavorGeneric = exports.serializeFlavorParena = exports.deserializeFlavorJitoRestaking = exports.serializeFlavorJitoRestaking = exports.deserializeFlavorKamino = exports.serializeFlavorKamino = exports.deserializeFlavorMarginfi = exports.serializeFlavorMarginfi = void 0;
4
+ const anchor_1 = require("@coral-xyz/anchor");
5
+ const exponent_fetcher_1 = require("@exponent-labs/exponent-fetcher");
6
+ const marginfi_sy_sdk_1 = require("@exponent-labs/marginfi-sy-sdk");
7
+ const kamino_lend_standard_1 = require("@exponent-labs/kamino-lend-standard");
8
+ const kamino_sy_sdk_1 = require("@exponent-labs/kamino-sy-sdk");
9
+ const jito_restaking_sy_sdk_1 = require("@exponent-labs/jito-restaking-sy-sdk");
10
+ const precise_number_1 = require("@exponent-labs/precise-number");
11
+ const perena_sy_sdk_1 = require("@exponent-labs/perena-sy-sdk");
12
+ const generic_sy_sdk_1 = require("@exponent-labs/generic-sy-sdk");
13
+ function serializeFlavorMarginfi(flavor) {
14
+ return {
15
+ flavor: "marginfi",
16
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
17
+ mintBase: flavor.mintBase.toString(),
18
+ baseTokenProgram: flavor.baseTokenProgram.toString(),
19
+ emissions: flavor.emissions.map((e) => ({
20
+ exchangeRate: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.exchangeRate[0]).valueString),
21
+ mint: e.mint.toString(),
22
+ tokenProgram: e.tokenProgram.toString(),
23
+ })),
24
+ bank: flavor.bank.toString(),
25
+ emissionMint: flavor.emissionMint?.toString(),
26
+ emissionTokenProgram: flavor.emissionTokenProgram?.toString(),
27
+ mfiSyState: {
28
+ selfAddress: flavor.mfiSyState.selfAddress.toString(),
29
+ marginfiSyProgramId: flavor.mfiSyState.marginfiSyProgramId.toString(),
30
+ syRate: flavor.mfiSyState.syRate,
31
+ mintBase: flavor.mfiSyState.mintBase.toString(),
32
+ tokenProgramBase: flavor.mfiSyState.tokenProgramBase.toString(),
33
+ marginfiProgramId: flavor.mfiSyState.marginfiProgramId.toString(),
34
+ marginfiGroupId: flavor.mfiSyState.marginfiGroupId.toString(),
35
+ emissionsMint: flavor.mfiSyState.emissionsMint?.toString() || null,
36
+ emissionsTokenProgram: flavor.mfiSyState.emissionsTokenProgram?.toString() || null,
37
+ account: {
38
+ marginfiBank: flavor.mfiSyState.account.marginfiBank.toString(),
39
+ marginfiAccount: flavor.mfiSyState.account.marginfiAccount.toString(),
40
+ mintSy: flavor.mfiSyState.account.mintSy.toString(),
41
+ tokenSyEscrow: flavor.mfiSyState.account.tokenSyEscrow.toString(),
42
+ maxSySupply: flavor.mfiSyState.account.maxSySupply.toString(),
43
+ minMintSize: flavor.mfiSyState.account.minMintSize.toString(),
44
+ minRedeemSize: flavor.mfiSyState.account.minRedeemSize.toString(),
45
+ emissions: flavor.mfiSyState.account.emissions.map((e) => ({
46
+ mint: e.mint.toString(),
47
+ tokenProgram: e.tokenProgram.toString(),
48
+ escrowAccount: e.escrowAccount.toString(),
49
+ index: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.index[0]).valueString),
50
+ lastSeenIndex: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.lastSeenIndex[0]).valueString),
51
+ lastSeenTotalAccruedEmissions: e.lastSeenTotalAccruedEmissions.toString(),
52
+ totalClaimedEmissions: e.totalClaimedEmissions.toString(),
53
+ treasuryEmission: e.treasuryEmission.toString(),
54
+ })),
55
+ },
56
+ },
57
+ };
58
+ }
59
+ exports.serializeFlavorMarginfi = serializeFlavorMarginfi;
60
+ function deserializeFlavorMarginfi(flavor) {
61
+ return {
62
+ flavor: "marginfi",
63
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
64
+ mintBase: new anchor_1.web3.PublicKey(flavor.mintBase),
65
+ baseTokenProgram: new anchor_1.web3.PublicKey(flavor.baseTokenProgram),
66
+ emissions: flavor.emissions.map((e) => ({
67
+ exchangeRate: { 0: [new anchor_1.BN(precise_number_1.PreciseNumber.fromRaw([new anchor_1.BN(e.exchangeRate)]).valueString)] },
68
+ mint: new anchor_1.web3.PublicKey(e.mint),
69
+ tokenProgram: new anchor_1.web3.PublicKey(e.tokenProgram),
70
+ })),
71
+ bank: new anchor_1.web3.PublicKey(flavor.bank),
72
+ emissionMint: flavor.emissionMint ? new anchor_1.web3.PublicKey(flavor.emissionMint) : undefined,
73
+ emissionTokenProgram: flavor.emissionTokenProgram ? new anchor_1.web3.PublicKey(flavor.emissionTokenProgram) : undefined,
74
+ mfiSyState: {
75
+ selfAddress: new anchor_1.web3.PublicKey(flavor.mfiSyState.selfAddress),
76
+ marginfiSyProgramId: new anchor_1.web3.PublicKey(flavor.mfiSyState.marginfiSyProgramId),
77
+ syRate: flavor.mfiSyState.syRate,
78
+ mintBase: new anchor_1.web3.PublicKey(flavor.mfiSyState.mintBase),
79
+ tokenProgramBase: new anchor_1.web3.PublicKey(flavor.mfiSyState.tokenProgramBase),
80
+ marginfiProgramId: new anchor_1.web3.PublicKey(flavor.mfiSyState.marginfiProgramId),
81
+ marginfiGroupId: new anchor_1.web3.PublicKey(flavor.mfiSyState.marginfiGroupId),
82
+ emissionsMint: flavor.mfiSyState.emissionsMint ? new anchor_1.web3.PublicKey(flavor.mfiSyState.emissionsMint) : null,
83
+ emissionsTokenProgram: flavor.mfiSyState.emissionsTokenProgram
84
+ ? new anchor_1.web3.PublicKey(flavor.mfiSyState.emissionsTokenProgram)
85
+ : null,
86
+ account: {
87
+ marginfiBank: new anchor_1.web3.PublicKey(flavor.mfiSyState.account.marginfiBank),
88
+ marginfiAccount: new anchor_1.web3.PublicKey(flavor.mfiSyState.account.marginfiAccount),
89
+ mintSy: new anchor_1.web3.PublicKey(flavor.mfiSyState.account.mintSy),
90
+ tokenSyEscrow: new anchor_1.web3.PublicKey(flavor.mfiSyState.account.tokenSyEscrow),
91
+ maxSySupply: BigInt(flavor.mfiSyState.account.maxSySupply),
92
+ minMintSize: BigInt(flavor.mfiSyState.account.minMintSize),
93
+ minRedeemSize: BigInt(flavor.mfiSyState.account.minRedeemSize),
94
+ emissions: flavor.mfiSyState.account.emissions.map((emission) => ({
95
+ mint: new anchor_1.web3.PublicKey(emission.mint),
96
+ tokenProgram: new anchor_1.web3.PublicKey(emission.tokenProgram),
97
+ escrowAccount: new anchor_1.web3.PublicKey(emission.escrowAccount),
98
+ index: { 0: [new anchor_1.BN(emission.index)] },
99
+ lastSeenIndex: { 0: [new anchor_1.BN(emission.lastSeenIndex)] },
100
+ lastSeenTotalAccruedEmissions: new anchor_1.BN(emission.lastSeenTotalAccruedEmissions),
101
+ totalClaimedEmissions: new anchor_1.BN(emission.totalClaimedEmissions),
102
+ treasuryEmission: new anchor_1.BN(emission.treasuryEmission),
103
+ })),
104
+ },
105
+ },
106
+ };
107
+ }
108
+ exports.deserializeFlavorMarginfi = deserializeFlavorMarginfi;
109
+ function serializeFlavorKamino(flavor) {
110
+ return {
111
+ flavor: "kamino",
112
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
113
+ mintBase: flavor.mintBase.toString(),
114
+ baseTokenProgram: flavor.baseTokenProgram.toString(),
115
+ emissions: flavor.emissions.map((e) => ({
116
+ exchangeRate: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.exchangeRate[0]).valueString),
117
+ mint: e.mint.toString(),
118
+ tokenProgram: e.tokenProgram.toString(),
119
+ })),
120
+ kaminoSyState: {
121
+ selfAddress: flavor.kaminoSyState.selfAddress.toString(),
122
+ klendSyProgramId: flavor.kaminoSyState.klendSyProgramId.toString(),
123
+ syRate: flavor.kaminoSyState.syRate,
124
+ mintBase: flavor.kaminoSyState.mintBase.toString(),
125
+ tokenProgramBase: flavor.kaminoSyState.tokenProgramBase.toString(),
126
+ klendProgramId: flavor.kaminoSyState.klendProgramId.toString(),
127
+ klendMarketId: flavor.kaminoSyState.klendMarketId.toString(),
128
+ account: {
129
+ kaminoReserve: flavor.kaminoSyState.account.kaminoReserve.toString(),
130
+ kaminoObligation: flavor.kaminoSyState.account.kaminoObligation.toString(),
131
+ kaminoFarm: flavor.kaminoSyState.account.kaminoFarm.toString(),
132
+ kaminoUserMetadata: flavor.kaminoSyState.account.kaminoUserMetadata.toString(),
133
+ mintSy: flavor.kaminoSyState.account.mintSy.toString(),
134
+ tokenSyEscrow: flavor.kaminoSyState.account.tokenSyEscrow.toString(),
135
+ minMintSize: flavor.kaminoSyState.account.minMintSize.toString(),
136
+ minRedeemSize: flavor.kaminoSyState.account.minRedeemSize.toString(),
137
+ userState: flavor.kaminoSyState.account.userState.toString(),
138
+ maxSySupply: flavor.kaminoSyState.account.maxSySupply.toString(),
139
+ emissions: flavor.kaminoSyState.account.emissions.map((e) => ({
140
+ mint: e.mint.toString(),
141
+ tokenProgram: e.tokenProgram.toString(),
142
+ escrowAccount: e.escrowAccount.toString(),
143
+ index: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.index[0]).valueString),
144
+ lastSeenIndex: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.lastSeenIndex[0]).valueString),
145
+ lastSeenTotalAccruedEmissions: e.lastSeenTotalAccruedEmissions.toString(),
146
+ totalClaimedEmissions: e.totalClaimedEmissions.toString(),
147
+ treasuryEmission: e.treasuryEmission.toString(),
148
+ })),
149
+ },
150
+ },
151
+ };
152
+ }
153
+ exports.serializeFlavorKamino = serializeFlavorKamino;
154
+ function deserializeFlavorKamino(flavor) {
155
+ return {
156
+ flavor: "kamino",
157
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
158
+ mintBase: new anchor_1.web3.PublicKey(flavor.mintBase),
159
+ baseTokenProgram: new anchor_1.web3.PublicKey(flavor.baseTokenProgram),
160
+ emissions: flavor.emissions.map((e) => ({
161
+ exchangeRate: { 0: [new anchor_1.BN(precise_number_1.PreciseNumber.fromRaw([new anchor_1.BN(e.exchangeRate)]).valueString)] },
162
+ mint: new anchor_1.web3.PublicKey(e.mint),
163
+ tokenProgram: new anchor_1.web3.PublicKey(e.tokenProgram),
164
+ })),
165
+ kaminoSyState: {
166
+ selfAddress: new anchor_1.web3.PublicKey(flavor.kaminoSyState.selfAddress),
167
+ klendSyProgramId: new anchor_1.web3.PublicKey(flavor.kaminoSyState.klendSyProgramId),
168
+ syRate: flavor.kaminoSyState.syRate,
169
+ mintBase: new anchor_1.web3.PublicKey(flavor.kaminoSyState.mintBase),
170
+ tokenProgramBase: new anchor_1.web3.PublicKey(flavor.kaminoSyState.tokenProgramBase),
171
+ klendProgramId: new anchor_1.web3.PublicKey(flavor.kaminoSyState.klendProgramId),
172
+ klendMarketId: new anchor_1.web3.PublicKey(flavor.kaminoSyState.klendMarketId),
173
+ account: {
174
+ kaminoReserve: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.kaminoReserve),
175
+ kaminoObligation: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.kaminoObligation),
176
+ kaminoFarm: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.kaminoFarm),
177
+ kaminoUserMetadata: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.kaminoUserMetadata),
178
+ mintSy: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.mintSy),
179
+ tokenSyEscrow: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.tokenSyEscrow),
180
+ minMintSize: flavor.kaminoSyState.account.minMintSize,
181
+ minRedeemSize: flavor.kaminoSyState.account.minRedeemSize,
182
+ userState: new anchor_1.web3.PublicKey(flavor.kaminoSyState.account.userState),
183
+ maxSySupply: flavor.kaminoSyState.account.maxSySupply,
184
+ emissions: flavor.kaminoSyState.account.emissions.map((emission) => ({
185
+ mint: new anchor_1.web3.PublicKey(emission.mint),
186
+ tokenProgram: new anchor_1.web3.PublicKey(emission.tokenProgram),
187
+ escrowAccount: new anchor_1.web3.PublicKey(emission.escrowAccount),
188
+ index: { 0: [new anchor_1.BN(emission.index)] },
189
+ lastSeenIndex: { 0: [new anchor_1.BN(emission.lastSeenIndex)] },
190
+ lastSeenTotalAccruedEmissions: new anchor_1.BN(emission.lastSeenTotalAccruedEmissions),
191
+ totalClaimedEmissions: new anchor_1.BN(emission.totalClaimedEmissions),
192
+ treasuryEmission: new anchor_1.BN(emission.treasuryEmission),
193
+ })),
194
+ },
195
+ },
196
+ };
197
+ }
198
+ exports.deserializeFlavorKamino = deserializeFlavorKamino;
199
+ function serializeFlavorJitoRestaking(flavor) {
200
+ return {
201
+ flavor: "jitoRestaking",
202
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
203
+ mintBase: flavor.mintBase.toString(),
204
+ baseTokenProgram: flavor.baseTokenProgram.toString(),
205
+ emissions: flavor.emissions.map((e) => ({
206
+ exchangeRate: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.exchangeRate[0]).valueString),
207
+ mint: e.mint.toString(),
208
+ tokenProgram: e.tokenProgram.toString(),
209
+ })),
210
+ jitoSyState: {
211
+ selfAddress: flavor.jitoSyState.selfAddress.toString(),
212
+ syRate: flavor.jitoSyState.syRate,
213
+ underlyingExchangeRate: flavor.jitoSyState.underlyingExchangeRate,
214
+ mintBase: flavor.jitoSyState.mintBase.toString(),
215
+ tokenProgramBase: flavor.jitoSyState.tokenProgramBase.toString(),
216
+ account: {
217
+ jitoVault: flavor.jitoSyState.account.jitoVault.toString(),
218
+ mintSy: flavor.jitoSyState.account.mintSy.toString(),
219
+ tokenSyEscrow: flavor.jitoSyState.account.tokenSyEscrow.toString(),
220
+ minMintSize: flavor.jitoSyState.account.minMintSize.toString(),
221
+ minRedeemSize: flavor.jitoSyState.account.minRedeemSize.toString(),
222
+ maxSySupply: flavor.jitoSyState.account.maxSySupply.toString(),
223
+ interfaceAccounts: flavor.jitoSyState.account.interfaceAccounts.map((a) => a.toString()),
224
+ interfaceType: flavor.jitoSyState.account.interfaceType,
225
+ emissions: flavor.jitoSyState.account.emissions.map((e) => ({
226
+ mint: e.mint.toString(),
227
+ tokenProgram: e.tokenProgram.toString(),
228
+ escrowAccount: e.escrowAccount.toString(),
229
+ index: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.index[0]).valueString),
230
+ lastSeenIndex: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.lastSeenIndex[0]).valueString),
231
+ lastSeenTotalAccruedEmissions: e.lastSeenTotalAccruedEmissions.toString(),
232
+ totalClaimedEmissions: e.totalClaimedEmissions.toString(),
233
+ treasuryEmission: e.treasuryEmission.toString(),
234
+ })),
235
+ },
236
+ },
237
+ };
238
+ }
239
+ exports.serializeFlavorJitoRestaking = serializeFlavorJitoRestaking;
240
+ function deserializeFlavorJitoRestaking(flavor) {
241
+ return {
242
+ flavor: "jitoRestaking",
243
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
244
+ mintBase: new anchor_1.web3.PublicKey(flavor.mintBase),
245
+ baseTokenProgram: new anchor_1.web3.PublicKey(flavor.baseTokenProgram),
246
+ emissions: flavor.emissions.map((e) => ({
247
+ exchangeRate: { 0: [new anchor_1.BN(precise_number_1.PreciseNumber.fromRaw([new anchor_1.BN(e.exchangeRate)]).valueString)] },
248
+ mint: new anchor_1.web3.PublicKey(e.mint),
249
+ tokenProgram: new anchor_1.web3.PublicKey(e.tokenProgram),
250
+ })),
251
+ jitoSyState: {
252
+ selfAddress: new anchor_1.web3.PublicKey(flavor.jitoSyState.selfAddress),
253
+ syRate: flavor.jitoSyState.syRate,
254
+ underlyingExchangeRate: flavor.jitoSyState.underlyingExchangeRate,
255
+ mintBase: new anchor_1.web3.PublicKey(flavor.jitoSyState.mintBase),
256
+ tokenProgramBase: new anchor_1.web3.PublicKey(flavor.jitoSyState.tokenProgramBase),
257
+ account: {
258
+ jitoVault: new anchor_1.web3.PublicKey(flavor.jitoSyState.account.jitoVault),
259
+ mintSy: new anchor_1.web3.PublicKey(flavor.jitoSyState.account.mintSy),
260
+ tokenSyEscrow: new anchor_1.web3.PublicKey(flavor.jitoSyState.account.tokenSyEscrow),
261
+ minMintSize: new anchor_1.BN(flavor.jitoSyState.account.minMintSize),
262
+ minRedeemSize: new anchor_1.BN(flavor.jitoSyState.account.minRedeemSize),
263
+ maxSySupply: new anchor_1.BN(flavor.jitoSyState.account.maxSySupply),
264
+ interfaceAccounts: flavor.jitoSyState.account.interfaceAccounts.map((a) => new anchor_1.web3.PublicKey(a)),
265
+ interfaceType: flavor.jitoSyState.account.interfaceType,
266
+ emissions: flavor.jitoSyState.account.emissions.map((emission) => ({
267
+ mint: new anchor_1.web3.PublicKey(emission.mint),
268
+ tokenProgram: new anchor_1.web3.PublicKey(emission.tokenProgram),
269
+ escrowAccount: new anchor_1.web3.PublicKey(emission.escrowAccount),
270
+ index: { 0: [new anchor_1.BN(emission.index)] },
271
+ lastSeenIndex: { 0: [new anchor_1.BN(emission.lastSeenIndex)] },
272
+ lastSeenTotalAccruedEmissions: new anchor_1.BN(emission.lastSeenTotalAccruedEmissions),
273
+ totalClaimedEmissions: new anchor_1.BN(emission.totalClaimedEmissions),
274
+ treasuryEmission: new anchor_1.BN(emission.treasuryEmission),
275
+ })),
276
+ },
277
+ },
278
+ };
279
+ }
280
+ exports.deserializeFlavorJitoRestaking = deserializeFlavorJitoRestaking;
281
+ function serializeFlavorParena(flavor) {
282
+ return {
283
+ flavor: "perena",
284
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
285
+ baseTokenProgram: flavor.baseTokenProgram.toString(),
286
+ mintBase: flavor.mintBase.toString(),
287
+ emissions: flavor.emissions.map((e) => ({
288
+ exchangeRate: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.exchangeRate[0]).valueString),
289
+ mint: e.mint.toString(),
290
+ tokenProgram: e.tokenProgram.toString(),
291
+ })),
292
+ perenaSyState: {
293
+ selfAddress: flavor.perenaSyState.selfAddress.toString(),
294
+ syRate: flavor.perenaSyState.syRate,
295
+ mintBase: flavor.perenaSyState.lpMint.toString(),
296
+ tokenProgramBase: flavor.perenaSyState.tokenProgramBase.toString(),
297
+ underlyingExchangeRate: Number(flavor.perenaSyState.syRate),
298
+ account: {
299
+ perenaStablePool: flavor.perenaSyState.account.perenaStablePool.toString(),
300
+ mintSy: flavor.perenaSyState.account.mintSy.toString(),
301
+ tokenSyEscrow: flavor.perenaSyState.account.tokenSyEscrow.toString(),
302
+ minMintSize: flavor.perenaSyState.account.minMintSize.toString(),
303
+ minRedeemSize: flavor.perenaSyState.account.minRedeemSize.toString(),
304
+ maxSySupply: flavor.perenaSyState.account.maxSySupply.toString(),
305
+ emissions: flavor.perenaSyState.account.emissions.map((e) => ({
306
+ mint: e.mint.toString(),
307
+ tokenProgram: e.tokenProgram.toString(),
308
+ escrowAccount: e.escrowAccount.toString(),
309
+ index: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.index[0]).valueString),
310
+ lastSeenIndex: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.lastSeenIndex[0]).valueString),
311
+ lastSeenTotalAccruedEmissions: e.lastSeenTotalAccruedEmissions.toString(),
312
+ totalClaimedEmissions: e.totalClaimedEmissions.toString(),
313
+ treasuryEmission: e.treasuryEmission.toString(),
314
+ })),
315
+ interfaceAccounts: flavor.perenaSyState.account.interfaceAccounts.map((a) => a.toString()),
316
+ },
317
+ },
318
+ };
319
+ }
320
+ exports.serializeFlavorParena = serializeFlavorParena;
321
+ function serializeFlavorGeneric(flavor) {
322
+ return {
323
+ flavor: "generic",
324
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
325
+ baseTokenProgram: flavor.baseTokenProgram.toString(),
326
+ mintBase: flavor.mintBase.toString(),
327
+ emissions: flavor.emissions.map((e) => ({
328
+ exchangeRate: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.exchangeRate[0]).valueString),
329
+ mint: e.mint.toString(),
330
+ tokenProgram: e.tokenProgram.toString(),
331
+ })),
332
+ genericSyState: {
333
+ selfAddress: flavor.genericSyState.selfAddress.toString(),
334
+ syRate: flavor.genericSyState.syRate,
335
+ tokenProgramBase: flavor.genericSyState.tokenProgramBase.toString(),
336
+ account: {
337
+ yieldBearingMint: flavor.genericSyState.account.yieldBearingMint.toString(),
338
+ mintSy: flavor.genericSyState.account.mintSy.toString(),
339
+ tokenSyEscrow: flavor.genericSyState.account.tokenSyEscrow.toString(),
340
+ minMintSize: flavor.genericSyState.account.minMintSize.toString(),
341
+ minRedeemSize: flavor.genericSyState.account.minRedeemSize.toString(),
342
+ maxSySupply: flavor.genericSyState.account.maxSySupply.toString(),
343
+ hook: {
344
+ ...flavor.genericSyState.account.hook,
345
+ preMintHookDiscriminator: Buffer.from(flavor.genericSyState.account.hook.preMintHookDiscriminator),
346
+ postRedeemHookDiscriminator: Buffer.from(flavor.genericSyState.account.hook.postRedeemHookDiscriminator),
347
+ },
348
+ emissions: flavor.genericSyState.account.emissions.map((e) => ({
349
+ mint: e.mint.toString(),
350
+ tokenProgram: e.tokenProgram.toString(),
351
+ escrowAccount: e.escrowAccount.toString(),
352
+ index: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.index[0]).valueString),
353
+ lastSeenIndex: parseFloat(precise_number_1.PreciseNumber.fromRaw(e.lastSeenIndex[0]).valueString),
354
+ lastSeenTotalAccruedEmissions: e.lastSeenTotalAccruedEmissions.toString(),
355
+ totalClaimedEmissions: e.totalClaimedEmissions.toString(),
356
+ treasuryEmission: e.treasuryEmission.toString(),
357
+ })),
358
+ interfaceAccounts: flavor.genericSyState.account.interfaceAccounts.map((a) => a.toString()),
359
+ interfaceType: flavor.genericSyState.account.interfaceType,
360
+ index: parseFloat(precise_number_1.PreciseNumber.fromRaw(flavor.genericSyState.account.index[0]).valueString),
361
+ },
362
+ },
363
+ };
364
+ }
365
+ exports.serializeFlavorGeneric = serializeFlavorGeneric;
366
+ function deserializeFlavorParena(flavor) {
367
+ return {
368
+ flavor: "perena",
369
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
370
+ baseTokenProgram: new anchor_1.web3.PublicKey(flavor.baseTokenProgram),
371
+ mintBase: new anchor_1.web3.PublicKey(flavor.mintBase),
372
+ perenaSyState: {
373
+ selfAddress: new anchor_1.web3.PublicKey(flavor.perenaSyState.selfAddress),
374
+ syRate: flavor.perenaSyState.syRate,
375
+ account: {
376
+ perenaStablePool: new anchor_1.web3.PublicKey(flavor.perenaSyState.account.perenaStablePool),
377
+ mintSy: new anchor_1.web3.PublicKey(flavor.perenaSyState.account.mintSy),
378
+ tokenSyEscrow: new anchor_1.web3.PublicKey(flavor.perenaSyState.account.tokenSyEscrow),
379
+ minMintSize: new anchor_1.BN(flavor.perenaSyState.account.minMintSize),
380
+ minRedeemSize: new anchor_1.BN(flavor.perenaSyState.account.minRedeemSize),
381
+ maxSySupply: new anchor_1.BN(flavor.perenaSyState.account.maxSySupply),
382
+ emissions: flavor.perenaSyState.account.emissions.map((emission) => ({
383
+ mint: new anchor_1.web3.PublicKey(emission.mint),
384
+ tokenProgram: new anchor_1.web3.PublicKey(emission.tokenProgram),
385
+ escrowAccount: new anchor_1.web3.PublicKey(emission.escrowAccount),
386
+ index: { 0: [new anchor_1.BN(emission.index)] },
387
+ lastSeenIndex: { 0: [new anchor_1.BN(emission.lastSeenIndex)] },
388
+ lastSeenTotalAccruedEmissions: new anchor_1.BN(emission.lastSeenTotalAccruedEmissions),
389
+ totalClaimedEmissions: new anchor_1.BN(emission.totalClaimedEmissions),
390
+ treasuryEmission: new anchor_1.BN(emission.treasuryEmission),
391
+ })),
392
+ interfaceAccounts: flavor.perenaSyState.account.interfaceAccounts.map((a) => new anchor_1.web3.PublicKey(a)),
393
+ },
394
+ lpMint: new anchor_1.web3.PublicKey(flavor.perenaSyState.mintBase),
395
+ tokenProgramBase: new anchor_1.web3.PublicKey(flavor.perenaSyState.tokenProgramBase),
396
+ },
397
+ emissions: flavor.emissions.map((e) => ({
398
+ exchangeRate: { 0: [new anchor_1.BN(precise_number_1.PreciseNumber.fromRaw([new anchor_1.BN(e.exchangeRate)]).valueString)] },
399
+ mint: new anchor_1.web3.PublicKey(e.mint),
400
+ tokenProgram: new anchor_1.web3.PublicKey(e.tokenProgram),
401
+ })),
402
+ };
403
+ }
404
+ exports.deserializeFlavorParena = deserializeFlavorParena;
405
+ function deserializeFlavorGeneric(flavor) {
406
+ return {
407
+ flavor: "generic",
408
+ currentSyExchangeRate: flavor.currentSyExchangeRate,
409
+ mintBase: new anchor_1.web3.PublicKey(flavor.mintBase),
410
+ baseTokenProgram: new anchor_1.web3.PublicKey(flavor.baseTokenProgram),
411
+ emissions: flavor.emissions.map((e) => ({
412
+ exchangeRate: { 0: [new anchor_1.BN(precise_number_1.PreciseNumber.fromRaw([new anchor_1.BN(e.exchangeRate)]).valueString)] },
413
+ mint: new anchor_1.web3.PublicKey(e.mint),
414
+ tokenProgram: new anchor_1.web3.PublicKey(e.tokenProgram),
415
+ })),
416
+ genericSyState: {
417
+ selfAddress: new anchor_1.web3.PublicKey(flavor.genericSyState.selfAddress),
418
+ syRate: flavor.genericSyState.syRate,
419
+ tokenProgramBase: new anchor_1.web3.PublicKey(flavor.genericSyState.tokenProgramBase),
420
+ account: {
421
+ mintSy: new anchor_1.web3.PublicKey(flavor.genericSyState.account.mintSy),
422
+ yieldBearingMint: new anchor_1.web3.PublicKey(flavor.genericSyState.account.yieldBearingMint),
423
+ tokenSyEscrow: new anchor_1.web3.PublicKey(flavor.genericSyState.account.tokenSyEscrow),
424
+ interfaceAccounts: flavor.genericSyState.account.interfaceAccounts.map((a) => new anchor_1.web3.PublicKey(a)),
425
+ interfaceType: flavor.genericSyState.account.interfaceType,
426
+ maxSySupply: new anchor_1.BN(flavor.genericSyState.account.maxSySupply),
427
+ minMintSize: new anchor_1.BN(flavor.genericSyState.account.minMintSize),
428
+ minRedeemSize: new anchor_1.BN(flavor.genericSyState.account.minRedeemSize),
429
+ hook: {
430
+ enabled: flavor.genericSyState.account.hook.enabled,
431
+ interfaceEmissionsAccountsUntil: flavor.genericSyState.account.hook.interfaceEmissionsAccountsUntil,
432
+ preMintHookDiscriminator: Array.from(flavor.genericSyState.account.hook.preMintHookDiscriminator),
433
+ postRedeemHookDiscriminator: Array.from(flavor.genericSyState.account.hook.postRedeemHookDiscriminator),
434
+ programId: new anchor_1.web3.PublicKey(flavor.genericSyState.account.hook.programId),
435
+ },
436
+ emissions: flavor.genericSyState.account.emissions.map((e) => ({
437
+ mint: new anchor_1.web3.PublicKey(e.mint),
438
+ tokenProgram: new anchor_1.web3.PublicKey(e.tokenProgram),
439
+ escrowAccount: new anchor_1.web3.PublicKey(e.escrowAccount),
440
+ index: { 0: [new anchor_1.BN(e.index)] },
441
+ lastSeenIndex: { 0: [new anchor_1.BN(e.lastSeenIndex)] },
442
+ lastSeenTotalAccruedEmissions: new anchor_1.BN(e.lastSeenTotalAccruedEmissions),
443
+ totalClaimedEmissions: new anchor_1.BN(e.totalClaimedEmissions),
444
+ treasuryEmission: new anchor_1.BN(e.treasuryEmission),
445
+ })),
446
+ index: { 0: [new anchor_1.BN(flavor.genericSyState.account.index)] },
447
+ },
448
+ },
449
+ };
450
+ }
451
+ exports.deserializeFlavorGeneric = deserializeFlavorGeneric;
452
+ /** Synchronous version to create Marginfi Flavor from data */
453
+ function makeFlavorMarginfiSync(data) {
454
+ const mfiSySdk = new marginfi_sy_sdk_1.MfiSySdk(data.mfiSyState);
455
+ return {
456
+ ...data,
457
+ flavor: "marginfi",
458
+ ixMintSy: (args) => mfiSySdk.ixMintSy(args),
459
+ ixRedeemSy: (args) => mfiSySdk.ixRedeemSy(args),
460
+ preIxs: async (args) => [],
461
+ postIxs: async (args) => [],
462
+ };
463
+ }
464
+ exports.makeFlavorMarginfiSync = makeFlavorMarginfiSync;
465
+ function makeFlavorKaminoSync(data) {
466
+ const klendSdk = new kamino_sy_sdk_1.KlendSySdk(data.kaminoSyState);
467
+ return {
468
+ ...data,
469
+ flavor: "kamino",
470
+ ixMintSy: (args) => klendSdk.ixMintSy(args),
471
+ ixRedeemSy: (args) => klendSdk.ixRedeemSy(args),
472
+ preIxs: async (args) => klendSdk.ixRefreshObligationAndFarms(args.signer),
473
+ postIxs: async (args) => [klendSdk.ixRefreshObligationAndFarms(args.signer)[2]],
474
+ };
475
+ }
476
+ exports.makeFlavorKaminoSync = makeFlavorKaminoSync;
477
+ function makeFlavorJitoRestakingSync(data) {
478
+ const jitoSdk = new jito_restaking_sy_sdk_1.JitoRestakingSySdk(data.jitoSyState);
479
+ return {
480
+ ...data,
481
+ flavor: "jitoRestaking",
482
+ ixMintSy: (args) => jitoSdk.ixMintSy(args),
483
+ ixRedeemSy: (args) => jitoSdk.ixRedeemSy(args),
484
+ preIxs: async (args) => [],
485
+ postIxs: async (args) => [],
486
+ };
487
+ }
488
+ exports.makeFlavorJitoRestakingSync = makeFlavorJitoRestakingSync;
489
+ function makeFlavorPerenaSync(data) {
490
+ const sySdk = new perena_sy_sdk_1.PerenaSySdk(data.perenaSyState);
491
+ return {
492
+ ...data,
493
+ flavor: "perena",
494
+ ixMintSy: (args) => sySdk.ixMintSy(args),
495
+ ixRedeemSy: (args) => sySdk.ixRedeemSy(args),
496
+ preIxs: async () => [],
497
+ postIxs: async () => [],
498
+ };
499
+ }
500
+ exports.makeFlavorPerenaSync = makeFlavorPerenaSync;
501
+ function makeFlavorGenericSync(data) {
502
+ const sySdk = new generic_sy_sdk_1.GenericSySdk(data.genericSyState);
503
+ return {
504
+ ...data,
505
+ flavor: "generic",
506
+ ixMintSy: (args) => sySdk.ixMintSy(args),
507
+ ixRedeemSy: (args) => sySdk.ixRedeemSy(args),
508
+ preIxs: async () => [],
509
+ postIxs: async () => [],
510
+ };
511
+ }
512
+ exports.makeFlavorGenericSync = makeFlavorGenericSync;
513
+ function flavorFinder(env, syProgram) {
514
+ if (env.marginfiSyProgramId.equals(syProgram)) {
515
+ return "marginfi";
516
+ }
517
+ else if (env.kaminoSyProgramId.equals(syProgram)) {
518
+ return "kamino";
519
+ }
520
+ else if (env.jitoRestakingSyProgramId.equals(syProgram)) {
521
+ return "jitoRestaking";
522
+ }
523
+ else if (env.perenaSyProgramId.equals(syProgram)) {
524
+ return "perena";
525
+ }
526
+ else if (env.genericSyProgramId.equals(syProgram)) {
527
+ return "generic";
528
+ }
529
+ else {
530
+ throw new Error("Unknown flavor");
531
+ }
532
+ }
533
+ exports.flavorFinder = flavorFinder;
534
+ async function makeFlavor(fetcher, env,
535
+ /** The actual SY program linked to the market */
536
+ syProgram, cpiAccounts) {
537
+ const fd = flavorFinder(env, syProgram);
538
+ if (fd === "marginfi") {
539
+ return makeMarginfiFlavor(fetcher, env.marginfiSyProgramId, cpiAccounts);
540
+ }
541
+ else if (fd === "kamino") {
542
+ return makeKaminoFlavor(fetcher, env.kaminoSyProgramId, cpiAccounts);
543
+ }
544
+ else if (fd === "jitoRestaking") {
545
+ return makeJitoRestakingFlavor(fetcher, env.jitoRestakingSyProgramId, cpiAccounts);
546
+ }
547
+ else if (fd === "perena") {
548
+ return makePerenaFlavor(fetcher, env.perenaSyProgramId, cpiAccounts);
549
+ }
550
+ else if (fd === "generic") {
551
+ return makeGenericFlavor(fetcher, env.genericSyProgramId, cpiAccounts);
552
+ }
553
+ {
554
+ throw new Error("Unknown flavor");
555
+ }
556
+ }
557
+ exports.makeFlavor = makeFlavor;
558
+ async function makeMarginfiFlavor(fetcher, marginfiSyProgramId, cpiAccounts) {
559
+ /** Solana's convention is to use the Program ID for the account address if the account is null */
560
+ const isNone = (x) => x.equals(marginfiSyProgramId);
561
+ const mapOptAccount = (x) => (isNone(x) ? undefined : x);
562
+ // TODO - I do not like hard-coding these magic numbers
563
+ const bank = cpiAccounts.getSyState[2].pubkey;
564
+ const emissionMint = cpiAccounts.getSyState[5].pubkey;
565
+ const emissionTokenProgram = cpiAccounts.getSyState[11].pubkey;
566
+ const mfiSySdk = await marginfi_sy_sdk_1.MfiSySdk.load({
567
+ cnx: fetcher.connection,
568
+ mfiBank: bank,
569
+ mfiSyProgramId: marginfiSyProgramId,
570
+ });
571
+ const currentSyExchangeRate = Number(mfiSySdk.state.syRate);
572
+ const emissions = mfiSySdk.account.emissions.map((e) => ({
573
+ exchangeRate: e.index,
574
+ mint: e.mint,
575
+ tokenProgram: e.tokenProgram,
576
+ }));
577
+ const ixMintSy = (args) => mfiSySdk.ixMintSy(args);
578
+ const ixRedeemSy = (args) => mfiSySdk.ixRedeemSy(args);
579
+ const mintBase = mfiSySdk.mintBase;
580
+ const baseTokenProgram = mfiSySdk.tokenProgramBase;
581
+ return {
582
+ flavor: "marginfi",
583
+ ixMintSy,
584
+ ixRedeemSy,
585
+ currentSyExchangeRate,
586
+ emissions,
587
+ bank,
588
+ mintBase,
589
+ baseTokenProgram,
590
+ mfiSyState: mfiSySdk.state,
591
+ emissionMint: mapOptAccount(emissionMint),
592
+ emissionTokenProgram: mapOptAccount(emissionTokenProgram),
593
+ preIxs: async (args) => [],
594
+ postIxs: async (args) => [],
595
+ };
596
+ }
597
+ async function makeKaminoFlavor(fetcher, kaminoSyProgramId, cpiAccounts) {
598
+ const isNone = (x) => x.equals(kaminoSyProgramId);
599
+ const mapOptAccount = (x) => (isNone(x) ? undefined : x);
600
+ // TODO - I do not like hard-coding these magic numbers
601
+ const reserve = cpiAccounts.getSyState[0].pubkey;
602
+ const reserveAcct = await (0, exponent_fetcher_1.fetchKaminoReserve)(reserve, fetcher.connection);
603
+ const mintBase = reserveAcct.baseMint;
604
+ // TODO - don't do this
605
+ const baseTokenProgram = await fetcher.connection.getAccountInfo(mintBase).then((a) => a.owner);
606
+ const meta = (0, kamino_lend_standard_1.getMeta)(reserve, kaminoSyProgramId);
607
+ const syMeta = await fetcher.fetchKaminoSyMeta(meta);
608
+ const klendSdk = await kamino_sy_sdk_1.KlendSySdk.load({
609
+ cnx: fetcher.connection,
610
+ klendMarketId: reserveAcct.lendingMarket,
611
+ klendReserve: reserve,
612
+ klendSyProgramId: kaminoSyProgramId,
613
+ klendProgramId: kamino_lend_standard_1.KAMINO_LEND_PROGRAM_ID,
614
+ });
615
+ return {
616
+ flavor: "kamino",
617
+ currentSyExchangeRate: reserveAcct.assetShareValue.toNumber(),
618
+ kaminoSyState: klendSdk.state,
619
+ emissions: syMeta.emissions.map((e) => ({
620
+ exchangeRate: e.lastSeenIndex,
621
+ mint: e.mint,
622
+ tokenProgram: e.tokenProgram,
623
+ })),
624
+ mintBase,
625
+ baseTokenProgram,
626
+ ixMintSy: (args) => {
627
+ return klendSdk.ixMintSy(args);
628
+ },
629
+ ixRedeemSy: (args) => {
630
+ return klendSdk.ixRedeemSy(args);
631
+ },
632
+ preIxs: async (args) => klendSdk.ixRefreshObligationAndFarms(args.signer),
633
+ postIxs: async (args) => [klendSdk.ixRefreshObligationAndFarms(args.signer)[2]],
634
+ };
635
+ }
636
+ async function makeJitoRestakingFlavor(fetcher, jitoRestakingSyProgramId, cpiAccounts) {
637
+ // TODO - I do not like hard-coding these magic numbers
638
+ const jitoVault = cpiAccounts.getSyState[1].pubkey;
639
+ // const recentBlockhash = await fetcher.connection.getLatestBlockhash().then((b) => b.blockhash)
640
+ const jitoSdk = await jito_restaking_sy_sdk_1.JitoRestakingSySdk.load({
641
+ cnx: fetcher.connection,
642
+ jitoVault,
643
+ jitoRestakingSyProgramId,
644
+ });
645
+ return {
646
+ flavor: "jitoRestaking",
647
+ currentSyExchangeRate: Number(jitoSdk.state.syRate),
648
+ jitoSyState: jitoSdk.state,
649
+ emissions: jitoSdk.emissions.map((e) => ({
650
+ exchangeRate: e.index,
651
+ mint: e.mint,
652
+ tokenProgram: e.tokenProgram,
653
+ })),
654
+ mintBase: jitoSdk.mintBase,
655
+ baseTokenProgram: jitoSdk.tokenProgramBase,
656
+ ixMintSy: (args) => jitoSdk.ixMintSy(args),
657
+ ixRedeemSy: (args) => jitoSdk.ixRedeemSy(args),
658
+ preIxs: async () => [],
659
+ postIxs: async () => [],
660
+ };
661
+ }
662
+ async function makePerenaFlavor(fetcher, perenaSyProgramId, cpiAccounts) {
663
+ const perenaStablePool = cpiAccounts.getSyState[1].pubkey;
664
+ const sySdk = await perena_sy_sdk_1.PerenaSySdk.load({
665
+ cnx: fetcher.connection,
666
+ perenaStablePool,
667
+ perenaSyProgramId,
668
+ });
669
+ return {
670
+ flavor: "perena",
671
+ currentSyExchangeRate: Number(sySdk.state.syRate),
672
+ mintBase: sySdk.mintBase,
673
+ baseTokenProgram: sySdk.tokenProgramBase,
674
+ ixMintSy: (args) => sySdk.ixMintSy(args),
675
+ ixRedeemSy: (args) => sySdk.ixRedeemSy(args),
676
+ preIxs: async () => [],
677
+ postIxs: async () => [],
678
+ perenaSyState: sySdk.state,
679
+ emissions: sySdk.emissions.map((e) => ({
680
+ exchangeRate: e.index,
681
+ mint: e.mint,
682
+ tokenProgram: e.tokenProgram,
683
+ })),
684
+ };
685
+ }
686
+ async function makeGenericFlavor(fetcher, genericStandardProgramId, cpiAccounts) {
687
+ const genericSyMeta = cpiAccounts.depositSy[1].pubkey;
688
+ const sySdk = await generic_sy_sdk_1.GenericSySdk.loadFromSyMeta({
689
+ cnx: fetcher.connection,
690
+ genericStandardProgramId,
691
+ syMetaAddress: genericSyMeta,
692
+ });
693
+ let preIxs = [];
694
+ let postIxs = [];
695
+ const isFragmetric = "fragmetric" in sySdk.state.account.interfaceType;
696
+ return {
697
+ flavor: "generic",
698
+ currentSyExchangeRate: sySdk.state.syRate,
699
+ mintBase: sySdk.state.account.yieldBearingMint,
700
+ baseTokenProgram: sySdk.tokenProgramBase,
701
+ ixMintSy: (args) => sySdk.ixMintSy(args),
702
+ ixRedeemSy: (args) => sySdk.ixRedeemSy(args),
703
+ preIxs: async () => preIxs,
704
+ postIxs: async () => postIxs,
705
+ genericSyState: sySdk.state,
706
+ emissions: sySdk.emissions.map((e) => ({
707
+ exchangeRate: e.index,
708
+ mint: e.mint,
709
+ tokenProgram: e.tokenProgram,
710
+ })),
711
+ };
712
+ }
713
+ //# sourceMappingURL=flavors.js.map