@sonarwatch/portfolio-plugins 0.11.193 → 0.11.194

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/CHANGELOG.md +1513 -1509
  2. package/README.md +3 -3
  3. package/package.json +2 -2
  4. package/src/AirdropFetcher.d.ts +11 -0
  5. package/src/AirdropFetcher.js +92 -0
  6. package/src/AirdropFetcher.js.map +1 -0
  7. package/src/index.d.ts +3 -0
  8. package/src/index.js +6 -1
  9. package/src/index.js.map +1 -1
  10. package/src/plugins/balancer/helpers/pools.js +21 -21
  11. package/src/plugins/drift/airdropFetcher.js +7 -21
  12. package/src/plugins/drift/airdropFetcher.js.map +1 -1
  13. package/src/plugins/drift/constants.d.ts +4 -0
  14. package/src/plugins/drift/constants.js +8 -4
  15. package/src/plugins/drift/constants.js.map +1 -1
  16. package/src/plugins/drift/helpersAirdrop.d.ts +3 -0
  17. package/src/plugins/drift/helpersAirdrop.js +59 -0
  18. package/src/plugins/drift/helpersAirdrop.js.map +1 -0
  19. package/src/plugins/drift/index.d.ts +1 -0
  20. package/src/plugins/drift/index.js +3 -1
  21. package/src/plugins/drift/index.js.map +1 -1
  22. package/src/plugins/parcl/airdropFetcher.js +7 -45
  23. package/src/plugins/parcl/airdropFetcher.js.map +1 -1
  24. package/src/plugins/parcl/constants.d.ts +3 -0
  25. package/src/plugins/parcl/constants.js +7 -4
  26. package/src/plugins/parcl/constants.js.map +1 -1
  27. package/src/plugins/parcl/helpersAirdrop.d.ts +19 -0
  28. package/src/plugins/parcl/helpersAirdrop.js +99 -0
  29. package/src/plugins/parcl/helpersAirdrop.js.map +1 -0
  30. package/src/plugins/parcl/index.d.ts +1 -0
  31. package/src/plugins/parcl/index.js +3 -1
  32. package/src/plugins/parcl/index.js.map +1 -1
  33. package/src/plugins/parcl/types.d.ts +6 -1
  34. package/src/plugins/sandglass/marketsJob.js +3 -2
  35. package/src/plugins/sandglass/marketsJob.js.map +1 -1
  36. package/src/plugins/sushiswap/helpers.js +24 -24
  37. package/src/plugins/uniswap-v2/helpers.js +22 -22
  38. package/src/utils/sei/constants.js +8 -8
  39. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @sonarwatch/portfolio-plugins
