@sonarwatch/portfolio-plugins 0.12.110 → 0.12.112
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -1
- package/package.json +1 -1
- package/src/plugins/aftermath/poolsJob.js +1 -1
- package/src/plugins/aftermath/poolsJob.js.map +1 -1
- package/src/plugins/raydium/farmsFetcher.js +29 -6
- package/src/plugins/raydium/farmsFetcher.js.map +1 -1
- package/src/plugins/save/constants.d.ts +5 -3
- package/src/plugins/save/constants.js +6 -4
- package/src/plugins/save/constants.js.map +1 -1
- package/src/plugins/save/index.js +2 -1
- package/src/plugins/save/index.js.map +1 -1
- package/src/plugins/save/rewardStatsJob.d.ts +3 -0
- package/src/plugins/save/rewardStatsJob.js +31 -0
- package/src/plugins/save/rewardStatsJob.js.map +1 -0
- package/src/plugins/save/rewardsFetcher.js +96 -54
- package/src/plugins/save/rewardsFetcher.js.map +1 -1
- package/src/plugins/save/structs.d.ts +12 -0
- package/src/plugins/save/structs.js +12 -1
- package/src/plugins/save/structs.js.map +1 -1
- package/src/plugins/save/types.d.ts +46 -0
package/CHANGELOG.md
CHANGED
@@ -2,10 +2,18 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.12.
|
5
|
+
## [0.12.112](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.111...plugins-0.12.112) (2024-08-02)
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
## [0.12.111](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.110...plugins-0.12.111) (2024-08-02)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [0.12.110](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.109...plugins-0.12.110) (2024-08-02)
|
14
|
+
|
15
|
+
|
16
|
+
|
9
17
|
## [0.12.109](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.108...plugins-0.12.109) (2024-08-01)
|
10
18
|
|
11
19
|
|
package/package.json
CHANGED
@@ -61,7 +61,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
61
|
poolInfo.normalized_balances.forEach((nBalance, i) => {
|
62
62
|
const caddress = (0, portfolio_core_1.formatTokenAddress)(`0x${poolInfo.type_names[i]}`, networkId);
|
63
63
|
const tokenPrice = tokenPriceById.get(caddress);
|
64
|
-
if (!tokenPrice)
|
64
|
+
if (!tokenPrice || !poolInfo.coin_decimals)
|
65
65
|
return;
|
66
66
|
poolUnderlyingsRaw.push({
|
67
67
|
address: caddress,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aftermath/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+DAA2E;AAG3E,iDAAmD;AACnD,2CAAuD;AAEvD,6CAAoD;AACpD,uEAAoE;AACpE,qEAAkE;AAClE,8EAG8C;AAE9C,MAAM,SAAS,GAAG,0BAAS,CAAC,GAAG,CAAC;AAEhC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,gBAAgB,GAAG,MAAM,IAAA,mCAAgB,EAAC,MAAM,EAAE,wBAAY,CAAC,CAAC;IAEtE,MAAM,cAAc,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC/D,IAAI,CAAC,cAAc,CAAC,MAAM;QAAE,OAAO;IAEnC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,QAAQ;SACtB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;;QAClB,IAAI,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,EAAE,CAAC;YACrC,MAAM,MAA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;IACD,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -38,7 +38,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
38
38
|
farmsInfo.forEach((farmInfo) => farmInfo
|
39
39
|
? farmsInfoMap.set(farmInfo.account.pubkey.toString(), farmInfo)
|
40
40
|
: undefined);
|
41
|
-
const
|
41
|
+
const liquiditiesWithoutRewards = [];
|
42
|
+
const elementsWithRewards = [];
|
42
43
|
for (let i = 0; i < userFarmAccounts.length; i += 1) {
|
43
44
|
const rewardAssets = [];
|
44
45
|
const assets = [];
|
@@ -79,7 +80,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
79
80
|
const value = (0, portfolio_core_1.getUsdValueSum)([assetsValue, rewardAssetsValue]);
|
80
81
|
if (value === 0)
|
81
82
|
continue;
|
82
|
-
|
83
|
+
if (rewardAssets.length === 0) {
|
84
|
+
liquiditiesWithoutRewards.push({
|
85
|
+
assets,
|
86
|
+
assetsValue,
|
87
|
+
rewardAssets: [],
|
88
|
+
rewardAssetsValue: null,
|
89
|
+
value: assetsValue,
|
90
|
+
yields: [],
|
91
|
+
});
|
92
|
+
continue;
|
93
|
+
}
|
94
|
+
const liquidityWithRewards = {
|
83
95
|
value,
|
84
96
|
assets,
|
85
97
|
assetsValue,
|
@@ -87,19 +99,30 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
87
99
|
rewardAssetsValue,
|
88
100
|
yields: [],
|
89
101
|
};
|
90
|
-
|
102
|
+
elementsWithRewards.push({
|
103
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
104
|
+
platformId: constants_1.platformId,
|
105
|
+
type: portfolio_core_1.PortfolioElementType.liquidity,
|
106
|
+
label: 'Farming',
|
107
|
+
value: liquidityWithRewards.value,
|
108
|
+
data: {
|
109
|
+
liquidities: [liquidityWithRewards],
|
110
|
+
},
|
111
|
+
});
|
91
112
|
}
|
92
|
-
if (
|
113
|
+
if (liquiditiesWithoutRewards.length === 0 &&
|
114
|
+
elementsWithRewards.length === 0)
|
93
115
|
return [];
|
94
116
|
return [
|
117
|
+
...elementsWithRewards,
|
95
118
|
{
|
96
119
|
networkId: portfolio_core_1.NetworkId.solana,
|
97
120
|
platformId: constants_1.platformId,
|
98
121
|
type: portfolio_core_1.PortfolioElementType.liquidity,
|
99
122
|
label: 'Farming',
|
100
|
-
value: (0, portfolio_core_1.getUsdValueSum)(
|
123
|
+
value: (0, portfolio_core_1.getUsdValueSum)(liquiditiesWithoutRewards.map((l) => l.value)),
|
101
124
|
data: {
|
102
|
-
liquidities,
|
125
|
+
liquidities: liquiditiesWithoutRewards,
|
103
126
|
},
|
104
127
|
},
|
105
128
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,uCAAiD;AACjD,+CAA6E;AAC7E,yCAA6C;AAE7C,uGAA+E;AAG/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,wBAAwB,GAAG,0BAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CACtE,IAAA,iCAAwB,EACtB,MAAM,EACN,cA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S;YACpC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,oBAAoB,CAAC,KAAK;YACjC,IAAI,EAAE;gBACJ,WAAW,EAAE,CAAC,oBAAoB,CAAC;aACpC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IACE,yBAAyB,CAAC,MAAM,KAAK,CAAC;QACtC,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAEhC,OAAO,EAAE,CAAC;IAEZ,OAAO;QACL,GAAG,mBAAmB;QACtB;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACpE,IAAI,EAAE;gBACJ,WAAW,EAAE,yBAAyB;aACvC;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -3,14 +3,16 @@ import { Platform } from '@sonarwatch/portfolio-core';
|
|
3
3
|
export declare const platformId = "save";
|
4
4
|
export declare const platform: Platform;
|
5
5
|
export declare const marketsPrefix = "save-markets";
|
6
|
-
export declare const reservesPrefix = "save-reserves";
|
7
6
|
export declare const marketsKey = "markets";
|
7
|
+
export declare const reservesPrefix = "save-reserves";
|
8
|
+
export declare const rewardStatsPrefix = "save-reward-stats";
|
9
|
+
export declare const rewardStatsKey = "reward-stats";
|
8
10
|
export declare const pid: PublicKey;
|
9
11
|
export declare const merkleProgramId: PublicKey;
|
10
12
|
export declare const marketsEndpoint = "https://api.solend.fi/v1/markets/configs";
|
11
13
|
export declare const reserveEndpoint = "https://api.solend.fi/v1/reserves/?ids=";
|
12
14
|
export declare const wadsDecimal = 18;
|
13
15
|
export declare const mainMarket = "4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY";
|
14
|
-
export declare const
|
15
|
-
export declare const
|
16
|
+
export declare const rewardProofsEndpoint = "https://api.save.finance/liquidity-mining/reward-proofs?obligation=";
|
17
|
+
export declare const externalRewardStatsEndpoint = "https://api.save.finance/liquidity-mining/external-reward-stats-v2?flat=true";
|
16
18
|
export declare const slndMint = "SLNDpmoWTVADgEdndyvWzroNL7zSi1dF9PC3xHGtPwp";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.slndMint = exports.
|
3
|
+
exports.slndMint = exports.externalRewardStatsEndpoint = exports.rewardProofsEndpoint = exports.mainMarket = exports.wadsDecimal = exports.reserveEndpoint = exports.marketsEndpoint = exports.merkleProgramId = exports.pid = exports.rewardStatsKey = exports.rewardStatsPrefix = exports.reservesPrefix = exports.marketsKey = exports.marketsPrefix = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'save';
|
6
6
|
exports.platform = {
|
@@ -11,15 +11,17 @@ exports.platform = {
|
|
11
11
|
website: 'https://save.finance/',
|
12
12
|
};
|
13
13
|
exports.marketsPrefix = `${exports.platformId}-markets`;
|
14
|
-
exports.reservesPrefix = `${exports.platformId}-reserves`;
|
15
14
|
exports.marketsKey = 'markets';
|
15
|
+
exports.reservesPrefix = `${exports.platformId}-reserves`;
|
16
|
+
exports.rewardStatsPrefix = `${exports.platformId}-reward-stats`;
|
17
|
+
exports.rewardStatsKey = 'reward-stats';
|
16
18
|
exports.pid = new web3_js_1.PublicKey('So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo');
|
17
19
|
exports.merkleProgramId = new web3_js_1.PublicKey('mrksLcZ6rMs9xkmJgw6oKiR3GECw44Gb5NeDqu64kiw');
|
18
20
|
exports.marketsEndpoint = 'https://api.solend.fi/v1/markets/configs';
|
19
21
|
exports.reserveEndpoint = 'https://api.solend.fi/v1/reserves/?ids=';
|
20
22
|
exports.wadsDecimal = 18;
|
21
23
|
exports.mainMarket = '4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY';
|
22
|
-
exports.
|
23
|
-
exports.
|
24
|
+
exports.rewardProofsEndpoint = 'https://api.save.finance/liquidity-mining/reward-proofs?obligation=';
|
25
|
+
exports.externalRewardStatsEndpoint = 'https://api.save.finance/liquidity-mining/external-reward-stats-v2?flat=true';
|
24
26
|
exports.slndMint = 'SLNDpmoWTVADgEdndyvWzroNL7zSi1dF9PC3xHGtPwp';
|
25
27
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,uBAAuB;CACjC,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,uBAAuB;CACjC,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,iBAAiB,GAAG,GAAG,kBAAU,eAAe,CAAC;AACjD,QAAA,cAAc,GAAG,cAAc,CAAC;AAEhC,QAAA,GAAG,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AACnE,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AACW,QAAA,eAAe,GAAG,0CAA0C,CAAC;AAC7D,QAAA,eAAe,GAAG,yCAAyC,CAAC;AAC5D,QAAA,WAAW,GAAG,EAAE,CAAC;AACjB,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAC5D,QAAA,oBAAoB,GAC/B,qEAAqE,CAAC;AAC3D,QAAA,2BAA2B,GACtC,8EAA8E,CAAC;AAEpE,QAAA,QAAQ,GAAG,6CAA6C,CAAC"}
|
@@ -9,7 +9,8 @@ const marketsJob_1 = __importDefault(require("./marketsJob"));
|
|
9
9
|
const obligationsFetcher_1 = __importDefault(require("./obligationsFetcher"));
|
10
10
|
const constants_1 = require("./constants");
|
11
11
|
const rewardsFetcher_1 = __importDefault(require("./rewardsFetcher"));
|
12
|
+
const rewardStatsJob_1 = __importDefault(require("./rewardStatsJob"));
|
12
13
|
exports.platforms = [constants_1.platform];
|
13
|
-
exports.jobs = [marketsJob_1.default, reservesJob_1.default];
|
14
|
+
exports.jobs = [marketsJob_1.default, reservesJob_1.default, rewardStatsJob_1.default];
|
14
15
|
exports.fetchers = [obligationsFetcher_1.default, rewardsFetcher_1.default];
|
15
16
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,8DAAsC;AACtC,8EAAqD;AACrD,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,qBAAW,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,8DAAsC;AACtC,8EAAqD;AACrD,2CAAuC;AACvC,sEAA8C;AAC9C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,qBAAW,EAAE,wBAAc,CAAC,CAAC;AACxD,QAAA,QAAQ,GAAc,CAAC,4BAAiB,EAAE,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,31 @@
|
|
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
|
+
const axios_1 = __importDefault(require("axios"));
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const rewardStatsRes = yield axios_1.default.get(constants_1.externalRewardStatsEndpoint);
|
20
|
+
yield cache.setItem(constants_1.rewardStatsKey, rewardStatsRes.data, {
|
21
|
+
prefix: constants_1.rewardStatsPrefix,
|
22
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
23
|
+
});
|
24
|
+
});
|
25
|
+
const job = {
|
26
|
+
id: `${constants_1.platformId}-reward-stats`,
|
27
|
+
executor,
|
28
|
+
label: 'normal',
|
29
|
+
};
|
30
|
+
exports.default = job;
|
31
|
+
//# sourceMappingURL=rewardStatsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rewardStatsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/rewardStatsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+DAAuD;AACvD,2CAKqB;AAKrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAAG,MAAM,eAAK,CAAC,GAAG,CACpC,uCAA2B,CAC5B,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,0BAAc,EAAE,cAAc,CAAC,IAAI,EAAE;QACvD,MAAM,EAAE,6BAAiB;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,eAAe;IAChC,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -14,77 +14,119 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const web3_js_1 = require("@solana/web3.js");
|
19
18
|
const bn_js_1 = require("bn.js");
|
19
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
20
20
|
const constants_1 = require("./constants");
|
21
|
-
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
21
|
const solana_1 = require("../../utils/solana");
|
23
22
|
const clients_1 = require("../../utils/clients");
|
24
23
|
const structs_1 = require("./structs");
|
25
|
-
const
|
26
|
-
|
24
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
25
|
+
const getClaimData = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
27
26
|
const obligationAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), '4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtf', constants_1.pid);
|
28
|
-
const
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
const
|
33
|
-
const slndRewards = rewards.filter((reward) => reward.incentivizer === 'slnd_points' &&
|
34
|
-
reward.quantity &&
|
35
|
-
reward.quantity !== '0');
|
36
|
-
const claimAndBumps = slndRewards.map((d) => web3_js_1.PublicKey.findProgramAddressSync([
|
27
|
+
const rewardProofsRes = yield axios_1.default.get(constants_1.rewardProofsEndpoint + obligationAddress.toString());
|
28
|
+
return rewardProofsRes.data.map((d) => (Object.assign(Object.assign({}, d), { distributorPublicKey: new web3_js_1.PublicKey(d.distributorPublicKey) })));
|
29
|
+
});
|
30
|
+
const getRewardData = (client, claimData) => __awaiter(void 0, void 0, void 0, function* () {
|
31
|
+
const claimAndBumps = claimData.map((d) => web3_js_1.PublicKey.findProgramAddressSync([
|
37
32
|
Buffer.from('ClaimStatus', 'utf8'),
|
38
|
-
new bn_js_1.BN.BN(d.index).toArrayLike(Buffer, 'le', 8),
|
39
|
-
|
40
|
-
], new web3_js_1.PublicKey(constants_1.merkleProgramId))
|
41
|
-
const
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
33
|
+
new bn_js_1.BN.BN.BN(d.index).toArrayLike(Buffer, 'le', 8),
|
34
|
+
d.distributorPublicKey.toBytes(),
|
35
|
+
], new web3_js_1.PublicKey(constants_1.merkleProgramId)));
|
36
|
+
const [merkleDistributors, claimStatuses] = yield Promise.all([
|
37
|
+
(0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.merkleDistributorStruct, claimData.map((d) => d.distributorPublicKey)),
|
38
|
+
(0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.claimStatusStruct, claimAndBumps.map((candb) => candb[0])),
|
39
|
+
]);
|
40
|
+
const fullData = (yield Promise.all(claimData.map((d, index) => __awaiter(void 0, void 0, void 0, function* () {
|
41
|
+
const merkleDistributor = merkleDistributors[index];
|
42
|
+
const claimAndBump = claimAndBumps[index];
|
43
|
+
const claimStatus = claimStatuses[index];
|
44
|
+
if (!merkleDistributor || !claimAndBump)
|
45
|
+
return null;
|
46
|
+
const [distributorATAPublicKey] = web3_js_1.PublicKey.findProgramAddressSync([
|
47
|
+
d.distributorPublicKey.toBuffer(),
|
48
|
+
new web3_js_1.PublicKey(solana_1.solanaTokenPid).toBuffer(),
|
49
|
+
merkleDistributor.mint.toBuffer(),
|
50
|
+
], solana_1.associatedTokenProgramId);
|
51
|
+
const accountFunded = (yield client.getTokenAccountBalance(distributorATAPublicKey)).value
|
52
|
+
.amount !== '0';
|
53
|
+
return Object.assign(Object.assign({}, d), { accountFunded, claimId: claimAndBump[0], claimStatusBump: claimAndBump[1], claimed: Boolean(claimStatus === null || claimStatus === void 0 ? void 0 : claimStatus.isClaimed), claimedAt: claimStatus ? Number(claimStatus.claimedAt) : 0, distributor: merkleDistributor, distributorATAPublicKey });
|
54
|
+
})))).filter((d) => d !== null);
|
55
|
+
const slndRewards = fullData.filter((d) => ['slnd_options', 'slnd'].includes(d.incentivizer));
|
56
|
+
return {
|
57
|
+
pythPointsRewards: fullData.filter((c) => c.incentivizer === 'pyth_points'),
|
58
|
+
slndPointsRewards: fullData.filter((c) => c.incentivizer === 'slnd_points'),
|
59
|
+
slnd: slndRewards,
|
60
|
+
external: fullData
|
61
|
+
.filter((d) => !['slnd_options', 'slnd', 'pyth_points', 'slnd_points'].includes(d.incentivizer))
|
62
|
+
.reduce((acc, currentValue) => {
|
63
|
+
if (!acc[currentValue.distributor.mint.toString()]) {
|
64
|
+
acc[currentValue.distributor.mint.toString()] = [];
|
65
|
+
}
|
66
|
+
acc[currentValue.distributor.mint.toString()].push(currentValue);
|
67
|
+
return acc;
|
68
|
+
}, {}),
|
69
|
+
};
|
70
|
+
});
|
71
|
+
const getRewards = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
72
|
+
const claimData = yield getClaimData(owner);
|
73
|
+
if (claimData.length === 0)
|
50
74
|
return [];
|
51
|
-
const
|
52
|
-
|
53
|
-
(
|
75
|
+
const client = (0, clients_1.getClientSolana)();
|
76
|
+
const [rewardData, rewardStats] = yield Promise.all([
|
77
|
+
getRewardData(client, claimData),
|
78
|
+
cache.getItem(constants_1.rewardStatsKey, {
|
79
|
+
prefix: constants_1.rewardStatsPrefix,
|
80
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
81
|
+
}),
|
54
82
|
]);
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
83
|
+
if (!rewardStats || rewardStats.length === 0)
|
84
|
+
return [];
|
85
|
+
const rewardsSummary = [
|
86
|
+
...new Set(rewardStats.map((rew) => rew.rewardMint)),
|
87
|
+
].map((rewardMint) => {
|
88
|
+
var _a, _b;
|
89
|
+
const claims = (_b = (_a = rewardData === null || rewardData === void 0 ? void 0 : rewardData.external) === null || _a === void 0 ? void 0 : _a[rewardMint]) !== null && _b !== void 0 ? _b : [];
|
90
|
+
const unclaimed = claims.filter((cd) => !cd.claimed && cd.accountFunded);
|
91
|
+
const totalUnclaimed = unclaimed.reduce((sum, lot) => new bignumber_js_1.default(lot.quantity).plus(sum), new bignumber_js_1.default(0));
|
92
|
+
return {
|
93
|
+
rewardMint,
|
94
|
+
totalUnclaimed,
|
95
|
+
};
|
66
96
|
});
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
97
|
+
const unclaimedSlnd = rewardData === null || rewardData === void 0 ? void 0 : rewardData.slnd.filter((cd) => cd.incentivizer === 'slnd' && !cd.claimed).reduce((sum, lot) => new bignumber_js_1.default(lot.quantity).dividedBy(Math.pow(10, 6)).plus(sum), new bignumber_js_1.default(0));
|
98
|
+
rewardsSummary.push({
|
99
|
+
rewardMint: constants_1.slndMint,
|
100
|
+
totalUnclaimed: unclaimedSlnd,
|
101
|
+
});
|
102
|
+
return rewardsSummary.filter((r) => r.totalUnclaimed.isGreaterThan(0));
|
103
|
+
});
|
104
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
105
|
+
const rewards = yield getRewards(owner, cache);
|
106
|
+
if (rewards.length === 0)
|
107
|
+
return [];
|
108
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(rewards.map((r) => r.rewardMint), portfolio_core_1.NetworkId.solana);
|
109
|
+
const assets = [];
|
110
|
+
rewards.forEach((reward) => {
|
111
|
+
const tokenPrice = tokenPrices.get(reward.rewardMint);
|
71
112
|
if (!tokenPrice)
|
72
113
|
return;
|
73
|
-
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address,
|
114
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, reward.totalUnclaimed.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice)), { attributes: { isClaimable: true } }));
|
74
115
|
});
|
75
116
|
if (assets.length === 0)
|
76
117
|
return [];
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
118
|
+
return [
|
119
|
+
{
|
120
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
121
|
+
label: 'Rewards',
|
122
|
+
platformId: constants_1.platformId,
|
123
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
124
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
|
125
|
+
data: {
|
126
|
+
assets,
|
127
|
+
},
|
85
128
|
},
|
86
|
-
|
87
|
-
return [element];
|
129
|
+
];
|
88
130
|
});
|
89
131
|
const fetcher = {
|
90
132
|
id: `${constants_1.platformId}-rewards`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rewardsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/rewardsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"rewardsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/rewardsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA0B;AAC1B,6CAAwD;AACxD,iCAA2B;AAC3B,gEAAqC;AAGrC,2CAQqB;AAErB,+CAI4B;AAC5B,iDAAsD;AACtD,uCAKmB;AACnB,qGAA6E;AAE7E,MAAM,YAAY,GAAG,CAAO,KAAa,EAAE,EAAE;IAC3C,MAAM,iBAAiB,GAAG,MAAM,mBAAS,CAAC,cAAc,CACtD,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB,kCAAkC,EAClC,eAAG,CACJ,CAAC;IAEF,MAAM,eAAe,GAAG,MAAM,eAAK,CAAC,GAAG,CACrC,gCAAoB,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CACpD,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCAClC,CAAC,KACJ,oBAAoB,EAAE,IAAI,mBAAS,CAAC,CAAC,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UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,EAAE;gBACJ,MAAM;aACP;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -93,3 +93,15 @@ export type ClaimStatus = {
|
|
93
93
|
amount: BigNumber;
|
94
94
|
};
|
95
95
|
export declare const claimStatusStruct: BeetStruct<ClaimStatus, Partial<ClaimStatus>>;
|
96
|
+
export type MerkleDistributor = {
|
97
|
+
buffer: Buffer;
|
98
|
+
base: PublicKey;
|
99
|
+
bump: number;
|
100
|
+
root: number[];
|
101
|
+
mint: PublicKey;
|
102
|
+
maxTotalClaim: BigNumber;
|
103
|
+
maxNumNodes: BigNumber;
|
104
|
+
totalAmountClaimed: BigNumber;
|
105
|
+
numNodesClaimed: BigNumber;
|
106
|
+
};
|
107
|
+
export declare const merkleDistributorStruct: BeetStruct<MerkleDistributor, Partial<MerkleDistributor>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.claimStatusStruct = exports.obligationLiquidityStruct = exports.obligationCollateralStruct = exports.obligationStruct = exports.reserveStruct = exports.lastUpdateStruct = exports.liquidityStruct = exports.collateralStruct = exports.reserveConfigStruct = exports.feesStruct = void 0;
|
3
|
+
exports.merkleDistributorStruct = exports.claimStatusStruct = exports.obligationLiquidityStruct = exports.obligationCollateralStruct = exports.obligationStruct = exports.reserveStruct = exports.lastUpdateStruct = exports.liquidityStruct = exports.collateralStruct = exports.reserveConfigStruct = exports.feesStruct = void 0;
|
4
4
|
const beet_1 = require("@metaplex-foundation/beet");
|
5
5
|
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
6
|
const solana_1 = require("../../utils/solana");
|
@@ -85,4 +85,15 @@ exports.claimStatusStruct = new beet_1.BeetStruct([
|
|
85
85
|
['claimedAt', solana_1.i64],
|
86
86
|
['amount', solana_1.u64],
|
87
87
|
], (args) => args);
|
88
|
+
exports.merkleDistributorStruct = new beet_1.BeetStruct([
|
89
|
+
['buffer', (0, solana_1.blob)(8)],
|
90
|
+
['base', beet_solana_1.publicKey],
|
91
|
+
['bump', beet_1.u8],
|
92
|
+
['root', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 32)],
|
93
|
+
['mint', beet_solana_1.publicKey],
|
94
|
+
['maxTotalClaim', solana_1.u64],
|
95
|
+
['maxNumNodes', solana_1.u64],
|
96
|
+
['totalAmountClaimed', solana_1.u64],
|
97
|
+
['numNodesClaimed', solana_1.u64],
|
98
|
+
], (args) => args);
|
88
99
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/structs.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/structs.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAG7D,+CAA0D;AAQ7C,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,mBAAmB,EAAE,SAAE,CAAC;CAC1B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAgBW,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,wBAAwB,EAAE,SAAE,CA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
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
1
2
|
export interface ApiResponse<T> {
|
2
3
|
results: T[];
|
3
4
|
next: null;
|
@@ -113,6 +114,24 @@ export type ExternalReward = {
|
|
113
114
|
lastSlot: number;
|
114
115
|
lastTx: 'string';
|
115
116
|
};
|
117
|
+
export type RewardStat = {
|
118
|
+
incentivizer: string;
|
119
|
+
lastSlot: number;
|
120
|
+
market: string;
|
121
|
+
mint: string;
|
122
|
+
reserveID: string;
|
123
|
+
rewardMint: string;
|
124
|
+
rewardSymbol: string;
|
125
|
+
rewardsPerShare: string;
|
126
|
+
side: string;
|
127
|
+
tokenMint: string;
|
128
|
+
totalBalance: string;
|
129
|
+
rewardRates: {
|
130
|
+
name: string;
|
131
|
+
beginningSlot: number;
|
132
|
+
rewardRate: number;
|
133
|
+
}[];
|
134
|
+
};
|
116
135
|
export type Obligation = {
|
117
136
|
obligationID: string;
|
118
137
|
lotNumber: number;
|
@@ -121,4 +140,31 @@ export type Obligation = {
|
|
121
140
|
distributorPublicKey: string;
|
122
141
|
name: string;
|
123
142
|
incentivizer: string;
|
143
|
+
distributor: {
|
144
|
+
mint: string;
|
145
|
+
};
|
146
|
+
};
|
147
|
+
export type ClaimData = {
|
148
|
+
name: string;
|
149
|
+
obligationID: string;
|
150
|
+
lotNumber: number;
|
151
|
+
index: number;
|
152
|
+
quantity: string;
|
153
|
+
root: string;
|
154
|
+
proof: Array<string>;
|
155
|
+
distributorPublicKey: PublicKey;
|
156
|
+
optionMarketKey: PublicKey | null;
|
157
|
+
incentivizer: string;
|
158
|
+
};
|
159
|
+
export type FullClaimDataType = ClaimData & {
|
160
|
+
claimed: boolean;
|
161
|
+
claimedAt: number;
|
162
|
+
claimStatusBump: number;
|
163
|
+
accountFunded: boolean;
|
164
|
+
distributor: {
|
165
|
+
mint: PublicKey;
|
166
|
+
bump: number;
|
167
|
+
};
|
168
|
+
claimId: PublicKey;
|
169
|
+
distributorATAPublicKey: PublicKey;
|
124
170
|
};
|