@sonarwatch/portfolio-plugins 0.11.192 → 0.11.194

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/AirdropFetcher.d.ts +11 -0
  4. package/src/AirdropFetcher.js +92 -0
  5. package/src/AirdropFetcher.js.map +1 -0
  6. package/src/index.d.ts +3 -0
  7. package/src/index.js +11 -1
  8. package/src/index.js.map +1 -1
  9. package/src/plugins/aftermath/constants.d.ts +2 -0
  10. package/src/plugins/aftermath/constants.js +3 -1
  11. package/src/plugins/aftermath/constants.js.map +1 -1
  12. package/src/plugins/aftermath/index.js +2 -1
  13. package/src/plugins/aftermath/index.js.map +1 -1
  14. package/src/plugins/aftermath/stakingFetcher.d.ts +3 -0
  15. package/src/plugins/aftermath/stakingFetcher.js +102 -0
  16. package/src/plugins/aftermath/stakingFetcher.js.map +1 -0
  17. package/src/plugins/aftermath/types.d.ts +17 -0
  18. package/src/plugins/drift/airdropFetcher.d.ts +3 -0
  19. package/src/plugins/drift/airdropFetcher.js +65 -0
  20. package/src/plugins/drift/airdropFetcher.js.map +1 -0
  21. package/src/plugins/drift/constants.d.ts +6 -0
  22. package/src/plugins/drift/constants.js +10 -4
  23. package/src/plugins/drift/constants.js.map +1 -1
  24. package/src/plugins/drift/helpersAirdrop.d.ts +3 -0
  25. package/src/plugins/drift/helpersAirdrop.js +59 -0
  26. package/src/plugins/drift/helpersAirdrop.js.map +1 -0
  27. package/src/plugins/drift/index.d.ts +1 -0
  28. package/src/plugins/drift/index.js +5 -2
  29. package/src/plugins/drift/index.js.map +1 -1
  30. package/src/plugins/drift/types.d.ts +12 -0
  31. package/src/plugins/jito/airdropFetcher.js +1 -2
  32. package/src/plugins/jito/airdropFetcher.js.map +1 -1
  33. package/src/plugins/jupiter/launchpad/allocationsFetcher.js +1 -1
  34. package/src/plugins/kamino/airdropFetcher.js +1 -1
  35. package/src/plugins/parcl/airdropFetcher.js +8 -47
  36. package/src/plugins/parcl/airdropFetcher.js.map +1 -1
  37. package/src/plugins/parcl/constants.d.ts +3 -0
  38. package/src/plugins/parcl/constants.js +7 -4
  39. package/src/plugins/parcl/constants.js.map +1 -1
  40. package/src/plugins/parcl/helpersAirdrop.d.ts +19 -0
  41. package/src/plugins/parcl/helpersAirdrop.js +99 -0
  42. package/src/plugins/parcl/helpersAirdrop.js.map +1 -0
  43. package/src/plugins/parcl/index.d.ts +1 -0
  44. package/src/plugins/parcl/index.js +3 -1
  45. package/src/plugins/parcl/index.js.map +1 -1
  46. package/src/plugins/parcl/types.d.ts +6 -1
  47. package/src/plugins/sandglass/constants.d.ts +6 -0
  48. package/src/plugins/sandglass/constants.js +16 -0
  49. package/src/plugins/sandglass/constants.js.map +1 -0
  50. package/src/plugins/sandglass/depositFetcher.d.ts +3 -0
  51. package/src/plugins/sandglass/depositFetcher.js +82 -0
  52. package/src/plugins/sandglass/depositFetcher.js.map +1 -0
  53. package/src/plugins/sandglass/filters.d.ts +3 -0
  54. package/src/plugins/sandglass/filters.js +21 -0
  55. package/src/plugins/sandglass/filters.js.map +1 -0
  56. package/src/plugins/sandglass/index.d.ts +6 -0
  57. package/src/plugins/sandglass/index.js +13 -0
  58. package/src/plugins/sandglass/index.js.map +1 -0
  59. package/src/plugins/sandglass/marketsJob.d.ts +3 -0
  60. package/src/plugins/sandglass/marketsJob.js +97 -0
  61. package/src/plugins/sandglass/marketsJob.js.map +1 -0
  62. package/src/plugins/sandglass/structs.d.ts +150 -0
  63. package/src/plugins/sandglass/structs.js +144 -0
  64. package/src/plugins/sandglass/structs.js.map +1 -0
  65. package/src/plugins/sandglass/types.d.ts +7 -0
  66. package/src/plugins/sandglass/types.js +3 -0
  67. package/src/plugins/sandglass/types.js.map +1 -0
  68. package/src/plugins/tensor/airdropPowerUsersFetcher.d.ts +3 -0
  69. package/src/plugins/tensor/airdropPowerUsersFetcher.js +45 -0
  70. package/src/plugins/tensor/airdropPowerUsersFetcher.js.map +1 -0
  71. package/src/plugins/tensor/constants.d.ts +2 -0
  72. package/src/plugins/tensor/constants.js +3 -1
  73. package/src/plugins/tensor/constants.js.map +1 -1
  74. package/src/plugins/tensor/helpers.d.ts +1 -0
  75. package/src/plugins/tensor/helpers.js +16 -0
  76. package/src/plugins/tensor/helpers.js.map +1 -0
  77. package/src/plugins/tensor/index.js +6 -1
  78. package/src/plugins/tensor/index.js.map +1 -1
  79. package/src/plugins/tensor/powerUsers.json +2898 -0
  80. package/src/plugins/wormhole/airdropFetcher.js +1 -2
  81. package/src/plugins/wormhole/airdropFetcher.js.map +1 -1
