@sonarwatch/portfolio-plugins 0.14.12 → 0.14.13
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/plugins/debridge/airdropFetcher.js +31 -11
- package/src/plugins/debridge/airdropFetcher.js.map +1 -1
- package/src/plugins/debridge/constants.d.ts +4 -1
- package/src/plugins/debridge/constants.js +8 -3
- package/src/plugins/debridge/constants.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.14.13](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.12...plugins-0.14.13) (2024-10-23)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.14.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.11...plugins-0.14.12) (2024-10-22)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -16,17 +16,22 @@ exports.fetcher = exports.airdropFetcherSolana = exports.airdropFetcherEvm = voi
|
|
16
16
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
19
|
+
const web3_js_1 = require("@solana/web3.js");
|
19
20
|
const AirdropFetcher_1 = require("../../AirdropFetcher");
|
20
21
|
const constants_1 = require("./constants");
|
22
|
+
const clients_1 = require("../../utils/clients");
|
21
23
|
const dbrFactor = new bignumber_js_1.default(Math.pow(10, constants_1.dbrDecimals));
|
22
24
|
const realDistributions = [
|
23
|
-
'Claim 50% vested with bonus in 6 months after TGE',
|
24
25
|
'First distribution',
|
26
|
+
'Claim 50% vested with bonus in 6 months after TGE',
|
25
27
|
];
|
26
28
|
const executorSolana = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
27
|
-
const apiRes = yield
|
28
|
-
|
29
|
-
|
29
|
+
const [apiRes, receipt] = yield Promise.all([
|
30
|
+
axios_1.default.get(constants_1.apiUrl + owner, {
|
31
|
+
timeout: 3000,
|
32
|
+
}),
|
33
|
+
(0, clients_1.getClientSolana)().getAccountInfo(getSolPda(owner, 1)),
|
34
|
+
]);
|
30
35
|
if (!apiRes.data.distributions || apiRes.data.distributions.length === 0) {
|
31
36
|
return (0, AirdropFetcher_1.getAirdropRaw)({
|
32
37
|
statics: constants_1.firstDistribStatics,
|
@@ -45,11 +50,12 @@ const executorSolana = (owner) => __awaiter(void 0, void 0, void 0, function* ()
|
|
45
50
|
for (const distribution of apiRes.data.distributions) {
|
46
51
|
if (!realDistributions.includes(distribution.title))
|
47
52
|
continue;
|
53
|
+
const isFirstDis = distribution.title === realDistributions[0];
|
48
54
|
const tokens = new bignumber_js_1.default(distribution.tokens).div(dbrFactor);
|
49
55
|
items.push({
|
50
56
|
amount: tokens.toNumber(),
|
51
|
-
isClaimed: false,
|
52
|
-
label: 'DBR',
|
57
|
+
isClaimed: isFirstDis ? !!receipt : false,
|
58
|
+
label: isFirstDis ? 'DBR' : 'DBR Vested(50%)',
|
53
59
|
address: constants_1.dbrMint,
|
54
60
|
imageUri: constants_1.dbrMint ? undefined : constants_1.platform.image,
|
55
61
|
});
|
@@ -60,9 +66,12 @@ const executorSolana = (owner) => __awaiter(void 0, void 0, void 0, function* ()
|
|
60
66
|
});
|
61
67
|
});
|
62
68
|
const executorEvm = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
63
|
-
const apiRes = yield
|
64
|
-
|
65
|
-
|
69
|
+
const [apiRes, receipt] = yield Promise.all([
|
70
|
+
axios_1.default.get(constants_1.apiUrl + owner, {
|
71
|
+
timeout: 3000,
|
72
|
+
}),
|
73
|
+
(0, clients_1.getClientSolana)().getAccountInfo(getEvmPda(owner, 1)),
|
74
|
+
]);
|
66
75
|
if (!apiRes.data.distributions || apiRes.data.distributions.length === 0) {
|
67
76
|
return (0, AirdropFetcher_1.getAirdropRaw)({
|
68
77
|
statics: constants_1.firstDistribStatics,
|
@@ -81,11 +90,12 @@ const executorEvm = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
90
|
for (const distribution of apiRes.data.distributions) {
|
82
91
|
if (!realDistributions.includes(distribution.title))
|
83
92
|
continue;
|
93
|
+
const isFirstDis = distribution.title === realDistributions[0];
|
84
94
|
const tokens = new bignumber_js_1.default(distribution.tokens).div(dbrFactor);
|
85
95
|
items.push({
|
86
96
|
amount: tokens.toNumber(),
|
87
|
-
isClaimed: false,
|
88
|
-
label: 'DBR',
|
97
|
+
isClaimed: isFirstDis ? !!receipt : false,
|
98
|
+
label: isFirstDis ? 'DBR' : 'DBR Vested(50%)',
|
89
99
|
address: undefined,
|
90
100
|
imageUri: constants_1.dbrMint ? undefined : constants_1.platform.image,
|
91
101
|
});
|
@@ -106,4 +116,14 @@ exports.airdropFetcherSolana = {
|
|
106
116
|
executor: executorSolana,
|
107
117
|
};
|
108
118
|
exports.fetcher = (0, AirdropFetcher_1.airdropFetcherToFetcher)(exports.airdropFetcherSolana, constants_1.platform.id, 'debridge-airdrop', constants_1.firstDistribStatics.claimEnd);
|
119
|
+
function getEvmPda(owner, season) {
|
120
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
121
|
+
constants_1.receiptBuffer,
|
122
|
+
Uint8Array.from([season]),
|
123
|
+
Buffer.from(owner.slice(2), 'hex'),
|
124
|
+
], constants_1.distributorPid)[0];
|
125
|
+
}
|
126
|
+
function getSolPda(owner, season) {
|
127
|
+
return web3_js_1.PublicKey.findProgramAddressSync([constants_1.receiptBuffer, Uint8Array.from([season]), new web3_js_1.PublicKey(owner).toBytes()], constants_1.distributorPid)[0];
|
128
|
+
}
|
109
129
|
//# sourceMappingURL=airdropFetcher.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/debridge/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AACrC,kDAA6C;AAC7C,yDAK8B;AAC9B,
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/debridge/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AACrC,kDAA6C;AAC7C,6CAAyD;AACzD,yDAK8B;AAC9B,2CASqB;AAErB,iDAAsD;AAEtD,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,uBAAW,CAAA,CAAC,CAAC;AACnD,MAAM,iBAAiB,GAAG;IACxB,oBAAoB;IACpB,mDAAmD;CACpD,CAAC;AACF,MAAM,cAAc,GAA2B,CAAO,KAAa,EAAE,EAAE;IACrE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAGnB,MAAM,OAAO,CAAC,GAAG,CAAC;QACpB,eAAK,CAAC,GAAG,CAAC,kBAAM,GAAG,KAAK,EAAE;YACxB,OAAO,EAAE,IAAI;SACd,CAAC;QACF,IAAA,yBAAe,GAAE,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACtD,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzE,OAAO,IAAA,8BAAa,EAAC;YACnB,OAAO,EAAE,+BAAmB;YAC5B,KAAK,EAAE;gBACL;oBACE,MAAM,EAAE,CAAC;oBACT,SAAS,EAAE,KAAK;oBAChB,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,mBAAO;oBAChB,QAAQ,EAAE,mBAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAW,CAAC,KAAK;iBAClD;aACF;SACF,CAAC,CAAC;IACL,CAAC;IA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AAC;AAEW,QAAA,iBAAiB,GAAmB;IAC/C,EAAE,EAAE,GAAG,+BAAmB,CAAC,EAAE,MAAM;IACnC,SAAS,EAAE,0BAAS,CAAC,QAAQ;IAC7B,QAAQ,EAAE,WAAW;CACtB,CAAC;AAEW,QAAA,oBAAoB,GAAmB;IAClD,EAAE,EAAE,GAAG,+BAAmB,CAAC,EAAE,SAAS;IACtC,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,cAAc;CACzB,CAAC;AACW,QAAA,OAAO,GAAG,IAAA,wCAAuB,EAC5C,4BAAoB,EACpB,oBAAQ,CAAC,EAAE,EACX,kBAAkB,EAClB,+BAAmB,CAAC,QAAQ,CAC7B,CAAC;AAEF,SAAS,SAAS,CAAC,KAAa,EAAE,MAAc;IAC9C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,yBAAa;QACb,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;KACnC,EACD,0BAAc,CACf,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,SAAS,CAAC,KAAa,EAAE,MAAc;IAC9C,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,yBAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,EAC1E,0BAAc,CACf,CAAC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { Platform } from '@sonarwatch/portfolio-core';
|
2
3
|
import { PublicKey } from '@solana/web3.js';
|
3
4
|
import { AirdropStatics } from '../../AirdropFetcher';
|
@@ -10,9 +11,11 @@ export declare const commonStatics: {
|
|
10
11
|
image: string;
|
11
12
|
};
|
12
13
|
export declare const firstDistribStatics: AirdropStatics;
|
13
|
-
export declare const
|
14
|
+
export declare const vestedDistributionStatics: AirdropStatics;
|
14
15
|
export declare const staticsByTitle: Map<string, AirdropStatics>;
|
15
16
|
export declare const dbrMint = "DBRiDgJAMsM95moTzJs7M9LnkGErpbv9v6CUR1DXnUu5";
|
16
17
|
export declare const dbrDecimals = 6;
|
17
18
|
export declare const apiUrl = "https://points-api.debridge.foundation/api/TokenDistribution/";
|
18
19
|
export declare const dlmmVaultProgramId: PublicKey;
|
20
|
+
export declare const distributorPid: PublicKey;
|
21
|
+
export declare const receiptBuffer: Buffer;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.dlmmVaultProgramId = exports.apiUrl = exports.dbrDecimals = exports.dbrMint = exports.staticsByTitle = exports.
|
3
|
+
exports.receiptBuffer = exports.distributorPid = exports.dlmmVaultProgramId = exports.apiUrl = exports.dbrDecimals = exports.dbrMint = exports.staticsByTitle = exports.vestedDistributionStatics = exports.firstDistribStatics = exports.commonStatics = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'debridge';
|
6
6
|
exports.platform = {
|
@@ -18,13 +18,18 @@ exports.commonStatics = {
|
|
18
18
|
image: 'https://sonar.watch/img/platforms/debridge.webp',
|
19
19
|
};
|
20
20
|
exports.firstDistribStatics = Object.assign(Object.assign({}, exports.commonStatics), { id: `${exports.platformId}-dis1`, claimEnd: undefined, claimStart: 1724940000000 });
|
21
|
-
exports.
|
21
|
+
exports.vestedDistributionStatics = Object.assign(Object.assign({}, exports.commonStatics), { id: `${exports.platformId}-dis1-vested`, claimEnd: undefined, claimStart: 1740751200000 });
|
22
22
|
exports.staticsByTitle = new Map([
|
23
23
|
['First Distribution', exports.firstDistribStatics],
|
24
|
-
[
|
24
|
+
[
|
25
|
+
'Claim 50% vested with bonus in 6 months after TGE',
|
26
|
+
exports.vestedDistributionStatics,
|
27
|
+
],
|
25
28
|
]);
|
26
29
|
exports.dbrMint = 'DBRiDgJAMsM95moTzJs7M9LnkGErpbv9v6CUR1DXnUu5';
|
27
30
|
exports.dbrDecimals = 6;
|
28
31
|
exports.apiUrl = 'https://points-api.debridge.foundation/api/TokenDistribution/';
|
29
32
|
exports.dlmmVaultProgramId = new web3_js_1.PublicKey('DBrLFG4dco1xNC5Aarbt3KEaKaJ5rBYHwysqZoeqsSFE');
|
33
|
+
exports.distributorPid = new web3_js_1.PublicKey('DeDRoPXNyHRJSagxZBBqs4hLAAM1bGKgxh7cyfuNCBpo');
|
34
|
+
exports.receiptBuffer = Buffer.from('receipt', 'utf-8');
|
30
35
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/debridge/constants.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,+BAA+B;IACxC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AAEW,QAAA,aAAa,GAAG;IAC3B,SAAS,EAAE,8BAA8B;IACzC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,UAAU;IACvB,KAAK,EAAE,iDAAiD;CACzD,CAAC;AAEW,QAAA,mBAAmB,mCAC3B,qBAAa,KAChB,EAAE,EAAE,GAAG,kBAAU,OAAO,EACxB,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,aAAa,IACzB;AAEW,QAAA,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/debridge/constants.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,+BAA+B;IACxC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AAEW,QAAA,aAAa,GAAG;IAC3B,SAAS,EAAE,8BAA8B;IACzC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,UAAU;IACvB,KAAK,EAAE,iDAAiD;CACzD,CAAC;AAEW,QAAA,mBAAmB,mCAC3B,qBAAa,KAChB,EAAE,EAAE,GAAG,kBAAU,OAAO,EACxB,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,aAAa,IACzB;AAEW,QAAA,yBAAyB,mCACjC,qBAAa,KAChB,EAAE,EAAE,GAAG,kBAAU,cAAc,EAC/B,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,aAAa,IACzB;AAEW,QAAA,cAAc,GAAgC,IAAI,GAAG,CAAC;IACjE,CAAC,oBAAoB,EAAE,2BAAmB,CAAC;IAC3C;QACE,mDAAmD;QACnD,iCAAyB;KAC1B;CACF,CAAC,CAAC;AAEU,QAAA,OAAO,GAAG,8CAA8C,CAAC;AACzD,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,MAAM,GACjB,+DAA+D,CAAC;AAErD,QAAA,kBAAkB,GAAG,IAAI,mBAAS,CAC7C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AACW,QAAA,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC"}
|