@sonarwatch/portfolio-plugins 0.12.52 → 0.12.54
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/famousfoxfederation/constants.d.ts +13 -0
- package/src/plugins/famousfoxfederation/constants.js +32 -0
- package/src/plugins/famousfoxfederation/constants.js.map +1 -0
- package/src/plugins/famousfoxfederation/helpers.d.ts +2 -0
- package/src/plugins/famousfoxfederation/helpers.js +11 -0
- package/src/plugins/famousfoxfederation/helpers.js.map +1 -0
- package/src/plugins/famousfoxfederation/index.d.ts +6 -0
- package/src/plugins/famousfoxfederation/index.js +14 -0
- package/src/plugins/famousfoxfederation/index.js.map +1 -0
- package/src/plugins/famousfoxfederation/stakingFetcher.d.ts +3 -0
- package/src/plugins/famousfoxfederation/stakingFetcher.js +70 -0
- package/src/plugins/famousfoxfederation/stakingFetcher.js.map +1 -0
- package/src/plugins/famousfoxfederation/stakingIdl.d.ts +31 -0
- package/src/plugins/famousfoxfederation/stakingIdl.js +226 -0
- package/src/plugins/famousfoxfederation/stakingIdl.js.map +1 -0
- package/src/plugins/famousfoxfederation/stakingJob.d.ts +3 -0
- package/src/plugins/famousfoxfederation/stakingJob.js +30 -0
- package/src/plugins/famousfoxfederation/stakingJob.js.map +1 -0
- package/src/plugins/famousfoxfederation/tokenMarketFetcher.d.ts +3 -0
- package/src/plugins/famousfoxfederation/tokenMarketFetcher.js +59 -0
- package/src/plugins/famousfoxfederation/tokenMarketFetcher.js.map +1 -0
- package/src/plugins/famousfoxfederation/tokenMarketIdl.d.ts +45 -0
- package/src/plugins/famousfoxfederation/tokenMarketIdl.js +792 -0
- package/src/plugins/famousfoxfederation/tokenMarketIdl.js.map +1 -0
- package/src/plugins/famousfoxfederation/types.d.ts +25 -0
- package/src/plugins/famousfoxfederation/types.js +3 -0
- package/src/plugins/famousfoxfederation/types.js.map +1 -0
- package/src/plugins/nxfinance/constants.d.ts +1 -0
- package/src/plugins/nxfinance/constants.js +2 -1
- package/src/plugins/nxfinance/constants.js.map +1 -1
- package/src/plugins/nxfinance/helpers.d.ts +4 -0
- package/src/plugins/nxfinance/helpers.js +52 -0
- package/src/plugins/nxfinance/helpers.js.map +1 -0
- package/src/plugins/nxfinance/positionsFetcher.js +57 -12
- package/src/plugins/nxfinance/positionsFetcher.js.map +1 -1
- package/src/plugins/nxfinance/types.d.ts +17 -0
- package/src/utils/solana/das/heliusAssetToAssetCollectible.js +1 -1
- package/src/utils/solana/das/heliusAssetToAssetCollectible.js.map +1 -1
- package/src/utils/solana/das/heliusAssetToAssetToken.d.ts +6 -0
- package/src/utils/solana/das/heliusAssetToAssetToken.js +27 -0
- package/src/utils/solana/das/heliusAssetToAssetToken.js.map +1 -0
- package/src/utils/solana/mintsToAssets.d.ts +3 -0
- package/src/utils/solana/mintsToAssets.js +58 -0
- package/src/utils/solana/mintsToAssets.js.map +1 -0
- package/src/plugins/nxfinance/structs.d.ts +0 -19
- package/src/plugins/nxfinance/structs.js +0 -22
- package/src/plugins/nxfinance/structs.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenMarketIdl.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/famousfoxfederation/tokenMarketIdl.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,CAAC,CAAC;oBACT,QAAQ,EAAE,CAAC,CAAC;iBACb;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,CAAC,CAAC;oBACT,QAAQ,EAAE,CAAC,CAAC;iBACb;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,CAAC,CAAC;oBACT,QAAQ,EAAE,CAAC,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IAAI,EAAE,KAAK;oBACX,KAAK,EAAE,CAAC,CAAC;iBACV;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,CAAC,CAAC;iBACV;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,CAAC,CAAC;iBACV;aACF;SACF;KACF;IACD,MAAM,EAAE;QACN;YACE,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,qBAAqB;YAC3B,GAAG,EAAE,0BAA0B;SAChC;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,yBAAyB;YAC/B,GAAG,EAAE,2BAA2B;SACjC;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,eAAe;SACrB;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,eAAe;SACrB;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,aAAa;SACnB;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,eAAe;SACrB;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,gBAAgB;SACtB;QACD;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,eAAe;SACrB;KACF;CACF,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
export type Order = {
|
2
|
+
mint: string;
|
3
|
+
owner: string;
|
4
|
+
cost: string;
|
5
|
+
count: string;
|
6
|
+
foxy: boolean;
|
7
|
+
staked: boolean;
|
8
|
+
};
|
9
|
+
export type StakingAccount = {
|
10
|
+
fox: string;
|
11
|
+
owner: string;
|
12
|
+
lock: string;
|
13
|
+
lastClaim: string;
|
14
|
+
tff: boolean;
|
15
|
+
v2: boolean;
|
16
|
+
};
|
17
|
+
export type StakingConfig = {
|
18
|
+
reward: string;
|
19
|
+
authority: string;
|
20
|
+
amount: string;
|
21
|
+
interval: string;
|
22
|
+
timelock: boolean;
|
23
|
+
count: boolean;
|
24
|
+
tcount: boolean;
|
25
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/famousfoxfederation/types.ts"],"names":[],"mappings":""}
|
@@ -5,4 +5,5 @@ export declare const platformId = "nxfinance";
|
|
5
5
|
export declare const platform: Platform;
|
6
6
|
export declare const ID: PublicKey;
|
7
7
|
export declare const leverageFiProgramID: PublicKey;
|
8
|
+
export declare const jlpMint = "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4";
|
8
9
|
export declare const nxfinanceLeverageIdlItem: IdlItem;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.nxfinanceLeverageIdlItem = exports.leverageFiProgramID = exports.ID = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.nxfinanceLeverageIdlItem = exports.jlpMint = exports.leverageFiProgramID = exports.ID = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
const idl_1 = require("./idl");
|
6
6
|
exports.platformId = 'nxfinance';
|
@@ -14,6 +14,7 @@ exports.platform = {
|
|
14
14
|
};
|
15
15
|
exports.ID = new web3_js_1.PublicKey('RaXcyfW8jK295UAU1XN2uLMTHnTWEaeCcNWLeDB4iD6');
|
16
16
|
exports.leverageFiProgramID = new web3_js_1.PublicKey('EHBN9YKtMmrZhj8JZqyBQRGqyyeHw5xUB1Q5eAHszuMt');
|
17
|
+
exports.jlpMint = '27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4';
|
17
18
|
exports.nxfinanceLeverageIdlItem = {
|
18
19
|
programId: exports.leverageFiProgramID.toString(),
|
19
20
|
idl: idl_1.NxfinanceLeverageIDL,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/constants.ts"],"names":[],"mappings":";;;AAEA,6CAA4C;AAC5C,+BAA6C;AAEhC,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,gCAAgC;IACzC,WAAW,EAAE,YAAY,EAAE,sCAAsC;CAClE,CAAC;AAEW,QAAA,EAAE,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AAElE,QAAA,mBAAmB,GAAG,IAAI,mBAAS,CAC9C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,wBAAwB,GAAG;IACtC,SAAS,EAAE,2BAAmB,CAAC,QAAQ,EAAE;IACzC,GAAG,EAAE,0BAAoB;IACzB,OAAO,EAAE,QAAQ;CACP,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/constants.ts"],"names":[],"mappings":";;;AAEA,6CAA4C;AAC5C,+BAA6C;AAEhC,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,gCAAgC;IACzC,WAAW,EAAE,YAAY,EAAE,sCAAsC;CAClE,CAAC;AAEW,QAAA,EAAE,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AAElE,QAAA,mBAAmB,GAAG,IAAI,mBAAS,CAC9C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,OAAO,GAAG,8CAA8C,CAAC;AAEzD,QAAA,wBAAwB,GAAG;IACtC,SAAS,EAAE,2BAAmB,CAAC,QAAQ,EAAE;IACzC,GAAG,EAAE,0BAAoB;IACzB,OAAO,EAAE,QAAQ;CACP,CAAC"}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.getBorrowNoteRate = exports.getSupplyNoteRate = void 0;
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
|
+
const getBorrowApr = (utilization) => {
|
9
|
+
if (utilization.isLessThanOrEqualTo(0.8)) {
|
10
|
+
return parseFloat(utilization.times(0.125).plus(0.1).toFixed(4, bignumber_js_1.default.ROUND_DOWN));
|
11
|
+
}
|
12
|
+
return parseFloat(utilization.times(1.25).minus(0.8).toFixed(4, bignumber_js_1.default.ROUND_DOWN));
|
13
|
+
};
|
14
|
+
const getM = (marginPool) => {
|
15
|
+
const borrowTokens = new bignumber_js_1.default(marginPool.borrowedTokens);
|
16
|
+
const depositTokens = new bignumber_js_1.default(marginPool.depositTokens);
|
17
|
+
const utilization = borrowTokens.dividedBy(depositTokens);
|
18
|
+
const borrowAPR = getBorrowApr(utilization);
|
19
|
+
return new bignumber_js_1.default(borrowAPR)
|
20
|
+
.multipliedBy(Date.now() / 1000 - Number(marginPool.accruedUntil))
|
21
|
+
.dividedBy(31536e3)
|
22
|
+
.multipliedBy(borrowTokens.dividedBy(Math.pow(10, 6)));
|
23
|
+
};
|
24
|
+
const getLoanInterest = (marginPool) => {
|
25
|
+
const m = getM(marginPool);
|
26
|
+
return new bignumber_js_1.default(marginPool.loanInterest)
|
27
|
+
.dividedToIntegerBy(Math.pow(10, 6))
|
28
|
+
.plus(m)
|
29
|
+
.toNumber();
|
30
|
+
};
|
31
|
+
const getDepositInterest = (marginPool) => {
|
32
|
+
const m = getM(marginPool);
|
33
|
+
return new bignumber_js_1.default(marginPool.depositInterest)
|
34
|
+
.dividedToIntegerBy(Math.pow(10, 6))
|
35
|
+
.plus(m)
|
36
|
+
.toNumber();
|
37
|
+
};
|
38
|
+
const getSupplyNoteRate = (marginPool) => {
|
39
|
+
const depositInterest = getDepositInterest(marginPool);
|
40
|
+
const depositTokens = new bignumber_js_1.default(marginPool.depositTokens).dividedBy(Math.pow(10, 6));
|
41
|
+
const depositNotes = new bignumber_js_1.default(marginPool.depositNotes).dividedBy(Math.pow(10, 6));
|
42
|
+
return depositTokens.plus(depositInterest).dividedBy(depositNotes);
|
43
|
+
};
|
44
|
+
exports.getSupplyNoteRate = getSupplyNoteRate;
|
45
|
+
const getBorrowNoteRate = (marginPool) => {
|
46
|
+
const loanInterest = getLoanInterest(marginPool);
|
47
|
+
const borrowedTokens = new bignumber_js_1.default(marginPool.borrowedTokens).dividedBy(Math.pow(10, 6));
|
48
|
+
const loanNotes = new bignumber_js_1.default(marginPool.loanNotes).dividedBy(Math.pow(10, 6));
|
49
|
+
return borrowedTokens.plus(loanInterest).dividedBy(loanNotes);
|
50
|
+
};
|
51
|
+
exports.getBorrowNoteRate = getBorrowNoteRate;
|
52
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAGrC,MAAM,YAAY,GAAG,CAAC,WAAsB,EAAE,EAAE;IAC9C,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,UAAU,CACf,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,sBAAS,CAAC,UAAU,CAAC,CACpE,CAAC;IACJ,CA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AAC;SAC7C,kBAAkB,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC;SAC3B,IAAI,CAAC,CAAC,CAAC;SACP,QAAQ,EAAE,CAAC;AAChB,CAAC,CAAC;AAEK,MAAM,iBAAiB,GAAG,CAAC,UAAsB,EAAE,EAAE;IAC1D,MAAM,eAAe,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,SAAS,CACrE,SAAA,EAAE,EAAI,CAAC,CAAA,CACR,CAAC;IACF,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,SAAS,CACnE,SAAA,EAAE,EAAI,CAAC,CAAA,CACR,CAAC;IAEF,OAAO,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AACrE,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEK,MAAM,iBAAiB,GAAG,CAAC,UAAsB,EAAE,EAAE;IAC1D,MAAM,YAAY,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,cAAc,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,SAAS,CACvE,SAAA,EAAE,EAAI,CAAC,CAAA,CACR,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC;IAEzE,OAAO,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAChE,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
@@ -19,6 +19,7 @@ const constants_1 = require("./constants");
|
|
19
19
|
const clients_1 = require("../../utils/clients");
|
20
20
|
const solana_1 = require("../../utils/solana");
|
21
21
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
|
+
const helpers_1 = require("./helpers");
|
22
23
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
24
|
const connection = (0, clients_1.getClientSolana)();
|
24
25
|
const marginAccountPublicKey = web3_js_1.PublicKey.findProgramAddressSync([
|
@@ -30,33 +31,74 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
30
31
|
if (!marginAccount)
|
31
32
|
return [];
|
32
33
|
const elements = [];
|
34
|
+
const mints = new Set();
|
35
|
+
marginAccount.deposits.forEach((d) => mints.add((0, portfolio_core_1.formatTokenAddress)(d.tokenMint, portfolio_core_1.NetworkId.solana)));
|
36
|
+
marginAccount.loans.forEach((l) => mints.add((0, portfolio_core_1.formatTokenAddress)(l.tokenMint, portfolio_core_1.NetworkId.solana)));
|
37
|
+
const marginPoolsPublicKeys = [...mints].map((mint) => web3_js_1.PublicKey.findProgramAddressSync([
|
38
|
+
web3_js_1.PublicKey.findProgramAddressSync([constants_1.ID.toBuffer()], constants_1.leverageFiProgramID)[0].toBuffer(),
|
39
|
+
new web3_js_1.PublicKey(mint).toBuffer(),
|
40
|
+
], constants_1.leverageFiProgramID)[0]);
|
41
|
+
const [tokenPrices, marginPools] = yield Promise.all([
|
42
|
+
cache.getTokenPricesAsMap([...mints], portfolio_core_1.NetworkId.solana),
|
43
|
+
(0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.nxfinanceLeverageIdlItem, marginPoolsPublicKeys),
|
44
|
+
]);
|
45
|
+
// assets for Lend
|
46
|
+
const assets = [];
|
47
|
+
// assets for Leverage
|
33
48
|
const borrowedAssets = [];
|
34
49
|
const borrowedYields = [];
|
35
50
|
const suppliedAssets = [];
|
36
51
|
const suppliedYields = [];
|
37
52
|
const rewardAssets = [];
|
38
|
-
const mints = new Set();
|
39
|
-
marginAccount.deposits.forEach((d) => mints.add((0, portfolio_core_1.formatTokenAddress)(d.tokenMint, portfolio_core_1.NetworkId.solana)));
|
40
|
-
marginAccount.loans.forEach((l) => mints.add((0, portfolio_core_1.formatTokenAddress)(l.tokenMint, portfolio_core_1.NetworkId.solana)));
|
41
|
-
const tokenPrices = yield cache.getTokenPricesAsMap([...mints], portfolio_core_1.NetworkId.solana);
|
42
53
|
marginAccount.deposits.forEach((deposit) => {
|
43
54
|
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(deposit.tokenMint, portfolio_core_1.NetworkId.solana));
|
44
55
|
if (!tokenPrice)
|
45
56
|
return;
|
46
|
-
|
57
|
+
const marginPool = marginPools.find((mp) => (mp === null || mp === void 0 ? void 0 : mp.tokenMint) === deposit.tokenMint);
|
58
|
+
if (!marginPool)
|
59
|
+
return;
|
60
|
+
const supplyNoteRate = (0, helpers_1.getSupplyNoteRate)(marginPool);
|
61
|
+
const amount = new bignumber_js_1.default(deposit.depositNote)
|
62
|
+
.multipliedBy(supplyNoteRate)
|
47
63
|
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
48
|
-
.toNumber()
|
64
|
+
.toNumber();
|
65
|
+
if (amount > 0) {
|
66
|
+
const assetToken = (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice);
|
67
|
+
if (deposit.tokenMint === constants_1.jlpMint) {
|
68
|
+
suppliedAssets.push(assetToken);
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
assets.push(assetToken);
|
72
|
+
}
|
73
|
+
}
|
49
74
|
});
|
50
75
|
marginAccount.loans.forEach((loan) => {
|
51
76
|
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(loan.tokenMint, portfolio_core_1.NetworkId.solana));
|
52
77
|
if (!tokenPrice)
|
53
78
|
return;
|
54
|
-
|
79
|
+
const marginPool = marginPools.find((mp) => (mp === null || mp === void 0 ? void 0 : mp.tokenMint) === loan.tokenMint);
|
80
|
+
if (!marginPool)
|
81
|
+
return;
|
82
|
+
const borrowNoteRate = (0, helpers_1.getBorrowNoteRate)(marginPool);
|
83
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, new bignumber_js_1.default(loan.loanNote)
|
84
|
+
.multipliedBy(borrowNoteRate)
|
55
85
|
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
56
86
|
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
|
57
87
|
});
|
58
|
-
if (
|
59
|
-
|
88
|
+
if (assets.length > 0)
|
89
|
+
elements.push({
|
90
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
91
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
92
|
+
platformId: constants_1.platformId,
|
93
|
+
label: 'Lending',
|
94
|
+
name: 'Jupiter Lending Pool',
|
95
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
96
|
+
data: {
|
97
|
+
assets,
|
98
|
+
},
|
99
|
+
});
|
100
|
+
if (suppliedAssets.length > 0 || borrowedAssets.length > 0) {
|
101
|
+
const { borrowedValue, suppliedValue, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({
|
60
102
|
suppliedAssets,
|
61
103
|
borrowedAssets,
|
62
104
|
rewardAssets,
|
@@ -65,8 +107,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
65
107
|
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
66
108
|
networkId: portfolio_core_1.NetworkId.solana,
|
67
109
|
platformId: constants_1.platformId,
|
68
|
-
label: '
|
69
|
-
|
110
|
+
label: 'Leverage',
|
111
|
+
name: `JLP Leverage x${new bignumber_js_1.default(marginAccount.leverage)
|
112
|
+
.dividedBy(100)
|
113
|
+
.decimalPlaces(2)}`,
|
114
|
+
value: suppliedValue,
|
70
115
|
data: {
|
71
116
|
borrowedAssets,
|
72
117
|
borrowedValue,
|
@@ -77,7 +122,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
77
122
|
rewardAssets,
|
78
123
|
rewardValue,
|
79
124
|
healthRatio: null,
|
80
|
-
value,
|
125
|
+
value: suppliedValue,
|
81
126
|
},
|
82
127
|
});
|
83
128
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAErC,2CAMqB;AAErB,iDAAsD;AACtD,+CAAuE;AACvE,qGAA6E;AAE7E,uCAAiE;AAEjE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,sBAAsB,GAAG,mBAAS,CAAC,sBAAsB,CAC7D;QACE,mBAAS,CAAC,sBAAsB,CAC9B,CAAC,cAAE,CAAC,QAAQ,EAAE,CAAC,EACf,+BAAmB,CACpB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QACf,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KACvB,EACD,+BAAmB,CACpB,CAAC,CAAC,CAAC,CAAC;IAEL,MAAM,aAAa,GAAG,CACpB,MAAM,IAAA,0CAAiC,EACrC,UAAU,EACV,oCAAwB,EACxB,CAAC,sBAAsB,CAAC,CACzB,CACF,CAAC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,MAAM,QAAQ,GAAuB,EAAE,CAAC;IAExC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC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ACtB,cAAc;YACd,cAAc;YACd,YAAY;SACb,CAAC,CAAC;QAEL,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,iBAAiB,IAAI,sBAAS,CAAC,aAAa,CAAC,QAAQ,CAAC;iBACzD,SAAS,CAAC,GAAG,CAAC;iBACd,aAAa,CAAC,CAAC,CAAC,EAAE;YACrB,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,YAAY;gBACZ,WAAW;gBACX,WAAW,EAAE,IAAI;gBACjB,KAAK,EAAE,aAAa;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -19,3 +19,20 @@ export type LoanDetail = {
|
|
19
19
|
loanToken: string;
|
20
20
|
loanValue: string;
|
21
21
|
};
|
22
|
+
export type MarginPool = {
|
23
|
+
leveragefi: string;
|
24
|
+
vault: string;
|
25
|
+
feeDestination: string;
|
26
|
+
poolAuthority: string;
|
27
|
+
tokenMint: string;
|
28
|
+
tokenPriceOracle: string;
|
29
|
+
borrowedTokens: string;
|
30
|
+
depositTokens: string;
|
31
|
+
depositNotes: string;
|
32
|
+
loanNotes: string;
|
33
|
+
depositInterest: string;
|
34
|
+
loanInterest: string;
|
35
|
+
protocolFee: string;
|
36
|
+
accruedUntil: string;
|
37
|
+
utilizationFlag: string;
|
38
|
+
};
|
@@ -53,7 +53,7 @@ function heliusAssetToAssetCollectible(asset, props) {
|
|
53
53
|
return {
|
54
54
|
type: portfolio_core_1.PortfolioAssetType.collectible,
|
55
55
|
attributes: {
|
56
|
-
tags: tags.length > 0 ? tags :
|
56
|
+
tags: tags.length > 0 ? tags : [],
|
57
57
|
},
|
58
58
|
data: {
|
59
59
|
address: asset.id,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB,EAClB,KAGC;;IAED,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEhD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,UAA6C,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,QAAQ,CAAC;IAC5C,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,OAAO,CAAC;IAC1C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE1D,SAAS;IACT,IAAI,OAAO,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,OAAO,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,KAAK,CAAC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C,
|
1
|
+
{"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB,EAClB,KAGC;;IAED,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEhD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,UAA6C,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,QAAQ,CAAC;IAC5C,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,OAAO,CAAC;IAC1C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE1D,SAAS;IACT,IAAI,OAAO,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,OAAO,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;QACzC,IAAI,CAAC,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAChC,IAAI,EAAE,KAAK,MAAM;YAAE,OAAO,IAAI,C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QAAQ,CAAC,IAAI;iBAC3B,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;iBAChB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,CAAA;YACzB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;YACpC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU;YAC7C,UAAU;SACX;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;KAC7C,CAAC;AACJ,CAAC;AA7ED,sEA6EC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { PortfolioAssetToken } from '@sonarwatch/portfolio-core';
|
2
|
+
import { HeliusAsset } from './types';
|
3
|
+
export declare function heliusAssetToAssetToken(asset: HeliusAsset, amount: number, props?: {
|
4
|
+
price?: number;
|
5
|
+
tags?: string[];
|
6
|
+
}): PortfolioAssetToken | null;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.heliusAssetToAssetToken = void 0;
|
4
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
|
+
function heliusAssetToAssetToken(asset, amount, props) {
|
6
|
+
var _a, _b, _c;
|
7
|
+
// Tags
|
8
|
+
const tags = [];
|
9
|
+
if ((_a = props === null || props === void 0 ? void 0 : props.tags) === null || _a === void 0 ? void 0 : _a.length)
|
10
|
+
tags.push(...props.tags);
|
11
|
+
return {
|
12
|
+
type: portfolio_core_1.PortfolioAssetType.token,
|
13
|
+
attributes: {
|
14
|
+
tags: tags.length > 0 ? tags : [],
|
15
|
+
},
|
16
|
+
name: (_b = asset.token_info) === null || _b === void 0 ? void 0 : _b.symbol,
|
17
|
+
data: {
|
18
|
+
address: asset.id,
|
19
|
+
amount,
|
20
|
+
price: (_c = props === null || props === void 0 ? void 0 : props.price) !== null && _c !== void 0 ? _c : null,
|
21
|
+
},
|
22
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
23
|
+
value: (props === null || props === void 0 ? void 0 : props.price) ? props.price * amount : null,
|
24
|
+
};
|
25
|
+
}
|
26
|
+
exports.heliusAssetToAssetToken = heliusAssetToAssetToken;
|
27
|
+
//# sourceMappingURL=heliusAssetToAssetToken.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"heliusAssetToAssetToken.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetToken.ts"],"names":[],"mappings":";;;AAAA,+DAIoC;AAGpC,SAAgB,uBAAuB,CACrC,KAAkB,EAClB,MAAc,EACd,KAGC;;IAED,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAElD,OAAO;QACL,IAAI,EAAE,mCAAkB,CAAC,KAAK;QAC9B,UAAU,EAAE;YACV,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;SAClC;QACD,IAAI,EAAE,MAAA,KAAK,CAAC,UAAU,0CAAE,MAAM;QAC9B,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,MAAM;YACN,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,mCAAI,IAAI;SAC5B;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI;KAClD,CAAC;AACJ,CAAC;AA1BD,0DA0BC"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.mintsToAssets = void 0;
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
+
const getAssetBatchDas_1 = require("./das/getAssetBatchDas");
|
18
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../misc/tokenPriceToAssetToken"));
|
19
|
+
const heliusAssetToAssetCollectible_1 = require("./das/heliusAssetToAssetCollectible");
|
20
|
+
const heliusAssetToAssetToken_1 = require("./das/heliusAssetToAssetToken");
|
21
|
+
const mintsToAssets = (dasUrl, cache, mints, amounts) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
if (mints.length !== amounts.length)
|
23
|
+
throw new Error('mintsToAssets: wrong parameters');
|
24
|
+
const uniqueMints = Array.from(new Set(mints));
|
25
|
+
const [heliusAssets, tokenPrices] = yield Promise.all([
|
26
|
+
(0, getAssetBatchDas_1.getAssetBatchDasAsMap)(dasUrl, uniqueMints),
|
27
|
+
cache.getTokenPricesAsMap(uniqueMints, portfolio_core_1.NetworkId.solana),
|
28
|
+
]);
|
29
|
+
const assets = new Map();
|
30
|
+
mints.forEach((mint, i) => {
|
31
|
+
const heliusAsset = heliusAssets.get(mint);
|
32
|
+
const tokenPrice = tokenPrices.get(mint);
|
33
|
+
const amount = amounts[i];
|
34
|
+
if (!heliusAsset && !tokenPrice)
|
35
|
+
return;
|
36
|
+
if (!amount)
|
37
|
+
return;
|
38
|
+
if (tokenPrice) {
|
39
|
+
// TOKEN
|
40
|
+
assets.set(mint, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice));
|
41
|
+
}
|
42
|
+
else if (heliusAsset) {
|
43
|
+
// NFT
|
44
|
+
const assetCollectible = (0, heliusAssetToAssetCollectible_1.heliusAssetToAssetCollectible)(heliusAsset);
|
45
|
+
if (assetCollectible)
|
46
|
+
assets.set(mint, assetCollectible);
|
47
|
+
else {
|
48
|
+
// Unknown token
|
49
|
+
const assetToken = (0, heliusAssetToAssetToken_1.heliusAssetToAssetToken)(heliusAsset, amount);
|
50
|
+
if (assetToken)
|
51
|
+
assets.set(mint, assetToken);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
});
|
55
|
+
return assets;
|
56
|
+
});
|
57
|
+
exports.mintsToAssets = mintsToAssets;
|
58
|
+
//# sourceMappingURL=mintsToAssets.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mintsToAssets.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/mintsToAssets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,6DAA+D;AAE/D,4FAAoE;AACpE,uFAAoF;AACpF,2EAAwE;AAEjE,MAAM,aAAa,GAAG,CAC3B,MAAmB,EACnB,KAAY,EACZ,KAAe,EACf,OAAiB,EACjB,EAAE;IACF,IAAI,KAAK,CAAC,MAAM,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uB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC;gBAChE,IAAI,UAAU;oBAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA,CAAC;AAjDW,QAAA,aAAa,iBAiDxB"}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@solana/web3.js';
|
4
|
-
import BigNumber from 'bignumber.js';
|
5
|
-
export declare enum State {
|
6
|
-
Uninitialized = 0,
|
7
|
-
StakePool = 1,
|
8
|
-
InactiveStakePool = 2,
|
9
|
-
StakeAccount = 3
|
10
|
-
}
|
11
|
-
export type Liquidity = {
|
12
|
-
buffer: Buffer;
|
13
|
-
state: State;
|
14
|
-
mint: PublicKey;
|
15
|
-
owner: PublicKey;
|
16
|
-
amountDeposited: BigNumber;
|
17
|
-
space: number[];
|
18
|
-
};
|
19
|
-
export declare const liquidityStruct: BeetStruct<Liquidity, Partial<Liquidity>>;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.liquidityStruct = exports.State = void 0;
|
4
|
-
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
-
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
-
const solana_1 = require("../../utils/solana");
|
7
|
-
var State;
|
8
|
-
(function (State) {
|
9
|
-
State[State["Uninitialized"] = 0] = "Uninitialized";
|
10
|
-
State[State["StakePool"] = 1] = "StakePool";
|
11
|
-
State[State["InactiveStakePool"] = 2] = "InactiveStakePool";
|
12
|
-
State[State["StakeAccount"] = 3] = "StakeAccount";
|
13
|
-
})(State || (exports.State = State = {}));
|
14
|
-
exports.liquidityStruct = new beet_1.BeetStruct([
|
15
|
-
['buffer', (0, solana_1.blob)(8)],
|
16
|
-
['state', beet_1.u8],
|
17
|
-
['mint', beet_solana_1.publicKey],
|
18
|
-
['owner', beet_solana_1.publicKey],
|
19
|
-
['amountDeposited', solana_1.u64],
|
20
|
-
['space', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 128)],
|
21
|
-
], (args) => args);
|
22
|
-
//# sourceMappingURL=structs.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAE/C,IAAY,KAKX;AALD,WAAY,KAAK;IACf,mDAAa,CAAA;IACb,2CAAS,CAAA;IACT,2DAAiB,CAAA;IACjB,iDAAY,CAAA;AACd,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB;AAWY,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,OAAO,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,GAAG,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
|