@sonarwatch/portfolio-plugins 0.11.218 → 0.11.220

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/index.js +8 -0
  4. package/src/index.js.map +1 -1
  5. package/src/plugins/bonfida/constants.d.ts +5 -0
  6. package/src/plugins/bonfida/constants.js +15 -0
  7. package/src/plugins/bonfida/constants.js.map +1 -0
  8. package/src/plugins/bonfida/index.d.ts +6 -0
  9. package/src/plugins/bonfida/index.js +12 -0
  10. package/src/plugins/bonfida/index.js.map +1 -0
  11. package/src/plugins/bonfida/offersFetcher.d.ts +3 -0
  12. package/src/plugins/bonfida/offersFetcher.js +78 -0
  13. package/src/plugins/bonfida/offersFetcher.js.map +1 -0
  14. package/src/plugins/bonfida/structs.d.ts +27 -0
  15. package/src/plugins/bonfida/structs.js +29 -0
  16. package/src/plugins/bonfida/structs.js.map +1 -0
  17. package/src/plugins/cropper/clmmJob.d.ts +3 -0
  18. package/src/plugins/cropper/clmmJob.js +15 -0
  19. package/src/plugins/cropper/clmmJob.js.map +1 -0
  20. package/src/plugins/cropper/constants.d.ts +5 -0
  21. package/src/plugins/cropper/constants.js +15 -0
  22. package/src/plugins/cropper/constants.js.map +1 -0
  23. package/src/plugins/cropper/helpers.d.ts +2 -0
  24. package/src/plugins/cropper/helpers.js +9 -0
  25. package/src/plugins/cropper/helpers.js.map +1 -0
  26. package/src/plugins/cropper/index.d.ts +6 -0
  27. package/src/plugins/cropper/index.js +12 -0
  28. package/src/plugins/cropper/index.js.map +1 -0
  29. package/src/plugins/navi/collateralFetcher.js +7 -5
  30. package/src/plugins/navi/collateralFetcher.js.map +1 -1
  31. package/src/plugins/orca/getWhirlpoolPositions.d.ts +4 -3
  32. package/src/plugins/orca/getWhirlpoolPositions.js +7 -6
  33. package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
  34. package/src/plugins/orca/getWhirlpoolsJob.d.ts +3 -0
  35. package/src/plugins/orca/getWhirlpoolsJob.js +47 -0
  36. package/src/plugins/orca/getWhirlpoolsJob.js.map +1 -0
  37. package/src/plugins/orca/structs/whirlpool.d.ts +0 -5
  38. package/src/plugins/orca/structs/whirlpool.js.map +1 -1
  39. package/src/plugins/orca/whirlpoolsJob.js +2 -33
  40. package/src/plugins/orca/whirlpoolsJob.js.map +1 -1
  41. package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +7 -3
  42. package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
  43. package/src/plugins/tokens/types.d.ts +3 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.220](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.219...plugins-0.11.220) (2024-05-27)
6
+
7
+
8
+
9
+ ## [0.11.219](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.218...plugins-0.11.219) (2024-05-27)
10
+
11
+
12
+
5
13
  ## [0.11.218](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.217...plugins-0.11.218) (2024-05-27)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.218",
3
+ "version": "0.11.220",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -42,7 +42,7 @@
42
42
  "web3-v1": "npm:web3@^1.5.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@sonarwatch/portfolio-core": "0.11.218"
45
+ "@sonarwatch/portfolio-core": "0.11.220"
46
46
  },
47
47
  "main": "./src/index.js",
48
48
  "types": "./src/index.d.ts"
package/src/index.js CHANGED
@@ -112,6 +112,8 @@ const kriya_1 = require("./plugins/kriya");
112
112
  const haedal_1 = require("./plugins/haedal");
113
113
  const flowx_1 = require("./plugins/flowx");
114
114
  const mole_1 = require("./plugins/mole");
115
+ const bonfida_1 = require("./plugins/bonfida");
116
+ const cropper_1 = require("./plugins/cropper");
115
117
  var constants_1 = require("./plugins/tokens/constants");
116
118
  Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
117
119
  Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
@@ -217,6 +219,8 @@ exports.platforms = [
217
219
  ...kriya_1.platforms,
218
220
  ...haedal_1.platforms,
219
221
  ...mole_1.platforms,
222
+ ...bonfida_1.platforms,
223
+ ...cropper_1.platforms,
220
224
  ];
221
225
  // JOBS //
