@sonarwatch/portfolio-core 0.11.193 → 0.11.195

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,10 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.11.193](https://github.com/sonarwatch/portfolio/compare/core-0.11.192...core-0.11.193) (2024-05-02)
5
+ ## [0.11.195](https://github.com/sonarwatch/portfolio/compare/core-0.11.194...core-0.11.195) (2024-05-04)
6
6
 
7
7
 
8
8
 
9
+ ## [0.11.194](https://github.com/sonarwatch/portfolio/compare/core-0.11.193...core-0.11.194) (2024-05-04)
10
+
11
+
12
+
13
+ ## [0.11.193](https://github.com/sonarwatch/portfolio/compare/core-0.11.192...core-0.11.193) (2024-05-02)
14
+
15
+
16
+
9
17
  ## [0.11.192](https://github.com/sonarwatch/portfolio/compare/core-0.11.191...core-0.11.192) (2024-05-02)
10
18
 
11
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-core",
3
- "version": "0.11.193",
3
+ "version": "0.11.195",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "@ethersproject/address": "^5.7.0",
@@ -0,0 +1,66 @@
1
+ import { AddressSystemType } from './Address';
2
+ import { NetworkIdType } from './Network';
3
+ import { UsdValue } from './UsdValue';
4
+ export declare enum AirdropClaimStatus {
5
+ notYetOpen = "notYetOpen",
6
+ open = "open",
7
+ closed = "closed"
8
+ }
9
+ export declare enum AirdropUserStatus {
10
+ claimable = "claimable",
11
+ claimableLater = "claimableLater",
12
+ claimed = "claimed",
13
+ claimMissed = "claimMissed",
14
+ nonEligible = "nonEligible"
15
+ }
16
+ export declare function getAirdropClaimStatus(claimStart?: number, claimEnd?: number): AirdropClaimStatus;
17
+ export declare function getAirdropUserStatus(claimStatus: AirdropClaimStatus, amount?: number, isClaimed?: boolean): AirdropUserStatus;
18
+ export declare function getAirdropStatus(claimStart?: number, claimEnd?: number, amount?: number, isClaimed?: boolean): {
19
+ userStatus: AirdropUserStatus;
20
+ claimStatus: AirdropClaimStatus;
21
+ };
22
+ export type Airdrop = {
23
+ id: string;
24
+ claimStatus: AirdropClaimStatus;
25
+ claimLink: string;
26
+ claimStart?: number;
27
+ claimEnd?: number;
28
+ image: string;
29
+ organizerLink: string;
30
+ organizerName: string;
31
+ name?: string;
32
+ label: string;
33
+ price: UsdValue;
34
+ userStatus: AirdropUserStatus;
35
+ amount?: number;
36
+ };
37
+ /**
38
+ * Represents the result of a fetcher.
39
+ */
40
+ export type AirdropFetcherResult = {
41
+ date: number;
42
+ owner: string;
43
+ networdkId: NetworkIdType;
44
+ fetcherId: string;
45
+ duration: number;
46
+ airdrop: Airdrop;
47
+ };
48
+ /**
49
+ * Represents the report of a fetcher.
50
+ */
51
+ export type AirdropFetcherReport = {
52
+ id: string;
53
+ status: 'succeeded' | 'failed';
54
+ duration?: number;
55
+ error?: string;
56
+ };
57
+ /**
58
+ * Represents the result of multiple fetchers.
59
+ */
60
+ export type AirdropFetchersResult = {
61
+ date: number;
62
+ owner: string;
63
+ addressSystem: AddressSystemType;
64
+ fetcherReports: AirdropFetcherReport[];
65
+ airdrops: Airdrop[];
66
+ };
package/src/Airdrop.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAirdropStatus = exports.getAirdropUserStatus = exports.getAirdropClaimStatus = exports.AirdropUserStatus = exports.AirdropClaimStatus = void 0;
4
+ var AirdropClaimStatus;
5
+ (function (AirdropClaimStatus) {
6
+ AirdropClaimStatus["notYetOpen"] = "notYetOpen";
7
+ AirdropClaimStatus["open"] = "open";
8
+ AirdropClaimStatus["closed"] = "closed";
9
+ })(AirdropClaimStatus || (exports.AirdropClaimStatus = AirdropClaimStatus = {}));
10
+ var AirdropUserStatus;
11
+ (function (AirdropUserStatus) {
12
+ AirdropUserStatus["claimable"] = "claimable";
13
+ AirdropUserStatus["claimableLater"] = "claimableLater";
14
+ AirdropUserStatus["claimed"] = "claimed";
15
+ AirdropUserStatus["claimMissed"] = "claimMissed";
16
+ AirdropUserStatus["nonEligible"] = "nonEligible";
17
+ })(AirdropUserStatus || (exports.AirdropUserStatus = AirdropUserStatus = {}));
18
+ function getAirdropClaimStatus(claimStart, claimEnd) {
19
+ const now = Date.now();
20
+ if (claimStart === undefined)
21
+ return AirdropClaimStatus.notYetOpen;
22
+ if (claimStart > now)
23
+ return AirdropClaimStatus.notYetOpen;
24
+ if (claimEnd === undefined)
25
+ return AirdropClaimStatus.open;
26
+ if (claimEnd > now)
27
+ return AirdropClaimStatus.open;
28
+ return AirdropClaimStatus.closed;
29
+ }
30
+ exports.getAirdropClaimStatus = getAirdropClaimStatus;
31
+ function getAirdropUserStatus(claimStatus, amount, isClaimed) {
32
+ if (amount === undefined || amount === 0)
33
+ return AirdropUserStatus.nonEligible;
34
+ if (claimStatus === AirdropClaimStatus.notYetOpen)
35
+ return AirdropUserStatus.claimableLater;
36
+ if (isClaimed)
37
+ return AirdropUserStatus.claimed;
38
+ if (claimStatus === AirdropClaimStatus.closed)
39
+ return AirdropUserStatus.claimMissed;
40
+ return AirdropUserStatus.claimable;
41
+ }
42
+ exports.getAirdropUserStatus = getAirdropUserStatus;
43
+ function getAirdropStatus(claimStart, claimEnd, amount, isClaimed) {
44
+ const claimStatus = getAirdropClaimStatus(claimStart, claimEnd);
45
+ return {
46
+ claimStatus,
47
+ userStatus: getAirdropUserStatus(claimStatus, amount, isClaimed),
48
+ };
49
+ }
50
+ exports.getAirdropStatus = getAirdropStatus;
51
+ //# sourceMappingURL=Airdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Airdrop.js","sourceRoot":"","sources":["../../../../packages/core/src/Airdrop.ts"],"names":[],"mappings":";;;AAIA,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IAC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,EACf,SAAmB;IAKnB,MAAM,WAAW,GAAG,qBAAqB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChE,OAAO;QACL,WAAW;QACX,UAAU,EAAE,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC;KACjE,CAAC;AACJ,CAAC;AAdD,4CAcC"}
@@ -19,6 +19,7 @@ export type PortfolioAssetAttributes = {
19
19
  /**
20
20
  * Represents the date (in ms) when the asset will be unlocked.
21
21
  * If current date is greater than this value, the asset is unlocked.
22
+ * If set to -1, it means it's locked for an unknown or indeterminate period
22
23
  */
23
24
  lockedUntil?: number;
24
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAClB,CAAC;AAwCX;;GAEG;AACU,QAAA,oBAAoB,GAAG;IAClC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;CAChB,CAAC"}
1
+ {"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAClB,CAAC;AAyCX;;GAEG;AACU,QAAA,oBAAoB,GAAG;IAClC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;CAChB,CAAC"}
package/src/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './name-service';
4
4
  export * from './utils';
5
5
  export * from './llama';
6
6
  export * from './Address';
7
+ export * from './Airdrop';
7
8
  export * from './UsdValue';
8
9
  export * from './Client';
9
10
  export * from './Network';
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ __exportStar(require("./name-service"), exports);
20
20
  __exportStar(require("./utils"), exports);
21
21
  __exportStar(require("./llama"), exports);
22
22
  __exportStar(require("./Address"), exports);
23
+ __exportStar(require("./Airdrop"), exports);
23
24
  __exportStar(require("./UsdValue"), exports);
24
25
  __exportStar(require("./Client"), exports);
25
26
  __exportStar(require("./Network"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,0CAAwB;AACxB,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,0CAAwB;AACxB,mDAAiC"}