@sonarwatch/portfolio-plugins 0.14.17 → 0.14.18

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @sonarwatch/portfolio-plugins
2
-
3
- This library is @sonarwatch/portfolio-plugins
1
+ # @sonarwatch/portfolio-plugins
2
+
3
+ This library is @sonarwatch/portfolio-plugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.14.17",
3
+ "version": "0.14.18",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
36
36
  const graphql_request_1 = __importStar(require("graphql-request"));
37
37
  function getBalancerPoolsV2(url) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const query = (0, graphql_request_1.gql) `
40
- query pools {
41
- pools(
42
- first: 1000
43
- orderBy: totalLiquidity
44
- orderDirection: desc
45
- where: { totalLiquidity_gt: "500" }
46
- ) {
47
- id
48
- address
49
- symbol
50
- totalLiquidity
51
- totalShares
52
- tokens {
53
- balance
54
- decimals
55
- symbol
56
- address
57
- }
58
- }
59
- }
39
+ const query = (0, graphql_request_1.gql) `
40
+ query pools {
41
+ pools(
42
+ first: 1000
43
+ orderBy: totalLiquidity
44
+ orderDirection: desc
45
+ where: { totalLiquidity_gt: "500" }
46
+ ) {
47
+ id
48
+ address
49
+ symbol
50
+ totalLiquidity
51
+ totalShares
52
+ tokens {
53
+ balance
54
+ decimals
55
+ symbol
56
+ address
57
+ }
58
+ }
59
+ }
60
60
  `;
61
61
  const res = yield (0, graphql_request_1.default)(url, query);
62
62
  const pools = res.pools;
@@ -31,14 +31,13 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
31
31
  const atlasTokenPrice = yield cache.getTokenPrice(constants_1.atlasMint, portfolio_core_1.NetworkId.solana);
32
32
  const assets = [];
33
33
  accounts.forEach((account) => {
34
- if (!account.totalStake.isZero()) {
35
- assets.push((0, tokenPriceToAssetToken_1.default)(constants_1.atlasMint, account.totalStake.div(Math.pow(10, constants_1.atlasDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, atlasTokenPrice, atlasTokenPrice === null || atlasTokenPrice === void 0 ? void 0 : atlasTokenPrice.price, {}));
36
- }
34
+ if (account.totalStake.isZero())
35
+ return;
36
+ const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.atlasMint, account.totalStake.div(Math.pow(10, constants_1.atlasDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, atlasTokenPrice);
37
37
  if (!account.pendingRewards.isZero()) {
38
- assets.push((0, tokenPriceToAssetToken_1.default)(constants_1.atlasMint, account.totalStake.div(Math.pow(10, constants_1.atlasDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, atlasTokenPrice, atlasTokenPrice === null || atlasTokenPrice === void 0 ? void 0 : atlasTokenPrice.price, {
39
- isClaimable: true,
40
- }));
38
+ asset.attributes = { isClaimable: true };
41
39
  }
40
+ assets.push(asset);
42
41
  });
43
42
  if (assets.length === 0)
44
43
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/staratlas/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAEpC,2CAA+E;AAE/E,iDAAsD;AACtD,qGAA6E;AAC7E,+CAA8D;AAC9D,uCAA0C;AAE1C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,UAAU,EACV,uBAAa,EACb,sBAAU,EACV;QACE,EAAE,QAAQ,EAAE,uBAAa,CAAC,QAAQ,EAAE;QACpC;YACE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,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ACV,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;SAClD;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"}
1
+ {"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/staratlas/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAEpC,2CAA+E;AAE/E,iDAAsD;AACtD,qGAA6E;AAC7E,+CAA8D;AAC9D,uCAA0C;AAE1C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,UAAU,EACV,uBAAa,EACb,sBAAU,EACV;QACE,EAAE,QAAQ,EAAE,uBAAa,CAAC,QAAQ,EAAE;QACpC;YACE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE;SACpC;KACF,CACF,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,aAAa,CAC/C,qBAAS,EACT,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;YAAE,OAAO;QAExC,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,qBAAS,EACT,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,yBAAa,CAAA,CAAC,CAAC,QAAQ,EAAE,EACtD,0BAAS,CAAC,MAAM,EAChB,eAAe,CAChB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC;YACrC,KAAK,CAAC,UAAU,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAC3C,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,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;SAClD;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"}
@@ -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;
@@ -36,19 +36,19 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
36
36
  return [];
37
37
  const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
38
38
  positionInfos.forEach((positionInfo, i) => {
39
- if (positionInfo[0] &&
40
- !positionInfo[0].liquidated &&
41
- !positionInfo[0].closed) {
39
+ if (positionInfo[i] &&
40
+ !positionInfo[i].liquidated &&
41
+ !positionInfo[i].closed) {
42
42
  const element = elementRegistry.addElementBorrowlend({
43
43
  label: 'Leverage',
44
44
  });
45
45
  element.addSuppliedAsset({
46
46
  address: strategiesInfo[i].token_mint,
47
- amount: positionInfo[0].position_amount,
47
+ amount: positionInfo[i].position_amount,
48
48
  });
49
49
  element.addBorrowedAsset({
50
50
  address: strategiesInfo[i].collateral_mint,
51
- amount: positionInfo[0].leverage_amount,
51
+ amount: positionInfo[i].leverage_amount,
52
52
  });
53
53
  }
54
54
  });
@@ -42,20 +42,20 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
42
42
  const clients_1 = require("../../utils/clients");
43
43
  const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
44
44
  const helpers_1 = require("./helpers");
45
- const query = (0, graphql_request_1.gql) `
46
- query GetAirdropFinalFrontend($authority: String!) {
47
- getAirdropFinalFrontend(authority: $authority) {
48
- authority
49
- community_allocation
50
- eligibility
51
- main_allocation
52
- og_allocation
53
- s1_allocation
54
- s2_allocation
55
- total_allocation
56
- __typename
57
- }
58
- }
45
+ const query = (0, graphql_request_1.gql) `
46
+ query GetAirdropFinalFrontend($authority: String!) {
47
+ getAirdropFinalFrontend(authority: $authority) {
48
+ authority
49
+ community_allocation
50
+ eligibility
51
+ main_allocation
52
+ og_allocation
53
+ s1_allocation
54
+ s2_allocation
55
+ total_allocation
56
+ __typename
57
+ }
58
+ }
59
59
  `;