2
-
3
- This library is @sonarwatch/portfolio-plugins
1
+ # @sonarwatch/portfolio-plugins
2
+
3
+ This library is @sonarwatch/portfolio-plugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.193",
3
+ "version": "0.11.194",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.193"
44
+ "@sonarwatch/portfolio-core": "0.11.194"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -0,0 +1,11 @@
1
+ import { AddressSystemType, Airdrop, AirdropFetcherResult, AirdropFetchersResult, NetworkIdType } from '@sonarwatch/portfolio-core';
2
+ import { Cache } from './Cache';
3
+ export type AirdropFetcherExecutor = (owner: string, cache: Cache) => Promise<Airdrop>;
4
+ export type AirdropFetcher = {
5
+ id: string;
6
+ networkId: NetworkIdType;
7
+ executor: AirdropFetcherExecutor;
8
+ };
9
+ export declare function runAirdropFetchersByNetworkId(owner: string, networkId: NetworkIdType, fetchers: AirdropFetcher[], cache: Cache): Promise<AirdropFetchersResult>;
10
+ export declare function runAirdropFetchers(owner: string, addressSystem: AddressSystemType, fetchers: AirdropFetcher[], cache: Cache): Promise<AirdropFetchersResult>;
11
+ export declare function runAirdropFetcher(owner: string, fetcher: AirdropFetcher, cache: Cache): Promise<AirdropFetcherResult>;
@@ -0,0 +1,92 @@
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.runAirdropFetcher = exports.runAirdropFetchers = exports.runAirdropFetchersByNetworkId = void 0;
16
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
17
+ const promiseTimeout_1 = __importDefault(require("./utils/misc/promiseTimeout"));
18
+ const runAirdropFetcherTimeout = 10000;
19
+ function runAirdropFetchersByNetworkId(owner, networkId, fetchers, cache) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const isFetchersValids = fetchers.every((f) => f.networkId === networkId);
22
+ if (!isFetchersValids)
23
+ throw new Error(`Not all airdrop fetchers have the right network id: ${networkId}`);
24
+ const { addressSystem } = portfolio_core_1.networks[networkId];
25
+ return runAirdropFetchers(owner, addressSystem, fetchers, cache);
26
+ });
27
+ }
28
+ exports.runAirdropFetchersByNetworkId = runAirdropFetchersByNetworkId;
29
+ function runAirdropFetchers(owner, addressSystem, fetchers, cache) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const fOwner = (0, portfolio_core_1.formatAddress)(owner, addressSystem);
32
+ const isFetchersValids = fetchers.every((f) => portfolio_core_1.networks[f.networkId].addressSystem === addressSystem);
33
+ if (!isFetchersValids)
34
+ throw new Error(`Not all fetchers have the right address system: ${addressSystem}`);
35
+ const promises = fetchers.map((f) => runAirdropFetcher(fOwner, f, cache));
36
+ const result = yield Promise.allSettled(promises);
37
+ const fReports = [];
38
+ const airdrops = result.flatMap((r, index) => {
39
+ let fReport;
40
+ if (r.status === 'fulfilled') {
41
+ fReport = {
42
+ id: fetchers[index].id,
43
+ status: 'succeeded',
44
+ duration: r.value.duration,
45
+ error: undefined,
46
+ };
47
+ }
48
+ else {
49
+ fReport = {
50
+ id: fetchers[index].id,
51
+ status: 'failed',
52
+ duration: undefined,
53
+ error: r.reason.message || 'Unknown error',
54
+ };
55
+ }
56
+ fReports.push(fReport);
57
+ if (r.status === 'rejected')
58
+ return [];
59
+ return r.value.airdrop;
60
+ });
61
+ return {
62
+ date: Date.now(),
63
+ owner: fOwner,
64
+ addressSystem,
65
+ fetcherReports: fReports,
66
+ airdrops,
67
+ };
68
+ });
69
+ }
70
+ exports.runAirdropFetchers = runAirdropFetchers;
71
+ function runAirdropFetcher(owner, fetcher, cache) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const startDate = Date.now();
74
+ const fOwner = (0, portfolio_core_1.formatAddressByNetworkId)(owner, fetcher.networkId);
75
+ const fetcherPromise = fetcher
76
+ .executor(fOwner, cache)
77
+ .then((airdrop) => {
78
+ const now = Date.now();
79
+ return {
80
+ owner: fOwner,
81
+ fetcherId: fetcher.id,
82
+ networdkId: fetcher.networkId,
83
+ duration: now - startDate,
84
+ airdrop,
85
+ date: now,
86
+ };
87
+ });
88
+ return (0, promiseTimeout_1.default)(fetcherPromise, runAirdropFetcherTimeout, `Fetcher timed out: ${fetcher.id}`);
89
+ });
90
+ }
91
+ exports.runAirdropFetcher = runAirdropFetcher;
92
+ //# sourceMappingURL=AirdropFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirdropFetcher.js","sourceRoot":"","sources":["../../../../packages/plugins/src/AirdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAUoC;AAEpC,iFAAyD;AAazD,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC,SAAsB,6BAA6B,CACjD,KAAa,EACb,SAAwB,EACxB,QAA0B,EAC1B,KAAY;;QAEZ,MA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CAAC,SAAS;gBAC7B,QAAQ,EAAE,GAAG,GAAG,SAAS;gBACzB,OAAO;gBACP,IAAI,EAAE,GAAG;aACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACL,OAAO,IAAA,wBAAc,EACnB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,OAAO,CAAC,EAAE,EAAE,CACnC,CAAC;IACJ,CAAC;CAAA;AAzBD,8CAyBC"}
package/src/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { Platform } from '@sonarwatch/portfolio-core';
2
2
  import { Fetcher } from './Fetcher';
