@sonarwatch/portfolio-plugins 0.14.1 → 0.14.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1595 -1574
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/debridge/airdropFetcher.js +6 -0
- package/src/plugins/debridge/airdropFetcher.js.map +1 -1
- package/src/plugins/debridge/constants.d.ts +3 -1
- package/src/plugins/debridge/constants.js +4 -2
- package/src/plugins/debridge/constants.js.map +1 -1
- package/src/plugins/debridge/dlmmVaultsFetcher.d.ts +3 -0
- package/src/plugins/debridge/dlmmVaultsFetcher.js +158 -0
- package/src/plugins/debridge/dlmmVaultsFetcher.js.map +1 -0
- package/src/plugins/debridge/dlmmVaultsJob.d.ts +3 -0
- package/src/plugins/debridge/dlmmVaultsJob.js +42 -0
- package/src/plugins/debridge/dlmmVaultsJob.js.map +1 -0
- package/src/plugins/debridge/index.js +7 -2
- package/src/plugins/debridge/index.js.map +1 -1
- package/src/plugins/deepbook/airdropFetcher.js +36 -14
- package/src/plugins/deepbook/airdropFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/custodiesJob.js +2 -2
- package/src/plugins/jupiter/exchange/custodiesJob.js.map +1 -1
- package/src/plugins/jupiter/exchange/filters.d.ts +1 -0
- package/src/plugins/jupiter/exchange/filters.js +10 -1
- package/src/plugins/jupiter/exchange/filters.js.map +1 -1
- package/src/plugins/jupiter/launchpad/constants.js +1 -1
- package/src/plugins/kamino/{s2AirdropFetcher.js → s2AirdropFetcher.old.js} +1 -1
- package/src/plugins/kamino/s2AirdropFetcher.old.js.map +1 -0
- package/src/plugins/native-stake/solana/constants.js +0 -1
- package/src/plugins/native-stake/solana/constants.js.map +1 -1
- package/src/plugins/native-stake/solana/solanaFetcher.js +11 -7
- package/src/plugins/native-stake/solana/solanaFetcher.js.map +1 -1
- package/src/plugins/nxfinance/positionsFetcher.js +1 -1
- package/src/plugins/nxfinance/positionsFetcher.js.map +1 -1
- package/src/plugins/scallop/cnyAirdropFetcher.js +1 -1
- package/src/plugins/scallop/cnyAirdropFetcher.js.map +1 -1
- package/src/plugins/scallop/constants.d.ts +9 -16
- package/src/plugins/scallop/constants.js +28 -44
- package/src/plugins/scallop/constants.js.map +1 -1
- package/src/plugins/scallop/index.js +7 -1
- package/src/plugins/scallop/index.js.map +1 -1
- package/src/plugins/scallop/lendingsFetcher.js +149 -79
- package/src/plugins/scallop/lendingsFetcher.js.map +1 -1
- package/src/plugins/scallop/marketJob.js.map +1 -1
- package/src/plugins/scallop/obligationsFetcher.js +2 -2
- package/src/plugins/scallop/obligationsFetcher.js.map +1 -1
- package/src/plugins/scallop/poolsJob.js +14 -5
- package/src/plugins/scallop/poolsJob.js.map +1 -1
- package/src/plugins/scallop/sCoinJob.js +2 -1
- package/src/plugins/scallop/sCoinJob.js.map +1 -1
- package/src/plugins/scallop/types/address.d.ts +1 -0
- package/src/plugins/scallop/types/basic.d.ts +4 -0
- package/src/plugins/scallop/types/coin.d.ts +18 -8
- package/src/plugins/scallop/types/coin.js +50 -2
- package/src/plugins/scallop/types/coin.js.map +1 -1
- package/src/plugins/scallop/types/data.d.ts +7 -5
- package/src/plugins/scallop/types/index.d.ts +2 -0
- package/src/plugins/scallop/types/index.js +2 -0
- package/src/plugins/scallop/types/index.js.map +1 -1
- package/src/plugins/scallop/types/spool.d.ts +10 -0
- package/src/plugins/scallop/types/spool.js +3 -0
- package/src/plugins/scallop/types/spool.js.map +1 -0
- package/src/plugins/scallop/types/sui.d.ts +2 -0
- package/src/plugins/scallop/types/sui.js +3 -0
- package/src/plugins/scallop/types/sui.js.map +1 -0
- package/src/plugins/scallop/types/vesca.d.ts +9 -12
- package/src/plugins/scallop/veScaFetcher.js +1 -1
- package/src/plugins/scallop/veScaFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/vaultka/constants.d.ts +8 -0
- package/src/plugins/vaultka/constants.js +31 -0
- package/src/plugins/vaultka/constants.js.map +1 -0
- package/src/plugins/vaultka/index.d.ts +6 -0
- package/src/plugins/vaultka/index.js +15 -0
- package/src/plugins/vaultka/index.js.map +1 -0
- package/src/plugins/vaultka/lendingFetcher.d.ts +3 -0
- package/src/plugins/vaultka/lendingFetcher.js +58 -0
- package/src/plugins/vaultka/lendingFetcher.js.map +1 -0
- package/src/plugins/vaultka/lendingJob.d.ts +3 -0
- package/src/plugins/vaultka/lendingJob.js +32 -0
- package/src/plugins/vaultka/lendingJob.js.map +1 -0
- package/src/plugins/vaultka/strategyFetcher.d.ts +3 -0
- package/src/plugins/vaultka/strategyFetcher.js +63 -0
- package/src/plugins/vaultka/strategyFetcher.js.map +1 -0
- package/src/plugins/vaultka/strategyJob.d.ts +3 -0
- package/src/plugins/vaultka/strategyJob.js +32 -0
- package/src/plugins/vaultka/strategyJob.js.map +1 -0
- package/src/plugins/vaultka/structs.d.ts +59 -0
- package/src/plugins/vaultka/structs.js +58 -0
- package/src/plugins/vaultka/structs.js.map +1 -0
- package/src/plugins/zeta/airdropFetcher.js +14 -14
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/sui/types.d.ts +4 -0
- package/src/plugins/kamino/s2AirdropFetcher.js.map +0 -1
- /package/src/plugins/kamino/{s2AirdropFetcher.d.ts → s2AirdropFetcher.old.d.ts} +0 -0
@@ -1,5 +1,53 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.
|
3
|
+
exports.wormholeCoinTypeToSymbolMap = exports.sCoinTypeToCoinTypeMap = exports.sCoinTypesMap = exports.sCoinToCoinName = void 0;
|
4
|
+
exports.sCoinToCoinName = {
|
5
|
+
scallop_sui: 'sui',
|
6
|
+
scallop_cetus: 'cetus',
|
7
|
+
scallop_sca: 'sca',
|
8
|
+
scallop_wormhole_usdc: 'wusdc',
|
9
|
+
scallop_wormhole_usdt: 'wusdt',
|
10
|
+
scallop_wormhole_eth: 'weth',
|
11
|
+
scallop_wormhole_btc: 'wbtc',
|
12
|
+
scallop_wormhole_sol: 'wsol',
|
13
|
+
scallop_af_sui: 'afsui',
|
14
|
+
scallop_ha_sui: 'hasui',
|
15
|
+
scallop_v_sui: 'vsui',
|
16
|
+
scallop_usdc: 'usdc',
|
17
|
+
};
|
18
|
+
exports.sCoinTypesMap = {
|
19
|
+
scallop_sui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
20
|
+
scallop_cetus: '0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
|
21
|
+
scallop_sca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
22
|
+
scallop_wormhole_usdc: '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
23
|
+
scallop_wormhole_usdt: '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
24
|
+
scallop_wormhole_eth: '0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
|
25
|
+
scallop_af_sui: '0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI',
|
26
|
+
scallop_ha_sui: '0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI',
|
27
|
+
scallop_v_sui: '0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI',
|
28
|
+
scallop_usdc: '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
|
29
|
+
scallop_wormhole_btc: '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
|
30
|
+
scallop_wormhole_sol: '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
|
31
|
+
};
|
32
|
+
exports.sCoinTypeToCoinTypeMap = {
|
33
|
+
[exports.sCoinTypesMap.scallop_sui]: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
|
34
|
+
[exports.sCoinTypesMap.scallop_cetus]: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS',
|
35
|
+
[exports.sCoinTypesMap.scallop_sca]: '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA',
|
36
|
+
[exports.sCoinTypesMap.scallop_wormhole_usdc]: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
|
37
|
+
[exports.sCoinTypesMap.scallop_wormhole_usdt]: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',
|
38
|
+
[exports.sCoinTypesMap.scallop_wormhole_eth]: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',
|
39
|
+
[exports.sCoinTypesMap.scallop_wormhole_btc]: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN',
|
40
|
+
[exports.sCoinTypesMap.scallop_wormhole_sol]: '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN',
|
41
|
+
[exports.sCoinTypesMap.scallop_af_sui]: '0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI',
|
42
|
+
[exports.sCoinTypesMap.scallop_ha_sui]: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
|
43
|
+
[exports.sCoinTypesMap.scallop_v_sui]: '0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT',
|
44
|
+
[exports.sCoinTypesMap.scallop_usdc]: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
|
45
|
+
};
|
46
|
+
exports.wormholeCoinTypeToSymbolMap = {
|
47
|
+
[exports.sCoinTypeToCoinTypeMap[exports.sCoinTypesMap.scallop_wormhole_usdc]]: 'wUSDC',
|
48
|
+
[exports.sCoinTypeToCoinTypeMap[exports.sCoinTypesMap.scallop_wormhole_usdt]]: 'wUSDT',
|
49
|
+
[exports.sCoinTypeToCoinTypeMap[exports.sCoinTypesMap.scallop_wormhole_eth]]: 'wETH',
|
50
|
+
[exports.sCoinTypeToCoinTypeMap[exports.sCoinTypesMap.scallop_wormhole_btc]]: 'wBTC',
|
51
|
+
[exports.sCoinTypeToCoinTypeMap[exports.sCoinTypesMap.scallop_wormhole_sol]]: 'wSOL',
|
52
|
+
};
|
5
53
|
//# sourceMappingURL=coin.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coin.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/coin.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"coin.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/coin.ts"],"names":[],"mappings":";;;AAea,QAAA,eAAe,GAAwB;IAClD,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,OAAO;IACtB,WAAW,EAAE,KAAK;IAClB,q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Aa,CAAC,YAAY,CAAC,EAC1B,gFAAgF;CAC1E,CAAC;AAEE,QAAA,2BAA2B,GAAmC;IACzE,CAAC,8BAAsB,CAAC,qBAAa,CAAC,qBAAqB,CAAC,CAAC,EAAE,OAAO;IACtE,CAAC,8BAAsB,CAAC,qBAAa,CAAC,qBAAqB,CAAC,CAAC,EAAE,OAAO;IACtE,CAAC,8BAAsB,CAAC,qBAAa,CAAC,oBAAoB,CAAC,CAAC,EAAE,MAAM;IACpE,CAAC,8BAAsB,CAAC,qBAAa,CAAC,oBAAoB,CAAC,CAAC,EAAE,MAAM;IACpE,CAAC,8BAAsB,CAAC,qBAAa,CAAC,oBAAoB,CAAC,CAAC,EAAE,MAAM;CACrE,CAAC"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
2
|
-
import { CoinTypeMetadata } from './coin';
|
3
|
-
import { sCoinNames } from '../constants';
|
2
|
+
import { CoinTypeMetadata, MarketCoinNames, PoolCoinNames, SCoinNames } from './coin';
|
4
3
|
import { ID } from '../../../utils/sui/structs/id';
|
5
4
|
export type UserLending = {
|
6
5
|
coinType: string;
|
@@ -16,18 +15,21 @@ export type UserObligations = {
|
|
16
15
|
};
|
17
16
|
};
|
18
17
|
};
|
18
|
+
export type UserLendingData = {
|
19
|
+
[T in PoolCoinNames]?: UserLending;
|
20
|
+
};
|
19
21
|
export type UserStakeAccounts = {
|
20
|
-
[T in
|
22
|
+
[T in MarketCoinNames]?: {
|
21
23
|
points: string;
|
22
24
|
index: string;
|
23
25
|
stakes: string;
|
24
26
|
}[];
|
25
27
|
};
|
26
28
|
export type Pools = {
|
27
|
-
[T in
|
29
|
+
[T in PoolCoinNames]: CoinTypeMetadata;
|
28
30
|
};
|
29
31
|
export type SCoinTypeMetadata = {
|
30
|
-
[T in
|
32
|
+
[T in SCoinNames]: CoinTypeMetadata;
|
31
33
|
};
|
32
34
|
export type ClaimStatus = {
|
33
35
|
name: string;
|
@@ -19,4 +19,6 @@ __exportStar(require("./coin"), exports);
|
|
19
19
|
__exportStar(require("./market"), exports);
|
20
20
|
__exportStar(require("./data"), exports);
|
21
21
|
__exportStar(require("./basic"), exports);
|
22
|
+
__exportStar(require("./spool"), exports);
|
23
|
+
__exportStar(require("./sui"), exports);
|
22
24
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,0CAAwB"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AACxB,wCAAsB"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ExtendedBasicField, IdField, NameField } from './basic';
|
2
|
+
export type SpoolAccountFieldsType = {
|
3
|
+
id: IdField;
|
4
|
+
index: string;
|
5
|
+
points: string;
|
6
|
+
spool_id: string;
|
7
|
+
stake_type: ExtendedBasicField<NameField>;
|
8
|
+
stakes: string;
|
9
|
+
total_points: string;
|
10
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spool.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/spool.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sui.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/sui.ts"],"names":[],"mappings":""}
|
@@ -1,13 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
name: string;
|
6
|
-
value: {
|
7
|
-
type: string;
|
8
|
-
fields: {
|
9
|
-
locked_sca_amount: string;
|
10
|
-
unlock_at: string;
|
11
|
-
};
|
12
|
-
};
|
1
|
+
import { ExtendedBasicField, IdField, NameField } from './basic';
|
2
|
+
type VeScaValueType = {
|
3
|
+
locked_sca_amount: string;
|
4
|
+
unlock_at: string;
|
13
5
|
};
|
6
|
+
export type VeSca = {
|
7
|
+
id: IdField;
|
8
|
+
value: ExtendedBasicField<VeScaValueType>;
|
9
|
+
} & NameField;
|
10
|
+
export {};
|
@@ -24,7 +24,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
24
24
|
const client = (0, clients_1.getClientSui)();
|
25
25
|
const veScaKeys = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
26
26
|
filter: {
|
27
|
-
StructType:
|
27
|
+
StructType: constants_1.veScaKeyType,
|
28
28
|
},
|
29
29
|
});
|
30
30
|
if (veScaKeys.length === 0)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"veScaFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/veScaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AAGrC,
|
1
|
+
{"version":3,"file":"veScaFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/veScaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AAGrC,2CAAgF;AAChF,qGAA6E;AAC7E,qEAAkE;AAClE,uFAAoF;AAEpF,iDAAmD;AAEnD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,KAAK,EAAE;QACrD,MAAM,EAAE;YACN,UAAU,EAAE,wBAAY;SACzB;KACF,CAAC,CAAC;IACH,I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AAI,CACT,IAAA,gCAAsB,EACpB,sBAAU,EACV,IAAI,sBAAS,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,uBAAW,CAAA,CAAC,CAAC,QAAQ,EAAE,EAC7D,0BAAS,CAAC,GAAG,EACb,aAAa,EACb,SAAS,EACT;YACE,WAAW;SACZ,CACF,CACF,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,KAAK,EAAE,QAAQ;YACf,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE;gBACJ,MAAM;aACP;YACD,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,EAAE,OAAO;SACd;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
|
|
54
54
|
}
|
55
55
|
function getV3PairsAddresses(url, length = 300) {
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
57
|
-
const query = (0, graphql_request_1.gql) `
|
58
|
-
{
|
59
|
-
pools(
|
60
|
-
orderBy: totalValueLockedUSD
|
61
|
-
first: ${length}
|
62
|
-
orderDirection: desc
|
63
|
-
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
-
) {
|
65
|
-
id
|
66
|
-
token0Price
|
67
|
-
token1Price
|
68
|
-
liquidity
|
69
|
-
token0 {
|
70
|
-
id
|
71
|
-
totalSupply
|
72
|
-
decimals
|
73
|
-
}
|
74
|
-
token1 {
|
75
|
-
id
|
76
|
-
totalSupply
|
77
|
-
decimals
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
57
|
+
const query = (0, graphql_request_1.gql) `
|
58
|
+
{
|
59
|
+
pools(
|
60
|
+
orderBy: totalValueLockedUSD
|
61
|
+
first: ${length}
|
62
|
+
orderDirection: desc
|
63
|
+
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
+
) {
|
65
|
+
id
|
66
|
+
token0Price
|
67
|
+
token1Price
|
68
|
+
liquidity
|
69
|
+
token0 {
|
70
|
+
id
|
71
|
+
totalSupply
|
72
|
+
decimals
|
73
|
+
}
|
74
|
+
token1 {
|
75
|
+
id
|
76
|
+
totalSupply
|
77
|
+
decimals
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
81
|
`;
|
82
82
|
const res = yield (0, graphql_request_1.default)(url, query);
|
83
83
|
const pools = res.pools;
|
@@ -40,28 +40,28 @@ function getPairKey(version) {
|
|
40
40
|
exports.getPairKey = getPairKey;
|
41
41
|
function getPairsV2FromTheGraph(url, length = 300) {
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
43
|
-
const query = (0, graphql_request_1.gql) `
|
44
|
-
{
|
45
|
-
pairs(
|
46
|
-
orderBy: reserveUSD
|
47
|
-
first: ${length}
|
48
|
-
orderDirection: desc
|
49
|
-
where: { trackedReserveETH_not: "0" }
|
50
|
-
) {
|
51
|
-
id
|
52
|
-
reserve0
|
53
|
-
reserve1
|
54
|
-
totalSupply
|
55
|
-
token0 {
|
56
|
-
id
|
57
|
-
decimals
|
58
|
-
}
|
59
|
-
token1 {
|
60
|
-
id
|
61
|
-
decimals
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
43
|
+
const query = (0, graphql_request_1.gql) `
|
44
|
+
{
|
45
|
+
pairs(
|
46
|
+
orderBy: reserveUSD
|
47
|
+
first: ${length}
|
48
|
+
orderDirection: desc
|
49
|
+
where: { trackedReserveETH_not: "0" }
|
50
|
+
) {
|
51
|
+
id
|
52
|
+
reserve0
|
53
|
+
reserve1
|
54
|
+
totalSupply
|
55
|
+
token0 {
|
56
|
+
id
|
57
|
+
decimals
|
58
|
+
}
|
59
|
+
token1 {
|
60
|
+
id
|
61
|
+
decimals
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
65
|
`;
|
66
66
|
const res = yield (0, graphql_request_1.default)(url, query);
|
67
67
|
const pairs = res.pairs;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
3
|
+
export declare const platformId = "vaultka";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const lendingsCacheKey = "lendings";
|
6
|
+
export declare const lendingProgramIds: PublicKey[];
|
7
|
+
export declare const strategiesCacheKey = "strategies";
|
8
|
+
export declare const strategies: string[];
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.strategies = exports.strategiesCacheKey = exports.lendingProgramIds = exports.lendingsCacheKey = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'vaultka';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Vaultka',
|
9
|
+
image: 'https://sonar.watch/img/platforms/vaultka.webp',
|
10
|
+
website: 'https://solana.vaultka.com/',
|
11
|
+
twitter: 'https://x.com/Vaultkaofficial',
|
12
|
+
defiLlamaId: 'vaultka', // from https://defillama.com/docs/api
|
13
|
+
};
|
14
|
+
exports.lendingsCacheKey = `lendings`;
|
15
|
+
exports.lendingProgramIds = [
|
16
|
+
new web3_js_1.PublicKey('DE7BUY3Fa4CRc44RxRDpcknbCT6mYTY3LpZNFET7k3Hz'),
|
17
|
+
new web3_js_1.PublicKey('DMhoXyVNpCFeCEfEjEQfS6gzAEcPUUSXM8Xnd2UXJfiS'),
|
18
|
+
new web3_js_1.PublicKey('nKMLJtN1rr64K9DjmfzXvzaq4JEy5a4AJHHP9gY1dW6'),
|
19
|
+
new web3_js_1.PublicKey('69oX4gmwgDAfXWxSRtTx9SHvWmu2bd9qVGjQPpAFHaBF'),
|
20
|
+
];
|
21
|
+
exports.strategiesCacheKey = `strategies`;
|
22
|
+
exports.strategies = [
|
23
|
+
'6UBsNdYq3MEao1m9NXQD1VEmXvptUXhfMwdHANGAo4bs',
|
24
|
+
'B3FS1X2PZPBrtBZiyAN9oqABnu3o5YWwdY5ioqoVh64P',
|
25
|
+
'SkFLfp7eSRsan13dEUZSVzMBj3vdyZnhaasFKQTzuiE',
|
26
|
+
'6VwarrrqWVWAmZtNdgGafeyoXD3SsspKxuxkZVarZqTA',
|
27
|
+
'9p5Sc5SvR8QpJCQV3U4q6zVUTupr4Tr9Jmf48sbcSjtX',
|
28
|
+
'FRyGij76xTvAg1nPPTaXHfa3QxUfZuKARuAyAaMyoLPo',
|
29
|
+
'A7PDwCJ3qcdVoZLqq7wHAwMq9yEKZU2vFx7Y9qbZ1dKJ',
|
30
|
+
];
|
31
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/vaultka/constants.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAE/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,OAAO,EAAE,6BAA6B;IACtC,OAAO,EAAE,+BAA+B;IACxC,WAAW,EAAE,SAAS,EAAE,sCAAsC;CAC/D,CAAC;AAEW,QAAA,gBAAgB,GAAG,UAAU,CAAC;AAE9B,QAAA,iBAAiB,GAAG;IAC/B,IAAI,mBAAS,CAAC,8CAA8C,CAAC;IAC7D,IAAI,mBAAS,CAAC,8CAA8C,CAAC;IAC7D,IAAI,mBAAS,CAAC,6CAA6C,CAAC;IAC5D,IAAI,mBAAS,CAAC,8CAA8C,CAAC;CAC9D,CAAC;AAEW,QAAA,kBAAkB,GAAG,YAAY,CAAC;AAElC,QAAA,UAAU,GAAG;IACxB,8CAA8C;IAC9C,8CAA8C;IAC9C,6CAA6C;IAC7C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;CAC/C,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
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.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const lendingJob_1 = __importDefault(require("./lendingJob"));
|
9
|
+
const lendingFetcher_1 = __importDefault(require("./lendingFetcher"));
|
10
|
+
const strategyFetcher_1 = __importDefault(require("./strategyFetcher"));
|
11
|
+
const strategyJob_1 = __importDefault(require("./strategyJob"));
|
12
|
+
exports.platforms = [constants_1.platform];
|
13
|
+
exports.jobs = [lendingJob_1.default, strategyJob_1.default];
|
14
|
+
exports.fetchers = [lendingFetcher_1.default, strategyFetcher_1.default];
|
15
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/vaultka/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,8DAAsC;AACtC,sEAA8C;AAC9C,wEAAgD;AAChD,gEAAwC;AAE3B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,qBAAW,CAAC,CAAC;AACxC,QAAA,QAAQ,GAAc,CAAC,wBAAc,EAAE,yBAAe,CAAC,CAAC"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const web3_js_1 = require("@solana/web3.js");
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const solana_1 = require("../../utils/solana");
|
21
|
+
const structs_1 = require("./structs");
|
22
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
23
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
const connection = (0, clients_1.getClientSolana)();
|
25
|
+
const userInfos = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.userInfoStruct, constants_1.lendingProgramIds.map((lendingProgramId) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('USER_INFOS'), new web3_js_1.PublicKey(owner).toBuffer()], lendingProgramId)[0]));
|
26
|
+
if (!userInfos || userInfos.filter((u) => u !== null).length === 0)
|
27
|
+
return [];
|
28
|
+
const lendings = yield cache.getItem(constants_1.lendingsCacheKey, {
|
29
|
+
prefix: constants_1.platformId,
|
30
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
31
|
+
});
|
32
|
+
if (!lendings)
|
33
|
+
return [];
|
34
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
35
|
+
const element = elementRegistry.addElementMultiple({
|
36
|
+
label: 'Lending',
|
37
|
+
});
|
38
|
+
userInfos.forEach((userInfo, i) => {
|
39
|
+
if (userInfo)
|
40
|
+
element.addAsset({
|
41
|
+
address: lendings[i].mint
|
42
|
+
? lendings[i].mint.toString()
|
43
|
+
: portfolio_core_1.solanaNativeAddress,
|
44
|
+
amount: new bignumber_js_1.default(lendings[i].vault_balance)
|
45
|
+
.plus(lendings[i].borrowed_amount)
|
46
|
+
.multipliedBy(userInfo.shares)
|
47
|
+
.dividedBy(lendings[i].total_shares),
|
48
|
+
});
|
49
|
+
});
|
50
|
+
return elementRegistry.getElements(cache);
|
51
|
+
});
|
52
|
+
const fetcher = {
|
53
|
+
id: `${constants_1.platformId}-lending`,
|
54
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
55
|
+
executor,
|
56
|
+
};
|
57
|
+
exports.default = fetcher;
|
58
|
+
//# sourceMappingURL=lendingFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"lendingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/vaultka/lendingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA4E;AAC5E,6CAA4C;AAC5C,gEAAqC;AAErC,2CAA8E;AAE9E,iDAAsD;AACtD,+CAAmE;AACnE,uCAAoD;AACpD,gFAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,SAAS,GAA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,CAAC,CAAC,CAAC,eAAe,CAAC;qBACjC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;qBAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;aACvC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,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"}
|
@@ -0,0 +1,32 @@
|
|
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
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const web3_js_1 = require("@solana/web3.js");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const structs_1 = require("./structs");
|
16
|
+
const clients_1 = require("../../utils/clients");
|
17
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const connection = (0, clients_1.getClientSolana)();
|
20
|
+
const lendings = yield Promise.all(constants_1.lendingProgramIds.map((lendingProgramId) => (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.lendingStruct, web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('LENDING')], lendingProgramId)[0])));
|
21
|
+
yield cache.setItem(constants_1.lendingsCacheKey, lendings, {
|
22
|
+
prefix: constants_1.platformId,
|
23
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
24
|
+
});
|
25
|
+
});
|
26
|
+
const job = {
|
27
|
+
id: `${constants_1.platformId}-lending`,
|
28
|
+
executor,
|
29
|
+
label: 'normal',
|
30
|
+
};
|
31
|
+
exports.default = job;
|
32
|
+
//# sourceMappingURL=lendingJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"lendingJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/vaultka/lendingJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAG5C,2CAA8E;AAC9E,uCAA0C;AAC1C,iDAAsD;AACtD,kFAA+E;AAE/E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,6BAAiB,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CACzC,IAAA,2CAAoB,EAClB,UAAU,EACV,uBAAa,EACb,mBAAS,CAAC,sBAAsB,CAC9B,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EACxB,gBAAgB,CACjB,CAAC,CAAC,CAAC,CACL,CACF,CACF,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,4BAAgB,EAAE,QAAQ,EAAE;QAC9C,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,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,63 @@
|
|
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
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const web3_js_1 = require("@solana/web3.js");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const solana_1 = require("../../utils/solana");
|
17
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
18
|
+
const structs_1 = require("./structs");
|
19
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const connection = (0, clients_1.getClientSolana)();
|
21
|
+
const positionInfos = yield Promise.all(constants_1.strategies.map((strategy) => (0, solana_1.getParsedProgramAccounts)(connection, structs_1.positionInfoStruct, new web3_js_1.PublicKey(strategy), [
|
22
|
+
{
|
23
|
+
memcmp: {
|
24
|
+
offset: 24,
|
25
|
+
bytes: owner,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
])));
|
29
|
+
if (!positionInfos || positionInfos.filter((u) => u !== null).length === 0)
|
30
|
+
return [];
|
31
|
+
const strategiesInfo = yield cache.getItem(constants_1.strategiesCacheKey, {
|
32
|
+
prefix: constants_1.platformId,
|
33
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
34
|
+
});
|
35
|
+
if (!strategiesInfo)
|
36
|
+
return [];
|
37
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
38
|
+
positionInfos.forEach((positionInfo, i) => {
|
39
|
+
if (positionInfo[0] &&
|
40
|
+
!positionInfo[0].liquidated &&
|
41
|
+
!positionInfo[0].closed) {
|
42
|
+
const element = elementRegistry.addElementBorrowlend({
|
43
|
+
label: 'Leverage',
|
44
|
+
});
|
45
|
+
element.addSuppliedAsset({
|
46
|
+
address: strategiesInfo[i].token_mint,
|
47
|
+
amount: positionInfo[0].position_amount,
|
48
|
+
});
|
49
|
+
element.addBorrowedAsset({
|
50
|
+
address: strategiesInfo[i].collateral_mint,
|
51
|
+
amount: positionInfo[0].leverage_amount,
|
52
|
+
});
|
53
|
+
}
|
54
|
+
});
|
55
|
+
return elementRegistry.getElements(cache);
|
56
|
+
});
|
57
|
+
const fetcher = {
|
58
|
+
id: `${constants_1.platformId}-strategy`,
|
59
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
60
|
+
executor,
|
61
|
+
};
|
62
|
+
exports.default = fetcher;
|
63
|
+
//# sourceMappingURL=strategyFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"strategyFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/vaultka/strategyFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAE5C,2CAAyE;AAEzE,iDAAsD;AACtD,+CAA8D;AAC9D,gFAA6E;AAC7E,uCAAuE;AAEvE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,sBAAU,CAA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gBAC1C,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,eAAe;aACxC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,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"}
|
@@ -0,0 +1,32 @@
|
|
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
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const web3_js_1 = require("@solana/web3.js");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const structs_1 = require("./structs");
|
16
|
+
const clients_1 = require("../../utils/clients");
|
17
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const connection = (0, clients_1.getClientSolana)();
|
20
|
+
const strategys = yield Promise.all(constants_1.strategies.map((strategy) => (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.strategyStruct, web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('STRATEGY')], new web3_js_1.PublicKey(strategy))[0])));
|
21
|
+
yield cache.setItem(constants_1.strategiesCacheKey, strategys, {
|
22
|
+
prefix: constants_1.platformId,
|
23
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
24
|
+
});
|
25
|
+
});
|
26
|
+
const job = {
|
27
|
+
id: `${constants_1.platformId}-strategy`,
|
28
|
+
executor,
|
29
|
+
label: 'normal',
|
30
|
+
};
|
31
|
+
exports.default = job;
|
32
|
+
//# sourceMappingURL=strategyJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"strategyJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/vaultka/strategyJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAG5C,2CAAyE;AACzE,uCAA2C;AAC3C,iDAAsD;AACtD,kFAA+E;AAE/E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CACjC,sBAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1B,IAAA,2CAAoB,EAClB,UAAU,EACV,wBAAc,EACd,mBAAS,CAAC,sBAAsB,CAC9B,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EACzB,IAAI,mBAAS,CAAC,QAAQ,CAAC,CACxB,CAAC,CAAC,CAAC,CACL,CACF,CACF,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,8BAAkB,EAAE,SAAS,EAAE;QACjD,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;AACF,kBAAe,GAAG,CAAC"}
|