@sonarwatch/portfolio-plugins 0.12.54 → 0.12.56
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/AirdropFetcher.d.ts +24 -1
- package/src/AirdropFetcher.js +64 -1
- package/src/AirdropFetcher.js.map +1 -1
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/allbridge/positionsFetcher.js +1 -1
- package/src/plugins/allbridge/positionsFetcher.js.map +1 -1
- package/src/plugins/drift/airdropFetcher.js +3 -66
- package/src/plugins/drift/airdropFetcher.js.map +1 -1
- package/src/plugins/drift/constants.d.ts +2 -1
- package/src/plugins/drift/constants.js +11 -2
- package/src/plugins/drift/constants.js.map +1 -1
- package/src/plugins/drift/helpersAirdrop.d.ts +6 -2
- package/src/plugins/drift/helpersAirdrop.js +21 -21
- package/src/plugins/drift/helpersAirdrop.js.map +1 -1
- package/src/plugins/drift/types.d.ts +0 -16
- package/src/plugins/echelon/constants.d.ts +10 -0
- package/src/plugins/echelon/constants.js +20 -0
- package/src/plugins/echelon/constants.js.map +1 -0
- package/src/plugins/echelon/depositsFetcher.d.ts +3 -0
- package/src/plugins/echelon/depositsFetcher.js +178 -0
- package/src/plugins/echelon/depositsFetcher.js.map +1 -0
- package/src/plugins/echelon/helpers.d.ts +1 -0
- package/src/plugins/echelon/helpers.js +39 -0
- package/src/plugins/echelon/helpers.js.map +1 -0
- package/src/plugins/echelon/index.d.ts +6 -0
- package/src/plugins/echelon/index.js +13 -0
- package/src/plugins/echelon/index.js.map +1 -0
- package/src/plugins/echelon/marketsJob.d.ts +3 -0
- package/src/plugins/echelon/marketsJob.js +80 -0
- package/src/plugins/echelon/marketsJob.js.map +1 -0
- package/src/plugins/echelon/types.d.ts +78 -0
- package/src/plugins/echelon/types.js +3 -0
- package/src/plugins/echelon/types.js.map +1 -0
- package/src/plugins/jupiter/governance/asrFetcher.js +3 -3
- package/src/plugins/jupiter/governance/asrFetcher.js.map +1 -1
- package/src/plugins/jupiter/helpers.d.ts +0 -1
- package/src/plugins/jupiter/helpers.js +1 -9
- package/src/plugins/jupiter/helpers.js.map +1 -1
- package/src/plugins/jupiter/launchpad/allocationsFetcher.js +2 -2
- package/src/plugins/jupiter/launchpad/allocationsFetcher.js.map +1 -1
- package/src/plugins/kamino/airdropFetcher.js +2 -2
- package/src/plugins/kamino/airdropFetcher.js.map +1 -1
- package/src/plugins/parcl/airdropFetcher.js +2 -41
- package/src/plugins/parcl/airdropFetcher.js.map +1 -1
- package/src/plugins/parcl/constants.d.ts +2 -0
- package/src/plugins/parcl/constants.js +11 -1
- package/src/plugins/parcl/constants.js.map +1 -1
- package/src/plugins/parcl/helpersAirdrop.d.ts +0 -17
- package/src/plugins/parcl/helpersAirdrop.js +21 -24
- package/src/plugins/parcl/helpersAirdrop.js.map +1 -1
- package/src/plugins/zeta/airdropFetcher.js +2 -2
- package/src/plugins/zeta/airdropFetcher.js.map +1 -1
- package/src/utils/solana/jupiter/deriveClaimStatus.d.ts +2 -0
- package/src/utils/solana/jupiter/deriveClaimStatus.js +13 -0
- package/src/utils/solana/jupiter/deriveClaimStatus.js.map +1 -0
- package/src/utils/solana/jupiter/deriveClaimStatuses.d.ts +2 -0
- package/src/utils/solana/jupiter/deriveClaimStatuses.js +9 -0
- package/src/utils/solana/jupiter/deriveClaimStatuses.js.map +1 -0
- package/src/plugins/jito/helper.d.ts +0 -3
- package/src/plugins/jito/helper.js +0 -21
- package/src/plugins/jito/helper.js.map +0 -1
@@ -0,0 +1,178 @@
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const aptos_1 = require("../../utils/aptos");
|
21
|
+
const arrayToMap_1 = require("../../utils/misc/arrayToMap");
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const client = (0, clients_1.getClientAptos)();
|
24
|
+
const [userVault, userStaker] = yield Promise.all([
|
25
|
+
(0, aptos_1.getAccountResource)(client, owner, constants_1.vaultType),
|
26
|
+
(0, aptos_1.getAccountResource)(client, owner, constants_1.stakerType),
|
27
|
+
]);
|
28
|
+
if (!userVault && !userStaker)
|
29
|
+
return [];
|
30
|
+
const markets = yield cache.getItem(constants_1.marketKey, {
|
31
|
+
prefix: constants_1.platformId,
|
32
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
33
|
+
});
|
34
|
+
if (!markets)
|
35
|
+
return [];
|
36
|
+
const [tokenPrices, collateralBalances, liabilityBalances] = yield Promise.all([
|
37
|
+
cache.getTokenPricesAsMap(markets.map((market) => market.coinType), portfolio_core_1.NetworkId.aptos),
|
38
|
+
yield Promise.all(((userVault === null || userVault === void 0 ? void 0 : userVault.collaterals.data) || []).map((collateral) => (0, aptos_1.getView)(client, {
|
39
|
+
function: `${constants_1.echelonLendingPackage}account_coins`,
|
40
|
+
functionArguments: [
|
41
|
+
owner,
|
42
|
+
collateral.key.inner,
|
43
|
+
],
|
44
|
+
}).then((res) => {
|
45
|
+
if (!res || !res[0])
|
46
|
+
return null;
|
47
|
+
return res[0];
|
48
|
+
}))),
|
49
|
+
yield Promise.all(((userVault === null || userVault === void 0 ? void 0 : userVault.liabilities.data) || []).map((liability) => (0, aptos_1.getView)(client, {
|
50
|
+
function: `${constants_1.echelonLendingPackage}account_liability`,
|
51
|
+
functionArguments: [
|
52
|
+
owner,
|
53
|
+
liability.key.inner,
|
54
|
+
],
|
55
|
+
}).then((res) => {
|
56
|
+
if (!res || !res[0])
|
57
|
+
return null;
|
58
|
+
return res[0];
|
59
|
+
}))),
|
60
|
+
]);
|
61
|
+
if (!tokenPrices || tokenPrices.size < 1)
|
62
|
+
return [];
|
63
|
+
const marketsAsMap = (0, arrayToMap_1.arrayToMap)(markets, 'market');
|
64
|
+
const borrowedAssets = [];
|
65
|
+
const borrowedYields = [];
|
66
|
+
const suppliedAssets = [];
|
67
|
+
const suppliedYields = [];
|
68
|
+
const rewardAssets = [];
|
69
|
+
const suppliedLtvs = [];
|
70
|
+
((userVault === null || userVault === void 0 ? void 0 : userVault.collaterals.data) || []).forEach((collateral, i) => {
|
71
|
+
const market = marketsAsMap.get(collateral.key.inner);
|
72
|
+
if (!market || !market.collateralFactor)
|
73
|
+
return;
|
74
|
+
const tokenPrice = tokenPrices.get(market.coinType);
|
75
|
+
if (!tokenPrice)
|
76
|
+
return;
|
77
|
+
const collateralBalance = collateralBalances[i];
|
78
|
+
if (!collateralBalance || collateralBalance === '0')
|
79
|
+
return;
|
80
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(market.coinType, new bignumber_js_1.default(collateralBalance)
|
81
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
82
|
+
.toNumber(), portfolio_core_1.NetworkId.aptos, tokenPrice));
|
83
|
+
suppliedLtvs.push(market.collateralFactor);
|
84
|
+
suppliedYields.push([
|
85
|
+
{
|
86
|
+
apr: new bignumber_js_1.default(market.supplyApr).toNumber(),
|
87
|
+
apy: (0, portfolio_core_1.aprToApy)(new bignumber_js_1.default(market.supplyApr).toNumber()),
|
88
|
+
},
|
89
|
+
]);
|
90
|
+
});
|
91
|
+
((userVault === null || userVault === void 0 ? void 0 : userVault.liabilities.data) || []).forEach((liability, i) => {
|
92
|
+
const market = marketsAsMap.get(liability.key.inner);
|
93
|
+
if (!market)
|
94
|
+
return;
|
95
|
+
const tokenPrice = tokenPrices.get(market.coinType);
|
96
|
+
if (!tokenPrice)
|
97
|
+
return;
|
98
|
+
const liabilityBalance = liabilityBalances[i];
|
99
|
+
if (!liabilityBalance || liabilityBalance === '0')
|
100
|
+
return;
|
101
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(market.coinType, new bignumber_js_1.default(liabilityBalance)
|
102
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
103
|
+
.toNumber(), portfolio_core_1.NetworkId.aptos, tokenPrice));
|
104
|
+
borrowedYields.push([
|
105
|
+
{
|
106
|
+
apr: new bignumber_js_1.default(market.borrowApr).toNumber(),
|
107
|
+
apy: (0, portfolio_core_1.aprToApy)(new bignumber_js_1.default(market.borrowApr).toNumber()),
|
108
|
+
},
|
109
|
+
]);
|
110
|
+
});
|
111
|
+
if (userStaker && userStaker.user_pools.data.length > 0) {
|
112
|
+
const rewardPromises = [];
|
113
|
+
userStaker.user_pools.data.forEach((userPool) => {
|
114
|
+
userPool.value.rewards.data.forEach((reward) => {
|
115
|
+
rewardPromises.push((0, aptos_1.getView)(client, {
|
116
|
+
function: `${constants_1.echelonFarmingPackage}claimable_reward_amount`,
|
117
|
+
functionArguments: [
|
118
|
+
owner,
|
119
|
+
reward.key,
|
120
|
+
userPool.value.farming_identifier,
|
121
|
+
],
|
122
|
+
}).then((res) => {
|
123
|
+
const market = markets.find((m) => m.asset_name === reward.key);
|
124
|
+
if (!market || !res || !res[0])
|
125
|
+
return null;
|
126
|
+
return {
|
127
|
+
coinType: market.coinType,
|
128
|
+
balance: Number(res[0]),
|
129
|
+
};
|
130
|
+
}));
|
131
|
+
});
|
132
|
+
});
|
133
|
+
const claimableRewardsAmounts = yield Promise.all(rewardPromises);
|
134
|
+
claimableRewardsAmounts.forEach((claimableReward) => {
|
135
|
+
if (!claimableReward || claimableReward.balance === 0)
|
136
|
+
return;
|
137
|
+
const tokenPrice = tokenPrices.get(claimableReward.coinType);
|
138
|
+
if (!tokenPrice)
|
139
|
+
return;
|
140
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(claimableReward.coinType, new bignumber_js_1.default(claimableReward.balance)
|
141
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
142
|
+
.toNumber(), portfolio_core_1.NetworkId.aptos, tokenPrice));
|
143
|
+
});
|
144
|
+
}
|
145
|
+
const { borrowedValue, healthRatio, suppliedValue, value, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({
|
146
|
+
suppliedAssets,
|
147
|
+
borrowedAssets,
|
148
|
+
rewardAssets,
|
149
|
+
suppliedLtvs,
|
150
|
+
});
|
151
|
+
const element = {
|
152
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
153
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
154
|
+
platformId: constants_1.platformId,
|
155
|
+
label: 'Lending',
|
156
|
+
value,
|
157
|
+
data: {
|
158
|
+
borrowedAssets,
|
159
|
+
borrowedValue,
|
160
|
+
borrowedYields,
|
161
|
+
suppliedAssets,
|
162
|
+
suppliedValue,
|
163
|
+
suppliedYields,
|
164
|
+
healthRatio,
|
165
|
+
rewardAssets,
|
166
|
+
rewardValue,
|
167
|
+
value,
|
168
|
+
},
|
169
|
+
};
|
170
|
+
return [element];
|
171
|
+
});
|
172
|
+
const fetcher = {
|
173
|
+
id: `${constants_1.platformId}-deposits`,
|
174
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
175
|
+
executor,
|
176
|
+
};
|
177
|
+
exports.default = fetcher;
|
178
|
+
//# sourceMappingURL=depositsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/echelon/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AAGrC,2CAOqB;AAErB,qGAA6E;AAC7E,iDAAqD;AACrD,6CAAgE;AAChE,4DAAyD;AAGzD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAEhC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChD,IAAA,0BAAkB,EAAY,MAAM,EAAE,KAAK,EAAE,qBAAS,CAAC;QACvD,IAAA,0BAAkB,EAAa,MAAM,EAAE,KAAK,EAAE,sBAAU,CAAC;KAC1D,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAAW,qBAAS,EAAE;QACvD,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,KAAK;KAC3B,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,GACxD,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,KAAK,CAAC,mBAAmB,CACvB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAa,EACpD,0BAAS,CAAC,KAAK,CAChB;QACD,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,CAAC,IAAI,KAAI,EAAE,CAAC,CAAC,GAAG,C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AO,CAAC;iBACnC,SAAS,CAAC,SAAA,EAAE,EAAI,UAAU,CAAC,QAAQ,CAAA,CAAC;iBACpC,QAAQ,EAAE,EACb,0BAAS,CAAC,KAAK,EACf,UAAU,CACX,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC;QACtB,cAAc;QACd,cAAc;QACd,YAAY;QACZ,YAAY;KACb,CAAC,CAAC;IAEL,MAAM,OAAO,GAAqB;QAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,KAAK;QAC1B,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,KAAK;IAC1B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const fp64ToFloat: (a: bigint) => number;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
// input cannot be larger the 2^31
|
3
|
+
// this should allow at least 6 digits precision in the fractional part
|
4
|
+
// https://stackoverflow.com/questions/45929493/node-js-maximum-safe-floating-point-number
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fp64ToFloat = void 0;
|
7
|
+
const ZERO = BigInt(0);
|
8
|
+
const ONE = BigInt(1);
|
9
|
+
const fp64ToFloat = (a) => {
|
10
|
+
// avoid large number
|
11
|
+
let mask = BigInt('0xffffffff000000000000000000000000');
|
12
|
+
if ((a & mask) != ZERO) {
|
13
|
+
throw new Error('too large');
|
14
|
+
}
|
15
|
+
// integer part
|
16
|
+
mask = BigInt('0x10000000000000000');
|
17
|
+
let base = 1;
|
18
|
+
let result = 0;
|
19
|
+
for (let i = 0; i < 32; ++i) {
|
20
|
+
if ((a & mask) != ZERO) {
|
21
|
+
result += base;
|
22
|
+
}
|
23
|
+
base *= 2;
|
24
|
+
mask = mask << ONE;
|
25
|
+
}
|
26
|
+
// fractional part
|
27
|
+
mask = BigInt('0x8000000000000000');
|
28
|
+
base = 0.5;
|
29
|
+
for (let i = 0; i < 32; ++i) {
|
30
|
+
if ((a & mask) != ZERO) {
|
31
|
+
result += base;
|
32
|
+
}
|
33
|
+
base /= 2;
|
34
|
+
mask = mask >> ONE;
|
35
|
+
}
|
36
|
+
return result;
|
37
|
+
};
|
38
|
+
exports.fp64ToFloat = fp64ToFloat;
|
39
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/echelon/helpers.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,uEAAuE;AACvE,0FAA0F;;;AAE1F,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEf,MAAM,WAAW,GAAG,CAAC,CAAS,EAAU,EAAE;IAC/C,qBAAqB;IACrB,IAAI,IAAI,GAAG,MAAM,CAAC,oCAAoC,CAAC,CAAC;IACxD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC;IAED,eAAe;IACf,IAAI,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACrC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,IAAI,CAAC;QACjB,CAAC;QACD,IAAI,IAAI,CAAC,CAAC;QACV,IAAI,GAAG,IAAI,IAAI,GAAG,CAAC;IACrB,CAAC;IAED,kBAAkB;IAClB,IAAI,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,CAAC;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,IAAI,CAAC;QACjB,CAAC;QACD,IAAI,IAAI,CAAC,CAAC;QACV,IAAI,GAAG,IAAI,IAAI,GAAG,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA9BW,QAAA,WAAW,eA8BtB"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
|
9
|
+
const marketsJob_1 = __importDefault(require("./marketsJob"));
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [marketsJob_1.default];
|
12
|
+
exports.fetchers = [depositsFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/echelon/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,8DAAsC;AAEzB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,CAAC,CAAC;AAC3B,QAAA,QAAQ,GAAc,CAAC,yBAAe,CAAC,CAAC"}
|
@@ -0,0 +1,80 @@
|
|
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 aptos_1 = require("../../utils/aptos");
|
16
|
+
const helpers_1 = require("./helpers");
|
17
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
+
const client = (0, clients_1.getClientAptos)();
|
19
|
+
const marketsResult = yield (0, aptos_1.getView)(client, {
|
20
|
+
function: '0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba::lending::market_objects',
|
21
|
+
});
|
22
|
+
if (!marketsResult)
|
23
|
+
return;
|
24
|
+
const marketsIds = marketsResult[0].map((o) => o.inner);
|
25
|
+
const markets = yield Promise.all(marketsIds.map((market) => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
+
const [borrowApr, supplyApr, coinType, lendingMarket] = yield Promise.all([
|
27
|
+
(0, aptos_1.getView)(client, {
|
28
|
+
function: `${constants_1.echelonLendingPackage}borrow_interest_rate`,
|
29
|
+
functionArguments: [market],
|
30
|
+
}).then((res) => {
|
31
|
+
if (!res || !res[0]) {
|
32
|
+
return null;
|
33
|
+
}
|
34
|
+
const r = res[0];
|
35
|
+
return (0, helpers_1.fp64ToFloat)(BigInt(r.v)) * 100;
|
36
|
+
}),
|
37
|
+
(0, aptos_1.getView)(client, {
|
38
|
+
function: `${constants_1.echelonLendingPackage}supply_interest_rate`,
|
39
|
+
functionArguments: [market],
|
40
|
+
}).then((res) => {
|
41
|
+
if (!res || !res[0]) {
|
42
|
+
return null;
|
43
|
+
}
|
44
|
+
const r = res[0];
|
45
|
+
return (0, helpers_1.fp64ToFloat)(BigInt(r.v)) * 100;
|
46
|
+
}),
|
47
|
+
(0, aptos_1.getView)(client, {
|
48
|
+
function: `${constants_1.echelonLendingPackage}market_coin`,
|
49
|
+
functionArguments: [market],
|
50
|
+
}).then((res) => {
|
51
|
+
if (!res || !res[0]) {
|
52
|
+
return null;
|
53
|
+
}
|
54
|
+
return (0, portfolio_core_1.formatTokenAddress)(res[0], portfolio_core_1.NetworkId.aptos);
|
55
|
+
}),
|
56
|
+
(0, aptos_1.getAccountResource)(client, market, constants_1.marketType),
|
57
|
+
]);
|
58
|
+
return {
|
59
|
+
market,
|
60
|
+
asset_name: lendingMarket === null || lendingMarket === void 0 ? void 0 : lendingMarket.asset_name,
|
61
|
+
borrowApr,
|
62
|
+
supplyApr,
|
63
|
+
coinType,
|
64
|
+
collateralFactor: lendingMarket
|
65
|
+
? Number(lendingMarket.collateral_factor_bps) / 1e4
|
66
|
+
: null,
|
67
|
+
};
|
68
|
+
})));
|
69
|
+
yield cache.setItem(constants_1.marketKey, markets, {
|
70
|
+
prefix: constants_1.platformId,
|
71
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
72
|
+
});
|
73
|
+
});
|
74
|
+
const job = {
|
75
|
+
id: `${constants_1.platformId}-markets`,
|
76
|
+
executor,
|
77
|
+
label: 'normal',
|
78
|
+
};
|
79
|
+
exports.default = job;
|
80
|
+
//# sourceMappingURL=marketsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/echelon/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA2E;AAG3E,2CAKqB;AACrB,iDAAqD;AACrD,6CAAgE;AAEhE,uCAAwC;AAExC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAEhC,MAAM,aAAa,GAAG,MAAM,IAAA,eAAO,EAAC,MAAM,EAAE;QAC1C,QAAQ,EACN,6FAA6F;KAChG,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa;QAAE,OAAO;IAE3B,MAAM,UAAU,GAAI,aAAa,CAAC,CAAC,CAAyB,CAAC,GAAG,CAC9D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CACf,CAAC;IAEF,MAAM,OAAO,GAAa,MAAM,OAAO,CAAC,GAAG,CACzC,UAAU,CAAC,GAAG,CAAC,CAAO,MAAM,EAAE,EAAE;QAC9B,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACvE;YACE,IAAA,eAAO,EAAC,MAAM,EAAE;gBACd,QAAQ,EAAE,GAAG,iCAAqB,sBAAsB;gBACxD,iBAAiB,EAAE,CAAC,MAAuB,CAAC;aAC7C,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACd,IAAI,CAAC,GAAG,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a,uBAAb,aAAa,CAAE,UAAU;YACrC,SAAS;YACT,SAAS;YACT,QAAQ;YACR,gBAAgB,EAAE,aAAa;gBAC7B,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,qBAAqB,CAAC,GAAG,GAAG;gBACnD,CAAC,CAAC,IAAI;SACC,CAAC;IACd,CAAC,CAAA,CAAC,CACH,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,qBAAS,EAAE,OAAO,EAAE;QACtC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
export type UserVault = {
|
2
|
+
collaterals: {
|
3
|
+
data: Collateral[];
|
4
|
+
};
|
5
|
+
efficiency_mode_id: number;
|
6
|
+
liabilities: {
|
7
|
+
data: Liability[];
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export type Collateral = {
|
11
|
+
key: {
|
12
|
+
inner: string;
|
13
|
+
};
|
14
|
+
value: string;
|
15
|
+
};
|
16
|
+
export type Liability = {
|
17
|
+
key: {
|
18
|
+
inner: string;
|
19
|
+
};
|
20
|
+
value: {
|
21
|
+
interest_accumulated: string;
|
22
|
+
last_interest_rate_index: {
|
23
|
+
v: string;
|
24
|
+
};
|
25
|
+
principal: string;
|
26
|
+
};
|
27
|
+
};
|
28
|
+
export type Market = {
|
29
|
+
market: string;
|
30
|
+
asset_name: string;
|
31
|
+
supplyApr: number;
|
32
|
+
borrowApr: number;
|
33
|
+
coinType: string;
|
34
|
+
collateralFactor: number;
|
35
|
+
};
|
36
|
+
export type LendingMarket = {
|
37
|
+
asset_mantissa: string;
|
38
|
+
asset_name: string;
|
39
|
+
asset_type: string;
|
40
|
+
borrow_cap: string;
|
41
|
+
collateral_factor_bps: string;
|
42
|
+
efficiency_mode_id: number;
|
43
|
+
initial_liquidity: string;
|
44
|
+
interest_rate_last_update_seconds: string;
|
45
|
+
interest_rate_model_type: string;
|
46
|
+
paused: boolean;
|
47
|
+
supply_cap: string;
|
48
|
+
total_cash: string;
|
49
|
+
total_liability: string;
|
50
|
+
total_reserve: string;
|
51
|
+
total_shares: string;
|
52
|
+
};
|
53
|
+
export type UserStaker = {
|
54
|
+
user_pools: {
|
55
|
+
data: UserPool[];
|
56
|
+
};
|
57
|
+
};
|
58
|
+
export type UserPool = {
|
59
|
+
key: string;
|
60
|
+
value: {
|
61
|
+
farming_identifier: string;
|
62
|
+
rewards: {
|
63
|
+
data: Reward[];
|
64
|
+
};
|
65
|
+
};
|
66
|
+
};
|
67
|
+
export type Reward = {
|
68
|
+
key: string;
|
69
|
+
value: {
|
70
|
+
last_acc_rewards_per_share: string;
|
71
|
+
reward_amount: string;
|
72
|
+
reward_name: string;
|
73
|
+
};
|
74
|
+
};
|
75
|
+
export type RewardBalance = {
|
76
|
+
coinType: string;
|
77
|
+
balance: number;
|
78
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/echelon/types.ts"],"names":[],"mappings":""}
|
@@ -16,7 +16,7 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const clients_1 = require("../../../utils/clients");
|
19
|
-
const
|
19
|
+
const deriveClaimStatus_1 = require("../../../utils/solana/jupiter/deriveClaimStatus");
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../../utils/misc/tokenPriceToAssetToken"));
|
21
21
|
const structs_1 = require("../launchpad/structs");
|
22
22
|
const constants_1 = require("../launchpad/constants");
|
@@ -34,10 +34,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
34
34
|
for (let i = 0; i < claims.length; i++) {
|
35
35
|
const proof = claims[i];
|
36
36
|
if (proof.mint === constants_1.jupMint) {
|
37
|
-
claimsStatusPubkeys.push((0,
|
37
|
+
claimsStatusPubkeys.push((0, deriveClaimStatus_1.deriveClaimStatus)(owner, proof.merkle_tree, constants_1.jupDisProgram));
|
38
38
|
}
|
39
39
|
else {
|
40
|
-
claimsStatusPubkeys.push((0,
|
40
|
+
claimsStatusPubkeys.push((0, deriveClaimStatus_1.deriveClaimStatus)(owner, proof.merkle_tree, constants_1.mainDisProgram));
|
41
41
|
}
|
42
42
|
}
|
43
43
|
const [claimStatusAccounts, tokenPriceById] = yield Promise.all([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"asrFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/governance/asrFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAE7C,gEAAqC;AAGrC,oDAAyD;AAEzD,
|
1
|
+
{"version":3,"file":"asrFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/governance/asrFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAE7C,gEAAqC;AAGrC,oDAAyD;AAEzD,uFAAoF;AACpF,wGAAgF;AAChF,kDAAyD;AACzD,sDAKgC;AAChC,2CAAyC;AACzC,kDAAsE;AAEtE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,WAAW,GAAsC,MAAM,eAAK;SAC/D,GAAG,CAAC,GAAG,kBAAM,IAAI,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SAC5C,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CA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AAe,OAAO,CAAC"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
2
|
import { PortfolioAssetToken } from '@sonarwatch/portfolio-core';
|
3
|
-
export declare function deriveClaimStatus(claimant: string, merkleTree: string, merkleDistributor: string): PublicKey;
|
4
3
|
export declare function getVotePda(owner: string): PublicKey;
|
5
4
|
export declare function getJupiterPrices(mints: PublicKey[], vsMint: PublicKey): Promise<Map<string, number>>;
|
6
5
|
export declare function getMergedAssets(assets: PortfolioAssetToken[]): PortfolioAssetToken[];
|
@@ -12,19 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.getMergedAssets = exports.getJupiterPrices = exports.getVotePda =
|
15
|
+
exports.getMergedAssets = exports.getJupiterPrices = exports.getVotePda = void 0;
|
16
16
|
const web3_js_1 = require("@solana/web3.js");
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
18
18
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
19
19
|
const constants_1 = require("./launchpad/constants");
|
20
|
-
function deriveClaimStatus(claimant, merkleTree, merkleDistributor) {
|
21
|
-
return web3_js_1.PublicKey.findProgramAddressSync([
|
22
|
-
Buffer.from('ClaimStatus'),
|
23
|
-
new web3_js_1.PublicKey(claimant).toBytes(),
|
24
|
-
new web3_js_1.PublicKey(merkleTree).toBytes(),
|
25
|
-
], new web3_js_1.PublicKey(merkleDistributor))[0];
|
26
|
-
}
|
27
|
-
exports.deriveClaimStatus = deriveClaimStatus;
|
28
20
|
function getVotePda(owner) {
|
29
21
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
30
22
|
Buffer.from('Escrow'),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;AAC7C,+DAGoC;AAEpC,qDAAoE;AAEpE,SAAgB,
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;AAC7C,+DAGoC;AAEpC,qDAAoE;AAEpE,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrB,wBAAY,CAAC,OAAO,EAAE;QACtB,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;KAC/B,EACD,yBAAa,CACd,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gCASC;AAED,SAAsB,gBAAgB,CAAC,KAAkB,EAAE,MAAiB;;QAC1E,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CACzB,+BAA+B,EAC/B;YACE,MAAM,EAAE;gBACN,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBAC7C,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC3B;SACF,CACF,CAAC;QACF,MAAM,MAAM,GAAwB,IAAI,GAAG,EAAE,CAAC;QAC9C,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAfD,4CAeC;AAED,SAAgB,eAAe,CAAC,MAA6B;IAC3D,MAAM,WAAW,GAAqC,IAAI,GAAG,EAAE,CAAC;IAChE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;YAAE,SAAS;QAErC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;QAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QACtC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAC/B,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC;YACzC,aAAa,CAAC,KAAK,GAAG,IAAA,+BAAc,EAAC,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YACxE,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1C,CAAC;AAnBD,0CAmBC"}
|
@@ -16,7 +16,7 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const clients_1 = require("../../../utils/clients");
|
19
|
-
const
|
19
|
+
const deriveClaimStatus_1 = require("../../../utils/solana/jupiter/deriveClaimStatus");
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../../utils/misc/tokenPriceToAssetToken"));
|
21
21
|
const structs_1 = require("./structs");
|
22
22
|
const constants_1 = require("./constants");
|
@@ -40,7 +40,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
40
40
|
continue;
|
41
41
|
eligibleAirdrops.push(constants_1.airdropsInfo[i]);
|
42
42
|
proofs.push(proof.data);
|
43
|
-
claimsPubkeys.push((0,
|
43
|
+
claimsPubkeys.push((0, deriveClaimStatus_1.deriveClaimStatus)(owner, proof.data.merkle_tree, constants_1.airdropsInfo[i].distributorProgram));
|
44
44
|
}
|
45
45
|
if (proofs.length === 0)
|
46
46
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"allocationsFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/launchpad/allocationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAE7C,gEAAqC;AAGrC,oDAAyD;AAEzD,
|
1
|
+
{"version":3,"file":"allocationsFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/launchpad/allocationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAE7C,gEAAqC;AAGrC,oDAAyD;AAEzD,uFAAoF;AACpF,wGAAgF;AAChF,uCAA8C;AAC9C,2CAA+E;AAC/E,kDAAsE;AAEtE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,WAAW,GACf,MAAM,OAAO,CAAC,GAAG,CACf,wBAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YACnC,OAAO,eAAK;iBACT,GAAG,CAAC,GAAG,qBAAS,IAAI,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iBAC5D,K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IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -16,7 +16,7 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
16
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
18
18
|
const constants_1 = require("./constants");
|
19
|
-
const
|
19
|
+
const deriveClaimStatus_1 = require("../../utils/solana/jupiter/deriveClaimStatus");
|
20
20
|
const clients_1 = require("../../utils/clients");
|
21
21
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
22
|
const kmnoFactor = new bignumber_js_1.default(Math.pow(10, constants_1.kmnoDecimals));
|
@@ -26,7 +26,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
26
26
|
.catch(() => null);
|
27
27
|
if (!allocation)
|
28
28
|
return [];
|
29
|
-
const pda = (0,
|
29
|
+
const pda = (0, deriveClaimStatus_1.deriveClaimStatus)(owner, allocation.data.merkle_tree, constants_1.distributorProgram);
|
30
30
|
const client = (0, clients_1.getClientSolana)();
|
31
31
|
const claimStatus = yield client.getAccountInfo(pda);
|
32
32
|
if (claimStatus)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AACrC,kDAA6C;AAG7C,2CAMqB;AACrB,
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AACrC,kDAA6C;AAG7C,2CAMqB;AACrB,oFAAiF;AAEjF,iDAAsD;AACtD,qGAA6E;AAE7E,MAAM,UAAU,GAAG,IAAI,sBAAS,CAAC,S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KACF,CAAC;AACJ,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"}
|
@@ -1,47 +1,8 @@
|
|
1
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
3
|
const constants_1 = require("./constants");
|
17
|
-
const clients_1 = require("../../utils/clients");
|
18
|
-
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
19
4
|
const helpersAirdrop_1 = require("./helpersAirdrop");
|
20
|
-
const
|
21
|
-
|
22
|
-
return [];
|
23
|
-
const client = (0, clients_1.getClientSolana)();
|
24
|
-
const airdrop = yield (0, helpersAirdrop_1.fetchAirdrop)(owner, client, cache);
|
25
|
-
if (!(0, portfolio_core_1.isAirdropEligible)(airdrop) || airdrop.isClaimed)
|
26
|
-
return [];
|
27
|
-
if (!airdrop.amount)
|
28
|
-
return [];
|
29
|
-
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.prclMint, airdrop.amount, portfolio_core_1.NetworkId.solana, undefined, airdrop.price || undefined, { isClaimable: true });
|
30
|
-
return [
|
31
|
-
{
|
32
|
-
value: asset.value,
|
33
|
-
type: portfolio_core_1.PortfolioElementType.multiple,
|
34
|
-
platformId: constants_1.platformId,
|
35
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
36
|
-
label: 'Airdrop',
|
37
|
-
data: { assets: [asset] },
|
38
|
-
},
|
39
|
-
];
|
40
|
-
});
|
41
|
-
const fetcher = {
|
42
|
-
id: `${constants_1.platformId}-airdrop`,
|
43
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
44
|
-
executor,
|
45
|
-
};
|
5
|
+
const AirdropFetcher_1 = require("../../AirdropFetcher");
|
6
|
+
const fetcher = (0, AirdropFetcher_1.airdropFetcherToFetcher)(helpersAirdrop_1.airdropFetcher, constants_1.platformId, `${constants_1.platformId}-airdrop`, constants_1.airdropStatics.claimEnd);
|
46
7
|
exports.default = fetcher;
|
47
8
|
//# sourceMappingURL=airdropFetcher.js.map
|