222
226
  exports.jobs = [
@@ -305,6 +309,8 @@ exports.jobs = [
305
309
  ...haedal_1.jobs,
306
310
  ...flowx_1.jobs,
307
311
  ...mole_1.jobs,
312
+ ...bonfida_1.jobs,
313
+ ...cropper_1.jobs,
308
314
  ];
309
315
  // FETCHERS //
310
316
  exports.fetchers = [
@@ -395,6 +401,8 @@ exports.fetchers = [
395
401
  ...haedal_1.fetchers,
396
402
  ...flowx_1.fetchers,
397
403
  ...mole_1.fetchers,
404
+ ...bonfida_1.fetchers,
405
+ ...cropper_1.fetchers,
398
406
  ];
399
407
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
400
408
  exports.airdropFetchers = [
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,uDAAgE;AAChE,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACx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f,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,cAAW;IACd,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,eAAY;CAChB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC;AACW,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,uDAAgE;AAChE,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAKyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAI6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,+CAI2B;AAC3B,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6C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IACf,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,kBAAe;CACnB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC;AACW,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Platform } from '@sonarwatch/portfolio-core';
3
+ export declare const platformId = "bonfida";
4
+ export declare const platform: Platform;
5
+ export declare const offerPid: PublicKey;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.offerPid = exports.platform = exports.platformId = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ exports.platformId = 'bonfida';
6
+ exports.platform = {
7
+ id: exports.platformId,
8
+ name: 'Bonfida (SNS)',
9
+ image: 'https://sonar.watch/img/platforms/bonfida.webp',
10
+ website: 'https://www.sns.id/',
11
+ twitter: 'https://twitter.com/bonfida',
12
+ defiLlamaId: 'solana-name-service', // from https://defillama.com/docs/api
13
+ };
14
+ exports.offerPid = new web3_js_1.PublicKey('85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29');
15
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bonfida/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gDAAgD;IACvD,OAAO,EAAE,qBAAqB;IAC9B,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,qBAAqB,EAAE,sCAAsC;CAC3E,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAI,mBAAS,CACnC,8CAA8C,CAC/C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const platforms: Platform[];
5
+ export declare const jobs: Job[];
6
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,12 @@
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 offersFetcher_1 = __importDefault(require("./offersFetcher"));
9
+ exports.platforms = [constants_1.platform];
10
+ exports.jobs = [];
11
+ exports.fetchers = [offersFetcher_1.default];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bonfida/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,oEAA4C;AAE/B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,uBAAa,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,78 @@
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 constants_1 = require("./constants");
17
+ const clients_1 = require("../../utils/clients");
18
+ const solana_1 = require("../../utils/solana");
19
+ const structs_1 = require("./structs");
20
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
21
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const connection = (0, clients_1.getClientSolana)();
23
+ const categoryOfferAccounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.categoryOfferStruct, constants_1.offerPid, [
24
+ { memcmp: { offset: 0, bytes: 'C' } },
25
+ {
26
+ memcmp: {
27
+ bytes: owner,
28
+ offset: 50,
29
+ },
30
+ },
31
+ ]);
32
+ const offerAccounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.offerStruct, constants_1.offerPid, [
33
+ { memcmp: { offset: 0, bytes: '2' } },
34
+ {
35
+ memcmp: {
36
+ bytes: owner,
37
+ offset: 34,
38
+ },
39
+ },
40
+ ]);
41
+ if (offerAccounts.length === 0 && categoryOfferAccounts.length === 0)
42
+ return [];
43
+ const tokenPrices = yield cache.getTokenPricesAsMap([...offerAccounts.map((a) => a.mint.toString()), portfolio_core_1.solanaNativeAddress], portfolio_core_1.NetworkId.solana);
44
+ const assets = [];
45
+ [
46
+ ...offerAccounts,
47
+ ...categoryOfferAccounts.map((a) => (Object.assign(Object.assign({}, a), { mint: portfolio_core_1.solanaNativeAddress }))),
48
+ ].forEach((acc) => {
49
+ if (acc.amount.isZero())
50
+ return;
51
+ const tokenPrice = tokenPrices.get(acc.mint.toString());
52
+ if (!tokenPrice)
53
+ return;
54
+ const amount = acc.amount.div(Math.pow(10, tokenPrice.decimals)).toNumber();
55
+ const asset = (0, tokenPriceToAssetToken_1.default)(acc.mint.toString(), amount, portfolio_core_1.NetworkId.solana, tokenPrice);
56
+ assets.push(asset);
57
+ });
58
+ if (assets.length === 0)
59
+ return [];
60
+ const element = {
61
+ networkId: portfolio_core_1.NetworkId.solana,
62
+ label: 'Deposit',
63
+ platformId: constants_1.platformId,
64
+ type: portfolio_core_1.PortfolioElementType.multiple,
65
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
66
+ data: {
67
+ assets,
68
+ },
69
+ };
70
+ return [element];
71
+ });
72
+ const fetcher = {
73
+ id: `${constants_1.platformId}-offers`,
74
+ networkId: portfolio_core_1.NetworkId.solana,
75
+ executor,
76
+ };
77
+ exports.default = fetcher;
78
+ //# sourceMappingURL=offersFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offersFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bonfida/offersFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAEpC,2CAAmD;AAEnD,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA6D;AAC7D,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,qBAAqB,GAAG,MAAM,IAAA,iCAAwB,EAC1D,UAAU,EACV,6BAAmB,EACnB,oBAAQ,EACR;QACE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrC;YACE,MAAM,EAAE;gBACN,KAAK,EAAE,KAAK;gBACZ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AsB,EAClC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EACnB,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,MAAM,OAAO,GAA6B;QACxC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,SAAS;QAChB,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;QACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,27 @@
1
+ /// <reference types="node" />
2
+ import { BeetStruct } from '@metaplex-foundation/beet';
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import BigNumber from 'bignumber.js';
5
+ export declare enum State {
6
+ Uninitialized = 0,
7
+ StakePool = 1,
8
+ InactiveStakePool = 2,
9
+ StakeAccount = 3
10
+ }
11
+ export type Offer = {
12
+ buffer: Buffer;
13
+ domain: PublicKey;
14
+ owner: PublicKey;
15
+ mint: PublicKey;
16
+ amount: BigNumber;
17
+ tokenAccount: PublicKey;
18
+ };
19
+ export declare const offerStruct: BeetStruct<Offer, Partial<Offer>>;
20
+ export type CategoryOffer = {
21
+ buffer: Buffer;
22
+ idk: BigNumber;
23
+ amount: BigNumber;
24
+ categoryAccount: PublicKey;
25
+ owner: PublicKey;
26
+ };
27
+ export declare const categoryOfferStruct: BeetStruct<CategoryOffer, Partial<CategoryOffer>>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.categoryOfferStruct = exports.offerStruct = exports.State = void 0;
4
+ const beet_1 = require("@metaplex-foundation/beet");
5
+ const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
+ const solana_1 = require("../../utils/solana");
7
+ var State;
8
+ (function (State) {
9
+ State[State["Uninitialized"] = 0] = "Uninitialized";
10
+ State[State["StakePool"] = 1] = "StakePool";
11
+ State[State["InactiveStakePool"] = 2] = "InactiveStakePool";
12
+ State[State["StakeAccount"] = 3] = "StakeAccount";
13
+ })(State || (exports.State = State = {}));
14
+ exports.offerStruct = new beet_1.BeetStruct([
15
+ ['buffer', (0, solana_1.blob)(2)],
16
+ ['domain', beet_solana_1.publicKey],
17
+ ['owner', beet_solana_1.publicKey],
18
+ ['mint', beet_solana_1.publicKey],
19
+ ['amount', solana_1.u64],
20
+ ['tokenAccount', beet_solana_1.publicKey],
21
+ ], (args) => args);
22
+ exports.categoryOfferStruct = new beet_1.BeetStruct([
23
+ ['buffer', (0, solana_1.blob)(2)],
24
+ ['idk', solana_1.u64],
25
+ ['amount', solana_1.u64],
26
+ ['categoryAccount', beet_solana_1.publicKey],
27
+ ['owner', beet_solana_1.publicKey],
28
+ ], (args) => args);
29
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bonfida/structs.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AACvD,kEAA6D;AAG7D,+CAA+C;AAE/C,IAAY,KAKX;AALD,WAAY,KAAK;IACf,mDAAa,CAAA;IACb,2CAAS,CAAA;IACT,2DAAiB,CAAA;IACjB,iDAAY,CAAA;AACd,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB;AAWY,QAAA,WAAW,GAAG,IAAI,iBAAU,CACvC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,cAAc,EAAE,uBAAS,CAAC;CAC5B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC;AAUW,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,KAAK,EAAE,YAAG,CAAC;IACZ,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,iBAAiB,EAAE,uBAAS,CAAC;IAC9B,CAAC,OAAO,EAAE,uBAAS,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -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
+ const getWhirlpoolsJob_1 = __importDefault(require("../orca/getWhirlpoolsJob"));
7
+ const constants_1 = require("./constants");
8
+ // Based on Orca Whirlpools (CLMM)
9
+ const job = {
10
+ id: `${constants_1.platformId}-clmm`,
11
+ executor: (0, getWhirlpoolsJob_1.default)(constants_1.clmmPid),
12
+ label: 'normal',
13
+ };
14
+ exports.default = job;
15
+ //# sourceMappingURL=clmmJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clmmJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cropper/clmmJob.ts"],"names":[],"mappings":";;;;;AACA,gFAAwD;AACxD,2CAAkD;AAElD,kCAAkC;AAClC,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ,EAAE,IAAA,0BAAgB,EAAC,mBAAO,CAAC;IACnC,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Platform } from '@sonarwatch/portfolio-core';
3
+ export declare const platformId = "cropper";
4
+ export declare const platform: Platform;
5
+ export declare const clmmPid: PublicKey;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clmmPid = exports.platform = exports.platformId = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ exports.platformId = 'cropper';
6
+ exports.platform = {
7
+ id: exports.platformId,
8
+ name: 'Cropper',
9
+ image: 'https://sonar.watch/img/platforms/cropper.webp',
10
+ website: 'https://cropper.finance/',
11
+ twitter: 'https://twitter.com/CropperFinance',
12
+ defiLlamaId: 'cropper', // from https://defillama.com/docs/api
13
+ };
14
+ exports.clmmPid = new web3_js_1.PublicKey('H8W3ctz92svYg6mkn1UtGfu2aQr2fnUFHM1RhScEtQDt');
15
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cropper/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/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,0BAA0B;IACnC,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EAAE,SAAS,EAAE,sCAAsC;CAC/D,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { PortfolioAssetCollectible } from '@sonarwatch/portfolio-core';
2
+ export declare function isClmmPosition(nft: PortfolioAssetCollectible): boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isClmmPosition = void 0;
4
+ function isClmmPosition(nft) {
5
+ var _a;
6
+ return ((_a = nft.data.name) === null || _a === void 0 ? void 0 : _a.startsWith('Cropper CLMM Position')) === true;
7
+ }
8
+ exports.isClmmPosition = isClmmPosition;
9
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cropper/helpers.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc,CAAC,GAA8B;;IAC3D,OAAO,CAAA,MAAA,GAAG,CAAC,IAAI,CAAC,IAAI,0CAAE,UAAU,CAAC,uBAAuB,CAAC,MAAK,IAAI,CAAC;AACrE,CAAC;AAFD,wCAEC"}
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const platforms: Platform[];
5
+ export declare const jobs: Job[];
6
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,12 @@
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 clmmJob_1 = __importDefault(require("./clmmJob"));
9
+ exports.platforms = [constants_1.platform];
10
+ exports.jobs = [clmmJob_1.default];
11
+ exports.fetchers = [];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cropper/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wDAAgC;AAEnB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,iBAAO,CAAC,CAAC;AACxB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
@@ -98,11 +98,13 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
98
98
  }
