@sonarwatch/portfolio-plugins 0.12.127 → 0.12.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +2237 -2225
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/src/index.js +10 -0
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/deepbook/airdropFetcher.d.ts +2 -0
  8. package/src/plugins/deepbook/airdropFetcher.js +66 -0
  9. package/src/plugins/deepbook/airdropFetcher.js.map +1 -0
  10. package/src/plugins/deepbook/constants.d.ts +7 -0
  11. package/src/plugins/deepbook/constants.js +24 -0
  12. package/src/plugins/deepbook/constants.js.map +1 -0
  13. package/src/plugins/deepbook/index.d.ts +8 -0
  14. package/src/plugins/deepbook/index.js +10 -0
  15. package/src/plugins/deepbook/index.js.map +1 -0
  16. package/src/plugins/quarry/calculatePositions.d.ts +3 -0
  17. package/src/plugins/quarry/calculatePositions.js +47 -0
  18. package/src/plugins/quarry/calculatePositions.js.map +1 -0
  19. package/src/plugins/quarry/constants.d.ts +4 -0
  20. package/src/plugins/quarry/constants.js +15 -1
  21. package/src/plugins/quarry/constants.js.map +1 -1
  22. package/src/plugins/quarry/filters.d.ts +3 -0
  23. package/src/plugins/quarry/filters.js +24 -0
  24. package/src/plugins/quarry/filters.js.map +1 -0
  25. package/src/plugins/quarry/helpers.d.ts +4 -16
  26. package/src/plugins/quarry/helpers.js +5 -4
  27. package/src/plugins/quarry/helpers.js.map +1 -1
  28. package/src/plugins/quarry/index.js +2 -1
  29. package/src/plugins/quarry/index.js.map +1 -1
  30. package/src/plugins/quarry/mergeMineIdl.d.ts +91 -0
  31. package/src/plugins/quarry/mergeMineIdl.js +1183 -0
  32. package/src/plugins/quarry/mergeMineIdl.js.map +1 -0
  33. package/src/plugins/quarry/positionsFetcher.js +43 -47
  34. package/src/plugins/quarry/positionsFetcher.js.map +1 -1
  35. package/src/plugins/quarry/redeemerIdl.d.ts +59 -0
  36. package/src/plugins/quarry/redeemerIdl.js +219 -0
  37. package/src/plugins/quarry/redeemerIdl.js.map +1 -0
  38. package/src/plugins/quarry/redeemersJob.d.ts +3 -0
  39. package/src/plugins/quarry/redeemersJob.js +56 -0
  40. package/src/plugins/quarry/redeemersJob.js.map +1 -0
  41. package/src/plugins/quarry/types.d.ts +39 -0
  42. package/src/plugins/suins/airdropFetcher.d.ts +2 -0
  43. package/src/plugins/suins/airdropFetcher.js +67 -0
  44. package/src/plugins/suins/airdropFetcher.js.map +1 -0
  45. package/src/plugins/suins/constants.d.ts +7 -0
  46. package/src/plugins/suins/constants.js +24 -0
  47. package/src/plugins/suins/constants.js.map +1 -0
  48. package/src/plugins/suins/index.d.ts +8 -0
  49. package/src/plugins/suins/index.js +10 -0
  50. package/src/plugins/suins/index.js.map +1 -0
  51. package/src/plugins/sushiswap/helpers.js +24 -24
  52. package/src/plugins/uniswap-v2/helpers.js +22 -22
  53. package/src/utils/sei/constants.js +8 -8
  54. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  55. package/src/utils/sui/types.d.ts +6 -0
