@sonarwatch/portfolio-core 0.11.197 → 0.11.199
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 +8 -0
- package/package.json +1 -1
- package/src/Airdrop.d.ts +56 -15
- package/src/Airdrop.js +9 -13
- package/src/Airdrop.js.map +1 -1
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.11.199](https://github.com/sonarwatch/portfolio/compare/core-0.11.198...core-0.11.199) (2024-05-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.11.198](https://github.com/sonarwatch/portfolio/compare/core-0.11.197...core-0.11.198) (2024-05-06)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [0.11.197](https://github.com/sonarwatch/portfolio/compare/core-0.11.196...core-0.11.197) (2024-05-04)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED
package/src/Airdrop.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { AddressSystemType } from './Address';
|
|
|
2
2
|
import { NetworkIdType } from './Network';
|
|
3
3
|
import { UsdValue } from './UsdValue';
|
|
4
4
|
export declare enum AirdropClaimStatus {
|
|
5
|
-
notYetOpen = "
|
|
6
|
-
open = "
|
|
7
|
-
closed = "
|
|
5
|
+
notYetOpen = "0_notYetOpen",
|
|
6
|
+
open = "1_open",
|
|
7
|
+
closed = "2_closed"
|
|
8
8
|
}
|
|
9
9
|
export declare enum AirdropUserStatus {
|
|
10
10
|
claimable = "claimable",
|
|
@@ -13,26 +13,67 @@ export declare enum AirdropUserStatus {
|
|
|
13
13
|
claimMissed = "claimMissed",
|
|
14
14
|
nonEligible = "nonEligible"
|
|
15
15
|
}
|
|
16
|
+
export declare function isAirdropEligible(airdrop: Airdrop): boolean;
|
|
16
17
|
export declare function getAirdropClaimStatus(claimStart?: number, claimEnd?: number): AirdropClaimStatus;
|
|
17
|
-
export declare function getAirdropUserStatus(claimStatus: AirdropClaimStatus, amount
|
|
18
|
-
export declare function getAirdropStatus(claimStart?: number, claimEnd?: number, amount?: number, isClaimed?: boolean): {
|
|
19
|
-
userStatus: AirdropUserStatus;
|
|
20
|
-
claimStatus: AirdropClaimStatus;
|
|
21
|
-
};
|
|
18
|
+
export declare function getAirdropUserStatus(claimStatus: AirdropClaimStatus, amount: number, isClaimed: boolean): AirdropUserStatus;
|
|
22
19
|
export type Airdrop = {
|
|
20
|
+
/**
|
|
21
|
+
* The airdrop id. (e.g. 'jupiter_season1')
|
|
22
|
+
*/
|
|
23
23
|
id: string;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The airdrop image.
|
|
26
|
+
*/
|
|
27
|
+
image: string;
|
|
28
|
+
/**
|
|
29
|
+
* The airdrop emitter name. (e.g. Jupiter)
|
|
30
|
+
*/
|
|
31
|
+
emitterName: string;
|
|
32
|
+
/**
|
|
33
|
+
* The airdrop emitter link.
|
|
34
|
+
*/
|
|
35
|
+
emitterLink: string;
|
|
36
|
+
/**
|
|
37
|
+
* A name for the airdrop. Should not container the emitter name. (e.g. 'Season #1')
|
|
38
|
+
*/
|
|
39
|
+
name?: string;
|
|
40
|
+
/**
|
|
41
|
+
* A short name for the airdrop. (e.g. 'Jupiter S1')
|
|
42
|
+
*/
|
|
43
|
+
shortName: string;
|
|
44
|
+
/**
|
|
45
|
+
* The airdrop claim link.
|
|
46
|
+
*/
|
|
25
47
|
claimLink: string;
|
|
48
|
+
/**
|
|
49
|
+
* The airdrop claim start date (as ms).
|
|
50
|
+
*/
|
|
26
51
|
claimStart?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The airdrop claim end date (as ms).
|
|
54
|
+
*/
|
|
27
55
|
claimEnd?: number;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
56
|
+
/**
|
|
57
|
+
* The airdrop claim status.
|
|
58
|
+
*/
|
|
59
|
+
claimStatus: AirdropClaimStatus;
|
|
60
|
+
/**
|
|
61
|
+
* Indicates whether airdrop has already been claimed by the user.
|
|
62
|
+
*/
|
|
63
|
+
isClaimed: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The airdropped item amount.
|
|
66
|
+
* If set to -1 means non eligible.
|
|
67
|
+
*/
|
|
68
|
+
amount: number;
|
|
69
|
+
/**
|
|
70
|
+
* The airdropped item label.
|
|
71
|
+
*/
|
|
32
72
|
label: string;
|
|
73
|
+
/**
|
|
74
|
+
* The airdropped item price.
|
|
75
|
+
*/
|
|
33
76
|
price: UsdValue;
|
|
34
|
-
userStatus: AirdropUserStatus;
|
|
35
|
-
amount?: number;
|
|
36
77
|
};
|
|
37
78
|
/**
|
|
38
79
|
* Represents the result of a fetcher.
|
package/src/Airdrop.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAirdropUserStatus = exports.getAirdropClaimStatus = exports.isAirdropEligible = exports.AirdropUserStatus = exports.AirdropClaimStatus = void 0;
|
|
4
4
|
var AirdropClaimStatus;
|
|
5
5
|
(function (AirdropClaimStatus) {
|
|
6
|
-
AirdropClaimStatus["notYetOpen"] = "
|
|
7
|
-
AirdropClaimStatus["open"] = "
|
|
8
|
-
AirdropClaimStatus["closed"] = "
|
|
6
|
+
AirdropClaimStatus["notYetOpen"] = "0_notYetOpen";
|
|
7
|
+
AirdropClaimStatus["open"] = "1_open";
|
|
8
|
+
AirdropClaimStatus["closed"] = "2_closed";
|
|
9
9
|
})(AirdropClaimStatus || (exports.AirdropClaimStatus = AirdropClaimStatus = {}));
|
|
10
10
|
var AirdropUserStatus;
|
|
11
11
|
(function (AirdropUserStatus) {
|
|
@@ -15,6 +15,10 @@ var AirdropUserStatus;
|
|
|
15
15
|
AirdropUserStatus["claimMissed"] = "claimMissed";
|
|
16
16
|
AirdropUserStatus["nonEligible"] = "nonEligible";
|
|
17
17
|
})(AirdropUserStatus || (exports.AirdropUserStatus = AirdropUserStatus = {}));
|
|
18
|
+
function isAirdropEligible(airdrop) {
|
|
19
|
+
return airdrop.amount > 0;
|
|
20
|
+
}
|
|
21
|
+
exports.isAirdropEligible = isAirdropEligible;
|
|
18
22
|
function getAirdropClaimStatus(claimStart, claimEnd) {
|
|
19
23
|
const now = Date.now();
|
|
20
24
|
if (claimStart === undefined)
|
|
@@ -29,7 +33,7 @@ function getAirdropClaimStatus(claimStart, claimEnd) {
|
|
|
29
33
|
}
|
|
30
34
|
exports.getAirdropClaimStatus = getAirdropClaimStatus;
|
|
31
35
|
function getAirdropUserStatus(claimStatus, amount, isClaimed) {
|
|
32
|
-
if (amount
|
|
36
|
+
if (amount <= 0)
|
|
33
37
|
return AirdropUserStatus.nonEligible;
|
|
34
38
|
if (claimStatus === AirdropClaimStatus.notYetOpen)
|
|
35
39
|
return AirdropUserStatus.claimableLater;
|
|
@@ -40,12 +44,4 @@ function getAirdropUserStatus(claimStatus, amount, isClaimed) {
|
|
|
40
44
|
return AirdropUserStatus.claimable;
|
|
41
45
|
}
|
|
42
46
|
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
47
|
//# sourceMappingURL=Airdrop.js.map
|
package/src/Airdrop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Airdrop.js","sourceRoot":"","sources":["../../../../packages/core/src/Airdrop.ts"],"names":[],"mappings":";;;AA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