@exponent-labs/generic-sy-sdk 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +32 -52
- package/build/index.js +472 -43
- package/build/index.js.map +1 -1
- package/build/types.d.ts +0 -1
- package/package.json +8 -8
- package/src/index.ts +546 -48
package/build/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GenericSySdk = exports.InterfaceType = void 0;
|
|
4
|
+
exports.getInterfaceTypeObj = getInterfaceTypeObj;
|
|
5
|
+
exports.getInterfaceTypeFromString = getInterfaceTypeFromString;
|
|
6
|
+
exports.initSy = initSy;
|
|
4
7
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
-
const generic_sy_idl_1 = require("@exponent-labs/generic-sy-idl");
|
|
6
8
|
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
-
const generic_sy_pda_1 = require("@exponent-labs/generic-sy-pda");
|
|
8
|
-
const exponent_fetcher_1 = require("@exponent-labs/exponent-fetcher");
|
|
9
9
|
const exponent_admin_pda_1 = require("@exponent-labs/exponent-admin-pda");
|
|
10
|
-
const
|
|
10
|
+
const exponent_fetcher_1 = require("@exponent-labs/exponent-fetcher");
|
|
11
11
|
const fragmetric_pda_1 = require("@exponent-labs/fragmetric-pda");
|
|
12
|
-
const
|
|
12
|
+
const generic_sy_idl_1 = require("@exponent-labs/generic-sy-idl");
|
|
13
|
+
const generic_sy_pda_1 = require("@exponent-labs/generic-sy-pda");
|
|
13
14
|
const precise_number_1 = require("@exponent-labs/precise-number");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
14
16
|
async function loadAccountState(cnx, yieldBearingMint, genericStandardProgramId, interfaceType) {
|
|
15
17
|
let interfaceIndex;
|
|
16
18
|
if ("pyth" in interfaceType) {
|
|
@@ -28,9 +30,30 @@ async function loadAccountState(cnx, yieldBearingMint, genericStandardProgramId,
|
|
|
28
30
|
else if ("meteora" in interfaceType) {
|
|
29
31
|
interfaceIndex = InterfaceType.Meteora;
|
|
30
32
|
}
|
|
33
|
+
else if ("sanctum" in interfaceType) {
|
|
34
|
+
interfaceIndex = InterfaceType.Sanctum;
|
|
35
|
+
}
|
|
31
36
|
else if ("fragmetricSupportedAsset" in interfaceType) {
|
|
32
37
|
interfaceIndex = InterfaceType.FragmetricSupportedAsset;
|
|
33
38
|
}
|
|
39
|
+
else if ("jupiterPerps" in interfaceType) {
|
|
40
|
+
interfaceIndex = InterfaceType.JupiterPerps;
|
|
41
|
+
}
|
|
42
|
+
else if ("adrena" in interfaceType) {
|
|
43
|
+
interfaceIndex = InterfaceType.Adrena;
|
|
44
|
+
}
|
|
45
|
+
else if ("hyloLpToken" in interfaceType) {
|
|
46
|
+
interfaceIndex = InterfaceType.HyloLpToken;
|
|
47
|
+
}
|
|
48
|
+
else if ("jupiterLend" in interfaceType) {
|
|
49
|
+
interfaceIndex = InterfaceType.JupiterLend;
|
|
50
|
+
}
|
|
51
|
+
else if ("kaminoVault" in interfaceType) {
|
|
52
|
+
interfaceIndex = InterfaceType.KaminoVault;
|
|
53
|
+
}
|
|
54
|
+
else if ("solstice" in interfaceType) {
|
|
55
|
+
interfaceIndex = InterfaceType.Solstice;
|
|
56
|
+
}
|
|
34
57
|
else {
|
|
35
58
|
throw new Error("Unsupported interface type");
|
|
36
59
|
}
|
|
@@ -50,6 +73,13 @@ var InterfaceType;
|
|
|
50
73
|
InterfaceType[InterfaceType["Fragmetric"] = 3] = "Fragmetric";
|
|
51
74
|
InterfaceType[InterfaceType["Meteora"] = 4] = "Meteora";
|
|
52
75
|
InterfaceType[InterfaceType["FragmetricSupportedAsset"] = 5] = "FragmetricSupportedAsset";
|
|
76
|
+
InterfaceType[InterfaceType["Sanctum"] = 6] = "Sanctum";
|
|
77
|
+
InterfaceType[InterfaceType["JupiterPerps"] = 7] = "JupiterPerps";
|
|
78
|
+
InterfaceType[InterfaceType["Adrena"] = 8] = "Adrena";
|
|
79
|
+
InterfaceType[InterfaceType["HyloLpToken"] = 9] = "HyloLpToken";
|
|
80
|
+
InterfaceType[InterfaceType["JupiterLend"] = 10] = "JupiterLend";
|
|
81
|
+
InterfaceType[InterfaceType["KaminoVault"] = 11] = "KaminoVault";
|
|
82
|
+
InterfaceType[InterfaceType["Solstice"] = 12] = "Solstice";
|
|
53
83
|
})(InterfaceType || (exports.InterfaceType = InterfaceType = {}));
|
|
54
84
|
function getInterfaceTypeObj(interfaceType) {
|
|
55
85
|
switch (interfaceType) {
|
|
@@ -65,11 +95,31 @@ function getInterfaceTypeObj(interfaceType) {
|
|
|
65
95
|
return { fragmetricSupportedAsset: {} };
|
|
66
96
|
case InterfaceType.Meteora:
|
|
67
97
|
return { meteora: {} };
|
|
98
|
+
case InterfaceType.Sanctum:
|
|
99
|
+
return { sanctum: {} };
|
|
100
|
+
case InterfaceType.JupiterPerps:
|
|
101
|
+
return {
|
|
102
|
+
jupiterPerps: {
|
|
103
|
+
lastFeeUsdResetUnixTimestamp: 0,
|
|
104
|
+
lastRealizedFeeUsd: new anchor_1.BN(0),
|
|
105
|
+
lastAumUsd: new anchor_1.BN(0),
|
|
106
|
+
lastRealizedFeeUsdUpdateUnixTimestamp: 0,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
case InterfaceType.Adrena:
|
|
110
|
+
return { adrena: { previousTotalFees: new anchor_1.BN(0) } };
|
|
111
|
+
case InterfaceType.HyloLpToken:
|
|
112
|
+
return { hyloLpToken: {} };
|
|
113
|
+
case InterfaceType.JupiterLend:
|
|
114
|
+
return { jupiterLend: { padding: [] } };
|
|
115
|
+
case InterfaceType.KaminoVault:
|
|
116
|
+
return { kaminoVault: { padding: [] } };
|
|
117
|
+
case InterfaceType.Solstice:
|
|
118
|
+
return { solstice: { padding: [] } };
|
|
68
119
|
default:
|
|
69
120
|
throw new Error(`Unsupported interface type: ${interfaceType}`);
|
|
70
121
|
}
|
|
71
122
|
}
|
|
72
|
-
exports.getInterfaceTypeObj = getInterfaceTypeObj;
|
|
73
123
|
function getInterfaceTypeFromString(interfaceType) {
|
|
74
124
|
switch (interfaceType) {
|
|
75
125
|
case "pyth":
|
|
@@ -84,18 +134,38 @@ function getInterfaceTypeFromString(interfaceType) {
|
|
|
84
134
|
return { fragmetricSupportedAsset: {} };
|
|
85
135
|
case "meteora":
|
|
86
136
|
return { meteora: {} };
|
|
137
|
+
case "sanctum":
|
|
138
|
+
return { sanctum: {} };
|
|
139
|
+
case "jupiter-perps":
|
|
140
|
+
return {
|
|
141
|
+
jupiterPerps: {
|
|
142
|
+
lastFeeUsdResetUnixTimestamp: 0,
|
|
143
|
+
lastRealizedFeeUsd: new anchor_1.BN(0),
|
|
144
|
+
lastAumUsd: new anchor_1.BN(0),
|
|
145
|
+
lastRealizedFeeUsdUpdateUnixTimestamp: 0,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
case "adrena":
|
|
149
|
+
return { adrena: { previousTotalFees: new anchor_1.BN(0) } };
|
|
150
|
+
case "hylo-lp-token":
|
|
151
|
+
return { hyloLpToken: {} };
|
|
152
|
+
case "jupiter-lend":
|
|
153
|
+
return { jupiterLend: { padding: [] } };
|
|
154
|
+
case "kamino-vault":
|
|
155
|
+
return { kaminoVault: { padding: [] } };
|
|
156
|
+
case "solstice":
|
|
157
|
+
return { solstice: { padding: [] } };
|
|
87
158
|
default:
|
|
88
159
|
throw new Error(`Unsupported interface type: ${interfaceType}`);
|
|
89
160
|
}
|
|
90
161
|
}
|
|
91
|
-
exports.getInterfaceTypeFromString = getInterfaceTypeFromString;
|
|
92
162
|
class GenericSySdk {
|
|
93
163
|
state;
|
|
94
164
|
/** Private program for building instructions */
|
|
95
165
|
program;
|
|
96
166
|
config;
|
|
97
167
|
syPda;
|
|
98
|
-
constructor(state, programId = new anchor_1.web3.PublicKey(
|
|
168
|
+
constructor(state, programId = new anchor_1.web3.PublicKey(generic_sy_idl_1.PROGRAM_ID), config = {}) {
|
|
99
169
|
this.state = state;
|
|
100
170
|
this.config = config;
|
|
101
171
|
// create a fake AnchorProvider -- which is unused
|
|
@@ -120,6 +190,27 @@ class GenericSySdk {
|
|
|
120
190
|
else if ("meteora" in this.state.account.interfaceType) {
|
|
121
191
|
interfaceIndex = InterfaceType.Meteora;
|
|
122
192
|
}
|
|
193
|
+
else if ("sanctum" in this.state.account.interfaceType) {
|
|
194
|
+
interfaceIndex = InterfaceType.Sanctum;
|
|
195
|
+
}
|
|
196
|
+
else if ("jupiterPerps" in this.state.account.interfaceType) {
|
|
197
|
+
interfaceIndex = InterfaceType.JupiterPerps;
|
|
198
|
+
}
|
|
199
|
+
else if ("adrena" in this.state.account.interfaceType) {
|
|
200
|
+
interfaceIndex = InterfaceType.Adrena;
|
|
201
|
+
}
|
|
202
|
+
else if ("hyloLpToken" in this.state.account.interfaceType) {
|
|
203
|
+
interfaceIndex = InterfaceType.HyloLpToken;
|
|
204
|
+
}
|
|
205
|
+
else if ("jupiterLend" in this.state.account.interfaceType) {
|
|
206
|
+
interfaceIndex = InterfaceType.JupiterLend;
|
|
207
|
+
}
|
|
208
|
+
else if ("kaminoVault" in this.state.account.interfaceType) {
|
|
209
|
+
interfaceIndex = InterfaceType.KaminoVault;
|
|
210
|
+
}
|
|
211
|
+
else if ("solstice" in this.state.account.interfaceType) {
|
|
212
|
+
interfaceIndex = InterfaceType.Solstice;
|
|
213
|
+
}
|
|
123
214
|
else {
|
|
124
215
|
throw new Error("Unsupported interface type");
|
|
125
216
|
}
|
|
@@ -140,14 +231,24 @@ class GenericSySdk {
|
|
|
140
231
|
fragmetricFund: account.interfaceAccounts[0],
|
|
141
232
|
index: 0,
|
|
142
233
|
});
|
|
143
|
-
return {
|
|
234
|
+
return {
|
|
235
|
+
syRate: index,
|
|
236
|
+
additionalData: {
|
|
237
|
+
fragmetricData: { receiptTokenMint, wrappedTokenMint },
|
|
238
|
+
},
|
|
239
|
+
};
|
|
144
240
|
}
|
|
145
241
|
else if ("fragmetric" in interfaceType) {
|
|
146
242
|
const { index, receiptTokenMint, wrappedTokenMint } = await (0, exponent_fetcher_1.fetchFragmetricIndex)({
|
|
147
243
|
connection: cnx,
|
|
148
244
|
fragmetricFund: account.interfaceAccounts[0],
|
|
149
245
|
});
|
|
150
|
-
return {
|
|
246
|
+
return {
|
|
247
|
+
syRate: index,
|
|
248
|
+
additionalData: {
|
|
249
|
+
fragmetricData: { receiptTokenMint, wrappedTokenMint },
|
|
250
|
+
},
|
|
251
|
+
};
|
|
151
252
|
}
|
|
152
253
|
else if ("meteora" in interfaceType) {
|
|
153
254
|
const currentTs = Math.floor(Date.now() / 1000);
|
|
@@ -159,6 +260,98 @@ class GenericSySdk {
|
|
|
159
260
|
const virtualPrice = await (0, exponent_fetcher_1.fetchMeteoraIndex)({ connection: cnx, accounts, onChainTime: currentTs });
|
|
160
261
|
return { syRate: virtualPrice.virtualPrice };
|
|
161
262
|
}
|
|
263
|
+
else if ("sanctum" in interfaceType) {
|
|
264
|
+
const accounts = {
|
|
265
|
+
lpMint: account.interfaceAccounts[0],
|
|
266
|
+
poolState: account.interfaceAccounts[1],
|
|
267
|
+
};
|
|
268
|
+
const exchangeRate = await (0, exponent_fetcher_1.fetchSanctumIndex)({ connection: cnx, accounts });
|
|
269
|
+
return { syRate: exchangeRate };
|
|
270
|
+
}
|
|
271
|
+
else if ("adrena" in interfaceType) {
|
|
272
|
+
// @ts-ignore
|
|
273
|
+
const previousTotalFees = account.interfaceType.adrena.previousTotalFees;
|
|
274
|
+
const currentIndex = account.index;
|
|
275
|
+
let accounts = {
|
|
276
|
+
pool: account.interfaceAccounts[0],
|
|
277
|
+
custody1: account.interfaceAccounts[1],
|
|
278
|
+
custody2: account.interfaceAccounts[2],
|
|
279
|
+
custody3: account.interfaceAccounts[3],
|
|
280
|
+
custody4: account.interfaceAccounts[4],
|
|
281
|
+
};
|
|
282
|
+
const syRate = await (0, exponent_fetcher_1.fetchAdrenaIndex)({ connection: cnx, accounts, currentIndex, previousTotalFees });
|
|
283
|
+
return { syRate: syRate.index };
|
|
284
|
+
}
|
|
285
|
+
else if ("jupiterPerps" in interfaceType) {
|
|
286
|
+
// @ts-ignore
|
|
287
|
+
const j = account.interfaceType.jupiterPerps;
|
|
288
|
+
const { index } = await (0, exponent_fetcher_1.fetchJupiterPerpsIndex)({
|
|
289
|
+
connection: cnx,
|
|
290
|
+
pool: account.interfaceAccounts[0],
|
|
291
|
+
lastFeeUsdResetUnixTimestamp: j.lastFeeUsdResetUnixTimestamp,
|
|
292
|
+
lastRealizedFeeUsd: new anchor_1.BN(j.lastRealizedFeeUsd),
|
|
293
|
+
lastAumUsd: new anchor_1.BN(j.lastAumUsd),
|
|
294
|
+
currentIndex: account.index,
|
|
295
|
+
lastRealizedFeeUsdUpdateUnixTimestamp: j.lastRealizedFeeUsdUpdateUnixTimestamp,
|
|
296
|
+
});
|
|
297
|
+
return { syRate: index };
|
|
298
|
+
}
|
|
299
|
+
else if ("hyloLpToken" in interfaceType) {
|
|
300
|
+
// For HyloLpToken, the exchange rate is calculated by the Rust program using hylo_cpi
|
|
301
|
+
// and will be available in the index field
|
|
302
|
+
const syRate = Number(precise_number_1.PreciseNumber.fromRaw(account.index[0]).valueString);
|
|
303
|
+
return { syRate };
|
|
304
|
+
}
|
|
305
|
+
else if ("jupiterLend" in interfaceType) {
|
|
306
|
+
const { index, baseTokenMint, tokenReservesLiquidity, lendingSupplyPosition, rewardsRateModel, rateModel } = await (0, exponent_fetcher_1.fetchJupiterLendIndex)({
|
|
307
|
+
connection: cnx,
|
|
308
|
+
jupiterLendAccount: account.interfaceAccounts[0],
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
syRate: index,
|
|
312
|
+
additionalData: {
|
|
313
|
+
jupiterLendData: {
|
|
314
|
+
baseTokenMint,
|
|
315
|
+
tokenReservesLiquidity,
|
|
316
|
+
lendingSupplyPosition,
|
|
317
|
+
rewardsRateModel,
|
|
318
|
+
rateModel,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
else if ("kaminoVault" in interfaceType) {
|
|
324
|
+
const { index, tokenVault, tokenMint, baseVaultAuthority, sharesMint, reserves } = await (0, exponent_fetcher_1.fetchKaminoVaultIndex)({
|
|
325
|
+
connection: cnx,
|
|
326
|
+
kaminoVaultAccount: account.interfaceAccounts[0],
|
|
327
|
+
});
|
|
328
|
+
return {
|
|
329
|
+
syRate: index,
|
|
330
|
+
additionalData: {
|
|
331
|
+
kaminoVaultData: {
|
|
332
|
+
vault: account.interfaceAccounts[0],
|
|
333
|
+
reserves: reserves.map((r) => {
|
|
334
|
+
return {
|
|
335
|
+
reserveAddress: r.reserveAddress,
|
|
336
|
+
marketAddress: r.reserve,
|
|
337
|
+
};
|
|
338
|
+
}),
|
|
339
|
+
tokenVault,
|
|
340
|
+
tokenMint,
|
|
341
|
+
baseVaultAuthority,
|
|
342
|
+
sharesMint,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
else if ("solstice" in interfaceType) {
|
|
348
|
+
const { redemptionRate } = await (0, exponent_fetcher_1.fetchSolsticeRedemptionRate)({
|
|
349
|
+
connection: cnx,
|
|
350
|
+
yieldPool: account.interfaceAccounts[0],
|
|
351
|
+
vestingSchedule: account.interfaceAccounts[1],
|
|
352
|
+
});
|
|
353
|
+
return { syRate: redemptionRate };
|
|
354
|
+
}
|
|
162
355
|
else {
|
|
163
356
|
return { syRate: 1 };
|
|
164
357
|
}
|
|
@@ -166,7 +359,7 @@ class GenericSySdk {
|
|
|
166
359
|
/** Load an instance of SyMeta */
|
|
167
360
|
static async load({ cnx, yieldBearingMint, interfaceType, genericStandardProgramId, config = {}, }) {
|
|
168
361
|
const account = await loadAccountState(cnx, yieldBearingMint, genericStandardProgramId, interfaceType);
|
|
169
|
-
const tokenProgramBase =
|
|
362
|
+
const tokenProgramBase = (await cnx.getAccountInfo(yieldBearingMint))?.owner;
|
|
170
363
|
let interfaceIndex;
|
|
171
364
|
if ("pyth" in interfaceType) {
|
|
172
365
|
interfaceIndex = InterfaceType.Pyth;
|
|
@@ -186,19 +379,40 @@ class GenericSySdk {
|
|
|
186
379
|
else if ("meteora" in interfaceType) {
|
|
187
380
|
interfaceIndex = InterfaceType.Meteora;
|
|
188
381
|
}
|
|
382
|
+
else if ("sanctum" in interfaceType) {
|
|
383
|
+
interfaceIndex = InterfaceType.Sanctum;
|
|
384
|
+
}
|
|
385
|
+
else if ("jupiterPerps" in interfaceType) {
|
|
386
|
+
interfaceIndex = InterfaceType.JupiterPerps;
|
|
387
|
+
}
|
|
388
|
+
else if ("adrena" in interfaceType) {
|
|
389
|
+
interfaceIndex = InterfaceType.Adrena;
|
|
390
|
+
}
|
|
391
|
+
else if ("hyloLpToken" in interfaceType) {
|
|
392
|
+
interfaceIndex = InterfaceType.HyloLpToken;
|
|
393
|
+
}
|
|
394
|
+
else if ("jupiterLend" in interfaceType) {
|
|
395
|
+
interfaceIndex = InterfaceType.JupiterLend;
|
|
396
|
+
}
|
|
397
|
+
else if ("kaminoVault" in interfaceType) {
|
|
398
|
+
interfaceIndex = InterfaceType.KaminoVault;
|
|
399
|
+
}
|
|
400
|
+
else if ("solstice" in interfaceType) {
|
|
401
|
+
interfaceIndex = InterfaceType.Solstice;
|
|
402
|
+
}
|
|
189
403
|
else {
|
|
190
404
|
throw new Error("Unsupported interface type");
|
|
191
405
|
}
|
|
192
406
|
const selfAddress = new generic_sy_pda_1.GenericSyPda(genericStandardProgramId, interfaceIndex).syMeta({
|
|
193
407
|
yieldBearingMint,
|
|
194
408
|
});
|
|
195
|
-
const { syRate,
|
|
409
|
+
const { syRate, additionalData } = await GenericSySdk.calculateSyRate(account, interfaceType, cnx);
|
|
196
410
|
const state = {
|
|
197
411
|
selfAddress,
|
|
198
412
|
account,
|
|
199
413
|
tokenProgramBase,
|
|
200
414
|
syRate,
|
|
201
|
-
|
|
415
|
+
additionalData,
|
|
202
416
|
};
|
|
203
417
|
return new GenericSySdk(state, genericStandardProgramId, config);
|
|
204
418
|
}
|
|
@@ -207,13 +421,13 @@ class GenericSySdk {
|
|
|
207
421
|
const fetcher = new exponent_fetcher_1.ExponentFetcher({ connection: cnx, genericStandardProgramId });
|
|
208
422
|
const account = await fetcher.fetchGenericSyMeta(syMetaAddress);
|
|
209
423
|
const tokenProgramBase = spl_token_1.TOKEN_PROGRAM_ID;
|
|
210
|
-
const { syRate,
|
|
424
|
+
const { syRate, additionalData } = await GenericSySdk.calculateSyRate(account, account.interfaceType, cnx);
|
|
211
425
|
const state = {
|
|
212
426
|
selfAddress: syMetaAddress,
|
|
213
427
|
account,
|
|
214
428
|
tokenProgramBase,
|
|
215
429
|
syRate,
|
|
216
|
-
|
|
430
|
+
additionalData,
|
|
217
431
|
};
|
|
218
432
|
return new GenericSySdk(state, genericStandardProgramId, config);
|
|
219
433
|
}
|
|
@@ -221,9 +435,9 @@ class GenericSySdk {
|
|
|
221
435
|
async reload(cnx) {
|
|
222
436
|
const account = await loadAccountState(cnx, this.state.account.yieldBearingMint, this.program.programId, this.state.account.interfaceType);
|
|
223
437
|
this.state.account = account;
|
|
224
|
-
const { syRate,
|
|
438
|
+
const { syRate, additionalData } = await GenericSySdk.calculateSyRate(account, account.interfaceType, cnx);
|
|
225
439
|
this.state.syRate = syRate;
|
|
226
|
-
this.state.
|
|
440
|
+
this.state.additionalData = additionalData;
|
|
227
441
|
}
|
|
228
442
|
get account() {
|
|
229
443
|
return this.state.account;
|
|
@@ -256,7 +470,7 @@ class GenericSySdk {
|
|
|
256
470
|
return this.state.tokenProgramBase;
|
|
257
471
|
}
|
|
258
472
|
get tokenVrtEscrow() {
|
|
259
|
-
return (0, spl_token_1.getAssociatedTokenAddressSync)(this.vrtMint, this.selfAddress, true,
|
|
473
|
+
return (0, spl_token_1.getAssociatedTokenAddressSync)(this.vrtMint, this.selfAddress, true, this.tokenProgramBase);
|
|
260
474
|
}
|
|
261
475
|
get tokenSyEscrow() {
|
|
262
476
|
return this.state.account.tokenSyEscrow;
|
|
@@ -269,10 +483,28 @@ class GenericSySdk {
|
|
|
269
483
|
!("fragmetricSupportedAsset" in this.state.account.interfaceType)) {
|
|
270
484
|
throw new Error("Not a fragmetric interface");
|
|
271
485
|
}
|
|
272
|
-
if (!this.state.fragmetricData) {
|
|
486
|
+
if (!this.state.additionalData?.fragmetricData) {
|
|
273
487
|
throw new Error("Fragmetric data not loaded");
|
|
274
488
|
}
|
|
275
|
-
return this.state.fragmetricData;
|
|
489
|
+
return this.state.additionalData.fragmetricData;
|
|
490
|
+
}
|
|
491
|
+
get jupiterLendData() {
|
|
492
|
+
if (!("jupiterLend" in this.state.account.interfaceType)) {
|
|
493
|
+
throw new Error("Not a Jupiter Lend interface");
|
|
494
|
+
}
|
|
495
|
+
if (!this.state.additionalData?.jupiterLendData) {
|
|
496
|
+
throw new Error("Jupiter Lend data not loaded");
|
|
497
|
+
}
|
|
498
|
+
return this.state.additionalData.jupiterLendData;
|
|
499
|
+
}
|
|
500
|
+
get kaminoVaultData() {
|
|
501
|
+
if (!("kaminoVault" in this.state.account.interfaceType)) {
|
|
502
|
+
throw new Error("Not a Kamino Vault interface");
|
|
503
|
+
}
|
|
504
|
+
if (!this.state.additionalData?.kaminoVaultData) {
|
|
505
|
+
throw new Error("Kamino Vault data not loaded");
|
|
506
|
+
}
|
|
507
|
+
return this.state.additionalData.kaminoVaultData;
|
|
276
508
|
}
|
|
277
509
|
get remainingAccounts() {
|
|
278
510
|
const accounts = this.account.interfaceAccounts
|
|
@@ -284,7 +516,7 @@ class GenericSySdk {
|
|
|
284
516
|
.concat(this.emissions.map((e) => ({ pubkey: e.escrowAccount, isSigner: false, isWritable: false })));
|
|
285
517
|
return accounts;
|
|
286
518
|
}
|
|
287
|
-
getAccountsWithSigner(signer) {
|
|
519
|
+
getAccountsWithSigner(signer, type = "mint") {
|
|
288
520
|
const accounts = this.account.interfaceAccounts
|
|
289
521
|
.map((a) => ({
|
|
290
522
|
pubkey: a,
|
|
@@ -292,14 +524,19 @@ class GenericSySdk {
|
|
|
292
524
|
isWritable: true,
|
|
293
525
|
}))
|
|
294
526
|
.concat(this.emissions.map((e) => ({ pubkey: e.escrowAccount, isSigner: false, isWritable: false })));
|
|
295
|
-
if ("fragmetric" in this.state.account.interfaceType
|
|
296
|
-
|
|
297
|
-
|
|
527
|
+
if (("fragmetric" in this.state.account.interfaceType ||
|
|
528
|
+
"fragmetricSupportedAsset" in this.state.account.interfaceType) &&
|
|
529
|
+
signer) {
|
|
530
|
+
// If skipWrap is true, return minimal accounts (skip additional interface-specific accounts)
|
|
531
|
+
if (this.config.skipWrap) {
|
|
298
532
|
return accounts;
|
|
299
533
|
}
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
|
|
534
|
+
// Fragmetric interface account logic
|
|
535
|
+
if (!this.state.additionalData?.fragmetricData) {
|
|
536
|
+
throw new Error("Fragmetric data not loaded for fragmetric interface");
|
|
537
|
+
}
|
|
538
|
+
const fragmetricReceiptTokenMint = this.state.additionalData.fragmetricData.receiptTokenMint;
|
|
539
|
+
const fragmetricWrappedTokenMint = this.state.additionalData.fragmetricData.wrappedTokenMint;
|
|
303
540
|
const fragmetricPda = new fragmetric_pda_1.FragmetricPda();
|
|
304
541
|
const fragmetricFundAccount = fragmetricPda.fundAccount(fragmetricReceiptTokenMint);
|
|
305
542
|
const fragmetricRewardAccount = fragmetricPda.rewardAccount(fragmetricReceiptTokenMint);
|
|
@@ -325,19 +562,170 @@ class GenericSySdk {
|
|
|
325
562
|
isWritable: false,
|
|
326
563
|
});
|
|
327
564
|
}
|
|
565
|
+
if ("jupiterLend" in this.state.account.interfaceType) {
|
|
566
|
+
// If skipWrap is true, return minimal accounts (skip additional interface-specific accounts)
|
|
567
|
+
if (this.config.skipWrap) {
|
|
568
|
+
return accounts;
|
|
569
|
+
}
|
|
570
|
+
const jupiterLendData = this.state.additionalData?.jupiterLendData;
|
|
571
|
+
if (!jupiterLendData) {
|
|
572
|
+
throw new Error("Jupiter lend data not loaded");
|
|
573
|
+
}
|
|
574
|
+
console.log("accounts before push", accounts);
|
|
575
|
+
const vaultAuthority = new anchor_1.web3.PublicKey("7s1da8DduuBFqGra5bJBjpnvL5E9mGzCuMk1Qkh4or2Z");
|
|
576
|
+
const vaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(jupiterLendData.baseTokenMint, vaultAuthority, true, this.tokenProgramBase);
|
|
577
|
+
if (type === "mint") {
|
|
578
|
+
const depositorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(jupiterLendData.baseTokenMint, signer, true, this.tokenProgramBase);
|
|
579
|
+
const recipientTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(this.vrtMint, signer, true, this.tokenProgramBase);
|
|
580
|
+
console.log("jupiter lend rate model: ", jupiterLendData.rateModel.toBase58());
|
|
581
|
+
accounts.push({ pubkey: signer, isSigner: true, isWritable: true }, { pubkey: depositorTokenAccount, isSigner: false, isWritable: true }, { pubkey: recipientTokenAccount, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.baseTokenMint, isSigner: false, isWritable: true },
|
|
582
|
+
// lending admin
|
|
583
|
+
{
|
|
584
|
+
pubkey: new anchor_1.web3.PublicKey("5nmGjA4s7ATzpBQXC5RNceRpaJ7pYw2wKsNBWyuSAZV6"),
|
|
585
|
+
isSigner: false,
|
|
586
|
+
isWritable: false,
|
|
587
|
+
}, { pubkey: this.account.interfaceAccounts[0], isSigner: false, isWritable: true }, { pubkey: this.vrtMint, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.tokenReservesLiquidity, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.lendingSupplyPosition, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.rateModel, isSigner: false, isWritable: true },
|
|
588
|
+
// vault
|
|
589
|
+
{
|
|
590
|
+
pubkey: vaultAta,
|
|
591
|
+
isSigner: false,
|
|
592
|
+
isWritable: true,
|
|
593
|
+
},
|
|
594
|
+
// supply vault owner - can be hardcoded
|
|
595
|
+
{
|
|
596
|
+
pubkey: vaultAuthority,
|
|
597
|
+
isSigner: false,
|
|
598
|
+
isWritable: true,
|
|
599
|
+
},
|
|
600
|
+
// liquidity program - can be hardcoded
|
|
601
|
+
{
|
|
602
|
+
pubkey: new anchor_1.web3.PublicKey("jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC"),
|
|
603
|
+
isSigner: false,
|
|
604
|
+
isWritable: true,
|
|
605
|
+
}, { pubkey: jupiterLendData.rewardsRateModel, isSigner: false, isWritable: true },
|
|
606
|
+
// token program
|
|
607
|
+
{ pubkey: this.tokenProgramBase, isSigner: false, isWritable: false },
|
|
608
|
+
// associated token program
|
|
609
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, { pubkey: anchor_1.web3.SystemProgram.programId, isSigner: false, isWritable: false }, {
|
|
610
|
+
pubkey: new anchor_1.web3.PublicKey("jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9"),
|
|
611
|
+
isSigner: false,
|
|
612
|
+
isWritable: false,
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
else if (type === "redeem") {
|
|
616
|
+
const recipientTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(jupiterLendData.baseTokenMint, signer, true, this.tokenProgramBase);
|
|
617
|
+
const depositorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(this.vrtMint, signer, true, this.tokenProgramBase);
|
|
618
|
+
accounts.push({ pubkey: signer, isSigner: true, isWritable: true }, { pubkey: depositorTokenAccount, isSigner: false, isWritable: true }, { pubkey: recipientTokenAccount, isSigner: false, isWritable: true }, {
|
|
619
|
+
// lending admin
|
|
620
|
+
pubkey: new anchor_1.web3.PublicKey("5nmGjA4s7ATzpBQXC5RNceRpaJ7pYw2wKsNBWyuSAZV6"),
|
|
621
|
+
isSigner: false,
|
|
622
|
+
isWritable: false,
|
|
623
|
+
},
|
|
624
|
+
// lending
|
|
625
|
+
{ pubkey: this.account.interfaceAccounts[0], isSigner: false, isWritable: true }, { pubkey: jupiterLendData.baseTokenMint, isSigner: false, isWritable: true }, { pubkey: this.vrtMint, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.tokenReservesLiquidity, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.lendingSupplyPosition, isSigner: false, isWritable: true }, { pubkey: jupiterLendData.rateModel, isSigner: false, isWritable: true },
|
|
626
|
+
// vault
|
|
627
|
+
{
|
|
628
|
+
pubkey: vaultAta,
|
|
629
|
+
isSigner: false,
|
|
630
|
+
isWritable: true,
|
|
631
|
+
},
|
|
632
|
+
// claim account
|
|
633
|
+
{
|
|
634
|
+
pubkey: new anchor_1.web3.PublicKey("HN1r4VfkDn53xQQfeGDYrNuDKFdemAhZsHYRwBrFhsW"),
|
|
635
|
+
isSigner: false,
|
|
636
|
+
isWritable: true,
|
|
637
|
+
},
|
|
638
|
+
// liquidity
|
|
639
|
+
{
|
|
640
|
+
pubkey: new anchor_1.web3.PublicKey("7s1da8DduuBFqGra5bJBjpnvL5E9mGzCuMk1Qkh4or2Z"),
|
|
641
|
+
isSigner: false,
|
|
642
|
+
isWritable: true,
|
|
643
|
+
},
|
|
644
|
+
// liquidity program
|
|
645
|
+
{
|
|
646
|
+
pubkey: new anchor_1.web3.PublicKey("jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC"),
|
|
647
|
+
isSigner: false,
|
|
648
|
+
isWritable: true,
|
|
649
|
+
}, { pubkey: jupiterLendData.rewardsRateModel, isSigner: false, isWritable: true },
|
|
650
|
+
// token program
|
|
651
|
+
{ pubkey: this.tokenProgramBase, isSigner: false, isWritable: false },
|
|
652
|
+
// associated token program
|
|
653
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, { pubkey: anchor_1.web3.SystemProgram.programId, isSigner: false, isWritable: false }, {
|
|
654
|
+
pubkey: new anchor_1.web3.PublicKey("jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9"),
|
|
655
|
+
isSigner: false,
|
|
656
|
+
isWritable: false,
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if ("kaminoVault" in this.state.account.interfaceType) {
|
|
661
|
+
// If skipWrap is true, return minimal accounts (skip additional interface-specific accounts)
|
|
662
|
+
if (this.config.skipWrap) {
|
|
663
|
+
return accounts;
|
|
664
|
+
}
|
|
665
|
+
const kaminoVaultData = this.state.additionalData?.kaminoVaultData;
|
|
666
|
+
if (!kaminoVaultData) {
|
|
667
|
+
throw new Error("Kamino vault data not loaded");
|
|
668
|
+
}
|
|
669
|
+
const userTokenAta = (0, spl_token_1.getAssociatedTokenAddressSync)(kaminoVaultData.tokenMint, signer, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
670
|
+
const userSharesAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.vrtMint, signer, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
671
|
+
accounts.push(
|
|
672
|
+
// user
|
|
673
|
+
{ pubkey: signer, isSigner: true, isWritable: true },
|
|
674
|
+
// vault_state
|
|
675
|
+
{ pubkey: kaminoVaultData.vault, isSigner: false, isWritable: true },
|
|
676
|
+
// token_vault
|
|
677
|
+
{ pubkey: kaminoVaultData.tokenVault, isSigner: false, isWritable: true },
|
|
678
|
+
// token_mint
|
|
679
|
+
{ pubkey: kaminoVaultData.tokenMint, isSigner: false, isWritable: true },
|
|
680
|
+
// base_vault_authority
|
|
681
|
+
{ pubkey: kaminoVaultData.baseVaultAuthority, isSigner: false, isWritable: true },
|
|
682
|
+
// shares_mint
|
|
683
|
+
{ pubkey: kaminoVaultData.sharesMint, isSigner: false, isWritable: true },
|
|
684
|
+
// user_token_ata
|
|
685
|
+
{ pubkey: userTokenAta, isSigner: false, isWritable: true },
|
|
686
|
+
// user_shares_ata
|
|
687
|
+
{ pubkey: userSharesAta, isSigner: false, isWritable: true },
|
|
688
|
+
// klend_program
|
|
689
|
+
{
|
|
690
|
+
pubkey: new anchor_1.web3.PublicKey("KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"),
|
|
691
|
+
isSigner: false,
|
|
692
|
+
isWritable: false,
|
|
693
|
+
},
|
|
694
|
+
// token_program
|
|
695
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
696
|
+
// shares_token_program
|
|
697
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
698
|
+
// event_authority
|
|
699
|
+
{
|
|
700
|
+
pubkey: new anchor_1.web3.PublicKey("24tHwQyJJ9akVXxnvkekGfAoeUJXXS7mE6kQNioNySsK"),
|
|
701
|
+
isSigner: false,
|
|
702
|
+
isWritable: true,
|
|
703
|
+
},
|
|
704
|
+
// kamino vault program
|
|
705
|
+
{
|
|
706
|
+
pubkey: new anchor_1.web3.PublicKey("KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd"),
|
|
707
|
+
isSigner: false,
|
|
708
|
+
isWritable: false,
|
|
709
|
+
}, ...kaminoVaultData.reserves.map((reserve) => ({
|
|
710
|
+
pubkey: reserve.reserveAddress,
|
|
711
|
+
isSigner: false,
|
|
712
|
+
isWritable: true,
|
|
713
|
+
})), ...kaminoVaultData.reserves.map((reserve) => ({
|
|
714
|
+
pubkey: reserve.marketAddress,
|
|
715
|
+
isSigner: false,
|
|
716
|
+
isWritable: true,
|
|
717
|
+
})));
|
|
718
|
+
}
|
|
328
719
|
return accounts;
|
|
329
720
|
}
|
|
330
721
|
ixMintSy({ depositor, amountBase, baseSrc, syDst, }) {
|
|
331
722
|
baseSrc = baseSrc || (0, spl_token_1.getAssociatedTokenAddressSync)(this.vrtMint, depositor, true, this.state.tokenProgramBase);
|
|
332
|
-
console.log("baseSrc", baseSrc.toBase58());
|
|
333
|
-
console.log("depositor", depositor.toBase58());
|
|
334
723
|
syDst = syDst || (0, spl_token_1.getAssociatedTokenAddressSync)(this.mintSy, depositor, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
335
|
-
console.log("this.selfAddress", this.selfAddress.toBase58());
|
|
336
724
|
return this.program.methods
|
|
337
725
|
.mint(new anchor_1.BN(amountBase))
|
|
338
726
|
.accountsStrict({
|
|
339
727
|
meta: this.selfAddress,
|
|
340
|
-
baseTokenProgram: this.tokenProgramBase,
|
|
728
|
+
baseTokenProgram: this.state.tokenProgramBase,
|
|
341
729
|
depositor,
|
|
342
730
|
mintSy: this.mintSy,
|
|
343
731
|
tokenBaseDepositor: baseSrc,
|
|
@@ -363,9 +751,51 @@ class GenericSySdk {
|
|
|
363
751
|
baseTokenProgram: this.tokenProgramBase,
|
|
364
752
|
tokenYieldBearingEscrow: this.tokenVrtEscrow,
|
|
365
753
|
})
|
|
366
|
-
.remainingAccounts(this.getAccountsWithSigner(redeemer))
|
|
754
|
+
.remainingAccounts(this.getAccountsWithSigner(redeemer, "redeem"))
|
|
367
755
|
.instruction();
|
|
368
756
|
}
|
|
757
|
+
preInstructions() {
|
|
758
|
+
let ixs = [];
|
|
759
|
+
if ("jupiterLend" in this.state.account.interfaceType) {
|
|
760
|
+
const jupiterLendData = this.state.additionalData?.jupiterLendData;
|
|
761
|
+
if (!jupiterLendData) {
|
|
762
|
+
throw new Error("Jupiter lend data not loaded");
|
|
763
|
+
}
|
|
764
|
+
const refreshInstruction = new anchor_1.web3.TransactionInstruction({
|
|
765
|
+
keys: [
|
|
766
|
+
{
|
|
767
|
+
pubkey: this.account.interfaceAccounts[0],
|
|
768
|
+
isSigner: false,
|
|
769
|
+
isWritable: true,
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
pubkey: jupiterLendData.baseTokenMint,
|
|
773
|
+
isSigner: false,
|
|
774
|
+
isWritable: true,
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
pubkey: this.vrtMint,
|
|
778
|
+
isSigner: false,
|
|
779
|
+
isWritable: true,
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
pubkey: jupiterLendData.tokenReservesLiquidity,
|
|
783
|
+
isSigner: false,
|
|
784
|
+
isWritable: true,
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
pubkey: jupiterLendData.rewardsRateModel,
|
|
788
|
+
isSigner: false,
|
|
789
|
+
isWritable: true,
|
|
790
|
+
},
|
|
791
|
+
],
|
|
792
|
+
programId: new anchor_1.web3.PublicKey("jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9"),
|
|
793
|
+
data: Buffer.from([24, 225, 53, 189, 72, 212, 225, 178]),
|
|
794
|
+
});
|
|
795
|
+
ixs.push(refreshInstruction);
|
|
796
|
+
}
|
|
797
|
+
return ixs;
|
|
798
|
+
}
|
|
369
799
|
getSyState() {
|
|
370
800
|
return this.program.methods
|
|
371
801
|
.getState()
|
|
@@ -398,30 +828,30 @@ class GenericSySdk {
|
|
|
398
828
|
preMintHookDiscriminator: Buffer.from(hook.preMintHookDiscriminator),
|
|
399
829
|
postRedeemHookDiscriminator: Buffer.from(hook.postRedeemHookDiscriminator),
|
|
400
830
|
};
|
|
401
|
-
return this.program.methods
|
|
831
|
+
return this.program.methods
|
|
832
|
+
.modifyHook(modifiedHook)
|
|
833
|
+
.accountsStrict({
|
|
402
834
|
adminState: this.adminState,
|
|
403
835
|
signer,
|
|
404
836
|
feePayer: signer,
|
|
405
837
|
meta: this.selfAddress,
|
|
406
838
|
systemProgram: anchor_1.web3.SystemProgram.programId,
|
|
407
|
-
})
|
|
839
|
+
})
|
|
840
|
+
.instruction();
|
|
408
841
|
}
|
|
409
842
|
}
|
|
410
843
|
exports.GenericSySdk = GenericSySdk;
|
|
411
|
-
function initSy(signer, interfaceAccounts, yieldBearingMint, interfaceIndex, syToken, initConfig) {
|
|
844
|
+
function initSy(signer, interfaceAccounts, yieldBearingMint, interfaceIndex, syToken, initConfig, yieldBearingMintTokenProgram = spl_token_1.TOKEN_PROGRAM_ID) {
|
|
412
845
|
const program = new anchor_1.Program(generic_sy_idl_1.IDL, new anchor_1.AnchorProvider(new anchor_1.web3.Connection("https://api.devnet.solana.com"), new utils_1.MyWallet(anchor_1.web3.Keypair.generate())));
|
|
413
|
-
console.log("interfaceIndex", interfaceIndex);
|
|
414
846
|
const pda = new generic_sy_pda_1.GenericSyPda(program.programId, interfaceIndex);
|
|
415
847
|
const syMetaAddress = pda.syMeta({ yieldBearingMint });
|
|
416
|
-
console.log("this.selfAddress in sdk", syMetaAddress.toBase58());
|
|
417
848
|
const mintSy = pda.mintSy({ yieldBearingMint });
|
|
418
|
-
console.log("mintSy in sdk", mintSy.toBase58());
|
|
419
849
|
const exponentAdminPda = new exponent_admin_pda_1.ExponentAdminPda(exponent_admin_pda_1.EXPONENT_ADMIN_PROGRAM_ID);
|
|
420
850
|
const metaplexMetadataProgram = new anchor_1.web3.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
|
|
421
851
|
const mintSyMetaplexMetadataPda = anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from("metadata"), metaplexMetadataProgram.toBuffer(), mintSy.toBuffer()], metaplexMetadataProgram)[0];
|
|
422
|
-
const tokenVrtEscrow = (0, spl_token_1.getAssociatedTokenAddressSync)(yieldBearingMint, syMetaAddress, true,
|
|
852
|
+
const tokenVrtEscrow = (0, spl_token_1.getAssociatedTokenAddressSync)(yieldBearingMint, syMetaAddress, true, yieldBearingMintTokenProgram);
|
|
423
853
|
const { minMintSize, minRedeemSize } = initConfig ? initConfig : { minMintSize: new anchor_1.BN(0), minRedeemSize: new anchor_1.BN(0) };
|
|
424
|
-
const { name: tokenName, uri: tokenUri, symbol: tokenSymbol, } = syToken ? syToken : { symbol: "
|
|
854
|
+
const { name: tokenName, uri: tokenUri, symbol: tokenSymbol, } = syToken ? syToken : { symbol: "wjlSOL", name: "Exponent Wrapped jlSOL", uri: "" };
|
|
425
855
|
const interfaceType = getInterfaceTypeObj(interfaceIndex);
|
|
426
856
|
const ix = program.methods
|
|
427
857
|
.initSy(minMintSize, minRedeemSize, tokenName, tokenSymbol, tokenUri, interfaceAccounts, interfaceType)
|
|
@@ -432,7 +862,7 @@ function initSy(signer, interfaceAccounts, yieldBearingMint, interfaceIndex, syT
|
|
|
432
862
|
admin: signer,
|
|
433
863
|
yieldBearingMint,
|
|
434
864
|
syTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
435
|
-
yieldBearingTokenProgram:
|
|
865
|
+
yieldBearingTokenProgram: yieldBearingMintTokenProgram,
|
|
436
866
|
tokenSyEscrow: pda.syEscrow({ yieldBearingMint }),
|
|
437
867
|
systemProgram: anchor_1.web3.SystemProgram.programId,
|
|
438
868
|
metadata: mintSyMetaplexMetadataPda,
|
|
@@ -442,5 +872,4 @@ function initSy(signer, interfaceAccounts, yieldBearingMint, interfaceIndex, syT
|
|
|
442
872
|
.instruction();
|
|
443
873
|
return ix;
|
|
444
874
|
}
|
|
445
|
-
exports.initSy = initSy;
|
|
446
875
|
//# sourceMappingURL=index.js.map
|