@@ -0,0 +1,67 @@
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
+ exports.airdropFetcher = void 0;
16
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
17
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
+ const AirdropFetcher_1 = require("../../AirdropFetcher");
19
+ const constants_1 = require("./constants");
20
+ const clients_1 = require("../../utils/clients");
21
+ const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
22
+ const deepFactor = new bignumber_js_1.default(Math.pow(10, constants_1.nsDecimals));
23
+ const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
24
+ const client = (0, clients_1.getClientSui)();
25
+ const nfts = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
26
+ filter: {
27
+ StructType: '0x220bca2187856d09aae578e2782b2b484049a32c755d20352e01236ba5368b63::distribution::NSWrapper',
28
+ },
29
+ });
30
+ let amount = 0;
31
+ if (nfts) {
32
+ const amounts = nfts.map((nft) => {
33
+ var _a, _b;
34
+ if ((_b = (_a = nft.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields) {
35
+ return (0, bignumber_js_1.default)(nft.data.content.fields.balance)
36
+ .dividedBy(deepFactor)
37
+ .toNumber();
38
+ }
39
+ return 0;
40
+ });
41
+ amount = amounts.reduce((am, curr) => curr + am, 0);
42
+ }
43
+ return (0, AirdropFetcher_1.getAirdropRaw)({
44
+ statics: constants_1.airdropStatics,
45
+ items: [
46
+ {
47
+ amount,
48
+ isClaimed: false,
49
+ label: 'NS',
50
+ address: constants_1.nsMint,
51
+ imageUri: constants_1.nsMint ? undefined : constants_1.platform.image,
52
+ },
53
+ ],
54
+ });
55
+ });
56
+ exports.airdropFetcher = {
57
+ id: constants_1.airdropStatics.id,
58
+ networkId: portfolio_core_1.NetworkId.sui,
59
+ executor,
60
+ };
61
+ // export const fetcher = airdropFetcherToFetcher(
62
+ // airdropFetcher,
63
+ // platform.id,
64
+ // 'deepbook-airdrop',
65
+ // airdropStatics.claimEnd
66
+ // );
67
+ //# sourceMappingURL=airdropFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suins/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AACrC,yDAI8B;AAC9B,2CAKqB;AACrB,iDAAmD;AACnD,qEAAkE;AAGlE,MAAM,UAAU,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,sBAAU,CAAA,CAAC,CAAC;AAEnD,MAAM,QAAQ,GAA2B,CAAO,KAAa,EAAE,EAAE;IAC/D,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,IAAA,iCAAe,EAAoB,MAAM,EAAE,KAAK,EAAE;QACnE,MAAM,EAAE;YACN,UAAU,EACR,6FAA6F;SAChG;KACF,CAAC,CAAC;IAEH,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;;YAC/B,IAAI,MAAA,MAAA,GAAG,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,EAAE,CAAC;gBAC9B,OAAO,IAAA,sBAAS,EAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;qBAC9C,SAAS,CAAC,UAAU,CAAC;qBACrB,QAAQ,EAAE,CAAC;YAChB,CAAC;YACD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;QACH,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAA,8BAAa,EAAC;QACnB,OAAO,EAAE,0BAAc;QACvB,KAAK,EAAE;YACL;gBACE,MAAM;gBACN,SAAS,EAAE,KAAK;gBAChB,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE,kBAAM;gBACf,QAAQ,EAAE,kBAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAa,CAAC,KAAK;aACnD;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEW,QAAA,cAAc,GAAmB;IAC5C,EAAE,EAAE,0BAAc,CAAC,EAAE;IACrB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AACF,kDAAkD;AAClD,oBAAoB;AACpB,iBAAiB;AACjB,wBAAwB;AACxB,4BAA4B;AAC5B,KAAK"}
@@ -0,0 +1,7 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { AirdropStatics } from '../../AirdropFetcher';
3
+ export declare const platformId = "suins";
4
+ export declare const platform: Platform;
5
+ export declare const airdropStatics: AirdropStatics;
6
+ export declare const nsMint: undefined;
7
+ export declare const nsDecimals = 6;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nsDecimals = exports.nsMint = exports.airdropStatics = exports.platform = exports.platformId = void 0;
4
+ exports.platformId = 'suins';
5
+ exports.platform = {
6
+ id: exports.platformId,
7
+ name: 'Sui Name Service',
8
+ image: 'https://sonar.watch/img/platforms/suins.webp',
9
+ website: 'https://suins.io/',
10
+ twitter: 'https://x.com/suinsdapp',
11
+ defiLlamaId: 'suins', // from https://defillama.com/docs/api
12
+ };
13
+ exports.airdropStatics = {
14
+ claimLink: '',
15
+ emitterLink: 'https://token.suins.io/',
16
+ emitterName: 'Sui NS',
17
+ id: `${exports.platformId}-token-launch`,
18
+ image: 'https://sonar.watch/img/platforms/suins.webp',
19
+ claimEnd: undefined,
20
+ claimStart: undefined,
21
+ };
22
+ exports.nsMint = undefined;
23
+ exports.nsDecimals = 6;
24
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suins/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,8CAA8C;IACrD,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,yBAAyB;IAClC,WAAW,EAAE,OAAO,EAAE,sCAAsC;CAC7D,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,QAAQ;IACrB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,8CAA8C;IACrD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,MAAM,GAAG,SAAS,CAAC;AACnB,QAAA,UAAU,GAAG,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ import { airdropFetcher } from './airdropFetcher';
5
+ export declare const platforms: Platform[];
6
+ export declare const jobs: Job[];
7
+ export declare const fetchers: Fetcher[];
8
+ export { airdropFetcher };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.airdropFetcher = exports.fetchers = exports.jobs = exports.platforms = void 0;
4
+ const constants_1 = require("./constants");
5
+ const airdropFetcher_1 = require("./airdropFetcher");
6
+ Object.defineProperty(exports, "airdropFetcher", { enumerable: true, get: function () { return airdropFetcher_1.airdropFetcher; } });
7
+ exports.platforms = [constants_1.platform];
8
+ exports.jobs = [];
9
+ exports.fetchers = [];
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suins/index.ts"],"names":[],"mappings":";;;AAGA,2CAAuC;AACvC,qDAAkD;AAKzC,+FALA,+BAAc,OAKA;AAHV,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,EAAE,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;
@@ -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;
@@ -21,3 +21,9 @@ export type ObjectResponse<K> = SuiObjectResponse & {
21
21
  export type Event<K> = SuiEvent & {
22
22
  parsedJson?: K;
23
23
  };
24
+ export type AirdropWrapperNFT = {
25
+ balance: string;
26
+ id: {
27
+ id: string;
28
+ };
29
+ };