@sonarwatch/portfolio-plugins 0.11.148 → 0.11.150
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1327 -1319
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/index.js +0 -4
- package/src/index.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/flexlend/depositsFetcher.js +63 -4
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/flexlend/struct.d.ts +18 -0
- package/src/plugins/flexlend/struct.js +18 -0
- package/src/plugins/flexlend/struct.js.map +1 -0
- package/src/plugins/hawksight/positionsFetcher.js +31 -13
- package/src/plugins/hawksight/positionsFetcher.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.d.ts +2 -3
- package/src/plugins/orca/getWhirlpoolPositions.js +2 -14
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/orca/helpers.d.ts +2 -2
- package/src/plugins/orca/helpers.js +1 -1
- package/src/plugins/orca/helpers.js.map +1 -1
- package/src/plugins/raydium/getRaydiumCLMMPositions.d.ts +2 -3
- package/src/plugins/raydium/getRaydiumCLMMPositions.js +3 -3
- package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
- package/src/plugins/raydium/helpers.d.ts +2 -2
- package/src/plugins/raydium/helpers.js +6 -1
- package/src/plugins/raydium/helpers.js.map +1 -1
- package/src/plugins/realms/constants.d.ts +4 -2
- package/src/plugins/realms/constants.js +10 -3
- package/src/plugins/realms/constants.js.map +1 -1
- package/src/plugins/realms/helpers.d.ts +4 -5
- package/src/plugins/realms/helpers.js +20 -28
- package/src/plugins/realms/helpers.js.map +1 -1
- package/src/plugins/realms/index.js +5 -5
- package/src/plugins/realms/index.js.map +1 -1
- package/src/plugins/realms/{depositsFetcher.js → realmsDepositsFetcher.js} +1 -1
- package/src/plugins/realms/realmsDepositsFetcher.js.map +1 -0
- package/src/plugins/realms/{programsJob.js → realmsProgramsJob.js} +4 -4
- package/src/plugins/realms/realmsProgramsJob.js.map +1 -0
- package/src/plugins/realms/types.d.ts +1 -1
- package/src/plugins/solend/constants.d.ts +1 -0
- package/src/plugins/solend/constants.js +2 -1
- package/src/plugins/solend/constants.js.map +1 -1
- package/src/plugins/solend/helpers.d.ts +6 -0
- package/src/plugins/solend/helpers.js +132 -1
- package/src/plugins/solend/helpers.js.map +1 -1
- package/src/plugins/solend/marketsJob.js +6 -0
- package/src/plugins/solend/marketsJob.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +27 -156
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/solend/reservesJob.js +15 -6
- package/src/plugins/solend/reservesJob.js.map +1 -1
- package/src/plugins/solend/types.d.ts +1 -1
- package/src/plugins/suilend/obligationsFetcher.js +2 -0
- package/src/plugins/suilend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +25 -14
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
- package/src/plugins/tokens/fetchers/solana.js +3 -1
- package/src/plugins/tokens/fetchers/solana.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/das/getAssetsByOwnerDas.d.ts +2 -2
- package/src/utils/solana/das/getAssetsByOwnerDas.js +3 -9
- package/src/utils/solana/das/getAssetsByOwnerDas.js.map +1 -1
- package/src/utils/solana/das/getDisplayOptions.d.ts +2 -0
- package/src/utils/solana/das/getDisplayOptions.js +16 -0
- package/src/utils/solana/das/getDisplayOptions.js.map +1 -0
- package/src/utils/solana/das/types.d.ts +8 -0
- package/src/plugins/phoenix/constants.d.ts +0 -7
- package/src/plugins/phoenix/constants.js +0 -17
- package/src/plugins/phoenix/constants.js.map +0 -1
- package/src/plugins/phoenix/helpers.d.ts +0 -6
- package/src/plugins/phoenix/helpers.js +0 -46
- package/src/plugins/phoenix/helpers.js.map +0 -1
- package/src/plugins/phoenix/helpers2.d.ts +0 -0
- package/src/plugins/phoenix/helpers2.js +0 -179
- package/src/plugins/phoenix/helpers2.js.map +0 -1
- package/src/plugins/phoenix/index.d.ts +0 -6
- package/src/plugins/phoenix/index.js +0 -10
- package/src/plugins/phoenix/index.js.map +0 -1
- package/src/plugins/phoenix/marketsJob.js +0 -39
- package/src/plugins/phoenix/marketsJob.js.map +0 -1
- package/src/plugins/phoenix/positionsFetcher.js +0 -64
- package/src/plugins/phoenix/positionsFetcher.js.map +0 -1
- package/src/plugins/phoenix/structs.d.ts +0 -67
- package/src/plugins/phoenix/structs.js +0 -82
- package/src/plugins/phoenix/structs.js.map +0 -1
- package/src/plugins/phoenix/types.d.ts +0 -29
- package/src/plugins/phoenix/types.js +0 -3
- package/src/plugins/phoenix/types.js.map +0 -1
- package/src/plugins/realms/depositsFetcher.d.ts +0 -3
- package/src/plugins/realms/depositsFetcher.js.map +0 -1
- package/src/plugins/realms/programsJob.d.ts +0 -3
- package/src/plugins/realms/programsJob.js.map +0 -1
- /package/src/plugins/{phoenix/positionsFetcher.d.ts → realms/realmsDepositsFetcher.d.ts} +0 -0
- /package/src/plugins/{phoenix/marketsJob.d.ts → realms/realmsProgramsJob.d.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/helpers.ts"],"names":[],"mappings":";;;;;;
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,yDAAyD;AACzD,yCAAyC;AACzC,sCAAsC;AACtC,+BAA+B;AAC/B,gEAAqC;AACrC,kDAAuB;AAEvB,2CAAkD;AAElD,SAAgB,kBAAkB,CAAC,GAA8B;IAC/D,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,+BA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AC,EAC5B,OAAO,CACR,CAAC,QAAQ,EAAE,CACb;KACF,CAAC;AACJ,CAAC;AAtDD,kFAsDC"}
|
@@ -3,8 +3,10 @@ import { Platform } from '@sonarwatch/portfolio-core';
|
|
3
3
|
import { VSRInfos } from './types';
|
4
4
|
export declare const platformId = "realms";
|
5
5
|
export declare const realmsPlatform: Platform;
|
6
|
+
export declare const heliumPlatformId = "helium";
|
7
|
+
export declare const heliumPlatform: Platform;
|
6
8
|
export declare const splGovProgramsKey = "splGovernancePrograms";
|
7
9
|
export declare const registrarKey = "registrars";
|
8
|
-
export declare const
|
9
|
-
export declare const
|
10
|
+
export declare const realmsCustomVsrInfo: VSRInfos[];
|
11
|
+
export declare const realmsVsrProgram: PublicKey;
|
10
12
|
export declare const splGovernanceUrl = "https://app.realms.today/api/splGovernancePrograms";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.splGovernanceUrl = exports.
|
3
|
+
exports.splGovernanceUrl = exports.realmsVsrProgram = exports.realmsCustomVsrInfo = exports.registrarKey = exports.splGovProgramsKey = exports.heliumPlatform = exports.heliumPlatformId = exports.realmsPlatform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'realms';
|
6
6
|
exports.realmsPlatform = {
|
@@ -10,9 +10,16 @@ exports.realmsPlatform = {
|
|
10
10
|
defiLlamaId: 'spl-governance',
|
11
11
|
website: 'https://app.realms.today/',
|
12
12
|
};
|
13
|
+
exports.heliumPlatformId = 'helium';
|
14
|
+
exports.heliumPlatform = {
|
15
|
+
id: exports.heliumPlatformId,
|
16
|
+
name: 'Helium',
|
17
|
+
image: 'https://sonar.watch/img/platforms/helium.png',
|
18
|
+
website: 'https://heliumvote.com/',
|
19
|
+
};
|
13
20
|
exports.splGovProgramsKey = 'splGovernancePrograms';
|
14
21
|
exports.registrarKey = 'registrars';
|
15
|
-
exports.
|
22
|
+
exports.realmsCustomVsrInfo = [
|
16
23
|
{
|
17
24
|
programId: new web3_js_1.PublicKey('VoteMBhDCqGLRgYpp9o7DGyq81KNmwjXQRAHStjtJsS'), // Marinade
|
18
25
|
mint: 'MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey',
|
@@ -30,6 +37,6 @@ exports.customVsrInfo = [
|
|
30
37
|
mint: '2j437Lt84XvysJiYbXTSJfAMy26Et9HiVGFvGFp8nYWH',
|
31
38
|
},
|
32
39
|
];
|
33
|
-
exports.
|
40
|
+
exports.realmsVsrProgram = new web3_js_1.PublicKey('vsr2nfGVNHmSY8uxoBGqq8AQbwz3JwaEaHqGbsTPXqQ');
|
34
41
|
exports.splGovernanceUrl = 'https://app.realms.today/api/splGovernancePrograms';
|
35
42
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAI/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AAEtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,iBAAiB,GAAG,uBAAuB,CAAC;AAC5C,QAAA,YAAY,GAAG,YAAY,CAAC;AAE5B,QAAA,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAI/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AAEtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAE5B,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,wBAAgB;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,OAAO,EAAE,yBAAyB;CACnC,CAAC;AAEW,QAAA,iBAAiB,GAAG,uBAAuB,CAAC;AAC5C,QAAA,YAAY,GAAG,YAAY,CAAC;AAE5B,QAAA,mBAAmB,GAAe;IAC7C;QACE,SAAS,EAAE,IAAI,mBAAS,CAAC,6CAA6C,CAAC,EAAE,WAAW;QACpF,IAAI,EAAE,6CAA6C;KACpD;IACD;QACE,SAAS,EAAE,IAAI,mBAAS,CAAC,8CAA8C,CAAC,EAAE,QAAQ;QAClF,IAAI,EAAE,6CAA6C;KACpD;IACD;QACE,SAAS,EAAE,IAAI,mBAAS,CAAC,6CAA6C,CAAC,EAAE,QAAQ;QACjF,IAAI,EAAE,6CAA6C;KACpD;IACD;QACE,SAAS,EAAE,IAAI,mBAAS,CAAC,8CAA8C,CAAC,EAAE,aAAa;QACvF,IAAI,EAAE,8CAA8C;KACrD;CACF,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAI,mBAAS,CAC3C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,gBAAgB,GAC3B,oDAAoD,CAAC"}
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import { PortfolioElement } from '@sonarwatch/portfolio-core';
|
1
|
+
import { PortfolioAssetCollectible, PortfolioElement } from '@sonarwatch/portfolio-core';
|
3
2
|
import BigNumber from 'bignumber.js';
|
4
3
|
import { PublicKey } from '@solana/web3.js';
|
5
4
|
import { Cache } from '../../Cache';
|
6
5
|
import { LockupKind } from './structs/realms';
|
7
|
-
export declare const
|
8
|
-
export declare function
|
6
|
+
export declare const nftIdentifier = "Voting Escrow Token Position";
|
7
|
+
export declare function isAnHeliumNFTVote(nft: PortfolioAssetCollectible): boolean;
|
9
8
|
export declare function getVoterPda(owner: string, registrar: string, vsr: string): PublicKey;
|
10
|
-
export declare function
|
9
|
+
export declare function getHeliumElementsFromNFTs(cache: Cache, nfts: PortfolioAssetCollectible[]): Promise<PortfolioElement[]>;
|
11
10
|
export declare function getLockedUntil(startTs: BigNumber, endTs: BigNumber, lockupKind: LockupKind): number | undefined;
|
@@ -12,21 +12,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.getLockedUntil = exports.
|
16
|
-
const js_1 = require("@metaplex-foundation/js");
|
15
|
+
exports.getLockedUntil = exports.getHeliumElementsFromNFTs = exports.getVoterPda = exports.isAnHeliumNFTVote = exports.nftIdentifier = void 0;
|
17
16
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
18
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
19
18
|
const web3_js_1 = require("@solana/web3.js");
|
20
|
-
const clients_1 = require("../../utils/clients");
|
21
19
|
const realms_1 = require("./structs/realms");
|
22
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
21
|
const constants_1 = require("./constants");
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
return nft && nft.name === exports.votingEscrowIdentifier;
|
22
|
+
exports.nftIdentifier = 'Voting Escrow Token Position';
|
23
|
+
function isAnHeliumNFTVote(nft) {
|
24
|
+
return nft.data.name === exports.nftIdentifier;
|
28
25
|
}
|
29
|
-
exports.
|
26
|
+
exports.isAnHeliumNFTVote = isAnHeliumNFTVote;
|
30
27
|
function getVoterPda(owner, registrar, vsr) {
|
31
28
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
32
29
|
new web3_js_1.PublicKey(registrar).toBuffer(),
|
@@ -35,32 +32,27 @@ function getVoterPda(owner, registrar, vsr) {
|
|
35
32
|
], new web3_js_1.PublicKey(vsr))[0];
|
36
33
|
}
|
37
34
|
exports.getVoterPda = getVoterPda;
|
38
|
-
function
|
35
|
+
function getHeliumElementsFromNFTs(cache, nfts) {
|
39
36
|
return __awaiter(this, void 0, void 0, function* () {
|
40
|
-
const client = (0, clients_1.getClientSolana)();
|
41
|
-
const metaplex = new js_1.Metaplex(client);
|
42
37
|
const assets = [];
|
43
38
|
const amountByMint = new Map();
|
44
39
|
for (const nft of nfts) {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
const
|
51
|
-
if (
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
else {
|
57
|
-
amountByMint.set(votersValues.votingMint, votersValues.amountDepositedNative);
|
58
|
-
}
|
40
|
+
const { attributes } = nft.data;
|
41
|
+
if (!attributes)
|
42
|
+
continue;
|
43
|
+
const votersValues = getNftValues(attributes);
|
44
|
+
if (votersValues && !votersValues.amountDepositedNative.isZero()) {
|
45
|
+
const existingAmount = amountByMint.get(votersValues.votingMint);
|
46
|
+
if (existingAmount) {
|
47
|
+
amountByMint.set(votersValues.votingMint, existingAmount.plus(votersValues.amountDepositedNative));
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
amountByMint.set(votersValues.votingMint, votersValues.amountDepositedNative);
|
59
51
|
}
|
60
52
|
}
|
61
53
|
}
|
62
54
|
const mints = Array.from(amountByMint.keys());
|
63
|
-
const tokenPriceById = yield
|
55
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.solana);
|
64
56
|
for (const mint of mints) {
|
65
57
|
const amount = amountByMint.get(mint);
|
66
58
|
if (amount) {
|
@@ -85,7 +77,7 @@ function getPositionFromVotingEscrowNFT(cache, nfts) {
|
|
85
77
|
];
|
86
78
|
});
|
87
79
|
}
|
88
|
-
exports.
|
80
|
+
exports.getHeliumElementsFromNFTs = getHeliumElementsFromNFTs;
|
89
81
|
function getLockedUntil(startTs, endTs, lockupKind) {
|
90
82
|
let lockedUntil;
|
91
83
|
if (lockupKind === realms_1.LockupKind.Constant) {
|
@@ -126,7 +118,7 @@ function getNftValues(items) {
|
|
126
118
|
registrar,
|
127
119
|
amountDeposited: new bignumber_js_1.default(amountDeposited),
|
128
120
|
amountDepositedNative: new bignumber_js_1.default(amountDepositedNative),
|
129
|
-
votingMintConfigIdx
|
121
|
+
votingMintConfigIdx,
|
130
122
|
votingMint,
|
131
123
|
startTs: new bignumber_js_1.default(startTs),
|
132
124
|
endTs: new bignumber_js_1.default(endTs),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,6CAA8C;AAC9C,qGAA6E;AAC7E,2CAAyC;AAE5B,QAAA,aAAa,GAAG,8BAA8B,CAAC;AAE5D,SAAgB,iBAAiB,CAAC,GAA8B;IAC9D,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,qBAAa,CAAC;AACzC,CAAC;AAFD,8CAEC;AAED,SAAgB,WAAW,CACzB,KAAa,EACb,SAAiB,EACjB,GAAW;IAEX,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,IAAI,mBAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;QACnC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;QAC7B,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,IAAI,mBAAS,CAAC,GAAG,CAAC,CACnB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAbD,kCAaC;AAED,SAAsB,yBAAyB,CAC7C,KAAY,EACZ,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B,IAAI;YACJ,UAAU;YACV,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC;SACb,CAAC;IAC9B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.platforms = exports.fetchers = exports.jobs = void 0;
|
7
|
-
const
|
7
|
+
const realmsDepositsFetcher_1 = __importDefault(require("./realmsDepositsFetcher"));
|
8
8
|
const constants_1 = require("./constants");
|
9
|
-
const
|
10
|
-
exports.jobs = [
|
11
|
-
exports.fetchers = [
|
12
|
-
exports.platforms = [constants_1.realmsPlatform];
|
9
|
+
const realmsProgramsJob_1 = __importDefault(require("./realmsProgramsJob"));
|
10
|
+
exports.jobs = [realmsProgramsJob_1.default];
|
11
|
+
exports.fetchers = [realmsDepositsFetcher_1.default];
|
12
|
+
exports.platforms = [constants_1.realmsPlatform, constants_1.heliumPlatform];
|
13
13
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/index.ts"],"names":[],"mappings":";;;;;;AAGA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/index.ts"],"names":[],"mappings":";;;;;;AAGA,oFAAsD;AACtD,2CAA6D;AAC7D,4EAA8C;AAEjC,QAAA,IAAI,GAAU,CAAC,2BAAW,CAAC,CAAC;AAC5B,QAAA,QAAQ,GAAc,CAAC,+BAAe,CAAC,CAAC;AACxC,QAAA,SAAS,GAAe,CAAC,0BAAc,EAAE,0BAAc,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"realmsDepositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/realmsDepositsFetcher.ts"],"names":[],"mappings":";;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AAM,CAAC,KAAK,EACpB,OAAO,CAAC,MAAM,CAAC,IAAI,CACpB,CAAC;gBAEF,YAAY,CAAC,IAAI,CACf,WAAW,CAAC,CAAC,iCAAM,KAAK,KAAE,UAAU,EAAE,EAAE,WAAW,EAAE,IAAG,CAAC,CAAC,KAAK,CAChE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACvD,IAAI,EAAE;gBACJ,MAAM,EAAE,YAAY;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -24,13 +24,13 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
24
|
const splGovPrograms = yield axios_1.default.get(constants_1.splGovernanceUrl);
|
25
25
|
const client = (0, clients_1.getClientSolana)();
|
26
26
|
const registrars = [];
|
27
|
-
const allRegistrars = yield (0, solana_1.getParsedProgramAccounts)(client, realms_1.registrarStruct, constants_1.
|
27
|
+
const allRegistrars = yield (0, solana_1.getParsedProgramAccounts)(client, realms_1.registrarStruct, constants_1.realmsVsrProgram, (0, filters_1.registratAccountFilter)());
|
28
28
|
allRegistrars.forEach((account) => registrars.push({
|
29
|
-
vsr: constants_1.
|
29
|
+
vsr: constants_1.realmsVsrProgram.toString(),
|
30
30
|
pubkey: account.pubkey.toString(),
|
31
31
|
mint: account.realmGoverningTokenMint.toString(),
|
32
32
|
}));
|
33
|
-
for (const vsrInfo of constants_1.
|
33
|
+
for (const vsrInfo of constants_1.realmsCustomVsrInfo) {
|
34
34
|
const customRegistrars = yield (0, solana_1.getParsedProgramAccounts)(client, realms_1.registrarStruct, new web3_js_1.PublicKey(vsrInfo.programId), (0, filters_1.registratAccountFilter)());
|
35
35
|
customRegistrars.forEach((registrar) => registrars.push({
|
36
36
|
pubkey: registrar.pubkey.toString(),
|
@@ -53,4 +53,4 @@ const job = {
|
|
53
53
|
label: 'normal',
|
54
54
|
};
|
55
55
|
exports.default = job;
|
56
|
-
//# sourceMappingURL=
|
56
|
+
//# sourceMappingURL=realmsProgramsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"realmsProgramsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/realmsProgramsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+DAAuD;AACvD,6CAA4C;AAG5C,2CAKqB;AACrB,+CAA8D;AAC9D,iDAAsD;AACtD,6CAAmD;AACnD,uCAAmD;AAGnD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAA4B,MAAM,eAAK,CAAC,GAAG,CAC7D,4BAAgB,CACjB,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,UAAU,GAAoB,EAAE,CAAC;IACvC,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAwB,EAClD,MAAM,EACN,wBAAe,EACf,4BAAgB,EAChB,IAAA,gCAAsB,GAAE,CACzB,CAAC;IACF,aAAa,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAChC,UAAU,CAAC,IAAI,CAAC;QACd,GAAG,EAAE,4BAAgB,CAAC,QAAQ,EAAE;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;QACjC,IAAI,EAAE,OAAO,CAAC,uBAAuB,CAAC,QAAQ,EAAE;KACjD,CAAC,CACH,CAAC;IACF,KAAK,MAAM,OAAO,IAAI,+BAAmB,EAAE,CAAC;QAC1C,MAAM,gBAAgB,GAAG,MAAM,IAAA,iCAAwB,EACrD,MAAM,EACN,wBAAe,EACf,IAAI,mBAAS,CAAC,OAAO,CAAC,SAAS,CAAC,EAChC,IAAA,gCAAsB,GAAE,CACzB,CAAC;QACF,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CACrC,UAAU,CAAC,IAAI,CAAC;YACd,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE;YACnC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE;YACjC,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAc;QAC5B,WAAW,EAAE,cAAc,CAAC,IAAI;QAChC,UAAU;KACX,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE;QACtC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -4,6 +4,7 @@ export declare const platformId = "solend";
|
|
4
4
|
export declare const solendPlatform: Platform;
|
5
5
|
export declare const marketsPrefix = "solend-markets";
|
6
6
|
export declare const reservesPrefix = "solend-reserves";
|
7
|
+
export declare const marketsKey = "markets";
|
7
8
|
export declare const pid: PublicKey;
|
8
9
|
export declare const marketsEndpoint = "https://api.solend.fi/v1/markets/configs";
|
9
10
|
export declare const reserveEndpoint = "https://api.solend.fi/v1/reserves/?ids=";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.mainMarket = exports.wadsDecimal = exports.reserveEndpoint = exports.marketsEndpoint = exports.pid = exports.reservesPrefix = exports.marketsPrefix = exports.solendPlatform = exports.platformId = void 0;
|
3
|
+
exports.mainMarket = exports.wadsDecimal = exports.reserveEndpoint = exports.marketsEndpoint = exports.pid = exports.marketsKey = exports.reservesPrefix = exports.marketsPrefix = exports.solendPlatform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'solend';
|
6
6
|
exports.solendPlatform = {
|
@@ -12,6 +12,7 @@ exports.solendPlatform = {
|
|
12
12
|
};
|
13
13
|
exports.marketsPrefix = `${exports.platformId}-markets`;
|
14
14
|
exports.reservesPrefix = `${exports.platformId}-reserves`;
|
15
|
+
exports.marketsKey = 'markets';
|
15
16
|
exports.pid = new web3_js_1.PublicKey('So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo');
|
16
17
|
exports.marketsEndpoint = 'https://api.solend.fi/v1/markets/configs';
|
17
18
|
exports.reserveEndpoint = 'https://api.solend.fi/v1/reserves/?ids=';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,oBAAoB;CAC9B,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,oBAAoB;CAC9B,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,UAAU,GAAG,SAAS,CAAC;AAEvB,QAAA,GAAG,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AACnE,QAAA,eAAe,GAAG,0CAA0C,CAAC;AAC7D,QAAA,eAAe,GAAG,yCAAyC,CAAC;AAC5D,QAAA,WAAW,GAAG,EAAE,CAAC;AACjB,QAAA,UAAU,GAAG,8CAA8C,CAAC"}
|
@@ -1,4 +1,9 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
import { PortfolioElement, TokenPrice } from '@sonarwatch/portfolio-core';
|
3
|
+
import { AccountInfo } from '@solana/web3.js';
|
4
|
+
import { Obligation } from './structs';
|
5
|
+
import { ParsedAccount } from '../../utils/solana';
|
6
|
+
import { MarketInfo, ReserveInfo } from './types';
|
2
7
|
export declare const upperFirst: (string: string) => string;
|
3
8
|
export declare function getObligationSeed(marketAddress: string, accountId: number): string;
|
4
9
|
export declare const parseDataflat: (dataFlat: Buffer, depositsLen: number, borrowsLen: number) => {
|
@@ -7,3 +12,4 @@ export declare const parseDataflat: (dataFlat: Buffer, depositsLen: number, borr
|
|
7
12
|
borrows: import("./structs").ObligationLiquidity[];
|
8
13
|
borrowsMap: Map<string, import("./structs").ObligationLiquidity>;
|
9
14
|
};
|
15
|
+
export declare function getElementsFromObligations(obligations: ParsedAccount<Obligation>[], reserveByAddress: Map<string, ReserveInfo>, marketByAddress: Map<string, MarketInfo>, tokenPriceByAddress: Map<string, TokenPrice>, pythAccountByAddress: Map<string, AccountInfo<Buffer>>): PortfolioElement[];
|
@@ -1,8 +1,17 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parseDataflat = exports.getObligationSeed = exports.upperFirst = void 0;
|
6
|
+
exports.getElementsFromObligations = exports.parseDataflat = exports.getObligationSeed = exports.upperFirst = void 0;
|
4
7
|
const beet_1 = require("@metaplex-foundation/beet");
|
8
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
9
|
+
const web3_js_1 = require("@solana/web3.js");
|
10
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
5
11
|
const structs_1 = require("./structs");
|
12
|
+
const constants_1 = require("./constants");
|
13
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
14
|
+
const helpers_1 = require("../../utils/solana/pyth/helpers");
|
6
15
|
const upperFirst = (string) => string ? string.charAt(0).toUpperCase() + string.slice(1) : '';
|
7
16
|
exports.upperFirst = upperFirst;
|
8
17
|
function getObligationSeed(marketAddress, accountId) {
|
@@ -27,4 +36,126 @@ const parseDataflat = (dataFlat, depositsLen, borrowsLen) => {
|
|
27
36
|
};
|
28
37
|
};
|
29
38
|
exports.parseDataflat = parseDataflat;
|
39
|
+
function getElementsFromObligations(obligations, reserveByAddress, marketByAddress, tokenPriceByAddress, pythAccountByAddress) {
|
40
|
+
const elements = [];
|
41
|
+
for (let i = 0; i < obligations.length; i += 1) {
|
42
|
+
const obligation = obligations[i];
|
43
|
+
if (!obligation)
|
44
|
+
continue;
|
45
|
+
const market = marketByAddress.get(obligation.lendingMarket.toString());
|
46
|
+
if (!market)
|
47
|
+
continue;
|
48
|
+
const { depositsMap, borrowsMap } = (0, exports.parseDataflat)(obligation.dataFlat, obligation.depositsLen, obligation.borrowsLen);
|
49
|
+
if (depositsMap.size === 0 && borrowsMap.size === 0)
|
50
|
+
continue;
|
51
|
+
const borrowedAssets = [];
|
52
|
+
const borrowedYields = [];
|
53
|
+
const suppliedAssets = [];
|
54
|
+
const suppliedYields = [];
|
55
|
+
const rewardAssets = [];
|
56
|
+
const suppliedLtvs = [];
|
57
|
+
const borrowedWeights = [];
|
58
|
+
for (let j = 0; j < market.reserves.length; j += 1) {
|
59
|
+
const { address: reserveAddress } = market.reserves[j];
|
60
|
+
const reserveInfo = reserveByAddress.get(reserveAddress);
|
61
|
+
if (!reserveInfo)
|
62
|
+
continue;
|
63
|
+
const { reserve } = reserveInfo;
|
64
|
+
const { liquidity, collateral } = reserve;
|
65
|
+
const lMint = liquidity.mintPubkey;
|
66
|
+
const lTokenPrice = tokenPriceByAddress.get(lMint);
|
67
|
+
let price;
|
68
|
+
if (!lTokenPrice) {
|
69
|
+
const pythOracle = new web3_js_1.PublicKey(reserve.liquidity.pythOracle);
|
70
|
+
const pythAccount = pythAccountByAddress.get(pythOracle.toString());
|
71
|
+
const pythPrice = pythAccount
|
72
|
+
? (0, helpers_1.parsePriceData)(pythAccount.data)
|
73
|
+
: undefined;
|
74
|
+
if (pythPrice)
|
75
|
+
price = pythPrice.price;
|
76
|
+
}
|
77
|
+
const decimals = liquidity.mintDecimals;
|
78
|
+
const reserveBorrowAmount = new bignumber_js_1.default(liquidity.borrowedAmountWads)
|
79
|
+
.dividedBy(Math.pow(10, (constants_1.wadsDecimal + decimals)))
|
80
|
+
.toNumber();
|
81
|
+
const reserveAvailableAmount = new bignumber_js_1.default(liquidity.availableAmount)
|
82
|
+
.dividedBy(Math.pow(10, decimals))
|
83
|
+
.toNumber();
|
84
|
+
const collateralSupply = new bignumber_js_1.default(collateral.mintTotalSupply)
|
85
|
+
.dividedBy(Math.pow(10, decimals))
|
86
|
+
.toNumber();
|
87
|
+
const reserveDepositAmount = reserveBorrowAmount + reserveAvailableAmount;
|
88
|
+
// Deposit
|
89
|
+
const deposit = depositsMap.get(reserveAddress);
|
90
|
+
if (deposit) {
|
91
|
+
if (!deposit.depositedAmount.isZero()) {
|
92
|
+
const suppliedAmount = deposit.depositedAmount
|
93
|
+
.div(Math.pow(10, decimals))
|
94
|
+
.times(reserveDepositAmount / collateralSupply)
|
95
|
+
.toNumber();
|
96
|
+
suppliedLtvs.push(reserve.config.liquidationThreshold / 100);
|
97
|
+
const apy = +reserveInfo.rates.supplyInterest / 100;
|
98
|
+
const cSuppliedYields = [
|
99
|
+
{
|
100
|
+
apr: (0, portfolio_core_1.apyToApr)(apy),
|
101
|
+
apy,
|
102
|
+
},
|
103
|
+
];
|
104
|
+
suppliedYields.push(cSuppliedYields);
|
105
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(lMint, suppliedAmount, portfolio_core_1.NetworkId.solana, lTokenPrice, price));
|
106
|
+
}
|
107
|
+
}
|
108
|
+
// Borrow
|
109
|
+
const borrow = borrowsMap.get(reserveAddress);
|
110
|
+
if (borrow) {
|
111
|
+
if (!borrow.borrowedAmountWads.isZero()) {
|
112
|
+
const borrowedAmount = borrow.borrowedAmountWads
|
113
|
+
.times(new bignumber_js_1.default(liquidity.cumulativeBorrowRateWads))
|
114
|
+
.div(borrow.cumulativeBorrowRateWads)
|
115
|
+
.dividedBy(new bignumber_js_1.default(Math.pow(10, (constants_1.wadsDecimal + decimals))))
|
116
|
+
.toNumber();
|
117
|
+
borrowedWeights.push(new bignumber_js_1.default(reserve.config.addedBorrowWeightBPS)
|
118
|
+
.dividedBy(Math.pow(10, 4))
|
119
|
+
.plus(1)
|
120
|
+
.toNumber());
|
121
|
+
const apy = +reserveInfo.rates.borrowInterest / 100;
|
122
|
+
const cBorrowedYields = [
|
123
|
+
{
|
124
|
+
apr: -(0, portfolio_core_1.apyToApr)(apy),
|
125
|
+
apy: -apy,
|
126
|
+
},
|
127
|
+
];
|
128
|
+
borrowedYields.push(cBorrowedYields);
|
129
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(lMint, borrowedAmount, portfolio_core_1.NetworkId.solana, lTokenPrice, price));
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
|
134
|
+
continue;
|
135
|
+
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets, suppliedLtvs, borrowedWeights);
|
136
|
+
elements.push({
|
137
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
138
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
139
|
+
platformId: constants_1.platformId,
|
140
|
+
label: 'Lending',
|
141
|
+
value,
|
142
|
+
name: market.name,
|
143
|
+
data: {
|
144
|
+
borrowedAssets,
|
145
|
+
borrowedValue,
|
146
|
+
borrowedYields,
|
147
|
+
suppliedAssets,
|
148
|
+
suppliedValue,
|
149
|
+
suppliedYields,
|
150
|
+
collateralRatio: null,
|
151
|
+
healthRatio,
|
152
|
+
rewardAssets,
|
153
|
+
rewardValue,
|
154
|
+
value,
|
155
|
+
},
|
156
|
+
});
|
157
|
+
}
|
158
|
+
return elements;
|
159
|
+
}
|
160
|
+
exports.getElementsFromObligations = getElementsFromObligations;
|
30
161
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/helpers.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAkE;AAClE,+DASoC;AACpC,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,EAAE,GACrE,IAAA,wCAAuB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,CAChB,CAAC;QAEJ,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AApKD,gEAoKC"}
|
@@ -19,12 +19,18 @@ const helpers_1 = require("./helpers");
|
|
19
19
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
20
|
const marketsInfoRes = yield axios_1.default.get(constants_1.marketsEndpoint);
|
21
21
|
const marketsInfo = marketsInfoRes.data;
|
22
|
+
const marketsEnhanced = [];
|
22
23
|
for (const marketInfo of marketsInfo) {
|
24
|
+
marketsEnhanced.push(Object.assign(Object.assign({}, marketInfo), { name: (0, helpers_1.upperFirst)(marketInfo.name) }));
|
23
25
|
yield cache.setItem(marketInfo.address, Object.assign(Object.assign({}, marketInfo), { name: (0, helpers_1.upperFirst)(marketInfo.name) }), {
|
24
26
|
prefix: constants_1.marketsPrefix,
|
25
27
|
networkId: portfolio_core_1.NetworkId.solana,
|
26
28
|
});
|
27
29
|
}
|
30
|
+
yield cache.setItem(constants_1.marketsKey, marketsEnhanced, {
|
31
|
+
prefix: constants_1.solendPlatform.id,
|
32
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
33
|
+
});
|
28
34
|
});
|
29
35
|
const job = {
|
30
36
|
id: `${constants_1.platformId}-markets`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,2CAMqB;AAErB,uCAAuC;AAIvC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAAgC,MAAM,eAAK,CAAC,GAAG,CACjE,2BAAe,CAChB,CAAC;IACF,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC;IACxC,MAAM,eAAe,GAAiB,EAAE,CAAC;IACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,eAAe,CAAC,IAAI,iCACf,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,IACjC,CAAC;QACH,MAAM,KAAK,CAAC,OAAO,CACjB,UAAU,CAAC,OAAO,kCAEb,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,KAEnC;YACE,MAAM,EAAN,yBAAM;YACN,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CACF,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,sBAAU,EAAE,eAAe,EAAE;QAC/C,MAAM,EAAE,0BAAc,CAAC,EAAE;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|