@sonarwatch/portfolio-core 0.12.57 → 0.12.59

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,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.12.59](https://github.com/sonarwatch/portfolio/compare/core-0.12.58...core-0.12.59) (2024-07-14)
6
+
7
+
8
+
9
+ ## [0.12.58](https://github.com/sonarwatch/portfolio/compare/core-0.12.57...core-0.12.58) (2024-07-14)
10
+
11
+
12
+
5
13
  ## [0.12.57](https://github.com/sonarwatch/portfolio/compare/core-0.12.56...core-0.12.57) (2024-07-12)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-core",
3
- "version": "0.12.57",
3
+ "version": "0.12.59",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "dependencies": {
package/src/Airdrop.d.ts CHANGED
@@ -19,14 +19,18 @@ export declare enum AirdropItemStatus {
19
19
  claimExpired = "4_claimExpired",
20
20
  ineligible = "5_ineligible"
21
21
  }
22
- export declare function getIsEligible(amount: number): boolean;
22
+ export declare function isEligibleAmount(amount: number): boolean;
23
23
  export declare function getAirdropStatus(claimStart?: number, claimEnd?: number): AirdropStatus;
24
24
  export declare function getAirdropItemStatus(airdropStatus: AirdropStatus, amount: number, isClaimed: IsClaimed): AirdropItemStatus;
25
- export type Airdrop = {
25
+ export type AirdropRaw = {
26
26
  /**
27
27
  * The airdrop id. (e.g. 'jupiter_season1')
28
28
  */
29
29
  id: string;
30
+ /**
31
+ * The airdrop network id. (e.g. 'solana')
32
+ */
33
+ networkId: NetworkIdType;
30
34
  /**
31
35
  * A name for the airdrop. Should not container the emitter name. (e.g. 'Season #1')
32
36
  */
@@ -55,16 +59,12 @@ export type Airdrop = {
55
59
  * The airdrop claim end date (as ms).
56
60
  */
57
61
  claimEnd?: number;
58
- /**
59
- * The airdrop status.
60
- */
61
- status: AirdropStatus;
62
62
  /**
63
63
  * The airdrop items.
64
64
  */
65
- items: AirdropItem[];
65
+ items: AirdropItemRaw[];
66
66
  };
67
- export type AirdropItem = {
67
+ export type AirdropItemRaw = {
68
68
  /**
69
69
  * Indicates whether the user is eligible to the airdrop.
70
70
  */
@@ -74,10 +74,6 @@ export type AirdropItem = {
74
74
  * If set to null it means that claim status is unknowned.
75
75
  */
76
76
  isClaimed: IsClaimed;
77
- /**
78
- * Indicates whether airdrop item has already been claimed by the user.
79
- */
80
- status: AirdropItemStatus;
81
77
  /**
82
78
  * The airdropped item address.
83
79
  */
@@ -91,14 +87,38 @@ export type AirdropItem = {
91
87
  * The airdropped item label.
92
88
  */
93
89
  label: string;
90
+ /**
91
+ * The airdropped item image uri.
92
+ */
93
+ imageUri?: string;
94
+ };
95
+ export type Airdrop = Omit<AirdropRaw, 'items'> & {
96
+ /**
97
+ * The airdrop status.
98
+ */
99
+ status: AirdropStatus;
100
+ /**
101
+ * The airdrop status.
102
+ */
103
+ value: UsdValue;
104
+ /**
105
+ * The airdrop items.
106
+ */
107
+ items: AirdropItem[];
108
+ };
109
+ export type AirdropItem = AirdropItemRaw & {
94
110
  /**
95
111
  * The airdropped item price.
96
112
  */
97
113
  price: UsdValue;
98
114
  /**
99
- * The airdropped item image uri.
115
+ * Indicates whether airdrop item has already been claimed by the user.
100
116
  */
101
- imageUri?: string;
117
+ status: AirdropItemStatus;
118
+ /**
119
+ * The airdrop status.
120
+ */
121
+ value: UsdValue;
102
122
  };
103
123
  /**
104
124
  * Represents the result of a fetcher.
package/src/Airdrop.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAirdropItemStatus = exports.getAirdropStatus = exports.getIsEligible = exports.AirdropItemStatus = exports.AirdropStatus = void 0;
3
+ exports.getAirdropItemStatus = exports.getAirdropStatus = exports.isEligibleAmount = exports.AirdropItemStatus = exports.AirdropStatus = void 0;
4
4
  var AirdropStatus;
5
5
  (function (AirdropStatus) {
6
6
  AirdropStatus["notYetOpen"] = "0_notYetOpen";
@@ -16,10 +16,10 @@ var AirdropItemStatus;
16
16
  AirdropItemStatus["claimExpired"] = "4_claimExpired";
17
17
  AirdropItemStatus["ineligible"] = "5_ineligible";
18
18
  })(AirdropItemStatus || (exports.AirdropItemStatus = AirdropItemStatus = {}));
19
- function getIsEligible(amount) {
19
+ function isEligibleAmount(amount) {
20
20
  return amount > 0;
21
21
  }
22
- exports.getIsEligible = getIsEligible;
22
+ exports.isEligibleAmount = isEligibleAmount;
23
23
  function getAirdropStatus(claimStart, claimEnd) {
24
24
  const now = Date.now();
25
25
  if (claimStart === undefined)
@@ -34,7 +34,7 @@ function getAirdropStatus(claimStart, claimEnd) {
34
34
  }
35
35
  exports.getAirdropStatus = getAirdropStatus;
36
36
  function getAirdropItemStatus(airdropStatus, amount, isClaimed) {
37
- if (amount <= 0)
37
+ if (!isEligibleAmount(amount))
38
38
  return AirdropItemStatus.ineligible;
39
39
  if (isClaimed === true)
40
40
  return AirdropItemStatus.claimed;
@@ -1 +1 @@
1
- {"version":3,"file":"Airdrop.js","sourceRoot":"","sources":["../../../../packages/core/src/Airdrop.ts"],"names":[],"mappings":";;;AAIA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,4CAA2B,CAAA;IAC3B,gCAAe,CAAA;IACf,oCAAmB,CAAA;AACrB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAQD,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,8CAAyB,CAAA;IACzB,wDAAmC,CAAA;IACnC,gEAA2C,CAAA;IAC3C,0CAAqB,CAAA;IACrB,oDAA+B,CAAA;IAC/B,gDAA2B,CAAA;AAC7B,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;AAED,SAAgB,aAAa,CAAC,MAAc;IAC1C,OAAO,MAA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