@sonarwatch/portfolio-plugins 0.12.23 → 0.12.24

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.12.23",
3
+ "version": "0.12.24",
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;
@@ -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;
@@ -11,22 +11,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.nameService = void 0;
13
13
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
14
+ const clients_1 = require("../../clients");
14
15
  function getOwner(name) {
15
16
  return __awaiter(this, void 0, void 0, function* () {
16
- const response = yield fetch(`https://www.aptosnames.com/api/mainnet/v1/address/${name}`);
17
- const { address } = yield response.json();
18
- if (!address)
17
+ const res = yield (0, clients_1.getClientAptos)().getName({ name });
18
+ if (!(res === null || res === void 0 ? void 0 : res.owner_address))
19
19
  return null;
20
- return address;
20
+ return res.owner_address;
21
21
  });
22
22
  }
23
23
  function getNames(address) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- const response = yield fetch(`https://www.aptosnames.com/api/mainnet/v1/primary-name/${address}`);
26
- const { name } = yield response.json();
27
- if (!name)
25
+ const res = yield (0, clients_1.getClientAptos)().getAccountNames({
26
+ accountAddress: address,
27
+ });
28
+ if (res.length === 0)
28
29
  return [];
29
- return [`${name}.apt`];
30
+ return res.map((el) => (el.domain ? `${el.domain}.apt` : [])).flat();
30
31
  });
31
32
  }
32
33
  exports.nameService = {
@@ -1 +1 @@
1
- {"version":3,"file":"aptos.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/name-service/services/aptos.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA8D;AAG9D,SAAe,QAAQ,CAAC,IAAY;;QAClC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,qDAAqD,IAAI,EAAE,CAC5D,CAAC;QACF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAED,SAAe,QAAQ,CAAC,OAAe;;QACrC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,0DAA0D,OAAO,EAAE,CACpE,CAAC;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC;IACzB,CAAC;CAAA;AAEY,QAAA,WAAW,GAAgB;IACtC,EAAE,EAAE,OAAO;IACX,OAAO,EAAE,iCAAgB;IACzB,QAAQ;IACR,QAAQ;CACT,CAAC"}
1
+ {"version":3,"file":"aptos.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/name-service/services/aptos.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA8D;AAE9D,2CAA+C;AAE/C,SAAe,QAAQ,CAAC,IAAY;;QAClC,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,GAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa,CAAA;YAAE,OAAO,IAAI,CAAC;QAErC,OAAO,GAAG,CAAC,aAAa,CAAC;IAC3B,CAAC;CAAA;AAED,SAAe,QAAQ,CAAC,OAAe;;QACrC,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,GAAE,CAAC,eAAe,CAAC;YACjD,cAAc,EAAE,OAAO;SACxB,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,CAAC;CAAA;AAEY,QAAA,WAAW,GAAgB;IACtC,EAAE,EAAE,OAAO;IACX,OAAO,EAAE,iCAAgB;IACzB,QAAQ;IACR,QAAQ;CACT,CAAC"}
@@ -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;