3
+ import { AirdropFetcher } from './AirdropFetcher';
3
4
  import { Job } from './Job';
4
5
  export { walletTokensPlatform, walletNftsPlatform, } from './plugins/tokens/constants';
5
6
  export { getFetchersByAddressSystem } from './utils/misc/getFetchersByAddressSystem';
6
7
  export * from './Cache';
7
8
  export * from './Fetcher';
9
+ export * from './AirdropFetcher';
8
10
  export * from './Job';
9
11
  export * from './utils/name-service';
10
12
  export * from './utils/blank';
@@ -13,3 +15,4 @@ export declare const platforms: Platform[];
13
15
  export declare const jobs: Job[];
14
16
  export declare const fetchers: Fetcher[];
15
17
  export declare const fetchersByAddressSystem: Record<import("@sonarwatch/portfolio-core").AddressSystemType, Fetcher[]>;
18
+ export declare const airdropFetchers: AirdropFetcher[];
package/src/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = exports.getLlamaProtocolsJob = exports.getFetchersByAddressSystem = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
20
+ exports.airdropFetchers = exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = exports.getLlamaProtocolsJob = exports.getFetchersByAddressSystem = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
21
21
  const getFetchersByAddressSystem_1 = require("./utils/misc/getFetchersByAddressSystem");
22
22
  const orphanPlatorms_1 = __importDefault(require("./orphanPlatorms"));
23
23
  const tokens_1 = require("./plugins/tokens");