@@ -4,3 +4,4 @@ import { Job } from '../../Job';
4
4
  export declare const platforms: Platform[];
5
5
  export declare const jobs: Job[];
6
6
  export declare const fetchers: Fetcher[];
7
+ export { airdropFetcher } from './helpersAirdrop';
@@ -3,12 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchers = exports.jobs = exports.platforms = void 0;
6
+ exports.airdropFetcher = exports.fetchers = exports.jobs = exports.platforms = void 0;
7
7
  const constants_1 = require("./constants");
8
8
  const spotMarketsJob_1 = __importDefault(require("./spotMarketsJob"));
9
9
  const deposits_1 = __importDefault(require("./deposits"));
10
10
  const premarketJob_1 = __importDefault(require("./premarketJob"));
11
+ const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
11
12
  exports.platforms = [constants_1.platform];
12
13
  exports.jobs = [spotMarketsJob_1.default, premarketJob_1.default];
13
- exports.fetchers = [deposits_1.default];
14
+ exports.fetchers = [deposits_1.default, airdropFetcher_1.default];
15
+ var helpersAirdrop_1 = require("./helpersAirdrop");
16
+ Object.defineProperty(exports, "airdropFetcher", { enumerable: true, get: function () { return helpersAirdrop_1.airdropFetcher; } });
14
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,0DAA8C;AAC9C,kEAA0C;AAE7B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,EAAE,sBAAY,CAAC,CAAC;AAC7C,QAAA,QAAQ,GAAc,CAAC,kBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,0DAA8C;AAC9C,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,EAAE,sBAAY,CAAC,CAAC;AAC7C,QAAA,QAAQ,GAAc,CAAC,kBAAoB,EAAE,wBAAc,CAAC,CAAC;AAC1E,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
@@ -7,3 +7,15 @@ export type PreMarketPrice = {
7
7
  id: string;
8
8
  price: number;
9
9
  };
