@sonarwatch/portfolio-core 0.12.55 → 0.12.56
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 +46 -17
- package/src/Airdrop.js +38 -35
- 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.56](https://github.com/sonarwatch/portfolio/compare/core-0.12.55...core-0.12.56) (2024-07-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [0.12.55](https://github.com/sonarwatch/portfolio/compare/core-0.12.54...core-0.12.55) (2024-07-11)
|
|
6
10
|
|
|
7
11
|
|
package/package.json
CHANGED
package/src/Airdrop.d.ts
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import { AddressSystemType } from './Address';
|
|
2
2
|
import { NetworkIdType } from './Network';
|
|
3
3
|
import { UsdValue } from './UsdValue';
|
|
4
|
-
export declare enum
|
|
4
|
+
export declare enum AirdropStatus {
|
|
5
5
|
notYetOpen = "0_notYetOpen",
|
|
6
6
|
open = "1_open",
|
|
7
7
|
closed = "2_closed"
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Indicates whether airdrop item has already been claimed by the user.
|
|
11
|
+
* If set to null it means that claim status is unknowned.
|
|
12
|
+
*/
|
|
13
|
+
export type IsClaimed = boolean | null;
|
|
14
|
+
export declare enum AirdropItemStatus {
|
|
10
15
|
claimable = "0_claimable",
|
|
11
16
|
claimableLater = "1_claimableLater",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
claimableOrClaimed = "2_claimableOrClaimed",
|
|
18
|
+
claimed = "3_claimed",
|
|
19
|
+
claimExpired = "4_claimExpired",
|
|
20
|
+
ineligible = "5_ineligible"
|
|
15
21
|
}
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
22
|
+
export declare function getIsEligible(amount: number): boolean;
|
|
23
|
+
export declare function getAirdropStatus(claimStart?: number, claimEnd?: number): AirdropStatus;
|
|
24
|
+
export declare function getAirdropItemStatus(airdropStatus: AirdropStatus, amount: number, isClaimed: IsClaimed): AirdropItemStatus;
|
|
19
25
|
export type Airdrop = {
|
|
20
26
|
/**
|
|
21
27
|
* The airdrop id. (e.g. 'jupiter_season1')
|
|
22
28
|
*/
|
|
23
29
|
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* A name for the airdrop. Should not container the emitter name. (e.g. 'Season #1')
|
|
32
|
+
*/
|
|
33
|
+
name?: string;
|
|
24
34
|
/**
|
|
25
35
|
* The airdrop image.
|
|
26
36
|
*/
|
|
@@ -33,10 +43,6 @@ export type Airdrop = {
|
|
|
33
43
|
* The airdrop emitter link.
|
|
34
44
|
*/
|
|
35
45
|
emitterLink: string;
|
|
36
|
-
/**
|
|
37
|
-
* A name for the airdrop. Should not container the emitter name. (e.g. 'Season #1')
|
|
38
|
-
*/
|
|
39
|
-
name?: string;
|
|
40
46
|
/**
|
|
41
47
|
* The airdrop claim link.
|
|
42
48
|
*/
|
|
@@ -50,16 +56,35 @@ export type Airdrop = {
|
|
|
50
56
|
*/
|
|
51
57
|
claimEnd?: number;
|
|
52
58
|
/**
|
|
53
|
-
* The airdrop
|
|
59
|
+
* The airdrop status.
|
|
54
60
|
*/
|
|
55
|
-
|
|
61
|
+
status: AirdropStatus;
|
|
56
62
|
/**
|
|
57
|
-
*
|
|
63
|
+
* The airdrop items.
|
|
58
64
|
*/
|
|
59
|
-
|
|
65
|
+
item: AirdropItem;
|
|
66
|
+
};
|
|
67
|
+
export type AirdropItem = {
|
|
68
|
+
/**
|
|
69
|
+
* Indicates whether the user is eligible to the airdrop.
|
|
70
|
+
*/
|
|
71
|
+
isEligible: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates whether airdrop item has already been claimed by the user.
|
|
74
|
+
* If set to null it means that claim status is unknowned.
|
|
75
|
+
*/
|
|
76
|
+
isClaimed: IsClaimed;
|
|
77
|
+
/**
|
|
78
|
+
* Indicates whether airdrop item has already been claimed by the user.
|
|
79
|
+
*/
|
|
80
|
+
status: AirdropItemStatus;
|
|
81
|
+
/**
|
|
82
|
+
* The airdropped item address.
|
|
83
|
+
*/
|
|
84
|
+
address?: string;
|
|
60
85
|
/**
|
|
61
86
|
* The airdropped item amount.
|
|
62
|
-
* If set to
|
|
87
|
+
* If set to 0 it means ineligible.
|
|
63
88
|
*/
|
|
64
89
|
amount: number;
|
|
65
90
|
/**
|
|
@@ -70,6 +95,10 @@ export type Airdrop = {
|
|
|
70
95
|
* The airdropped item price.
|
|
71
96
|
*/
|
|
72
97
|
price: UsdValue;
|
|
98
|
+
/**
|
|
99
|
+
* The airdropped item image uri.
|
|
100
|
+
*/
|
|
101
|
+
imageUri?: string;
|
|
73
102
|
};
|
|
74
103
|
/**
|
|
75
104
|
* Represents the result of a fetcher.
|
package/src/Airdrop.js
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})(
|
|
10
|
-
var
|
|
11
|
-
(function (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
exports.getAirdropItemStatus = exports.getAirdropStatus = exports.getIsEligible = exports.AirdropItemStatus = exports.AirdropStatus = void 0;
|
|
4
|
+
var AirdropStatus;
|
|
5
|
+
(function (AirdropStatus) {
|
|
6
|
+
AirdropStatus["notYetOpen"] = "0_notYetOpen";
|
|
7
|
+
AirdropStatus["open"] = "1_open";
|
|
8
|
+
AirdropStatus["closed"] = "2_closed";
|
|
9
|
+
})(AirdropStatus || (exports.AirdropStatus = AirdropStatus = {}));
|
|
10
|
+
var AirdropItemStatus;
|
|
11
|
+
(function (AirdropItemStatus) {
|
|
12
|
+
AirdropItemStatus["claimable"] = "0_claimable";
|
|
13
|
+
AirdropItemStatus["claimableLater"] = "1_claimableLater";
|
|
14
|
+
AirdropItemStatus["claimableOrClaimed"] = "2_claimableOrClaimed";
|
|
15
|
+
AirdropItemStatus["claimed"] = "3_claimed";
|
|
16
|
+
AirdropItemStatus["claimExpired"] = "4_claimExpired";
|
|
17
|
+
AirdropItemStatus["ineligible"] = "5_ineligible";
|
|
18
|
+
})(AirdropItemStatus || (exports.AirdropItemStatus = AirdropItemStatus = {}));
|
|
19
|
+
function getIsEligible(amount) {
|
|
20
|
+
return amount > 0;
|
|
20
21
|
}
|
|
21
|
-
exports.
|
|
22
|
-
function
|
|
22
|
+
exports.getIsEligible = getIsEligible;
|
|
23
|
+
function getAirdropStatus(claimStart, claimEnd) {
|
|
23
24
|
const now = Date.now();
|
|
24
25
|
if (claimStart === undefined)
|
|
25
|
-
return
|
|
26
|
+
return AirdropStatus.notYetOpen;
|
|
26
27
|
if (claimStart > now)
|
|
27
|
-
return
|
|
28
|
+
return AirdropStatus.notYetOpen;
|
|
28
29
|
if (claimEnd === undefined)
|
|
29
|
-
return
|
|
30
|
+
return AirdropStatus.open;
|
|
30
31
|
if (claimEnd > now)
|
|
31
|
-
return
|
|
32
|
-
return
|
|
32
|
+
return AirdropStatus.open;
|
|
33
|
+
return AirdropStatus.closed;
|
|
33
34
|
}
|
|
34
|
-
exports.
|
|
35
|
-
function
|
|
35
|
+
exports.getAirdropStatus = getAirdropStatus;
|
|
36
|
+
function getAirdropItemStatus(airdropStatus, amount, isClaimed) {
|
|
36
37
|
if (amount <= 0)
|
|
37
|
-
return
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
40
|
-
if (
|
|
41
|
-
return
|
|
42
|
-
if (
|
|
43
|
-
return
|
|
44
|
-
|
|
38
|
+
return AirdropItemStatus.ineligible;
|
|
39
|
+
if (isClaimed === true)
|
|
40
|
+
return AirdropItemStatus.claimed;
|
|
41
|
+
if (airdropStatus === AirdropStatus.notYetOpen)
|
|
42
|
+
return AirdropItemStatus.claimableLater;
|
|
43
|
+
if (airdropStatus === AirdropStatus.closed)
|
|
44
|
+
return AirdropItemStatus.claimExpired;
|
|
45
|
+
if (isClaimed === null)
|
|
46
|
+
return AirdropItemStatus.claimableOrClaimed;
|
|
47
|
+
return AirdropItemStatus.claimable;
|
|
45
48
|
}
|
|
46
|
-
exports.
|
|
49
|
+
exports.getAirdropItemStatus = getAirdropItemStatus;
|
|
47
50
|
//# 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":";;;AAIA,IAAY,
|
|
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,MAAM,GAAG,CAAC,CAAC;AACpB,CAAC;AAFD,sCAEC;AAED,SAAgB,gBAAgB,CAC9B,UAAmB,EACnB,QAAiB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