@sonarwatch/portfolio-plugins 0.12.186 → 0.12.188
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +13 -5
- package/package.json +1 -1
- package/src/plugins/aave/constants.js +1 -1
- package/src/plugins/abex/constants.d.ts +8 -1
- package/src/plugins/abex/constants.js +9 -2
- package/src/plugins/abex/constants.js.map +1 -1
- package/src/plugins/abex/getVaultInfo.d.ts +3 -0
- package/src/plugins/abex/getVaultInfo.js +65 -0
- package/src/plugins/abex/getVaultInfo.js.map +1 -0
- package/src/plugins/abex/helpers.d.ts +25 -0
- package/src/plugins/abex/helpers.js +353 -0
- package/src/plugins/abex/helpers.js.map +1 -0
- package/src/plugins/abex/index.js +7 -1
- package/src/plugins/abex/index.js.map +1 -1
- package/src/plugins/abex/marketsJob.js +13 -7
- package/src/plugins/abex/marketsJob.js.map +1 -1
- package/src/plugins/abex/ordersFetcher.d.ts +3 -0
- package/src/plugins/abex/ordersFetcher.js +49 -0
- package/src/plugins/abex/ordersFetcher.js.map +1 -0
- package/src/plugins/abex/parseValue.d.ts +1 -0
- package/src/plugins/abex/parseValue.js +30 -0
- package/src/plugins/abex/parseValue.js.map +1 -0
- package/src/plugins/abex/positionsFetcher.js +39 -57
- package/src/plugins/abex/positionsFetcher.js.map +1 -1
- package/src/plugins/abex/stakingFetcher.d.ts +3 -0
- package/src/plugins/abex/stakingFetcher.js +87 -0
- package/src/plugins/abex/stakingFetcher.js.map +1 -0
- package/src/plugins/abex/types.d.ts +172 -10
- package/src/plugins/balancer/index.js +4 -2
- package/src/plugins/balancer/index.js.map +1 -1
- package/src/plugins/bluemove/poolsJob.js +13 -11
- package/src/plugins/bluemove/poolsJob.js.map +1 -1
- package/src/plugins/liquiditypools-sei/index.js +4 -2
- package/src/plugins/liquiditypools-sei/index.js.map +1 -1
- package/src/plugins/pancakeswap/index.js +2 -2
- package/src/plugins/pancakeswap/index.js.map +1 -1
- package/src/plugins/sushiswap/index.js +5 -5
- package/src/plugins/sushiswap/index.js.map +1 -1
- package/src/plugins/whalesmarket/constants.d.ts +1 -1
- package/src/plugins/whalesmarket/constants.js +1 -1
- package/src/plugins/whalesmarket/constants.js.map +1 -1
- package/src/plugins/whalesmarket/tokensJob.js +2 -0
- package/src/plugins/whalesmarket/tokensJob.js.map +1 -1
- package/src/utils/elementbuilder/ElementLeverageBuilder.d.ts +13 -0
- package/src/utils/elementbuilder/ElementLeverageBuilder.js +40 -0
- package/src/utils/elementbuilder/ElementLeverageBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementRegistry.d.ts +2 -0
- package/src/utils/elementbuilder/ElementRegistry.js +6 -0
- package/src/utils/elementbuilder/ElementRegistry.js.map +1 -1
- package/src/utils/elementbuilder/LevPositionBuilder.d.ts +9 -0
- package/src/utils/elementbuilder/LevPositionBuilder.js +49 -0
- package/src/utils/elementbuilder/LevPositionBuilder.js.map +1 -0
- package/src/utils/elementbuilder/LevPositionParams.d.ts +14 -0
- package/src/utils/elementbuilder/LevPositionParams.js +3 -0
- package/src/utils/elementbuilder/LevPositionParams.js.map +1 -0
- package/src/utils/misc/Memoized.d.ts +8 -0
- package/src/utils/misc/Memoized.js +31 -0
- package/src/utils/misc/Memoized.js.map +1 -0
@@ -9,22 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
12
13
|
const constants_1 = require("./constants");
|
13
14
|
const clients_1 = require("../../utils/clients");
|
14
15
|
const getDynamicFieldObjects_1 = require("../../utils/sui/getDynamicFieldObjects");
|
15
|
-
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
16
|
const getLpTokenSourceRaw_1 = require("../../utils/misc/getLpTokenSourceRaw");
|
17
17
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
18
|
const client = (0, clients_1.getClientSui)();
|
19
19
|
const pools = yield (0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, constants_1.dexInfoId);
|
20
20
|
const mints = new Set();
|
21
21
|
pools.forEach((pool) => {
|
22
|
-
var _a, _b, _c
|
23
|
-
if (
|
24
|
-
!
|
25
|
-
|
22
|
+
var _a, _b, _c;
|
23
|
+
if (!pool.data ||
|
24
|
+
!pool.data.type ||
|
25
|
+
((_a = pool.data.content) === null || _a === void 0 ? void 0 : _a.fields.is_freeze) ||
|
26
|
+
!((_c = (_b = pool.data.content) === null || _b === void 0 ? void 0 : _b.fields.lsp_supply) === null || _c === void 0 ? void 0 : _c.type))
|
26
27
|
return;
|
27
|
-
|
28
|
+
const { keys: coinTypeKeys } = (0, portfolio_core_1.parseTypeString)(pool.data.type);
|
28
29
|
if (!coinTypeKeys)
|
29
30
|
return;
|
30
31
|
const coinTypeX = coinTypeKeys[0].type;
|
@@ -37,12 +38,13 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
38
|
const tokenPrices = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.sui);
|
38
39
|
const lpSources = [];
|
39
40
|
pools.forEach((pool) => {
|
40
|
-
var _a, _b, _c
|
41
|
-
if (
|
42
|
-
!
|
43
|
-
|
41
|
+
var _a, _b, _c;
|
42
|
+
if (!pool.data ||
|
43
|
+
!pool.data.type ||
|
44
|
+
((_a = pool.data.content) === null || _a === void 0 ? void 0 : _a.fields.is_freeze) ||
|
45
|
+
!((_c = (_b = pool.data.content) === null || _b === void 0 ? void 0 : _b.fields.lsp_supply) === null || _c === void 0 ? void 0 : _c.type))
|
44
46
|
return;
|
45
|
-
|
47
|
+
const { keys: coinTypeKeys } = (0, portfolio_core_1.parseTypeString)(pool.data.type);
|
46
48
|
if (!coinTypeKeys)
|
47
49
|
return;
|
48
50
|
const coinTypeX = coinTypeKeys[0].type;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAKoC;AAGpC,2CAAgE;AAChE,iDAAmD;AACnD,mFAAgF;AAEhF,8EAA2E;AAE3E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,KAAK,GAAG,MAAM,IAAA,+CAAsB,EAAO,MAAM,EAAE,qBAAS,CAAC,CAAC;IAEpE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;;QACrB,IACE,CAAC,IAAI,CAAC,IAAI;YACV,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;aACf,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,SAAS,CAAA;YACnC,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,UAAU,0CAAE,IAAI,CAAA;YAE3C,OAAO;QAET,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAA,gCAAe,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,IAAI,CAAC,YAAY;YAAE,OAAO;QAC1B,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACvC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEvC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS;YAAE,OAAO;QAErC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC,CAA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@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
-
|
7
|
+
// import job from './job';
|
8
8
|
const fetcher_1 = __importDefault(require("./fetcher"));
|
9
9
|
const constants_1 = require("./constants");
|
10
10
|
exports.platforms = [constants_1.seaswapPlatform, constants_1.astroportPlatform];
|
11
|
-
exports.jobs = [
|
11
|
+
exports.jobs = [
|
12
|
+
/* job */
|
13
|
+
];
|
12
14
|
exports.fetchers = [fetcher_1.default];
|
13
15
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/liquiditypools-sei/index.ts"],"names":[],"mappings":";;;;;;AAGA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/liquiditypools-sei/index.ts"],"names":[],"mappings":";;;;;;AAGA,2BAA2B;AAC3B,wDAAgC;AAChC,2CAAiE;AAEpD,QAAA,SAAS,GAAe,CAAC,2BAAe,EAAE,6BAAiB,CAAC,CAAC;AAC7D,QAAA,IAAI,GAAU;AACzB,SAAS;CACV,CAAC;AACW,QAAA,QAAQ,GAAc,CAAC,iBAAO,CAAC,CAAC"}
|
@@ -7,7 +7,7 @@ exports.fetchers = exports.jobs = exports.platforms = void 0;
|
|
7
7
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
8
8
|
const aptosLpJob_1 = __importDefault(require("./aptosLpJob"));
|
9
9
|
const constants_1 = require("./constants");
|
10
|
-
|
10
|
+
// import getPoolsJob from '../uniswap-v2/getPoolsJob';
|
11
11
|
const getPositionsV2Fetcher_1 = __importDefault(require("../uniswap-v2/getPositionsV2Fetcher"));
|
12
12
|
const getStakersBalancesFetcher_1 = __importDefault(require("./getStakersBalancesFetcher"));
|
13
13
|
const stakerCakeFetcher_1 = __importDefault(require("./stakerCakeFetcher"));
|
@@ -18,7 +18,7 @@ exports.jobs = [
|
|
18
18
|
// Aptos
|
19
19
|
aptosLpJob_1.default,
|
20
20
|
// Ethereum
|
21
|
-
|
21
|
+
// getPoolsJob(NetworkId.ethereum, platformId, 'V2', theGraphUrlEthV2),
|
22
22
|
// BNB
|
23
23
|
// getPoolsJob(NetworkId.bnb, platformId, 'V1', factoryV2Bnb),
|
24
24
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/pancakeswap/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AAGjE,8DAAoC;AACpC,2CAUqB;AACrB,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/pancakeswap/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AAGjE,8DAAoC;AACpC,2CAUqB;AACrB,uDAAuD;AACvD,gGAAwE;AACxE,4FAAoE;AACpE,4EAAoD;AACpD,kFAA+E;AAC/E,4EAAoD;AAEvC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU;IACzB,QAAQ;IACR,oBAAQ;IACR,WAAW;IACX,uEAAuE;IACvE,MAAM;IACN,8DAA8D;CAC/D,CAAC;AACW,QAAA,QAAQ,GAAc;IACjC,gBAAgB;IAChB,GAAG,2BAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAChC,IAAA,mDAAwB,EAAC,MAAM,EAAE,sBAAU,EAAE,IAAI,CAAC,CACnD;IACD,cAAc;IACd,IAAA,+BAAqB,EAAC,0BAAS,CAAC,QAAQ,EAAE,sBAAU,EAAE,IAAI,CAAC;IAC3D,IAAA,2BAAiB,EAAC,0BAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,gCAAoB,CAAC;IACjE,IAAA,mCAAyB,EAAC,0BAAS,CAAC,QAAQ,EAAE,sBAAU,EAAE,2BAAe,CAAC;IAE1E,SAAS;IACT,IAAA,+BAAqB,EAAC,0BAAS,CAAC,GAAG,EAAE,sBAAU,EAAE,IAAI,CAAC;IACtD,IAAI;IACJ,kDAAkD;IAClD,wEAAwE;IACxE,8BAA8B;IAC9B,KAAK;IACL,IAAA,2BAAiB,EAAC,0BAAS,CAAC,GAAG,EAAE,IAAI,EAAE,2BAAe,CAAC;IACvD,IAAA,mCAAyB,EAAC,0BAAS,CAAC,GAAG,EAAE,sBAAU,EAAE,sBAAU,CAAC;IAChE,2BAAiB;CAClB,CAAC"}
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
8
8
|
const constants_1 = require("./constants");
|
9
|
-
|
9
|
+
// import getPoolsJob from '../uniswap-v2/getPoolsJob';
|
10
10
|
const getPositionsV2Fetcher_1 = __importDefault(require("../uniswap-v2/getPositionsV2Fetcher"));
|
11
11
|
const poolsJob_1 = __importDefault(require("./aptos/poolsJob"));
|
12
12
|
exports.platforms = [constants_1.platform];
|
13
13
|
exports.jobs = [
|
14
14
|
poolsJob_1.default,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
// getPoolsJob(NetworkId.ethereum, platform.id, 'v2', ethereumTheGraphV2),
|
16
|
+
// getPoolsJob(NetworkId.polygon, platform.id, 'v2', polygonTheGraphV2),
|
17
|
+
// getPoolsJob(NetworkId.avalanche, platform.id, 'v2', avalancheTheGraphV2),
|
18
|
+
// getPoolsJob(NetworkId.bnb, platform.id, 'v2', bnbTheGraphV2),
|
19
19
|
];
|
20
20
|
exports.fetchers = [
|
21
21
|
(0, getPositionsV2Fetcher_1.default)(portfolio_core_1.NetworkId.ethereum, constants_1.platform.id, 'v2'),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sushiswap/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AAGjE,2CAMqB;AACrB,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sushiswap/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AAGjE,2CAMqB;AACrB,uDAAuD;AACvD,gGAAwE;AACxE,gEAA6C;AAEhC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU;IACzB,kBAAa;IACb,0EAA0E;IAC1E,wEAAwE;IACxE,4EAA4E;IAC5E,gEAAgE;CACjE,CAAC;AACW,QAAA,QAAQ,GAAc;IACjC,IAAA,+BAAqB,EAAC,0BAAS,CAAC,QAAQ,EAAE,oBAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAC5D,IAAA,+BAAqB,EAAC,0BAAS,CAAC,OAAO,EAAE,oBAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAC3D,IAAA,+BAAqB,EAAC,0BAAS,CAAC,SAAS,EAAE,oBAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAC7D,2DAA2D;IAC3D,4BAA4B;IAC5B,MAAM;IACN,qCAAqC;IACrC,6DAA6D;IAC7D,qEAAqE;IACrE,OAAO;IACP,iBAAiB;IACjB,SAAS;IACT,KAAK;CACN,CAAC"}
|
@@ -3,6 +3,6 @@ import { Platform } from '@sonarwatch/portfolio-core';
|
|
3
3
|
export declare const platformId = "whalesmarket";
|
4
4
|
export declare const platform: Platform;
|
5
5
|
export declare const pid: PublicKey;
|
6
|
-
export declare const whalesApi = "https://api
|
6
|
+
export declare const whalesApi = "https://api.whales.market/v2/tokens";
|
7
7
|
export declare const tokensKey = "tokens";
|
8
8
|
export declare const lastCountKey = "lastCount";
|
@@ -12,7 +12,7 @@ exports.platform = {
|
|
12
12
|
twitter: 'https://twitter.com/WhalesMarket',
|
13
13
|
};
|
14
14
|
exports.pid = new web3_js_1.PublicKey('stPdYNaJNsV3ytS9Xtx4GXXXRcVqVS6x66ZFa26K39S');
|
15
|
-
exports.whalesApi = 'https://api
|
15
|
+
exports.whalesApi = 'https://api.whales.market/v2/tokens';
|
16
16
|
exports.tokensKey = 'tokens';
|
17
17
|
exports.lastCountKey = 'lastCount';
|
18
18
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/whalesmarket/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,cAAc,CAAC;AAC5B,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,qDAAqD;IAC5D,WAAW,EAAE,eAAe,EAAE,sCAAsC;IACpE,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,kCAAkC;CAC5C,CAAC;AAEW,QAAA,GAAG,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AACnE,QAAA,SAAS,GAAG,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/whalesmarket/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,cAAc,CAAC;AAC5B,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,qDAAqD;IAC5D,WAAW,EAAE,eAAe,EAAE,sCAAsC;IACpE,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,kCAAkC;CAC5C,CAAC;AAEW,QAAA,GAAG,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AACnE,QAAA,SAAS,GAAG,qCAAqC,CAAC;AAElD,QAAA,SAAS,GAAG,QAAQ,CAAC;AACrB,QAAA,YAAY,GAAG,WAAW,CAAC"}
|
@@ -30,6 +30,8 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
params: { take: lastCount || minToTake, chain_id: 666666 },
|
31
31
|
})
|
32
32
|
.catch(() => null);
|
33
|
+
if (!apiRes)
|
34
|
+
console.log('WhalesMarket Job : unable to reach the API :', constants_1.whalesApi);
|
33
35
|
if (apiRes === null || apiRes === void 0 ? void 0 : apiRes.data.data) {
|
34
36
|
const tokens = apiRes.data.data.list;
|
35
37
|
yield cache.setItem(constants_1.tokensKey, tokens, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/whalesmarket/tokensJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+DAAuD;AAGvD,2CAA6E;AAE7E,mDAA2D;AAE3D,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,EAAE,IAAI,EAAE,8CAA8C,EAAE,QAAQ,EAAE,CAAC,EAAE;CAC7E,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,OAAO,CAAS,wBAAY,EAAE;QAC1D,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAyC,MAAM,eAAK;SAC7D,GAAG,CAAC,qBAAS,EAAE;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,IAAI,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE;KAC3D,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"tokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/whalesmarket/tokensJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;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AK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;YACtD,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,KAAK,CAAC,mBAAmB,CAAC;oBAC9B,OAAO,EAAE,KAAK,CAAC,IAAI;oBACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,MAAM,EAAE,KAAK;oBACb,EAAE,EAAE,sBAAU;oBACd,SAAS,EAAE,0BAAS,CAAC,MAAM;oBAC3B,UAAU,EAAE,gCAAoB,CAAC,EAAE;oBACnC,KAAK,EAAE,KAAK,CAAC,UAAU;oBACvB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { NetworkIdType, PortfolioElementLeverage } from '@sonarwatch/portfolio-core';
|
2
|
+
import { ElementBuilder } from './ElementBuilder';
|
3
|
+
import { ElementParams } from './ElementParams';
|
4
|
+
import { TokenPriceMap } from '../../TokenPriceMap';
|
5
|
+
import { LevPositionBuilder } from './LevPositionBuilder';
|
6
|
+
import { LevPositionParams } from './LevPositionParams';
|
7
|
+
export declare class ElementLeverageBuilder extends ElementBuilder {
|
8
|
+
positions: LevPositionBuilder[];
|
9
|
+
constructor(params: ElementParams);
|
10
|
+
addPosition(params: LevPositionParams): LevPositionBuilder;
|
11
|
+
mints(): string[];
|
12
|
+
get(networkId: NetworkIdType, platformId: string, tokenPrices: TokenPriceMap): PortfolioElementLeverage | null;
|
13
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ElementLeverageBuilder = void 0;
|
4
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
|
+
const ElementBuilder_1 = require("./ElementBuilder");
|
6
|
+
const LevPositionBuilder_1 = require("./LevPositionBuilder");
|
7
|
+
class ElementLeverageBuilder extends ElementBuilder_1.ElementBuilder {
|
8
|
+
constructor(params) {
|
9
|
+
super(params);
|
10
|
+
this.positions = [];
|
11
|
+
}
|
12
|
+
addPosition(params) {
|
13
|
+
const levPositionBuilder = new LevPositionBuilder_1.LevPositionBuilder(params);
|
14
|
+
this.positions.push(levPositionBuilder);
|
15
|
+
return levPositionBuilder;
|
16
|
+
}
|
17
|
+
mints() {
|
18
|
+
return this.positions.map((position) => position.mints()).flat();
|
19
|
+
}
|
20
|
+
get(networkId, platformId, tokenPrices) {
|
21
|
+
const positions = this.positions
|
22
|
+
.map((p) => p.get(networkId, tokenPrices))
|
23
|
+
.filter((p) => p !== null);
|
24
|
+
const value = (0, portfolio_core_1.getUsdValueSum)(positions.map((a) => a.value));
|
25
|
+
const element = {
|
26
|
+
type: this.type,
|
27
|
+
label: this.label,
|
28
|
+
data: {
|
29
|
+
positions,
|
30
|
+
value,
|
31
|
+
},
|
32
|
+
networkId,
|
33
|
+
platformId,
|
34
|
+
value,
|
35
|
+
};
|
36
|
+
return element;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
exports.ElementLeverageBuilder = ElementLeverageBuilder;
|
40
|
+
//# sourceMappingURL=ElementLeverageBuilder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ElementLeverageBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementLeverageBuilder.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AACpC,qDAAkD;AAGlD,6DAA0D;AAG1D,MAAa,s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
|
import { ElementLiquidityBuilder } from './ElementLiquidityBuilder';
|
7
7
|
import { ElementBorrowlendBuilder } from './ElementBorrowlendBuilder';
|
8
|
+
import { ElementLeverageBuilder } from './ElementLeverageBuilder';
|
8
9
|
export declare class ElementRegistry {
|
9
10
|
readonly networkId: NetworkIdType;
|
10
11
|
readonly platformId: string;
|
@@ -13,5 +14,6 @@ export declare class ElementRegistry {
|
|
13
14
|
addElementMultiple(params: Omit<ElementParams, 'type'>): ElementMultipleBuilder;
|
14
15
|
addElementLiquidity(params: Omit<ElementParams, 'type'>): ElementLiquidityBuilder;
|
15
16
|
addElementBorrowlend(params: Omit<ElementParams, 'type'>): ElementBorrowlendBuilder;
|
17
|
+
addElementLeverage(params: Omit<ElementParams, 'type'>): ElementLeverageBuilder;
|
16
18
|
getElements(cache: Cache): Promise<PortfolioElement[]>;
|
17
19
|
}
|
@@ -14,6 +14,7 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
14
14
|
const ElementMultipleBuilder_1 = require("./ElementMultipleBuilder");
|
15
15
|
const ElementLiquidityBuilder_1 = require("./ElementLiquidityBuilder");
|
16
16
|
const ElementBorrowlendBuilder_1 = require("./ElementBorrowlendBuilder");
|
17
|
+
const ElementLeverageBuilder_1 = require("./ElementLeverageBuilder");
|
17
18
|
class ElementRegistry {
|
18
19
|
constructor(networkId, platformId) {
|
19
20
|
this.networkId = networkId;
|
@@ -35,6 +36,11 @@ class ElementRegistry {
|
|
35
36
|
this.elements.push(elementBuilder);
|
36
37
|
return elementBuilder;
|
37
38
|
}
|
39
|
+
addElementLeverage(params) {
|
40
|
+
const elementBuilder = new ElementLeverageBuilder_1.ElementLeverageBuilder(Object.assign({ type: portfolio_core_1.PortfolioElementType.leverage }, params));
|
41
|
+
this.elements.push(elementBuilder);
|
42
|
+
return elementBuilder;
|
43
|
+
}
|
38
44
|
getElements(cache) {
|
39
45
|
return __awaiter(this, void 0, void 0, function* () {
|
40
46
|
const mints = this.elements.map((e) => e.mints()).flat();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ElementRegistry.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementRegistry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAMoC;AAIpC,qEAAkE;AAClE,uEAAoE;AACpE,yEAAsE;
|
1
|
+
{"version":3,"file":"ElementRegistry.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementRegistry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAMoC;AAIpC,qEAAkE;AAClE,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAElE,MAAa,eAAe;IAK1B,YAAY,SAAwB,EAAE,UAAkB;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,kBAAkB,CAChB,MAAmC;QAEnC,MAAM,cAAc,GAAG,IAAI,+CAAsB,iBAC/C,IAAI,EAAE,qCAAoB,CAAC,QAAQ,IAChC,MAAM,EACT,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,mBAAmB,CACjB,MAAmC;QAEnC,MAAM,cAAc,GAAG,IAAI,iDAAuB,iBAChD,IAAI,EAAE,qCAAoB,CAAC,SAAS,IACjC,MAAM,EACT,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,oBAAoB,CAClB,MAAmC;QAEnC,MAAM,cAAc,GAAG,IAAI,mDAAwB,iBACjD,IAAI,EAAE,qCAAoB,CAAC,UAAU,IAClC,MAAM,EACT,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,kBAAkB,CAChB,MAAmC;QAEnC,MAAM,cAAc,GAAG,IAAI,+CAAsB,iBAC/C,IAAI,EAAE,qCAAoB,CAAC,QAAQ,IAChC,MAAM,EACT,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAEK,WAAW,CAAC,KAAY;;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YACzD,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAE3E,OAAO,IAAI,CAAC,QAAQ;iBACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;iBAC/D,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CACtB,CAAC;QAC5B,CAAC;KAAA;CACF;AAhED,0CAgEC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { LevPosition, NetworkIdType } from '@sonarwatch/portfolio-core';
|
2
|
+
import { TokenPriceMap } from '../../TokenPriceMap';
|
3
|
+
import { LevPositionParams } from './LevPositionParams';
|
4
|
+
export declare class LevPositionBuilder {
|
5
|
+
private params;
|
6
|
+
constructor(params: LevPositionParams);
|
7
|
+
mints(): string[];
|
8
|
+
get(networkId: NetworkIdType, tokenPrices: TokenPriceMap): LevPosition | null;
|
9
|
+
}
|
@@ -0,0 +1,49 @@
|
|
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.LevPositionBuilder = void 0;
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
|
+
class LevPositionBuilder {
|
9
|
+
constructor(params) {
|
10
|
+
this.params = params;
|
11
|
+
}
|
12
|
+
mints() {
|
13
|
+
if (this.params.collateralAmount)
|
14
|
+
return [this.params.address];
|
15
|
+
return [];
|
16
|
+
}
|
17
|
+
get(networkId, tokenPrices) {
|
18
|
+
var _a;
|
19
|
+
let collateralValue;
|
20
|
+
if (this.params.collateralAmount) {
|
21
|
+
const collateralTokenPrice = tokenPrices.get(this.params.address);
|
22
|
+
if (!collateralTokenPrice)
|
23
|
+
return null;
|
24
|
+
collateralValue = this.params.collateralAmount
|
25
|
+
.dividedBy(Math.pow(10, collateralTokenPrice.decimals))
|
26
|
+
.multipliedBy(collateralTokenPrice.price);
|
27
|
+
}
|
28
|
+
else if (!this.params.collateralValue) {
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
collateralValue = new bignumber_js_1.default(this.params.collateralValue);
|
33
|
+
}
|
34
|
+
return {
|
35
|
+
address: this.params.address,
|
36
|
+
side: this.params.side,
|
37
|
+
liquidationPrice: this.params.liquidationPrice || null,
|
38
|
+
collateralValue: collateralValue.toNumber(),
|
39
|
+
sizeValue: this.params.sizeValue.toNumber(),
|
40
|
+
pnlValue: (_a = this.params.pnlValue) === null || _a === void 0 ? void 0 : _a.toNumber(),
|
41
|
+
value: collateralValue.plus(this.params.pnlValue || 0).toNumber(),
|
42
|
+
name: this.params.name,
|
43
|
+
imageUri: this.params.imageUri,
|
44
|
+
leverage: this.params.leverage,
|
45
|
+
};
|
46
|
+
}
|
47
|
+
}
|
48
|
+
exports.LevPositionBuilder = LevPositionBuilder;
|
49
|
+
//# sourceMappingURL=LevPositionBuilder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LevPositionBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/LevPositionBuilder.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AAIrC,MAAa,kBAAkB;IAG7B,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,GAAG,CACD,SAAwB,EACxB,WAA0B;;QAE1B,IAAI,eAAe,CAAC;QACpB,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACjC,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAClE,IAAI,CAAC,oBAAoB;gBAAE,OAAO,IAAI,CAAC;YACvC,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB;iBAC3C,SAAS,CAAC,SAAA,EAAE,EAAI,oBAAoB,CAAC,QAAQ,CAAA,CAAC;iBAC9C,YAAY,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,eAAe,GAAG,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,IAAI;YACtD,eAAe,EAAE,eAAe,CAAC,QAAQ,EAAE;YAC3C,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC3C,QAAQ,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,0CAAE,QAAQ,EAAE;YAC1C,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;YACjE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;SAChB,CAAC;IACnB,CAAC;CACF;AA1CD,gDA0CC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { LeverageSide, UsdValue } from '@sonarwatch/portfolio-core';
|
2
|
+
import BigNumber from 'bignumber.js';
|
3
|
+
export type LevPositionParams = {
|
4
|
+
address: string;
|
5
|
+
collateralAmount?: BigNumber;
|
6
|
+
collateralValue?: UsdValue;
|
7
|
+
side: LeverageSide;
|
8
|
+
sizeValue: BigNumber;
|
9
|
+
liquidationPrice?: BigNumber;
|
10
|
+
pnlValue?: BigNumber;
|
11
|
+
name?: string;
|
12
|
+
imageUri?: string;
|
13
|
+
leverage?: number;
|
14
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LevPositionParams.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/LevPositionParams.ts"],"names":[],"mappings":""}
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.Memoized = void 0;
|
13
|
+
const defaultMemoizedRefreshInterval = 600;
|
14
|
+
// T is the type of item memoized
|
15
|
+
class Memoized {
|
16
|
+
constructor(fetch, ttl = defaultMemoizedRefreshInterval) {
|
17
|
+
this.getItem = () => __awaiter(this, void 0, void 0, function* () {
|
18
|
+
const now = Date.now();
|
19
|
+
if (!this.item || this.lastUpdate + this.ttl < now) {
|
20
|
+
this.item = yield this.fetch();
|
21
|
+
this.lastUpdate = now;
|
22
|
+
}
|
23
|
+
return this.item;
|
24
|
+
});
|
25
|
+
this.fetch = fetch;
|
26
|
+
this.ttl = ttl;
|
27
|
+
this.lastUpdate = 0;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
exports.Memoized = Memoized;
|
31
|
+
//# sourceMappingURL=Memoized.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Memoized.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/Memoized.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C,iCAAiC;AACjC,MAAa,QAAQ;IAOnB,YACE,KAAuB,EACvB,MAAc,8BAA8B;QAO9C,YAAO,GAAG,GAAS,EAAE;YACnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEvB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;gBACnD,IAAI,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC/B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;YACxB,CAAC;YAED,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC,CAAA,CAAC;QAdA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;CAYF;AA1BD,4BA0BC"}
|