99
99
  if (rewards.size > 0) {
100
100
  rewards.forEach((amount, coinType) => {
101
- const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(coinType, portfolio_core_1.NetworkId.sui));
102
- if (tokenPrice) {
103
- rewardAssets.push((0, tokenPriceToAssetToken_1.default)(coinType, new bignumber_js_1.default(amount)
104
- .dividedBy(Math.pow(10, tokenPrice.decimals))
105
- .toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
101
+ if (amount > 0) {
102
+ const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(coinType, portfolio_core_1.NetworkId.sui));
103
+ if (tokenPrice) {
104
+ rewardAssets.push((0, tokenPriceToAssetToken_1.default)(coinType, new bignumber_js_1.default(amount)
105
+ .dividedBy(Math.pow(10, tokenPrice.decimals))
106
+ .toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
107
+ }
106
108
  }
107
109
  });
108
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qGAA6E;AAE7E,iFAA8E;AAC9E,+DAA4D;AAE5D,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC;AAE7C,MAAM,QAAQ,GAAoB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B,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qGAA6E;AAE7E,iFAA8E;AAC9E,+DAA4D;AAE5D,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC;AAE7C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAC1C,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,OAAO,CAAgB,uBAAW,EAAE;QACnE,MAAM,EAAE,0BAAc;QACtB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,YAAY;QAAE,OAAO,EAAE,CAAC;IAE7B,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/C,KAAK,CAAC,mBAAmB,CACvB,YAAY,CAAC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AG,EACb,UAAU,CACX,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IACE,cAAc,CAAC,MAAM,KAAK,CAAC;QAC3B,cAAc,CAAC,MAAM,KAAK,CAAC;QAC3B,YAAY,CAAC,MAAM,KAAK,CAAC;QAEzB,OAAO,EAAE,CAAC;IAEZ,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,CACb,CAAC;IACJ,MAAM,OAAO,GAAqB;QAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe,EAAE,IAAI;YACrB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,3 +1,4 @@
1
- import { PortfolioAssetCollectible, PortfolioElement } from '@sonarwatch/portfolio-core';
2
- import { Cache } from '../../Cache';
3
- export declare function getWhirlpoolPositions(cache: Cache, nfts: PortfolioAssetCollectible[]): Promise<PortfolioElement[]>;
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Appraiser } from '../tokens/types';
3
+ export declare const getWhirlpoolPositions: Appraiser;
4
+ export declare function getOrcaAppraiser(platformId: string, programId: PublicKey): Appraiser;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getWhirlpoolPositions = void 0;
15
+ exports.getOrcaAppraiser = exports.getWhirlpoolPositions = void 0;
16
16
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
17
17
  const web3_js_1 = require("@solana/web3.js");
18
18
  const constants_1 = require("./constants");
@@ -22,14 +22,15 @@ const whirlpool_1 = require("./structs/whirlpool");
22
22
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
23
23
  const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
24
24
  const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
25
- function getWhirlpoolPositions(cache, nfts) {
26
- return __awaiter(this, void 0, void 0, function* () {
25
+ exports.getWhirlpoolPositions = getOrcaAppraiser(constants_1.platformId, constants_1.whirlpoolProgram);
26
+ function getOrcaAppraiser(platformId, programId) {
27
+ return (cache, nfts) => __awaiter(this, void 0, void 0, function* () {
27
28
  const client = (0, clients_1.getClientSolana)();
28
29
  const positionsProgramAddress = [];
29
30
  nfts.forEach((nft) => {
30
31
  const address = new web3_js_1.PublicKey(nft.data.address);
31
32
  const positionSeed = [Buffer.from('position'), address.toBuffer()];
32
- const [programAddress] = web3_js_1.PublicKey.findProgramAddressSync(positionSeed, constants_1.whirlpoolProgram);
33
+ const [programAddress] = web3_js_1.PublicKey.findProgramAddressSync(positionSeed, programId);
33
34
  positionsProgramAddress.push(programAddress);
34
35
  });
35
36
  if (positionsProgramAddress.length === 0)
@@ -111,7 +112,7 @@ function getWhirlpoolPositions(cache, nfts) {
111
112
  {
112
113
  type: portfolio_core_1.PortfolioElementType.liquidity,
113
114
  networkId: portfolio_core_1.NetworkId.solana,
114
- platformId: constants_1.platformId,
115
+ platformId,
115
116
  label: 'LiquidityPool',
116
117
  name: 'Concentrated',
117
118
  value: totalLiquidityValue,
@@ -122,5 +123,5 @@ function getWhirlpoolPositions(cache, nfts) {
122
123
  ];
123
124
  });
124
125
  }
125
- exports.getWhirlpoolPositions = getWhirlpoolPositions;
126
+ exports.getOrcaAppraiser = getOrcaAppraiser;
126
127
  //# sourceMappingURL=getWhirlpoolPositions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,6CAA4C;AAC5C,2CAA4E;AAC5E,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAChE,qGAA6E;AAC7E,6EAAqD;AACrD,wFAAyF;AAEzF,SAAsB,qBAAqB,CACzC,KAAY,EACZ,IAAiC;;QAEjC,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhD,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEnE,MAAM,CAAC,cAAc,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACvD,YAAY,EACZ,4BAAgB,CACjB,CAAC;YACF,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACvD,MAAM,EACN,0BAAc,EACd,uBAAuB,CACxB,CAAC;QACF,IAAI,CAAC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V,sBAAU;gBACV,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,mBAAmB;gBAC1B,IAAI,EAAE;oBACJ,WAAW,EAAE,MAAM;iBACpB;aACF;SACF,CAAC;IACJ,CAAC;CAAA;AA3ID,sDA2IC"}
1
+ {"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAChE,qGAA6E;AAC7E,6EAAqD;AACrD,wFAAyF;AAG5E,QAAA,qBAAqB,GAAG,gBAAgB,CACnD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,gBAAgB,CAC9B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAiC,EACJ,EAAE;QAC/B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhD,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEnE,MAAM,CAAC,cAAc,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACvD,YAAY,EACZ,SAAS,CACV,CAAC;YACF,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,MAAM,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qCAAoB,CAAC,SAAS;gBACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,UAAU;gBACV,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,mBAAmB;gBAC1B,IAAI,EAAE;oBACJ,WAAW,EAAE,MAAM;iBACpB;aACF;SACF,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC;AAlJD,4CAkJC"}
@@ -0,0 +1,3 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { JobExecutor } from '../../Job';
3
+ export default function getWhirlpoolsJob(programId: PublicKey): JobExecutor;
@@ -0,0 +1,47 @@
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const constants_1 = require("./constants");
18
+ const solana_1 = require("../../utils/solana");
19
+ const clients_1 = require("../../utils/clients");
20
+ const whirlpool_1 = require("./structs/whirlpool");
21
+ const filters_1 = require("./filters");
22
+ const tokenPricesFromSqrt_1 = __importDefault(require("../../utils/clmm/tokenPricesFromSqrt"));
23
+ function getWhirlpoolsJob(programId) {
24
+ return (cache) => __awaiter(this, void 0, void 0, function* () {
25
+ const client = (0, clients_1.getClientSolana)();
26
+ const whirlpoolsInfo = yield (0, solana_1.getParsedProgramAccounts)(client, whirlpool_1.whirlpoolStruct, programId, filters_1.whirlpoolFilters);
27
+ const items = [];
28
+ for (let id = 0; id < whirlpoolsInfo.length; id++) {
29
+ const whirlpoolInfo = whirlpoolsInfo[id];
30
+ if (whirlpoolInfo.liquidity.isZero())
31
+ continue;
32
+ const reserveX = yield client.getBalance(whirlpoolInfo.tokenVaultA);
33
+ const reserveY = yield client.getBalance(whirlpoolInfo.tokenVaultB);
34
+ yield (0, tokenPricesFromSqrt_1.default)(cache, portfolio_core_1.NetworkId.solana, whirlpoolInfo.pubkey.toString(), new bignumber_js_1.default(reserveX), new bignumber_js_1.default(reserveY), whirlpoolInfo.sqrtPrice, whirlpoolInfo.tokenMintA.toString(), whirlpoolInfo.tokenMintB.toString());
35
+ items.push({
36
+ key: whirlpoolInfo.pubkey.toString(),
37
+ value: whirlpoolInfo,
38
+ });
39
+ }
40
+ yield cache.setItems(items, {
41
+ prefix: constants_1.whirlpoolPrefix,
42
+ networkId: portfolio_core_1.NetworkId.solana,
43
+ });
44
+ });
45
+ }
46
+ exports.default = getWhirlpoolsJob;
47
+ //# sourceMappingURL=getWhirlpoolsJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWhirlpoolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAErC,2CAA8C;AAC9C,+CAA8D;AAC9D,iDAAsD;AACtD,mDAAsD;AACtD,uCAA6C;AAG7C,+FAA4E;AAE5E,SAAwB,gBAAgB,CAAC,SAAoB;IAC3D,OAAO,CAAO,KAAY,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QAEjC,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAwB,EACnD,MAAM,EACN,2BAAe,EACf,SAAS,EACT,0BAAgB,CACjB,CAAC;QAEF,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;YAClD,MAAM,aAAa,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;YACzC,IAAI,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE;gBAAE,SAAS;YAE/C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YACpE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YACpE,MAAM,IAAA,6BAAwB,EAC5B,KAAK,EACL,0BAAS,CAAC,MAAM,EAChB,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,EAC/B,IAAI,sBAAS,CAAC,QAAQ,CAAC,EACvB,IAAI,sBAAS,CAAC,QAAQ,CAAC,EACvB,aAAa,CAAC,SAAS,EACvB,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EACnC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,CACpC,CAAC;YAEF,KAAK,CAAC,IAAI,CAAC;gBACT,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACpC,KAAK,EAAE,aAAa;aACrB,CAAC,CAAC;QACL,CAAC;QACD,MAAM,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE;YAC1B,MAAM,EAAE,2BAAe;YACvB,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAvCD,mCAuCC"}
@@ -7,11 +7,6 @@ export type PositionRewardInfo = {
7
7
  amountOwed: BigNumber;
8
8
  };
9
9
  export declare const positionRewardInfoStruct: BeetStruct<PositionRewardInfo, Partial<PositionRewardInfo>>;
10
- export type PositionWhirlpool = Position & {
11
- tickCurrentIndex?: number;
12
- tokenMintA?: PublicKey;
13
- tokenMintB?: PublicKey;
14
- };
15
10
  export type Position = {
16
11
  padding: Buffer;
17
12
  whirlpool: PublicKey;
@@ -1 +1 @@
1
- {"version":3,"file":"whirlpool.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orca/structs/whirlpool.ts"],"names":[],"mappings":";;;AAAA,oDAMmC;AACnC,kEAA6D;AAG7D,kDAAwD;AAO3C,QAAA,wBAAwB,GAAG,IAAI,iBAAU,CACpD;IACE,CAAC,wBAAwB,EAAE,aAAI,CAAC;IAChC,CAAC,YAAY,EAAE,YAAG,CAAC;CACpB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAA0B,CACrC,CAAC;AAsBW,QAAA,cAAc,GAAG,IAAI,iBAAU,CAC1C;IACE,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,cAAc,EAAE,uBAAS,CAAC;IAC3B,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,gBAAgB,EAAE,UAAG,CAAC;IACvB,CAAC,gBAAgB,EAAE,UAAG,CAAC;IACvB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,aAAa,EAAE,IAAA,4BAAqB,EAAC,gCAAwB,EAAE,CAAC,CAAC,CAAC;CACpE,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC;AAUW,QAAA,yBAAyB,GAAG,IAAI,iBAAU,CACrD;IACE,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,uBAAuB,EAAE,aAAI,CAAC;IAC/B,CAAC,iBAAiB,EAAE,aAAI,CAAC;CAC1B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAA2B,CACtC,CAAC;AAyBW,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACpB,CAAC,kBAAkB,EAAE,uBAAS,CAAC;IAC/B,CAAC,eAAe,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,iBAAiB,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,iBAAiB,EAAE,UAAG,CAAC;IACxB,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,kBAAkB,EAAE,UAAG,CAAC;IACzB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,kBAAkB,EAAE,aAAI,CAAC;IAC1B,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,kBAAkB,EAAE,aAAI,CAAC;IAC1B,CAAC,4BAA4B,EAAE,YAAG,CAAC;IACnC,CAAC,aAAa,EAAE,IAAA,4BAAqB,EAAC,iCAAyB,EAAE,CAAC,CAAC,CAAC;CACrE,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
1
+ {"version":3,"file":"whirlpool.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orca/structs/whirlpool.ts"],"names":[],"mappings":";;;AAAA,oDAMmC;AAC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IAC/B,CAAC,eAAe,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,iBAAiB,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,iBAAiB,EAAE,UAAG,CAAC;IACxB,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,kBAAkB,EAAE,UAAG,CAAC;IACzB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,kBAAkB,EAAE,aAAI,CAAC;IAC1B,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,kBAAkB,EAAE,aAAI,CAAC;IAC1B,CAAC,4BAA4B,EAAE,YAAG,CAAC;IACnC,CAAC,aAAa,EAAE,IAAA,4BAAqB,EAAC,iCAAyB,EAAE,CAAC,CAAC,CAAC;CACrE,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
@@ -1,44 +1,13 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
14
5
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
6
  const constants_1 = require("./constants");
18
- const solana_1 = require("../../utils/solana");
19
- const clients_1 = require("../../utils/clients");
20
- const whirlpool_1 = require("./structs/whirlpool");
21
- const filters_1 = require("./filters");
22
- const tokenPricesFromSqrt_1 = __importDefault(require("../../utils/clmm/tokenPricesFromSqrt"));
23
- const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
24
- const client = (0, clients_1.getClientSolana)();
25
- const whirlpoolsInfo = yield (0, solana_1.getParsedProgramAccounts)(client, whirlpool_1.whirlpoolStruct, constants_1.whirlpoolProgram, filters_1.whirlpoolFilters);
26
- for (let id = 0; id < whirlpoolsInfo.length; id++) {
27
- const whirlpoolInfo = whirlpoolsInfo[id];
28
- if (whirlpoolInfo.liquidity.isZero())
29
- continue;
30
- const reserveX = yield client.getBalance(whirlpoolInfo.tokenVaultA);
31
- const reserveY = yield client.getBalance(whirlpoolInfo.tokenVaultB);
32
- yield (0, tokenPricesFromSqrt_1.default)(cache, portfolio_core_1.NetworkId.solana, whirlpoolInfo.pubkey.toString(), new bignumber_js_1.default(reserveX), new bignumber_js_1.default(reserveY), whirlpoolInfo.sqrtPrice, whirlpoolInfo.tokenMintA.toString(), whirlpoolInfo.tokenMintB.toString());
33
- yield cache.setItem(whirlpoolInfo.pubkey.toString(), whirlpoolInfo, {
34
- prefix: constants_1.whirlpoolPrefix,
35
- networkId: portfolio_core_1.NetworkId.solana,
36
- });
37
- }
38
- });
7
+ const getWhirlpoolsJob_1 = __importDefault(require("./getWhirlpoolsJob"));
39
8
  const job = {
40
9
  id: `${constants_1.platformId}-whirlpools`,
41
- executor,
10
+ executor: (0, getWhirlpoolsJob_1.default)(constants_1.whirlpoolProgram),
42
11
  label: 'normal',
43
12
  };
44
13
  exports.default = job;
@@ -1 +1 @@
1
- {"version":3,"file":"whirlpoolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/whirlpoolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AACrC,2CAA4E;AAC5E,+CAA8D;AAC9D,iDAAsD;AACtD,mDAAsD;AACtD,uCAA6C;AAG7C,+FAA4E;AAE5E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAwB,EACnD,MAAM,EACN,2BAAe,EACf,4BAAgB,EAChB,0BAAgB,CACjB,CAAC;IAEF,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;QAClD,MAAM,aAAa,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE;YAAE,SAAS;QAE/C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACpE,MAAM,IAAA,6BAAwB,EAC5B,KAAK,EACL,0BAAS,CAAC,MAAM,EAChB,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,EAC/B,IAAI,sBAAS,CAAC,QAAQ,CAAC,EACvB,IAAI,sBAAS,CAAC,QAAQ,CAAC,EACvB,aAAa,CAAC,SAAS,EACvB,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EACnC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,CACpC,CAAC;QAEF,MAAM,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE;YAClE,MAAM,EAAE,2BAAe;YACvB,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"whirlpoolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/whirlpoolsJob.ts"],"names":[],"mappings":";;;;;AACA,2CAA2D;AAC3D,0EAAkD;AAElD,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,QAAQ,EAAE,IAAA,0BAAgB,EAAC,4BAAgB,CAAC;IAC5C,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -18,10 +18,13 @@ const getRaydiumCLMMPositions_1 = require("../../raydium/getRaydiumCLMMPositions
18
18
  const getWhirlpoolPositions_1 = require("../../orca/getWhirlpoolPositions");
19
19
  const helpers_1 = require("../../raydium/helpers");
20
20
  const helpers_2 = require("../../orca/helpers");
21
- const helpers_3 = require("../../daos/helpers");
21
+ const helpers_3 = require("../../cropper/helpers");
22
+ const helpers_4 = require("../../daos/helpers");
22
23
  const getSolanaDasEndpoint_1 = __importDefault(require("../../../utils/clients/getSolanaDasEndpoint"));
23
24
  const getAssetsByOwnerDas_1 = require("../../../utils/solana/das/getAssetsByOwnerDas");
24
25
  const heliusAssetToAssetCollectible_1 = require("../../../utils/solana/das/heliusAssetToAssetCollectible");
26
+ const constants_2 = require("../../orca/constants");
27
+ const constants_3 = require("../../cropper/constants");
25
28
  // Add here any pair of [Identifier,Appraiser] =
26
29
  // Identifier : a string to filter the asset concerned
27
30
  // Appraiser : the function to apply to those asset to get their underlying value
@@ -29,8 +32,9 @@ const heliusAssetToAssetCollectible_1 = require("../../../utils/solana/das/heliu
29
32
  // Don't add anything else.
30
33
  const appraiserByIdentifier = new Map([
31
34
  [helpers_1.isARaydiumPosition, getRaydiumCLMMPositions_1.getRaydiumCLMMPositions],
32
- [helpers_2.isAnOrcaPosition, getWhirlpoolPositions_1.getWhirlpoolPositions],
33
- [helpers_3.isAnHeliumNFTVote, helpers_3.getHeliumElementsFromNFTs],
35
+ [helpers_2.isAnOrcaPosition, (0, getWhirlpoolPositions_1.getOrcaAppraiser)(constants_2.platformId, constants_2.whirlpoolProgram)],
36
+ [helpers_3.isClmmPosition, (0, getWhirlpoolPositions_1.getOrcaAppraiser)(constants_3.platformId, constants_3.clmmPid)],
37
+ [helpers_4.isAnHeliumNFTVote, helpers_4.getHeliumElementsFromNFTs],
34
38
  ]);
35
39
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
36
40
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,4EAAyE;AACzE,mDAA2D;AAC3D,gDAAsD;AACtD,gDAG4B;AAC5B,uGAA+E;AAC/E,uFAAoF;AAEpF,2GAAwG;AASxG,gDAAgD;AAChD,sDAAsD;AACtD,iFAAiF;AACjF,EAAE;AACF,2BAA2B;AAE3B,MAAM,qBAAqB,GAA+B,IAAI,GAAG,CAAC;IAChE,CAAC,4BAAkB,EAAE,iDAAuB,CAAC;IAC7C,CAAC,0BAAgB,EAAE,6CAAqB,CAAC;IACzC,CAAC,2BAAiB,EAAE,mCAAyB,CAAC;CAC/C,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,WAAW,GAAG,I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GAAG,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,IAAI;YAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE3D,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC1D,IAAI,EAAE,CAAC;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,0BAA0B;IACxD,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,4EAAoE;AACpE,mDAA2D;AAC3D,gDAAsD;AACtD,mDAA4E;AAE5E,gDAG4B;AAC5B,uGAA+E;AAC/E,uFAAoF;AAEpF,2GAAwG;AAExG,oDAG8B;AAC9B,uDAGiC;AAIjC,gDAAgD;AAChD,sDAAsD;AACtD,iFAAiF;AACjF,EAAE;AACF,2BAA2B;AAE3B,MAAM,qBAAqB,GAA+B,IAAI,GAAG,CAAC;IAChE,CAAC,4BAAkB,EAAE,iDAAuB,CAAC;IAC7C,CAAC,0BAAgB,EAAE,IAAA,wCAAgB,EAAC,sBAAc,EAAE,4BAAgB,CAAC,C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AAC,UAAU,CAAC,0CAAE,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,iBAAiB,GAAkC,EAAE,CAAC;IAC5D,KAAK,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,qBAAqB,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,IAAI;YAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE3D,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC1D,IAAI,EAAE,CAAC;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,0BAA0B;IACxD,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,3 +1,5 @@
1
+ import { PortfolioAssetCollectible, PortfolioElement } from '@sonarwatch/portfolio-core';
2
+ import { Cache } from '../../Cache';
1
3
  export type TokenData = {
2
4
  address: string;
3
5
  decimals: number;
@@ -33,3 +35,4 @@ export type Token = {
33
35
  index?: string;
34
36
  };
35
37
  };
38
+ export type Appraiser = (cache: Cache, nfts: PortfolioAssetCollectible[]) => Promise<PortfolioElement[]>;