60
60
  const networkId = portfolio_core_1.NetworkId.solana;
61
61
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
4
- exports.infoQueryMsg = JSON.parse(`{
5
- "info": {}
4
+ exports.infoQueryMsg = JSON.parse(`{
5
+ "info": {}
6
6
  }`);
7
- exports.tokenInfoQueryMsg = JSON.parse(`{
8
- "token_info": {}
7
+ exports.tokenInfoQueryMsg = JSON.parse(`{
8
+ "token_info": {}
9
9
  }`);
10
- exports.minterQueryMsg = JSON.parse(`{
11
- "minter": {}
10
+ exports.minterQueryMsg = JSON.parse(`{
11
+ "minter": {}
12
12
  }`);
13
- exports.poolQueryMsg = JSON.parse(`{
14
- "pool": {}
13
+ exports.poolQueryMsg = JSON.parse(`{
14
+ "pool": {}
15
15
  }`);
16
16
  //# sourceMappingURL=constants.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function getQueryBalanceByOwner(owner) {
4
- return JSON.parse(`{
5
- "balance": {
6
- "address": "${owner}"
7
- }
4
+ return JSON.parse(`{
5
+ "balance": {
6
+ "address": "${owner}"
7
+ }
8
8
  }`);
9
9
  }
10
10
  exports.default = getQueryBalanceByOwner;