@sonarwatch/portfolio-plugins 0.14.12 → 0.14.14
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1640 -1632
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugins/abex/positionsFetcher.js +1 -1
- package/src/plugins/abex/positionsFetcher.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- 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/src/plugins/native-stake/solana/solanaValidatorsJob.js +1 -0
- package/src/plugins/native-stake/solana/solanaValidatorsJob.js.map +1 -1
- package/src/plugins/native-stake/solana/types.d.ts +2 -0
- package/src/plugins/parcl/stakingFetcher.js +9 -34
- package/src/plugins/parcl/stakingFetcher.js.map +1 -1
- package/src/plugins/parcl/types.d.ts +0 -9
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tradeport/bidsFetcher.d.ts +3 -0
- package/src/plugins/tradeport/bidsFetcher.js +46 -0
- package/src/plugins/tradeport/bidsFetcher.js.map +1 -0
- package/src/plugins/tradeport/bidsJob.d.ts +3 -0
- package/src/plugins/tradeport/bidsJob.js +41 -0
- package/src/plugins/tradeport/bidsJob.js.map +1 -0
- package/src/plugins/tradeport/constants.d.ts +4 -0
- package/src/plugins/tradeport/constants.js +5 -1
- package/src/plugins/tradeport/constants.js.map +1 -1
- package/src/plugins/tradeport/index.js +4 -2
- package/src/plugins/tradeport/index.js.map +1 -1
- package/src/plugins/tradeport/types.d.ts +18 -0
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/zeta/airdropFetcher.js +14 -14
- package/src/utils/elementbuilder/LevPositionBuilder.js +2 -1
- package/src/utils/elementbuilder/LevPositionBuilder.js.map +1 -1
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
package/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# @sonarwatch/portfolio-plugins
|
2
|
-
|
3
|
-
This library is @sonarwatch/portfolio-plugins
|
1
|
+
# @sonarwatch/portfolio-plugins
|
2
|
+
|
3
|
+
This library is @sonarwatch/portfolio-plugins
|
package/package.json
CHANGED
@@ -52,7 +52,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
element.addPosition({
|
55
|
-
address: positionInfo.
|
55
|
+
address: positionInfo.indexToken,
|
56
56
|
collateralValue: new bignumber_js_1.default(positionInfo.collateralAmount)
|
57
57
|
.multipliedBy(tokenPriceCollateral.price)
|
58
58
|
.dividedBy(Math.pow(10, tokenPriceCollateral.decimals))
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAqE;AACrE,gEAAqC;AAErC,2CAA6D;AAE7D,iDAAmD;AACnD,uCAImB;AACnB,gFAA6E;AAG7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,mBAAmB,GAAG,MAAM,IAAA,gCAAsB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAExE,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEhD,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,CAAc,8BAAkB,EAAE;QACtE,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,gBAAgB,GAAG,MAAM,IAAA,6BAAmB,EAChD,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,KAAK,CACN,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,iCAAe,CAAC,0BAAS,CAAC,GAAG,EAAE,sBAAU,CAAC,CAAC;IAEvE,KAAK,MAAM,YAAY,IAAI,gBAAgB,EAAE,CAAC;QAC5C,IAAI,YAAY,CAAC,MAAM;YAAE,SAAS;QAClC,MAAM,OAAO,GAAG,eAAe,CAAC,kBAAkB,CAAC;YACjD,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,mBAAmB,CACjD,CAAC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,eAAe,CAAC,EACvD,0BAAS,CAAC,GAAG,CACd,CAAC;QAEF,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACjE,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QAE3E,IAAI,CAAC,oBAAoB;YAAE,SAAS;QAEpC,IAAI,QAAQ,CAAC;QACb,IAAI,QAAQ,CAAC;QAEb,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,OAAO,GAAG,MAAM,IAAA,sBAAY,EAChC,YAAY,EACZ,eAAe,EACf,oBAAoB,CACrB,CAAC;YAEF,IAAI,OAAO,EAAE,CAAC;gBACZ,QAAQ,GAAG,IAAI,sBAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC3C,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,OAAO,CAAC,WAAW,CAAC;YAClB,OAAO,EAAE,YAAY,CAAC,
|
1
|
+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAqE;AACrE,gE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__awaiter(this, void 0, void 0, function* () {
|
39
|
-
const query = (0, graphql_request_1.gql) `
|
40
|
-
query pools {
|
41
|
-
pools(
|
42
|
-
first: 1000
|
43
|
-
orderBy: totalLiquidity
|
44
|
-
orderDirection: desc
|
45
|
-
where: { totalLiquidity_gt: "500" }
|
46
|
-
) {
|
47
|
-
id
|
48
|
-
address
|
49
|
-
symbol
|
50
|
-
totalLiquidity
|
51
|
-
totalShares
|
52
|
-
tokens {
|
53
|
-
balance
|
54
|
-
decimals
|
55
|
-
symbol
|
56
|
-
address
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
39
|
+
const query = (0, graphql_request_1.gql) `
|
40
|
+
query pools {
|
41
|
+
pools(
|
42
|
+
first: 1000
|
43
|
+
orderBy: totalLiquidity
|
44
|
+
orderDirection: desc
|
45
|
+
where: { totalLiquidity_gt: "500" }
|
46
|
+
) {
|
47
|
+
id
|
48
|
+
address
|
49
|
+
symbol
|
50
|
+
totalLiquidity
|
51
|
+
totalShares
|
52
|
+
tokens {
|
53
|
+
balance
|
54
|
+
decimals
|
55
|
+
symbol
|
56
|
+
address
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
60
|
`;
|
61
61
|
const res = yield (0, graphql_request_1.default)(url, query);
|
62
62
|
const pools = res.pools;
|
@@ -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,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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"}
|
@@ -34,6 +34,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
34
|
jitoApy: r.jito_apy,
|
35
35
|
stakingApy: r.staking_apy,
|
36
36
|
totalApy: r.total_apy,
|
37
|
+
commission: r.commission,
|
37
38
|
}));
|
38
39
|
yield cache.setItem(constants_1.validatorsKey, validators, {
|
39
40
|
prefix: constants_1.platformId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaValidatorsJob.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/native-stake/solana/solanaValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,4CAAyD;AACzD,2CAA0C;AAG1C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAgD,uBAAW,EAAE;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEnD,MAAM,UAAU,GAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACnD,KAAK,EAAE,CAAC,CAAC,aAAa;QACtB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ,EAAE,CAAC,CAAC,KAAK;QACjB,OAAO,EAAE,CAAC,CAAC,YAAY;QACvB,OAAO,EAAE,CAAC,CAAC,QAAQ;QACnB,UAAU,EAAE,CAAC,CAAC,WAAW;QACzB,QAAQ,EAAE,CAAC,CAAC,SAAS;
|
1
|
+
{"version":3,"file":"solanaValidators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G,CAAC"}
|
@@ -7,6 +7,7 @@ export type ValidatorApiResponse = {
|
|
7
7
|
jito_apy: number;
|
8
8
|
staking_apy: number;
|
9
9
|
total_apy: number;
|
10
|
+
commission: number;
|
10
11
|
};
|
11
12
|
export type Validator = {
|
12
13
|
voter: string;
|
@@ -16,4 +17,5 @@ export type Validator = {
|
|
16
17
|
jitoApy: number;
|
17
18
|
stakingApy: number;
|
18
19
|
totalApy: number;
|
20
|
+
commission: number;
|
19
21
|
};
|
@@ -15,37 +15,11 @@ const constants_1 = require("./constants");
|
|
15
15
|
const clients_1 = require("../../utils/clients");
|
16
16
|
const solana_1 = require("../../utils/solana");
|
17
17
|
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
18
|
-
const decodePosition = (buffer) => ({
|
19
|
-
amount: Number(buffer.readBigUInt64LE(1)),
|
20
|
-
activationEpoch: Number(buffer.readBigUInt64LE(1 + 8)),
|
21
|
-
unlockingStart: Number(buffer.readBigUInt64LE(1 + 8 + 8)),
|
22
|
-
});
|
23
|
-
const decodePositionAccount = (buffer) => {
|
24
|
-
let i = 0;
|
25
|
-
buffer.slice(i, i + 8);
|
26
|
-
i += 8;
|
27
|
-
const owner = new web3_js_1.PublicKey(buffer.slice(i, i + 32)).toString();
|
28
|
-
i += 32;
|
29
|
-
const positions = [];
|
30
|
-
let position;
|
31
|
-
for (let t = 0; t < 20; t++) {
|
32
|
-
position = decodePosition(buffer.slice(i, i + 200));
|
33
|
-
if (position.amount > 0)
|
34
|
-
positions.push(position);
|
35
|
-
else
|
36
|
-
break;
|
37
|
-
i += 200;
|
38
|
-
}
|
39
|
-
return {
|
40
|
-
owner,
|
41
|
-
positions,
|
42
|
-
};
|
43
|
-
};
|
44
18
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
45
19
|
const client = (0, clients_1.getClientSolana)();
|
20
|
+
// https://github.com/pyth-network/governance/blob/f624ea17fd2e7b22c799ffc2a560257d155410a5/staking/app/StakeConnection.ts
|
46
21
|
const accs = yield (0, solana_1.getProgramAccounts)(client, constants_1.stakingProgramId, [
|
47
22
|
{
|
48
|
-
// account PositionData
|
49
23
|
memcmp: {
|
50
24
|
offset: 0,
|
51
25
|
bytes: 'FM2r3wAdZaa',
|
@@ -54,22 +28,23 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
54
28
|
{
|
55
29
|
memcmp: {
|
56
30
|
offset: 8,
|
57
|
-
bytes:
|
31
|
+
bytes: owner,
|
58
32
|
},
|
59
33
|
},
|
60
34
|
]);
|
61
35
|
if (accs.length === 0)
|
62
36
|
return [];
|
63
|
-
const
|
37
|
+
const tokenBalances = yield Promise.all(accs.map((acc) => __awaiter(void 0, void 0, void 0, function* () {
|
38
|
+
const tokenAccount = yield client.getTokenAccountBalance(web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('custody'), acc.pubkey.toBuffer()], constants_1.stakingProgramId)[0]);
|
39
|
+
return Number(tokenAccount.value.amount);
|
40
|
+
})));
|
64
41
|
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
65
42
|
const element = elementRegistry.addElementMultiple({
|
66
43
|
label: 'Staked',
|
67
44
|
});
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
amount: positionAccount.positions.reduce((sum, position) => sum + Number(position.amount), 0),
|
72
|
-
});
|
45
|
+
element.addAsset({
|
46
|
+
address: constants_1.prclMint,
|
47
|
+
amount: tokenBalances.reduce((sum, current) => sum + current, 0),
|
73
48
|
});
|
74
49
|
return elementRegistry.getElements(cache);
|
75
50
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAE5C,2CAAqE;AAErE,iDAAsD;AACtD,+CAAwD;
|
1
|
+
{"version":3,"file":"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;KAChB,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,CAAC;QACf,OAAO,EAAE,oBAAQ;QACjB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,OAAO,EAAE,CAAC,CAAC;KACjE,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -7,12 +7,3 @@ export type ApiAirdropResponse = {
|
|
7
7
|
merkle_tree?: string;
|
8
8
|
error?: string;
|
9
9
|
};
|
10
|
-
export type PositionAccount = {
|
11
|
-
owner: string;
|
12
|
-
positions: Position[];
|
13
|
-
};
|
14
|
-
export type Position = {
|
15
|
-
amount: number;
|
16
|
-
activationEpoch: number;
|
17
|
-
unlockingStart: number;
|
18
|
-
};
|
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
|
|
54
54
|
}
|
55
55
|
function getV3PairsAddresses(url, length = 300) {
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
57
|
-
const query = (0, graphql_request_1.gql) `
|
58
|
-
{
|
59
|
-
pools(
|
60
|
-
orderBy: totalValueLockedUSD
|
61
|
-
first: ${length}
|
62
|
-
orderDirection: desc
|
63
|
-
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
-
) {
|
65
|
-
id
|
66
|
-
token0Price
|
67
|
-
token1Price
|
68
|
-
liquidity
|
69
|
-
token0 {
|
70
|
-
id
|
71
|
-
totalSupply
|
72
|
-
decimals
|
73
|
-
}
|
74
|
-
token1 {
|
75
|
-
id
|
76
|
-
totalSupply
|
77
|
-
decimals
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
57
|
+
const query = (0, graphql_request_1.gql) `
|
58
|
+
{
|
59
|
+
pools(
|
60
|
+
orderBy: totalValueLockedUSD
|
61
|
+
first: ${length}
|
62
|
+
orderDirection: desc
|
63
|
+
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
+
) {
|
65
|
+
id
|
66
|
+
token0Price
|
67
|
+
token1Price
|
68
|
+
liquidity
|
69
|
+
token0 {
|
70
|
+
id
|
71
|
+
totalSupply
|
72
|
+
decimals
|
73
|
+
}
|
74
|
+
token1 {
|
75
|
+
id
|
76
|
+
totalSupply
|
77
|
+
decimals
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
81
|
`;
|
82
82
|
const res = yield (0, graphql_request_1.default)(url, query);
|
83
83
|
const pools = res.pools;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const constants_1 = require("./constants");
|
14
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
15
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
16
|
+
const bidsMemo = new MemoizedCache_1.MemoizedCache(constants_1.bidsCacheKey, {
|
17
|
+
prefix: constants_1.platformId,
|
18
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
19
|
+
});
|
20
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
const allBids = yield bidsMemo.getItem(cache);
|
22
|
+
if (!allBids)
|
23
|
+
return [];
|
24
|
+
const bids = allBids.filter((bid) => bid.buyer === owner);
|
25
|
+
if (!bids)
|
26
|
+
return [];
|
27
|
+
const registry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
28
|
+
const element = registry.addElementMultiple({
|
29
|
+
label: 'Deposit',
|
30
|
+
tags: ['Bids'],
|
31
|
+
});
|
32
|
+
bids.forEach((bid) => {
|
33
|
+
element.addAsset({
|
34
|
+
address: portfolio_core_1.suiNativeAddress,
|
35
|
+
amount: bid.wallet.fields.balance,
|
36
|
+
});
|
37
|
+
});
|
38
|
+
return registry.getElements(cache);
|
39
|
+
});
|
40
|
+
const fetcher = {
|
41
|
+
id: `${constants_1.platformId}-bids`,
|
42
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
43
|
+
executor,
|
44
|
+
};
|
45
|
+
exports.default = fetcher;
|
46
|
+
//# sourceMappingURL=bidsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bidsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/bidsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AAEzE,2CAAuD;AAEvD,kEAA+D;AAE/D,gFAA6E;AAE7E,MAAM,QAAQ,GAAG,IAAI,6BAAa,CAAQ,wBAAY,EAAE;IACtD,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;CACzB,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,MAAM,QAAQ,GAAG,IAAI,iCAAe,CAAC,0BAAS,CAAC,GAAG,EAAE,sBAAU,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,QAAQ,CAAC,kBAAkB,CAAC;QAC1C,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,CAAC,MAAM,CAAC;KACf,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,OAAO,CAAC,QAAQ,CAAC;YACf,OAAO,EAAE,iCAAgB;YACzB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;SAClC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const constants_1 = require("./constants");
|
14
|
+
const clients_1 = require("../../utils/clients");
|
15
|
+
const getDynamicFieldObjects_1 = require("../../utils/sui/getDynamicFieldObjects");
|
16
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
const client = (0, clients_1.getClientSui)();
|
18
|
+
const objects = yield (0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, constants_1.bidsStore, {
|
19
|
+
showContent: true,
|
20
|
+
});
|
21
|
+
const bids = objects
|
22
|
+
.map((obj) => {
|
23
|
+
var _a, _b, _c, _d;
|
24
|
+
if (((_b = (_a = obj.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.type) && ((_d = (_c = obj.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.type) === constants_1.bidsType) {
|
25
|
+
return obj.data.content.fields;
|
26
|
+
}
|
27
|
+
return [];
|
28
|
+
})
|
29
|
+
.flat();
|
30
|
+
yield cache.setItem(constants_1.bidsCacheKey, bids, {
|
31
|
+
prefix: constants_1.platformId,
|
32
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
33
|
+
});
|
34
|
+
});
|
35
|
+
const job = {
|
36
|
+
id: `${constants_1.platformId}-bids`,
|
37
|
+
executor,
|
38
|
+
label: 'realtime',
|
39
|
+
};
|
40
|
+
exports.default = job;
|
41
|
+
//# sourceMappingURL=bidsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bidsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/bidsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAA4E;AAC5E,iDAAmD;AACnD,mFAAgF;AAGhF,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,OAAO,GAAG,MAAM,IAAA,+CAAsB,EAAC,MAAM,EAAE,qBAAS,EAAE;QAC9D,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAU,OAAO;SACxB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;;QACX,IAAI,CAAA,MAAA,MAAA,GAAG,CAAC,IAAI,0CAAE,OAAO,0CAAE,IAAI,KAAI,CAAA,MAAA,MAAA,GAAG,CAAC,IAAI,0CAAE,OAAO,0CAAE,IAAI,MAAK,oBAAQ,EAAE,CAAC;YACpE,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAa,CAAC;QACxC,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;SACD,IAAI,EAAE,CAAC;IAEV,MAAM,KAAK,CAAC,OAAO,CAAC,wBAAY,EAAE,IAAI,EAAE;QACtC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ;IACR,KAAK,EAAE,UAAU;CAClB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -2,4 +2,8 @@ import { Platform } from '@sonarwatch/portfolio-core';
|
|
2
2
|
export declare const platformId = "tradeport";
|
3
3
|
export declare const platform: Platform;
|
4
4
|
export declare const locksCacheKey = "locks";
|
5
|
+
export declare const bidsCacheKey = "bids";
|
5
6
|
export declare const lockStore = "0x4b705de46a79b29276baf45009bc7d6f70cc0f1407f0c9e03cac5729c0c47946";
|
7
|
+
export declare const bidsStore = "0x1e5e7f38e3a61d1d189506d0fc6b7e47e935a292d9e1b23c0f3f1c0f94227772";
|
8
|
+
export declare const bidsType = "0xec175e537be9e48f75fa6929291de6454d2502f1091feb22c0d26a22821bbf28::kiosk_biddings::Bid";
|
9
|
+
export declare const escrowType = "0xec175e537be9e48f75fa6929291de6454d2502f1091feb22c0d26a22821bbf28::kiosk_biddings::Escrow";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.lockStore = exports.locksCacheKey = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.escrowType = exports.bidsType = exports.bidsStore = exports.lockStore = exports.bidsCacheKey = exports.locksCacheKey = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'tradeport';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -11,5 +11,9 @@ exports.platform = {
|
|
11
11
|
// defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
12
12
|
};
|
13
13
|
exports.locksCacheKey = `locks`;
|
14
|
+
exports.bidsCacheKey = `bids`;
|
14
15
|
exports.lockStore = '0x4b705de46a79b29276baf45009bc7d6f70cc0f1407f0c9e03cac5729c0c47946';
|
16
|
+
exports.bidsStore = '0x1e5e7f38e3a61d1d189506d0fc6b7e47e935a292d9e1b23c0f3f1c0f94227772';
|
17
|
+
exports.bidsType = '0xec175e537be9e48f75fa6929291de6454d2502f1091feb22c0d26a22821bbf28::kiosk_biddings::Bid';
|
18
|
+
exports.escrowType = '0xec175e537be9e48f75fa6929291de6454d2502f1091feb22c0d26a22821bbf28::kiosk_biddings::Escrow';
|
15
19
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,4BAA4B;IACrC,qEAAqE;CACtE,CAAC;AACW,QAAA,aAAa,GAAG,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,4BAA4B;IACrC,qEAAqE;CACtE,CAAC;AACW,QAAA,aAAa,GAAG,OAAO,CAAC;AACxB,QAAA,YAAY,GAAG,MAAM,CAAC;AAEtB,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAC1D,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAC1D,QAAA,QAAQ,GACnB,yFAAyF,CAAC;AAC/E,QAAA,UAAU,GACrB,4FAA4F,CAAC"}
|
@@ -7,7 +7,9 @@ exports.fetchers = exports.jobs = exports.platforms = void 0;
|
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const positionsFetcher_1 = __importDefault(require("./positionsFetcher"));
|
9
9
|
const locksJob_1 = __importDefault(require("./locksJob"));
|
10
|
+
const bidsJob_1 = __importDefault(require("./bidsJob"));
|
11
|
+
const bidsFetcher_1 = __importDefault(require("./bidsFetcher"));
|
10
12
|
exports.platforms = [constants_1.platform];
|
11
|
-
exports.jobs = [locksJob_1.default];
|
12
|
-
exports.fetchers = [positionsFetcher_1.default];
|
13
|
+
exports.jobs = [locksJob_1.default, bidsJob_1.default];
|
14
|
+
exports.fetchers = [positionsFetcher_1.default, bidsFetcher_1.default];
|
13
15
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0EAAkD;AAClD,0DAAkC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0EAAkD;AAClD,0DAAkC;AAClC,wDAAgC;AAChC,gEAAwC;AAE3B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,EAAE,iBAAO,CAAC,CAAC;AAClC,QAAA,QAAQ,GAAc,CAAC,0BAAgB,EAAE,qBAAW,CAAC,CAAC"}
|
@@ -23,3 +23,21 @@ export type LockObject = {
|
|
23
23
|
name: number[];
|
24
24
|
value: Lock;
|
25
25
|
};
|
26
|
+
export type Bid = {
|
27
|
+
beneficiary: string;
|
28
|
+
buyer: string;
|
29
|
+
commission: string;
|
30
|
+
id: ID;
|
31
|
+
nft_id: null;
|
32
|
+
nft_type: string;
|
33
|
+
price: string;
|
34
|
+
wallet: Wallet;
|
35
|
+
};
|
36
|
+
export type Wallet = {
|
37
|
+
fields: Fields;
|
38
|
+
type: string;
|
39
|
+
};
|
40
|
+
export type Fields = {
|
41
|
+
balance: string;
|
42
|
+
id: ID;
|
43
|
+
};
|