10
+ export type AirdropResponse = {
11
+ claimant: string;
12
+ merkle_tree: string;
13
+ mint: string;
14
+ start_ts: number;
15
+ end_ts: number;
16
+ start_amount: number;
17
+ end_amount: number;
18
+ unvested_amount: number;
19
+ claimed_amount: number;
20
+ error: string;
21
+ };
@@ -47,10 +47,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
47
47
  return [
48
48
  {
49
49
  type: portfolio_core_1.PortfolioElementType.multiple,
50
- label: 'Rewards',
50
+ label: 'Airdrop',
51
51
  networkId: portfolio_core_1.NetworkId.solana,
52
52
  platformId: constants_1.platformId,
53
- name: 'Airdrop',
54
53
  data: {
55
54
  assets,
56
55
  },
@@ -1 +1 @@
1
- {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jito/airdropFetc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,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;QAC5B,MAAM,CAAC,IAAI,CACT,IAAA,gCAAsB,EACpB,mBAAO,EACP,gBAAgB,CAAC,QAAQ,EAAE,EAC3B,0BAAS,CAAC,MAAM,EAChB,UAAU,EACV,SAAS,EACT,EAAE,WAAW,EAAE,YAAY,EAAE,CAC9B,CACF,CAAC;IAEJ,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QAC1B,MAAM,CAAC,IAAI,CACT,IAAA,gCAAsB,EACpB,mBAAO,EACP,cAAc,CAAC,QAAQ,EAAE,EACzB,0BAAS,CAAC,MAAM,EAChB,UAAU,EACV,SAAS,EACT,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CACF,CAAC;IACJ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,MAAM;aACP;YACD,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;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":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jito/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AACrC,kDAA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B,MAAM,CAAC,IAAI,CACT,IAAA,gCAAsB,EACpB,mBAAO,EACP,gBAAgB,CAAC,QAAQ,EAAE,EAC3B,0BAAS,CAAC,MAAM,EAChB,UAAU,EACV,SAAS,EACT,EAAE,WAAW,EAAE,YAAY,EAAE,CAC9B,CACF,CAAC;IAEJ,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QAC1B,MAAM,CAAC,IAAI,CACT,IAAA,gCAAsB,EACpB,mBAAO,EACP,cAAc,CAAC,QAAQ,EAAE,EACzB,0BAAS,CAAC,MAAM,EAChB,UAAU,EACV,SAAS,EACT,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CACF,CAAC;IACJ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE;gBACJ,MAAM;aACP;YACD,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;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"}
@@ -65,7 +65,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
65
65
  return [
66
66
  {
67
67
  type: portfolio_core_1.PortfolioElementType.multiple,
68
- label: 'Rewards',
68
+ label: 'Airdrop',
69
69
  networkId: portfolio_core_1.NetworkId.solana,
70
70
  platformId: constants_1.platformId,
71
71
  name: 'Allocation',
@@ -42,7 +42,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
42
42
  platformId: constants_1.platformId,
43
43
  name: 'Season 1 Airdrop',
44
44
  networkId: portfolio_core_1.NetworkId.solana,
45
- label: 'Rewards',
45
+ label: 'Airdrop',
46
46
  data: { assets: [asset] },
47
47
  value: asset.value,
48
48
  },
@@ -13,67 +13,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const axios_1 = __importDefault(require("axios"));
17
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
16
  const constants_1 = require("./constants");
19
- const helpers_1 = require("../jupiter/helpers");
20
- const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
21
17
  const clients_1 = require("../../utils/clients");
22
- const structs_1 = require("../jupiter/launchpad/structs");
23
18
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
24
- const oneDayInMs = 24 * 60 * 60 * 1000;
25
- const endOfClaim = 1735603200000;
19
+ const helpersAirdrop_1 = require("./helpersAirdrop");
26
20
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
27
- if (Date.now() > endOfClaim)
21
+ if (Date.now() > helpersAirdrop_1.airdropStatics.claimEnd)
28
22
  return [];
29
23
  const client = (0, clients_1.getClientSolana)();
30
- const cachedAllocation = yield cache.getItem(owner, {
31
- prefix: constants_1.allocationPrefix,
32
- networkId: portfolio_core_1.NetworkId.solana,
33
- });
34
- let amount;
35
- let merkleTree;
36
- if (cachedAllocation) {
37
- amount = cachedAllocation.amount;
38
- merkleTree = cachedAllocation.merkle_tree;
39
- }
40
- else {
41
- const allocation = yield axios_1.default
42
- .get(constants_1.airdropApi + owner, {
43
- headers: {
44
- origin: 'https://app.parcl.co',
45
- referer: 'https://app.parcl.co',
46
- },
47
- })
48
- .catch(() => null);
49
- if (allocation) {
50
- merkleTree = allocation.data.merkle_tree;
51
- amount = new bignumber_js_1.default(allocation.data.amount)
52
- .dividedBy(Math.pow(10, constants_1.prclDecimals))
53
- .toNumber();
54
- yield cache.setItem(owner, { amount, merkle_tree: merkleTree }, {
55
- prefix: constants_1.allocationPrefix,
56
- networkId: portfolio_core_1.NetworkId.solana,
57
- ttl: oneDayInMs,
58
- });
59
- }
60
- }
61
- if (!amount || !merkleTree)
24
+ const airdrop = yield (0, helpersAirdrop_1.fetchAirdrop)(owner, client, cache);
25
+ if (airdrop.userStatus !== portfolio_core_1.AirdropUserStatus.claimable &&
26
+ airdrop.userStatus !== portfolio_core_1.AirdropUserStatus.claimableLater)
62
27
  return [];
63
- const claimStatusPubkey = (0, helpers_1.deriveClaimStatus)(owner, merkleTree, constants_1.distributorProgram);
64
- const claimStatusAccounts = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimStatusStruct, claimStatusPubkey);
65
- if (claimStatusAccounts)
28
+ if (!airdrop.amount)
66
29
  return [];
67
- const tokenPrice = yield cache.getTokenPrice(constants_1.prclMint, portfolio_core_1.NetworkId.solana);
68
- const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.prclMint, amount, portfolio_core_1.NetworkId.solana, tokenPrice, undefined, { isClaimable: true });
30
+ const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.prclMint, airdrop.amount, portfolio_core_1.NetworkId.solana, undefined, airdrop.price || undefined, { isClaimable: true });
69
31
  return [
70
32
  {
71
33
  value: asset.value,
72
34
  type: portfolio_core_1.PortfolioElementType.multiple,
73
35
  platformId: constants_1.platformId,
74
- name: 'Allocation',
75
36
  networkId: portfolio_core_1.NetworkId.solana,
76
- label: 'Rewards',
37
+ label: 'Airdrop',
77
38
  data: { assets: [asset] },
78
39
  },
79
40
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E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,CAAC"}
1
+ {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAAmD;AACnD,iDAAsD;AACtD,qGAA6E;AAC7E,qDAAgE;AAEhE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,+BAAc,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEpD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAY,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzD,IACE,OAAO,CAAC,UAAU,KAAK,kCAAiB,CAAC,SAAS;QAClD,OAAO,CAAC,UAAU,KAAK,kCAAiB,CAAC,cAAc;QAEvD,OAAO,EAAE,CAAC;IACZ,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,oBAAQ,EACR,OAAO,CAAC,MAAM,EACd,0BAAS,CAAC,MAAM,EAChB,SAAS,EACT,OAAO,CAAC,KAAK,IAAI,SAAS,EAC1B,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC;IAEF,OAAO;QACL;YACE,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,UAAU,EAAV,sBAAU;YACV,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE;SAC1B;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,6 +1,9 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  import { Platform } from '@sonarwatch/portfolio-core';
3
3
  export declare const platformId = "parcl";
4
+ export declare const platformImage = "https://sonar.watch/img/platforms/parcl.png";
5
+ export declare const platformWebsite = "https://app.parcl.co/";
6
+ export declare const platformName = "Parcl";
4
7
  export declare const platform: Platform;
5
8
  export declare const programId: PublicKey;
6
9
  export declare const usdcMint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.distributorProgram = exports.merkleTree = exports.merkleApi = exports.prclDecimals = exports.prclMint = exports.allocationPrefix = exports.airdropApi = exports.usdcDecimals = exports.usdcMint = exports.programId = exports.platform = exports.platformId = void 0;
3
+ exports.distributorProgram = exports.merkleTree = exports.merkleApi = exports.prclDecimals = exports.prclMint = exports.allocationPrefix = exports.airdropApi = exports.usdcDecimals = exports.usdcMint = exports.programId = exports.platform = exports.platformName = exports.platformWebsite = exports.platformImage = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'parcl';
6
+ exports.platformImage = 'https://sonar.watch/img/platforms/parcl.png';
7
+ exports.platformWebsite = 'https://app.parcl.co/';
8
+ exports.platformName = 'Parcl';
6
9
  exports.platform = {
7
10
  id: exports.platformId,
8
- name: 'Parcl',
9
- image: 'https://sonar.watch/img/platforms/parcl.png',
11
+ name: exports.platformName,
12
+ image: exports.platformImage,
10
13
  defiLlamaId: 'parent#parcl', // from https://defillama.com/docs/api
11
- website: 'https://app.parcl.co/',
14
+ website: exports.platformWebsite,
12
15
  twitter: 'https://twitter.com/Parcl',
13
16
  };
14
17
  exports.programId = new web3_js_1.PublicKey('3parcLrT7WnXAcyPfkCz49oofuuf2guUKkjuFkAhZW8Y');
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,cAAc,EAAE,sCAAsC;IACnE,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,UAAU,GAAG,yCAAyC,CAAC;AACvD,QAAA,gBAAgB,GAAG,GAAG,kBAAU,aAAa,CAAC;AAC9C,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,SAAS,GAAG,uCAAuC,CAAC;AACpD,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAC5D,QAAA,kBAAkB,GAC7B,8CAA8C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,uBAAuB,CAAC;AAC1C,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,cAAc,EAAE,sCAAsC;IACnE,OAAO,EAAE,uBAAe;IACxB,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,UAAU,GAAG,yCAAyC,CAAC;AACvD,QAAA,gBAAgB,GAAG,GAAG,kBAAU,aAAa,CAAC;AAC9C,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,SAAS,GAAG,uCAAuC,CAAC;AACpD,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAC5D,QAAA,kBAAkB,GAC7B,8CAA8C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Airdrop } from '@sonarwatch/portfolio-core';
2
+ import { Allocation } from './types';
3
+ import { Cache } from '../../Cache';
4
+ import { SolanaClient } from '../../utils/clients/types';
5
+ import { AirdropFetcher } from '../../AirdropFetcher';
6
+ export declare function fetchAllocation(owner: string, cache: Cache): Promise<Allocation>;
7
+ export declare const airdropStatics: {
8
+ id: string;
9
+ claimLink: string;
10
+ image: string;
11
+ label: string;
12
+ organizerLink: string;
13
+ organizerName: string;
14
+ claimStart: number;
15
+ claimEnd: number;
16
+ name: undefined;
17
+ };
18
+ export declare function fetchAirdrop(owner: string, client: SolanaClient, cache: Cache): Promise<Airdrop>;
19
+ export declare const airdropFetcher: AirdropFetcher;
@@ -0,0 +1,99 @@
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 = exports.fetchAirdrop = exports.airdropStatics = exports.fetchAllocation = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
19
+ const constants_1 = require("./constants");
20
+ const helpers_1 = require("../jupiter/helpers");
21
+ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
22
+ const structs_1 = require("../jupiter/launchpad/structs");
23
+ const clients_1 = require("../../utils/clients");
24
+ function fetchAllocation(owner, cache) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const cachedAllocation = yield cache.getItem(owner, {
27
+ prefix: constants_1.allocationPrefix,
28
+ networkId: portfolio_core_1.NetworkId.solana,
29
+ });
30
+ if (cachedAllocation)
31
+ return cachedAllocation;
32
+ let allocation;
33
+ const apiResponse = yield axios_1.default.get(constants_1.airdropApi + owner, {
34
+ headers: {
35
+ origin: 'https://app.parcl.co',
36
+ referer: 'https://app.parcl.co',
37
+ },
38
+ validateStatus(status) {
39
+ return status === 200 || status === 404;
40
+ },
41
+ });
42
+ if (apiResponse.data.error ||
43
+ !apiResponse.data.amount ||
44
+ !apiResponse.data.merkle_tree) {
45
+ allocation = {
46
+ amount: 0,
47
+ };
48
+ }
49
+ else {
50
+ const amount = new bignumber_js_1.default(apiResponse.data.amount)
51
+ .dividedBy(Math.pow(10, constants_1.prclDecimals))
52
+ .toNumber();
53
+ allocation = {
54
+ amount,
55
+ merkleTree: apiResponse.data.merkle_tree,
56
+ };
57
+ }
58
+ yield cache.setItem(owner, allocation, {
59
+ prefix: constants_1.allocationPrefix,
60
+ networkId: portfolio_core_1.NetworkId.solana,
61
+ ttl: 86400000, // 24h
62
+ });
63
+ return allocation;
64
+ });
65
+ }
66
+ exports.fetchAllocation = fetchAllocation;
67
+ exports.airdropStatics = {
68
+ id: 'parcl-airdrop-1',
69
+ claimLink: 'https://claims.parcllimited.com/',
70
+ image: constants_1.platformImage,
71
+ label: 'PRCL',
72
+ organizerLink: constants_1.platformWebsite,
73
+ organizerName: constants_1.platformName,
74
+ claimStart: 0,
75
+ claimEnd: 1735603200000,
76
+ name: undefined,
77
+ };
78
+ function fetchAirdrop(owner, client, cache) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const prclTokenPrice = yield cache.getTokenPrice(constants_1.prclMint, portfolio_core_1.NetworkId.solana);
81
+ const allocation = yield fetchAllocation(owner, cache);
82
+ if (allocation.amount === 0 || !allocation.merkleTree)
83
+ return Object.assign(Object.assign(Object.assign({}, exports.airdropStatics), (0, portfolio_core_1.getAirdropStatus)(exports.airdropStatics.claimStart, exports.airdropStatics.claimEnd)), { price: (prclTokenPrice === null || prclTokenPrice === void 0 ? void 0 : prclTokenPrice.price) || null });
84
+ const claimStatusPubkey = (0, helpers_1.deriveClaimStatus)(owner, allocation.merkleTree, constants_1.distributorProgram);
85
+ const claimStatusAccounts = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimStatusStruct, claimStatusPubkey);
86
+ const isClaimed = claimStatusAccounts !== null;
87
+ return Object.assign(Object.assign(Object.assign({}, exports.airdropStatics), (0, portfolio_core_1.getAirdropStatus)(exports.airdropStatics.claimStart, exports.airdropStatics.claimEnd, allocation.amount, isClaimed)), { amount: allocation.amount, price: (prclTokenPrice === null || prclTokenPrice === void 0 ? void 0 : prclTokenPrice.price) || null });
88
+ });
89
+ }
90
+ exports.fetchAirdrop = fetchAirdrop;
91
+ exports.airdropFetcher = {
92
+ id: exports.airdropStatics.id,
93
+ networkId: portfolio_core_1.NetworkId.solana,
94
+ executor: (owner, cache) => {
95
+ const client = (0, clients_1.getClientSolana)();
96
+ return fetchAirdrop(owner, client, cache);
97
+ },
98
+ };
99
+ //# sourceMappingURL=helpersAirdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpersAirdrop.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/helpersAirdrop.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,gEAAqC;AACrC,+DAIoC;AACpC,2CASqB;AAGrB,gDAAuD;AACvD,kFAA+E;AAE/E,0DAAiE;AAEjE,iDAAsD;AAEtD,SAAsB,eAAe,CACnC,KAAa,EACb,KAAY;;QAEZ,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAa,KAAK,EAAE;YAC9D,MAAM,EAAE,4BAAgB;YACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC,CAAC;QACH,IAAI,gBAAgB;YAAE,OAAO,gBAAgB,CAAC;QAE9C,IAAI,UAAsB,CAAC;QAC3B,MAAM,WAAW,GAAG,MAAM,eAAK,CAAC,GAAG,CAGjC,sBAAU,GAAG,KAAK,EAAE;YACpB,OAAO,EAAE;gBACP,MAAM,EAAE,sBAAsB;gBAC9B,OAAO,EAAE,sBAAsB;aAChC;YACD,cAAc,CAAC,MAAM;gBACnB,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;YAC1C,CAAC;SACF,CAAC,CAAC;QAEH,IACE,WAAW,CAAC,IAAI,CAAC,KAAK;YACtB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM;YACxB,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAC7B,CAAC;YACD,UAAU,GAAG;gBACX,MAAM,EAAE,CAAC;aACV,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;iBAClD,SAAS,CAAC,SAAA,EAAE,EAAI,wBAAY,CAAA,CAAC;iBAC7B,QAAQ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M,IAAA,2CAAoB,EACpD,MAAM,EACN,2BAAiB,EACjB,iBAAiB,CAClB,CAAC;QACF,MAAM,SAAS,GAAG,mBAAmB,KAAK,IAAI,CAAC;QAE/C,qDACK,sBAAc,GACd,IAAA,iCAAgB,EACjB,sBAAc,CAAC,UAAU,EACzB,sBAAc,CAAC,QAAQ,EACvB,UAAU,CAAC,MAAM,EACjB,SAAS,CACV,KACD,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,KAAK,EAAE,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,KAAI,IAAI,IACpC;IACJ,CAAC;CAAA;AArCD,oCAqCC;AAEY,QAAA,cAAc,GAAmB;IAC5C,EAAE,EAAE,sBAAc,CAAC,EAAE;IACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Platform } from '@sonarwatch/portfolio-core';
2
2
  import { Fetcher } from '../../Fetcher';