@@ -115,6 +115,7 @@ var getFetchersByAddressSystem_2 = require("./utils/misc/getFetchersByAddressSys
115
115
  Object.defineProperty(exports, "getFetchersByAddressSystem", { enumerable: true, get: function () { return getFetchersByAddressSystem_2.getFetchersByAddressSystem; } });
116
116
  __exportStar(require("./Cache"), exports);
117
117
  __exportStar(require("./Fetcher"), exports);
118
+ __exportStar(require("./AirdropFetcher"), exports);
118
119
  __exportStar(require("./Job"), exports);
119
120
  __exportStar(require("./utils/name-service"), exports);
120
121
  __exportStar(require("./utils/blank"), exports);
@@ -380,4 +381,8 @@ exports.fetchers = [
380
381
  ...sandglass_1.fetchers,
381
382
  ];
382
383
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
384
+ exports.airdropFetchers = [
385
+ drift_1.airdropFetcher,
386
+ parcl_1.airdropFetcher,
387
+ ];
383
388
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,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,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAI6B;AAC7B,qDAG8B;AAC9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G,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,yBAAkB;IACrB,GAAG,eAAY;IACf,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;CACrB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC"}
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
36
36
  const graphql_request_1 = __importStar(require("graphql-request"));
37
37
  function getBalancerPoolsV2(url) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const query = (0, graphql_request_1.gql) `
40
- query pools {
41
- pools(
42
- first: 1000
43
- orderBy: totalLiquidity
44
- orderDirection: desc
45
- where: { totalLiquidity_gt: "500" }
46
- ) {
47
- id
48
- address
49
- symbol
50
- totalLiquidity
51
- totalShares
52
- tokens {
53
- balance
54
- decimals
55
- symbol
56
- address
57
- }
58
- }
59
- }
39
+ const query = (0, graphql_request_1.gql) `
40
+ query pools {
41
+ pools(
42
+ first: 1000
43
+ orderBy: totalLiquidity
44
+ orderDirection: desc
45
+ where: { totalLiquidity_gt: "500" }
46
+ ) {
47
+ id
48
+ address
49
+ symbol
50
+ totalLiquidity
51
+ totalShares
52
+ tokens {
53
+ balance
54
+ decimals
55
+ symbol
56
+ address
57
+ }
58
+ }
59
+ }
60
60
  `;
61
61
  const res = yield (0, graphql_request_1.default)(url, query);
62
62
  const pools = res.pools;
@@ -13,34 +13,20 @@ 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
17
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
- const driftFactor = new bignumber_js_1.default(Math.pow(10, constants_1.driftDecimals));
18
+ const helpersAirdrop_1 = require("./helpersAirdrop");
21
19
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
22
- const res = yield axios_1.default
23
- .get(constants_1.airdropUrl + owner, {
24
- headers: {
25
- Origin: 'https://drift.foundation',
26
- Referer: 'https://drift.foundation/',
27
- },
28
- timeout: 1000,
29
- })
30
- .catch(() => null);
31
- if (!res || res.data.error || res.data.start_amount === 0)
32
- return [];
33
20
  // const client = getClientSolana();
34
21
  // const claimStatus = deriveClaimStatus(owner, res.data.merkle_tree, '');
35
22
  // const account = await client.getAccountInfo(claimStatus);
36
23
  // if (account) return [];
37
- const { mint } = res.data;
38
- const tokenPrice = mint !== portfolio_core_1.solanaNativeAddress
39
- ? yield cache.getTokenPrice(res.data.mint, portfolio_core_1.NetworkId.solana)
24
+ const amount = yield (0, helpersAirdrop_1.fetchAirdropAmount)(owner);
25
+ if (amount === 0)
26
+ return [];
27
+ const tokenPrice = constants_1.driftMint
28
+ ? yield cache.getTokenPrice(constants_1.driftMint, portfolio_core_1.NetworkId.solana)
40
29
  : undefined;
41
- const amount = new bignumber_js_1.default(res.data.start_amount)
42
- .dividedBy(driftFactor)
43
- .toNumber();
44
30
  const asset = tokenPrice
45
31
  ? (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice)
46
32
  : {
@@ -52,7 +38,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
52
38
  imageUri: constants_1.platform.image,
53
39
  },
54
40
  attributes: {
55
- lockedUntil: 0,
41
+ lockedUntil: -1,
56
42
  },
57
43
  networkId: portfolio_core_1.NetworkId.solana,
58
44
  value: null,
@@ -1 +1 @@
1
- {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAA8E;AAI9E,qGAA6E;AAE7E,MAAM,WAAW,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,yBAAa,CAAA,CAAC,CAAC;AAEvD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,GAAG,GAA0C,MAAM,eAAK;SAC3D,GAAG,CAAC,sBAAU,GAAG,KAAK,EAAE;QACvB,OAAO,EAAE;YACP,MAAM,EAAE,0BAA0B;YAClC,OAAO,EAAE,2BAA2B;SACrC;QACD,OAAO,EAAE,IAAI;KACd,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAErB,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErE,oCAAoC;IACpC,0EAA0E;IAC1E,4DAA4D;IAC5D,0BAA0B;IAE1B,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;IAC1B,MAAM,UAAU,GACd,IAAI,KAAK,oCAAmB;QAC1B,CAAC,CAAC,MAAM,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,0BAAS,CAAC,MAAM,CAAC;QAC5D,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;SAChD,SAAS,CAAC,WAAW,CAAC;SACtB,QAAQ,EAAE,CAAC;IAEd,MAAM,KAAK,GAAmB,UAAU;QACtC,CAAC,CAAC,IAAA,gCAAsB,EACpB,UAAU,CAAC,OAAO,EAClB,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX;QACH,CAAC,CAAC;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,MAAM;gBACN,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,oBAAQ,CAAC,KAAK;aACzB;YACD,UAAU,EAAE;gBACV,WAAW,EAAE,CAAC;aACf;YACD,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,IAAI;SACZ,CAAC;IAEN,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC,KAAK,CAAC;aAChB;YACD,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,SAAS;SACjB;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/drift/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAA8D;AAC9D,qGAA6E;AAC7E,qDAAsD;AAEtD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,oCAAoC;IACpC,0EAA0E;IAC1E,4DAA4D;IAC5D,0BAA0B;IAE1B,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAkB,EAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE5B,MAAM,UAAU,GAAG,qBAAS;QAC1B,CAAC,CAAC,MAAM,KAAK,CAAC,aAAa,CAAC,qBAAS,EAAE,0BAAS,CAAC,MAAM,CAAC;QACxD,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,KAAK,GAAmB,UAAU;QACtC,CAAC,CAAC,IAAA,gCAAsB,EACpB,UAAU,CAAC,OAAO,EAClB,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX;QACH,CAAC,CAAC;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,MAAM;gBACN,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,oBAAQ,CAAC,KAAK;aACzB;YACD,UAAU,EAAE;gBACV,WAAW,EAAE,CAAC,CAAC;aAChB;YACD,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,IAAI;SACZ,CAAC;IAEN,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC,KAAK,CAAC;aAChB;YACD,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,SAAS;SACjB;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,9 +1,13 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  import { Platform } from '@sonarwatch/portfolio-core';
3
3
  export declare const platformId = "drift";
4
+ export declare const platformName = "Drift";
5
+ export declare const platformImage = "https://sonar.watch/img/platforms/drift.png";
6
+ export declare const platformWebsite = "https://www.drift.trade/";
4
7
  export declare const platform: Platform;
5
8
  export declare const prefixSpotMarkets = "drift-spotMarkets";
6
9
  export declare const driftProgram: PublicKey;
7
10
  export declare const preMarketPriceKey = "premarketPrice";
8
11
  export declare const airdropUrl = "https://airdrop.drift.trade/eligibility/";
9
12
  export declare const driftDecimals = 6;
13
+ export declare const driftMint: undefined;
@@ -1,18 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.driftDecimals = exports.airdropUrl = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformId = void 0;
3
+ exports.driftMint = exports.driftDecimals = exports.airdropUrl = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformWebsite = exports.platformImage = exports.platformName = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'drift';
6
+ exports.platformName = 'Drift';
7
+ exports.platformImage = 'https://sonar.watch/img/platforms/drift.png';
8
+ exports.platformWebsite = 'https://www.drift.trade/';
6
9
  exports.platform = {
7
10
  id: exports.platformId,
8
- name: 'Drift',
9
- image: 'https://sonar.watch/img/platforms/drift.png',
11
+ name: exports.platformName,
12
+ image: exports.platformImage,
10
13
  defiLlamaId: 'drift',
11
- website: 'https://www.drift.trade/',
14
+ website: exports.platformWebsite,
12
15
  };
13
16
  exports.prefixSpotMarkets = `${exports.platformId}-spotMarkets`;
14
17
  exports.driftProgram = new web3_js_1.PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH');
15
18
  exports.preMarketPriceKey = 'premarketPrice';
16
19
  exports.airdropUrl = 'https://airdrop.drift.trade/eligibility/';
17
20
  exports.driftDecimals = 6;
21
+ exports.driftMint = undefined;
18
22
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/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,OAAO;IACpB,OAAO,EAAE,0BAA0B;CACpC,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AAErC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,aAAa,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AAErC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AirdropFetcher } from '../../AirdropFetcher';
2
+ export declare function fetchAirdropAmount(owner: string): Promise<number>;
3
+ export declare const airdropFetcher: AirdropFetcher;
@@ -0,0 +1,59 @@
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.fetchAirdropAmount = void 0;
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const axios_1 = __importDefault(require("axios"));
18
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
19
+ const constants_1 = require("./constants");
20
+ const driftFactor = new bignumber_js_1.default(Math.pow(10, constants_1.driftDecimals));
21
+ function fetchAirdropAmount(owner) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const res = yield axios_1.default.get(constants_1.airdropUrl + owner, {
24
+ headers: {
25
+ Origin: 'https://drift.foundation',
26
+ Referer: 'https://drift.foundation/',
27
+ },
28
+ timeout: 1000,
29
+ validateStatus(status) {
30
+ return status === 404 || status === 200;
31
+ },
32
+ });
33
+ return new bignumber_js_1.default(res.data.start_amount || 0)
34
+ .dividedBy(driftFactor)
35
+ .toNumber();
36
+ });
37
+ }
38
+ exports.fetchAirdropAmount = fetchAirdropAmount;
39
+ const airdropStatics = {
40
+ claimLink: 'https://drift.foundation/eligibility',
41
+ id: 'drift-airdrop-1',
42
+ image: constants_1.platformImage,
43
+ label: 'DRIFT',
44
+ name: undefined,
45
+ organizerName: constants_1.platformName,
46
+ organizerLink: constants_1.platformWebsite,
47
+ claimStart: undefined,
48
+ claimEnd: undefined,
49
+ };
50
+ const fetchAirdropExecutor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
51
+ const amount = yield fetchAirdropAmount(owner);
52
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, airdropStatics), { amount }), (0, portfolio_core_1.getAirdropStatus)(airdropStatics.claimStart, airdropStatics.claimEnd, amount)), { price: null });
53
+ });
54
+ exports.airdropFetcher = {
55
+ id: airdropStatics.id,
56
+ networkId: portfolio_core_1.NetworkId.solana,
57
+ executor: fetchAirdropExecutor,
58
+ };
59
+ //# sourceMappingURL=helpersAirdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpersAirdrop.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/helpersAirdrop.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,kDAA6C;AAC7C,+DAAyE;AACzE,2CAMqB;AAIrB,MAAM,WAAW,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,yBAAa,CAAA,CAAC,CAAC;AACvD,SAAsB,kBAAkB,CAAC,KAAa;;QACpD,MAAM,GAAG,GAAmC,MAAM,eAAK,CAAC,GAAG,CACzD,sBAAU,GAAG,KAAK,EAClB;YACE,OAAO,EAAE;gBACP,MAAM,EAAE,0BAA0B;gBAClC,OAAO,EAAE,2BAA2B;aACrC;YACD,OAAO,EAAE,IAAI;YACb,cAAc,CAAC,MAAM;gBACnB,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;YAC1C,CAAC;SACF,CACF,CAAC;QACF,OAAO,IAAI,sBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;aAC7C,SAAS,CAAC,WAAW,CAAC;aACtB,QAAQ,EAAE,CAAC;IAChB,CAAC;CAAA;AAjBD,gDAiBC;AAED,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE,sCAAsC;IACjD,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,yBAAa;IACpB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,wBAAY;IAC3B,aAAa,EAAE,2BAAe;IAC9B,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;CACpB,CAAC;AACF,MAAM,oBAAoB,GAA2B,CAAO,KAAa,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,mEACK,cAAc,KACjB,MAAM,KACH,IAAA,iCAAgB,EACjB,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,QAAQ,EACvB,MAAM,CACP,KACD,KAAK,EAAE,IAAI,IACX;AACJ,CAAC,CAAA,CAAC;AAEW,QAAA,cAAc,GAAmB;IAC5C,EAAE,EAAE,cAAc,CAAC,EAAE;IACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,oBAAoB;CAC/B,CAAC"}
@@ -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,7 +3,7 @@ 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"));
@@ -12,4 +12,6 @@ const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
12
12
  exports.platforms = [constants_1.platform];
13
13
  exports.jobs = [spotMarketsJob_1.default, premarketJob_1.default];
14
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; } });
15
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;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"}
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"}
@@ -13,59 +13,21 @@ 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,
@@ -1 +1 @@
1
- {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAC7E,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAOqB;AAErB,gDAAuD;AACvD,kFAA+E;AAC/E,iDAAsD;AACtD,0DAAiE;AACjE,qGAA6E;AAE7E,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACvC,MAAM,UAAU,GAAG,aAAa,CAAC;AACjC,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU;QAAE,OAAO,EAAE,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAa,KAAK,EAAE;QAC9D,MAAM,EAAE,4BAAgB;QACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC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aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,oBAAQ,EACR,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,EACV,SAAS,EACT,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
+ {"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;