@sonarwatch/portfolio-core 0.12.57 → 0.12.58
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 +4 -0
- package/package.json +1 -1
- package/src/Airdrop.d.ts +33 -13
- package/src/Airdrop.js +4 -4
- package/src/Airdrop.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.12.58](https://github.com/sonarwatch/portfolio/compare/core-0.12.57...core-0.12.58) (2024-07-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [0.12.57](https://github.com/sonarwatch/portfolio/compare/core-0.12.56...core-0.12.57) (2024-07-12)
|
|
6
10
|
|
|
7
11
|
|
package/package.json
CHANGED
package/src/Airdrop.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare enum AirdropItemStatus {
|
|
|
19
19
|
claimExpired = "4_claimExpired",
|
|
20
20
|
ineligible = "5_ineligible"
|
|
21
21
|
}
|
|
22
|
-
export declare function
|
|
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
25
|
export type Airdrop = {
|
|
@@ -27,6 +27,10 @@ export type Airdrop = {
|
|
|
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,10 +59,6 @@ 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
|
*/
|
|
@@ -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 AirdropEnhanced = Omit<Airdrop, '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: AirdropItemEnhanced[];
|
|
108
|
+
};
|
|
109
|
+
export type AirdropItemEnhanced = AirdropItem & {
|
|
94
110
|
/**
|
|
95
111
|
* The airdropped item price.
|
|
96
112
|
*/
|
|
97
113
|
price: UsdValue;
|
|
98
114
|
/**
|
|
99
|
-
*
|
|
115
|
+
* Indicates whether airdrop item has already been claimed by the user.
|
|
100
116
|
*/
|
|
101
|
-
|
|
117
|
+
status: AirdropItemStatus;
|
|
118
|
+
/**
|
|
119
|
+
* The airdrop status.
|
|
120
|
+
*/
|
|
121
|
+
value: UsdValue;
|
|
102
122
|
};
|
|
103
123
|
/**
|
|
104
124
|
* Represents the result of a fetcher.
|
|
@@ -109,7 +129,7 @@ export type AirdropFetcherResult = {
|
|
|
109
129
|
networdkId: NetworkIdType;
|
|
110
130
|
fetcherId: string;
|
|
111
131
|
duration: number;
|
|
112
|
-
airdrop:
|
|
132
|
+
airdrop: AirdropEnhanced;
|
|
113
133
|
};
|
|
114
134
|
/**
|
|
115
135
|
* Represents the report of a fetcher.
|
|
@@ -128,5 +148,5 @@ export type AirdropFetchersResult = {
|
|
|
128
148
|
owner: string;
|
|
129
149
|
addressSystem: AddressSystemType;
|
|
130
150
|
fetcherReports: AirdropFetcherReport[];
|
|
131
|
-
airdrops:
|
|
151
|
+
airdrops: AirdropEnhanced[];
|
|
132
152
|
};
|
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.
|
|
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
|
|
19
|
+
function isEligibleAmount(amount) {
|
|
20
20
|
return amount > 0;
|
|
21
21
|
}
|
|
22
|
-
exports.
|
|
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
|
|
37
|
+
if (!isEligibleAmount(amount))
|
|
38
38
|
return AirdropItemStatus.ineligible;
|
|
39
39
|
if (isClaimed === true)
|
|
40
40
|
return AirdropItemStatus.claimed;
|
package/src/Airdrop.js.map
CHANGED
|
@@ -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,
|
|
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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