3
3
  import { Job } from '../../Job';
4
+ export { airdropFetcher } from './helpersAirdrop';
4
5
  export declare const platforms: Platform[];
5
6
  export declare const jobs: Job[];
6
7
  export declare const fetchers: Fetcher[];
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchers = exports.jobs = exports.platforms = void 0;
6
+ exports.fetchers = exports.jobs = exports.platforms = exports.airdropFetcher = void 0;
7
7
  const constants_1 = require("./constants");
8
8
  const depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
9
9
  const marginFetcher_1 = __importDefault(require("./marginFetcher"));
10
10
  const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
11
+ var helpersAirdrop_1 = require("./helpersAirdrop");
12
+ Object.defineProperty(exports, "airdropFetcher", { enumerable: true, get: function () { return helpersAirdrop_1.airdropFetcher; } });
11
13
  exports.platforms = [constants_1.platform];
12
14
  exports.jobs = [];
13
15
  exports.fetchers = [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,oEAA4C;AAC5C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc;IACjC,yBAAe;IACf,uBAAa;IACb,wBAAc;CACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,oEAA4C;AAC5C,sEAA8C;AAE9C,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACV,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc;IACjC,yBAAe;IACf,uBAAa;IACb,wBAAc;CACf,CAAC"}
@@ -1,4 +1,9 @@
1
1
  export type Allocation = {
2
2
  amount: number;
3
- merkle_tree: string;
3
+ merkleTree?: string;
4
+ };
5
+ export type ApiAirdropResponse = {
6
+ amount?: number;
7
+ merkle_tree?: string;
8
+ error?: string;
4
9
  };
@@ -0,0 +1,6 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Platform } from '@sonarwatch/portfolio-core';
3
+ export declare const platformId = "sandglass";
4
+ export declare const platform: Platform;
5
+ export declare const programId: PublicKey;
6
+ export declare const marketsInfoKey = "markets";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.marketsInfoKey = exports.programId = exports.platform = exports.platformId = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ exports.platformId = 'sandglass';
6
+ exports.platform = {
7
+ id: exports.platformId,
8
+ name: 'Sandglass',
9
+ image: 'https://sonar.watch/img/platforms/sandglass.webp',
10
+ // defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
11
+ website: 'https://sandglass.so/',
12
+ twitter: 'https://twitter.com/sandglass_so',
13
+ };
14
+ exports.programId = new web3_js_1.PublicKey('SANDsy8SBzwUE8Zio2mrYZYqL52Phr2WQb9DDKuXMVK');
15
+ exports.marketsInfoKey = 'markets';
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sandglass/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,kDAAkD;IACzD,qEAAqE;IACrE,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,kCAAkC;CAC5C,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,6CAA6C,CAC9C,CAAC;AACW,QAAA,cAAc,GAAG,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,82 @@
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 filters_1 = require("./filters");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.sandglassAccountStruct, constants_1.programId, (0, filters_1.userAccountFilters)(owner));
25
+ if (accounts.length === 0)
26
+ return [];
27
+ const marketsInfos = yield cache.getItem(constants_1.marketsInfoKey, {
28
+ prefix: constants_1.platformId,
29
+ networkId: portfolio_core_1.NetworkId.solana,
30
+ });
31
+ if (!marketsInfos)
32
+ return [];
33
+ const marketInfoById = new Map();
34
+ marketsInfos.forEach((marketInfo) => marketInfoById.set(marketInfo.pubkey.toString(), marketInfo));
35
+ const mints = marketsInfos
36
+ .map((marketInfo) => [
37
+ marketInfo.ptMint,
38
+ marketInfo.ytMint,
39
+ // marketInfo.lpMint,
40
+ // marketInfo.syMint,
41
+ ])
42
+ .flat();
43
+ const tokenPriceById = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.solana);
44
+ const assets = [];
45
+ for (const account of accounts) {
46
+ const market = marketInfoById.get(account.marketAccount.toString());
47
+ if (!market)
48
+ continue;
49
+ const { stakePtAmount, stakeYtAmount } = account.stakeInfo;
50
+ const ptPrice = tokenPriceById.get(market.ptMint);
51
+ const ytPrice = tokenPriceById.get(market.ytMint);
52
+ if (ptPrice && !stakePtAmount.isZero()) {
53
+ const amount = stakePtAmount.dividedBy(Math.pow(10, ptPrice.decimals)).toNumber();
54
+ assets.push((0, tokenPriceToAssetToken_1.default)(market.ptMint, amount, portfolio_core_1.NetworkId.solana, ptPrice));
55
+ }
56
+ if (ytPrice && !stakeYtAmount.isZero()) {
57
+ const amount = stakeYtAmount.dividedBy(Math.pow(10, ytPrice.decimals)).toNumber();
58
+ assets.push((0, tokenPriceToAssetToken_1.default)(market.ytMint, amount, portfolio_core_1.NetworkId.solana, ytPrice));
59
+ }
60
+ }
61
+ if (assets.length === 0)
62
+ return [];
63
+ return [
64
+ {
65
+ label: 'Staked',
66
+ networkId: portfolio_core_1.NetworkId.solana,
67
+ platformId: constants_1.platformId,
68
+ type: 'multiple',
69
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
70
+ data: {
71
+ assets,
72
+ },
73
+ },
74
+ ];
75
+ });
76
+ const fetcher = {
77
+ id: `${constants_1.platformId}-deposit`,
78
+ networkId: portfolio_core_1.NetworkId.solana,
79
+ executor,
80
+ };
81
+ exports.default = fetcher;
82
+ //# sourceMappingURL=depositFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depositFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sandglass/depositFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAAoE;AACpE,iDAAsD;AACtD,+CAA8D;AAC9D,uCAAmD;AACnD,uCAA+C;AAE/C,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,MAAM,EACN,gCAAsB,EACt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C;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GetProgramAccountsFilter } from '@solana/web3.js';
2
+ export declare const userAccountFilters: (owner: string) => GetProgramAccountsFilter[];
3
+ export declare const marketAccountFilters: GetProgramAccountsFilter[];
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.marketAccountFilters = exports.userAccountFilters = void 0;
4
+ const userAccountFilters = (owner) => [
5
+ {
6
+ memcmp: {
7
+ offset: 41,
8
+ bytes: owner,
9
+ },
10
+ },
11
+ {
12
+ dataSize: 416,
13
+ },
14
+ ];
15
+ exports.userAccountFilters = userAccountFilters;
16
+ exports.marketAccountFilters = [
17
+ {
18
+ dataSize: 1104,
19
+ },
20
+ ];
21
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sandglass/filters.ts"],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,GAAG,CAChC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,GAAG;KACd;CACF,CAAC;AAZW,QAAA,kBAAkB,sBAY7B;AAEW,QAAA,oBAAoB,GAA+B;IAC9D;QACE,QAAQ,EAAE,IAAI;KACf;CACF,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,13 @@
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 depositFetcher_1 = __importDefault(require("./depositFetcher"));
9
+ const marketsJob_1 = __importDefault(require("./marketsJob"));
10
+ exports.platforms = [constants_1.platform];
11
+ exports.jobs = [marketsJob_1.default];
12
+ exports.fetchers = [depositFetcher_1.default];
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sandglass/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,8DAAqC;AAExB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAS,CAAC,CAAC;AAC1B,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;