@sonarwatch/portfolio-plugins 0.11.193 → 0.11.195
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -1
- package/package.json +2 -2
- package/src/AirdropFetcher.d.ts +11 -0
- package/src/AirdropFetcher.js +92 -0
- package/src/AirdropFetcher.js.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +10 -1
- package/src/index.js.map +1 -1
- package/src/plugins/drift/airdropFetcher.js +7 -21
- package/src/plugins/drift/airdropFetcher.js.map +1 -1
- package/src/plugins/drift/constants.d.ts +4 -0
- package/src/plugins/drift/constants.js +8 -4
- package/src/plugins/drift/constants.js.map +1 -1
- package/src/plugins/drift/helpersAirdrop.d.ts +3 -0
- package/src/plugins/drift/helpersAirdrop.js +59 -0
- package/src/plugins/drift/helpersAirdrop.js.map +1 -0
- package/src/plugins/drift/index.d.ts +1 -0
- package/src/plugins/drift/index.js +3 -1
- package/src/plugins/drift/index.js.map +1 -1
- package/src/plugins/kriya/constants.d.ts +13 -0
- package/src/plugins/kriya/constants.js +30 -0
- package/src/plugins/kriya/constants.js.map +1 -0
- package/src/plugins/kriya/farmsFetcher.d.ts +3 -0
- package/src/plugins/kriya/farmsFetcher.js +104 -0
- package/src/plugins/kriya/farmsFetcher.js.map +1 -0
- package/src/plugins/kriya/farmsJob.d.ts +3 -0
- package/src/plugins/kriya/farmsJob.js +47 -0
- package/src/plugins/kriya/farmsJob.js.map +1 -0
- package/src/plugins/kriya/index.d.ts +6 -0
- package/src/plugins/kriya/index.js +15 -0
- package/src/plugins/kriya/index.js.map +1 -0
- package/src/plugins/kriya/types.d.ts +155 -0
- package/src/plugins/kriya/types.js +16 -0
- package/src/plugins/kriya/types.js.map +1 -0
- package/src/plugins/kriya/vaultsFetcher.d.ts +3 -0
- package/src/plugins/kriya/vaultsFetcher.js +94 -0
- package/src/plugins/kriya/vaultsFetcher.js.map +1 -0
- package/src/plugins/kriya/vaultsJob.d.ts +3 -0
- package/src/plugins/kriya/vaultsJob.js +57 -0
- package/src/plugins/kriya/vaultsJob.js.map +1 -0
- package/src/plugins/parcl/airdropFetcher.js +7 -45
- package/src/plugins/parcl/airdropFetcher.js.map +1 -1
- package/src/plugins/parcl/constants.d.ts +3 -0
- package/src/plugins/parcl/constants.js +7 -4
- package/src/plugins/parcl/constants.js.map +1 -1
- package/src/plugins/parcl/helpersAirdrop.d.ts +19 -0
- package/src/plugins/parcl/helpersAirdrop.js +99 -0
- package/src/plugins/parcl/helpersAirdrop.js.map +1 -0
- package/src/plugins/parcl/index.d.ts +1 -0
- package/src/plugins/parcl/index.js +3 -1
- package/src/plugins/parcl/index.js.map +1 -1
- package/src/plugins/parcl/types.d.ts +6 -1
- package/src/plugins/sandglass/marketsJob.js +3 -2
- package/src/plugins/sandglass/marketsJob.js.map +1 -1
- package/src/utils/sui/mulitpleGetBalances.d.ts +3 -0
- package/src/utils/sui/mulitpleGetBalances.js +19 -0
- package/src/utils/sui/mulitpleGetBalances.js.map +1 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.d.ts +4 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.js +25 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.js.map +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,gEAAqC;AAGrC,2CAAuE;AACvE,iDAAmD;AACnD,qEAAkE;AAElE,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAe,EAAoB,MAAM,EAAE,KAAK,EAAE;QAC3E,MAAM,EAAE,EAAE,OAAO,EAAE,0BAAc,EAAE;KACpC,CAAC,CAAC;IACH,IAAI,YAAY,CAA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EAAE,KAAK;YAClB,YAAY,EAAE,EAAE;YAChB,iBAAiB,EAAE,IAAI;YACvB,KAAK;YACL,MAAM,EAAE;gBACN;oBACE,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,GAAG;oBACvB,GAAG,EAAE,IAAA,yBAAQ,EAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;iBAClC;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,OAAO;QACL;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,WAAW;aACZ;YACD,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,UAAU;SAClB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,47 @@
|
|
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 axios_1 = __importDefault(require("axios"));
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const pools = yield axios_1.default
|
20
|
+
.get(constants_1.poolsUrl, {
|
21
|
+
headers: {
|
22
|
+
Origin: 'https://www.app.kriya.finance/',
|
23
|
+
Referer: 'https://www.app.kriya.finance',
|
24
|
+
'X-Api-Key': 'xf40orKtic35JD39RVem77IOuSjb44FV5X7wSabU',
|
25
|
+
},
|
26
|
+
})
|
27
|
+
.catch(() => null);
|
28
|
+
if (!pools)
|
29
|
+
return;
|
30
|
+
const poolsInfo = [];
|
31
|
+
for (const pool of pools.data) {
|
32
|
+
if (pool.lspSupply === '0')
|
33
|
+
continue;
|
34
|
+
poolsInfo.push(pool);
|
35
|
+
}
|
36
|
+
yield cache.setItem(constants_1.farmsInfoKey, poolsInfo, {
|
37
|
+
prefix: constants_1.platformId,
|
38
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
39
|
+
});
|
40
|
+
});
|
41
|
+
const job = {
|
42
|
+
id: `${constants_1.platformId}-farms`,
|
43
|
+
executor,
|
44
|
+
label: 'normal',
|
45
|
+
};
|
46
|
+
exports.default = job;
|
47
|
+
//# sourceMappingURL=farmsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"farmsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/farmsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+DAAuD;AAGvD,2CAAiE;AAGjE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,KAAK,GAAqC,MAAM,eAAK;SACxD,GAAG,CAAC,oBAAQ,EAAE;QACb,OAAO,EAAE;YACP,MAAM,EAAE,gCAAgC;YACxC,OAAO,EAAE,+BAA+B;YACxC,WAAW,EAAE,0CAA0C;SACxD;KACF,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAErB,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,SAAS,KAAK,GAAG;YAAE,SAAS;QAErC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,wBAAY,EAAE,SAAS,EAAE;QAC3C,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,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
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 vaultsFetcher_1 = __importDefault(require("./vaultsFetcher"));
|
9
|
+
const vaultsJob_1 = __importDefault(require("./vaultsJob"));
|
10
|
+
const farmsJob_1 = __importDefault(require("./farmsJob"));
|
11
|
+
const farmsFetcher_1 = __importDefault(require("./farmsFetcher"));
|
12
|
+
exports.platforms = [constants_1.platform];
|
13
|
+
exports.jobs = [vaultsJob_1.default, farmsJob_1.default];
|
14
|
+
exports.fetchers = [vaultsFetcher_1.default, farmsFetcher_1.default];
|
15
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,oEAA2C;AAC3C,4DAAmC;AACnC,0DAAkC;AAClC,kEAA0C;AAE7B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,mBAAQ,EAAE,kBAAQ,CAAC,CAAC;AACnC,QAAA,QAAQ,GAAc,CAAC,uBAAY,EAAE,sBAAY,CAAC,CAAC"}
|
@@ -0,0 +1,155 @@
|
|
1
|
+
export type VaultInfo = {
|
2
|
+
id: string;
|
3
|
+
underlyingPool: string;
|
4
|
+
tokenType: string;
|
5
|
+
};
|
6
|
+
export type Vault = {
|
7
|
+
clmm_pool_id: string;
|
8
|
+
fee_a: string;
|
9
|
+
fee_b: string;
|
10
|
+
fee_val: string;
|
11
|
+
free_balance_a: string;
|
12
|
+
free_balance_b: string;
|
13
|
+
free_threshold_a: string;
|
14
|
+
free_threshold_b: string;
|
15
|
+
id: ID;
|
16
|
+
last_rebalance_sqrt_price: string;
|
17
|
+
last_rebalance_time: string;
|
18
|
+
lower_price_scalling: string;
|
19
|
+
lower_tick: number;
|
20
|
+
lower_trigger_price: string;
|
21
|
+
lower_trigger_price_scalling: string;
|
22
|
+
rewards_bag: RewardsBag;
|
23
|
+
seed_balance: string;
|
24
|
+
slippage_down: string;
|
25
|
+
slippage_up: string;
|
26
|
+
swap_routes: RewardsBag;
|
27
|
+
treasury_cap: TreasuryCap;
|
28
|
+
upper_price_scalling: string;
|
29
|
+
upper_tick: number;
|
30
|
+
upper_trigger_price: string;
|
31
|
+
upper_trigger_price_scalling: string;
|
32
|
+
};
|
33
|
+
export type ID = {
|
34
|
+
id: string;
|
35
|
+
};
|
36
|
+
export type RewardsBag = {
|
37
|
+
fields: RewardsBagFields;
|
38
|
+
type: string;
|
39
|
+
};
|
40
|
+
export type RewardsBagFields = {
|
41
|
+
id: ID;
|
42
|
+
size: string;
|
43
|
+
};
|
44
|
+
export type TreasuryCap = {
|
45
|
+
fields: TreasuryCapFields;
|
46
|
+
type: string;
|
47
|
+
};
|
48
|
+
export type TreasuryCapFields = {
|
49
|
+
id: ID;
|
50
|
+
total_supply: TotalSupply;
|
51
|
+
};
|
52
|
+
export type TotalSupply = {
|
53
|
+
fields: TotalSupplyFields;
|
54
|
+
type: string;
|
55
|
+
};
|
56
|
+
export type TotalSupplyFields = {
|
57
|
+
value: string;
|
58
|
+
};
|
59
|
+
export type VaultPositionInfo = {
|
60
|
+
id: string;
|
61
|
+
lowerTick: number;
|
62
|
+
upperTick: number;
|
63
|
+
liquidity: string;
|
64
|
+
totalSupply: string;
|
65
|
+
};
|
66
|
+
export type VaultPosition = {
|
67
|
+
id: ID;
|
68
|
+
name: number[];
|
69
|
+
value: Value;
|
70
|
+
};
|
71
|
+
export type Value = {
|
72
|
+
fields: ValueFields;
|
73
|
+
type: string;
|
74
|
+
};
|
75
|
+
export type ValueFields = {
|
76
|
+
coin_type_a: CoinType;
|
77
|
+
coin_type_b: CoinType;
|
78
|
+
description: string;
|
79
|
+
id: ID;
|
80
|
+
index: string;
|
81
|
+
liquidity: string;
|
82
|
+
name: string;
|
83
|
+
pool: string;
|
84
|
+
tick_lower_index: TickErIndex;
|
85
|
+
tick_upper_index: TickErIndex;
|
86
|
+
url: string;
|
87
|
+
};
|
88
|
+
export type CoinType = {
|
89
|
+
fields: CoinTypeAFields;
|
90
|
+
type: string;
|
91
|
+
};
|
92
|
+
export type CoinTypeAFields = {
|
93
|
+
name: string;
|
94
|
+
};
|
95
|
+
export type TickErIndex = {
|
96
|
+
fields: TickLowerIndexFields;
|
97
|
+
type: string;
|
98
|
+
};
|
99
|
+
export type TickLowerIndexFields = {
|
100
|
+
bits: number;
|
101
|
+
};
|
102
|
+
export type FarmInfo = {
|
103
|
+
tokenXReserve: string;
|
104
|
+
lspSupply: string;
|
105
|
+
protocolFeesPercent: string;
|
106
|
+
createdAt: Date;
|
107
|
+
farmSource: FarmSource;
|
108
|
+
volume: number;
|
109
|
+
packageId: string;
|
110
|
+
farmId: string;
|
111
|
+
objectId: string;
|
112
|
+
poolSource: PoolSource;
|
113
|
+
lspType: string;
|
114
|
+
lpFeesPercent: string;
|
115
|
+
tokenYType: string;
|
116
|
+
data: string;
|
117
|
+
updatedAt: Date;
|
118
|
+
isStable: boolean;
|
119
|
+
tokenXType: string;
|
120
|
+
tokenYReserve: string;
|
121
|
+
tokenX: Token;
|
122
|
+
tokenY: Token;
|
123
|
+
tvl: number;
|
124
|
+
apy: number;
|
125
|
+
feeApy: number;
|
126
|
+
};
|
127
|
+
export declare enum FarmSource {
|
128
|
+
Buck = "buck",
|
129
|
+
Empty = "",
|
130
|
+
Kriya = "kriya"
|
131
|
+
}
|
132
|
+
export declare enum PoolSource {
|
133
|
+
Deepbook = "deepbook",
|
134
|
+
DeepbookV2 = "deepbook_v2",
|
135
|
+
Kriya = "kriya"
|
136
|
+
}
|
137
|
+
export type Token = {
|
138
|
+
coinType: string;
|
139
|
+
ticker: string;
|
140
|
+
tokenName: string;
|
141
|
+
updatedAt: Date;
|
142
|
+
createdAt: Date;
|
143
|
+
decimals: number;
|
144
|
+
iconUrl: string;
|
145
|
+
description: string;
|
146
|
+
price: string;
|
147
|
+
};
|
148
|
+
export type LiquidityPosition = {
|
149
|
+
farm_id: string;
|
150
|
+
id: ID;
|
151
|
+
lock_until: string;
|
152
|
+
stake_amount: string;
|
153
|
+
stake_weight: string;
|
154
|
+
start_unit: string;
|
155
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PoolSource = exports.FarmSource = void 0;
|
4
|
+
var FarmSource;
|
5
|
+
(function (FarmSource) {
|
6
|
+
FarmSource["Buck"] = "buck";
|
7
|
+
FarmSource["Empty"] = "";
|
8
|
+
FarmSource["Kriya"] = "kriya";
|
9
|
+
})(FarmSource || (exports.FarmSource = FarmSource = {}));
|
10
|
+
var PoolSource;
|
11
|
+
(function (PoolSource) {
|
12
|
+
PoolSource["Deepbook"] = "deepbook";
|
13
|
+
PoolSource["DeepbookV2"] = "deepbook_v2";
|
14
|
+
PoolSource["Kriya"] = "kriya";
|
15
|
+
})(PoolSource || (exports.PoolSource = PoolSource = {}));
|
16
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/types.ts"],"names":[],"mappings":";;;AAgJA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,wBAAU,CAAA;IACV,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,wCAA0B,CAAA;IAC1B,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
|
@@ -0,0 +1,94 @@
|
|
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 clients_1 = require("../../utils/clients");
|
19
|
+
const mulitpleGetBalances_1 = require("../../utils/sui/mulitpleGetBalances");
|
20
|
+
const constants_2 = require("../cetus/constants");
|
21
|
+
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
22
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
const client = (0, clients_1.getClientSui)();
|
25
|
+
const vaultsBalances = yield (0, mulitpleGetBalances_1.getMultipleBalances)(client, owner, constants_1.vaultsInfo.map((vault) => vault.tokenType));
|
26
|
+
if (!vaultsBalances.some((balance) => balance.totalBalance !== '0'))
|
27
|
+
return [];
|
28
|
+
const poolInfos = yield cache.getItems(constants_1.vaultsInfo.map((vault) => vault.underlyingPool), { prefix: constants_2.clmmPoolsPrefix, networkId: portfolio_core_1.NetworkId.sui });
|
29
|
+
const vaultsPositionInfo = yield cache.getItem(constants_1.vaultsInfoKey, {
|
30
|
+
prefix: constants_1.platformId,
|
31
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
32
|
+
});
|
33
|
+
if (!vaultsPositionInfo)
|
34
|
+
return [];
|
35
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(poolInfos
|
36
|
+
.map((pool) => (pool ? [pool.coinTypeA, pool.coinTypeB] : []))
|
37
|
+
.flat(), portfolio_core_1.NetworkId.sui);
|
38
|
+
let totalValue = 0;
|
39
|
+
const liquidities = [];
|
40
|
+
for (let i = 0; i < vaultsBalances.length; i++) {
|
41
|
+
const balance = vaultsBalances[i];
|
42
|
+
const pool = poolInfos[i];
|
43
|
+
const vault = vaultsPositionInfo[i];
|
44
|
+
if (!pool || !vault)
|
45
|
+
continue;
|
46
|
+
const totalSupply = new bignumber_js_1.default(vault.totalSupply);
|
47
|
+
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(vault.liquidity), pool.current_tick_index, vault.lowerTick, vault.upperTick, false);
|
48
|
+
const shares = new bignumber_js_1.default(balance.totalBalance).dividedBy(totalSupply);
|
49
|
+
const [tokenPriceA, tokenPriceB] = [
|
50
|
+
tokenPriceById.get((0, portfolio_core_1.formatMoveTokenAddress)(pool.coinTypeA)),
|
51
|
+
tokenPriceById.get((0, portfolio_core_1.formatMoveTokenAddress)(pool.coinTypeB)),
|
52
|
+
];
|
53
|
+
if (!tokenPriceA || !tokenPriceB)
|
54
|
+
continue;
|
55
|
+
const amountA = tokenAmountA
|
56
|
+
.times(shares)
|
57
|
+
.dividedBy(Math.pow(10, tokenPriceA.decimals));
|
58
|
+
const amountB = tokenAmountB
|
59
|
+
.times(shares)
|
60
|
+
.dividedBy(Math.pow(10, tokenPriceB.decimals));
|
61
|
+
const assetA = (0, tokenPriceToAssetToken_1.default)(tokenPriceA.address, amountA.toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceA);
|
62
|
+
const assetB = (0, tokenPriceToAssetToken_1.default)(tokenPriceB.address, amountB.toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceB);
|
63
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([assetA.value, assetB.value]);
|
64
|
+
totalValue = (0, portfolio_core_1.getUsdValueSum)([totalValue, value]);
|
65
|
+
liquidities.push({
|
66
|
+
assets: [assetA, assetB],
|
67
|
+
assetsValue: value,
|
68
|
+
rewardAssets: [],
|
69
|
+
rewardAssetsValue: null,
|
70
|
+
value,
|
71
|
+
yields: [],
|
72
|
+
});
|
73
|
+
}
|
74
|
+
return [
|
75
|
+
{
|
76
|
+
type: 'liquidity',
|
77
|
+
data: {
|
78
|
+
liquidities,
|
79
|
+
},
|
80
|
+
label: 'LiquidityPool',
|
81
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
82
|
+
platformId: constants_1.platformId,
|
83
|
+
value: totalValue,
|
84
|
+
name: 'Vaults',
|
85
|
+
},
|
86
|
+
];
|
87
|
+
});
|
88
|
+
const fetcher = {
|
89
|
+
id: `${constants_1.platformId}-vaults`,
|
90
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
91
|
+
executor,
|
92
|
+
};
|
93
|
+
exports.default = fetcher;
|
94
|
+
//# sourceMappingURL=vaultsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/vaultsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAGrC,2CAAoE;AACpE,iDAAmD;AACnD,6EAA0E;AAE1E,kDAAqD;AAErD,wFAAyF;AACzF,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAG,MAAM,IAAA,yCAAmB,EAC9C,MAAM,EACN,KAAK,EACL,sBAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAC3C,CAAC;IAEF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,KAAK,GAAG,CAAC;QACjE,OAAO,EAAE,CAAC;IAEZ,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,QAAQ,CACpC,sBAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EAC/C,EAAE,MAAM,EAAE,2BAAe,EAAE,SAAS,EAAE,0BAAS,CAAC,GAAG,EAAE,CACtD,CAAC;IAEF,MA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SACX,CAAC,CAAC;IACL,CAAC;IACD,OAAO;QACL;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,WAAW;aACZ;YACD,KAAK,EAAE,eAAe;YACtB,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;SACf;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,57 @@
|
|
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 clients_1 = require("../../utils/clients");
|
14
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
15
|
+
const multipleGetDynamicFieldsObjects_1 = require("../../utils/sui/multipleGetDynamicFieldsObjects");
|
16
|
+
const constants_1 = require("./constants");
|
17
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
+
var _a, _b, _c, _d;
|
19
|
+
const client = (0, clients_1.getClientSui)();
|
20
|
+
const [vaultsObjects, vaultsDynamicFields] = yield Promise.all([
|
21
|
+
(0, multiGetObjects_1.multiGetObjects)(client, constants_1.vaultsInfo.map((vault) => vault.id)),
|
22
|
+
(0, multipleGetDynamicFieldsObjects_1.multipleGetDynamicFieldsObjects)(client, constants_1.vaultsInfo.map((vault) => vault.id)),
|
23
|
+
]);
|
24
|
+
const vaultsInfos = [];
|
25
|
+
for (let i = 0; i < vaultsObjects.length; i++) {
|
26
|
+
const vault = (_b = (_a = vaultsObjects[i].data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
|
27
|
+
if (!vault)
|
28
|
+
continue;
|
29
|
+
const dynamicFields = vaultsDynamicFields[i];
|
30
|
+
let vaultPosition;
|
31
|
+
for (const fields of dynamicFields) {
|
32
|
+
if (((_c = fields.data) === null || _c === void 0 ? void 0 : _c.type) === constants_1.dynamicFieldPositionType)
|
33
|
+
vaultPosition = (_d = fields.data.content) === null || _d === void 0 ? void 0 : _d.fields;
|
34
|
+
}
|
35
|
+
if (!vaultPosition)
|
36
|
+
continue;
|
37
|
+
const vaultPositionInfo = {
|
38
|
+
id: vault.id.id,
|
39
|
+
liquidity: vaultPosition.value.fields.liquidity,
|
40
|
+
lowerTick: vault.lower_tick,
|
41
|
+
upperTick: vault.upper_tick,
|
42
|
+
totalSupply: vault.treasury_cap.fields.total_supply.fields.value,
|
43
|
+
};
|
44
|
+
vaultsInfos.push(vaultPositionInfo);
|
45
|
+
}
|
46
|
+
yield cache.setItem(constants_1.vaultsInfoKey, vaultsInfos, {
|
47
|
+
prefix: constants_1.platformId,
|
48
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
49
|
+
});
|
50
|
+
});
|
51
|
+
const job = {
|
52
|
+
id: `${constants_1.platformId}-vaults`,
|
53
|
+
executor,
|
54
|
+
label: 'normal',
|
55
|
+
};
|
56
|
+
exports.default = job;
|
57
|
+
//# sourceMappingURL=vaultsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version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MAAM,iBAAiB,GAAsB;YAC3C,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE;YACf,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS;YAC/C,SAAS,EAAE,KAAK,CAAC,UAAU;YAC3B,SAAS,EAAE,KAAK,CAAC,UAAU;YAC3B,WAAW,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK;SACjE,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,WAAW,EAAE;QAC9C,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,SAAS;IAC1B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -13,59 +13,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
16
|
const constants_1 = require("./constants");
|
19
|
-
const helpers_1 = require("../jupiter/helpers");
|
20
|
-
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
21
17
|
const clients_1 = require("../../utils/clients");
|
22
|
-
const structs_1 = require("../jupiter/launchpad/structs");
|
23
18
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
24
|
-
const
|
25
|
-
const endOfClaim = 1735603200000;
|
19
|
+
const helpersAirdrop_1 = require("./helpersAirdrop");
|
26
20
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
27
|
-
if (Date.now() >
|
21
|
+
if (Date.now() > helpersAirdrop_1.airdropStatics.claimEnd)
|
28
22
|
return [];
|
29
23
|
const client = (0, clients_1.getClientSolana)();
|
30
|
-
const
|
31
|
-
|
32
|
-
|
33
|
-
});
|
34
|
-
let amount;
|
35
|
-
let merkleTree;
|
36
|
-
if (cachedAllocation) {
|
37
|
-
amount = cachedAllocation.amount;
|
38
|
-
merkleTree = cachedAllocation.merkle_tree;
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
const allocation = yield axios_1.default
|
42
|
-
.get(constants_1.airdropApi + owner, {
|
43
|
-
headers: {
|
44
|
-
origin: 'https://app.parcl.co',
|
45
|
-
referer: 'https://app.parcl.co',
|
46
|
-
},
|
47
|
-
})
|
48
|
-
.catch(() => null);
|
49
|
-
if (allocation) {
|
50
|
-
merkleTree = allocation.data.merkle_tree;
|
51
|
-
amount = new bignumber_js_1.default(allocation.data.amount)
|
52
|
-
.dividedBy(Math.pow(10, constants_1.prclDecimals))
|
53
|
-
.toNumber();
|
54
|
-
yield cache.setItem(owner, { amount, merkle_tree: merkleTree }, {
|
55
|
-
prefix: constants_1.allocationPrefix,
|
56
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
57
|
-
ttl: oneDayInMs,
|
58
|
-
});
|
59
|
-
}
|
60
|
-
}
|
61
|
-
if (!amount || !merkleTree)
|
24
|
+
const airdrop = yield (0, helpersAirdrop_1.fetchAirdrop)(owner, client, cache);
|
25
|
+
if (airdrop.userStatus !== portfolio_core_1.AirdropUserStatus.claimable &&
|
26
|
+
airdrop.userStatus !== portfolio_core_1.AirdropUserStatus.claimableLater)
|
62
27
|
return [];
|
63
|
-
|
64
|
-
const claimStatusAccounts = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimStatusStruct, claimStatusPubkey);
|
65
|
-
if (claimStatusAccounts)
|
28
|
+
if (!airdrop.amount)
|
66
29
|
return [];
|
67
|
-
const
|
68
|
-
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.prclMint, amount, portfolio_core_1.NetworkId.solana, tokenPrice, undefined, { isClaimable: true });
|
30
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.prclMint, airdrop.amount, portfolio_core_1.NetworkId.solana, undefined, airdrop.price || undefined, { isClaimable: true });
|
69
31
|
return [
|
70
32
|
{
|
71
33
|
value: asset.value,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAAmD;AACnD,iDAAsD;AACtD,qGAA6E;AAC7E,qDAAgE;AAEhE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,+BAAc,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEpD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAY,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzD,IACE,OAAO,CAAC,UAAU,KAAK,kCAAiB,CAAC,SAAS;QAClD,OAAO,CAAC,UAAU,KAAK,kCAAiB,CAAC,cAAc;QAEvD,OAAO,EAAE,CAAC;IACZ,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,oBAAQ,EACR,OAAO,CAAC,MAAM,EACd,0BAAS,CAAC,MAAM,EAChB,SAAS,EACT,OAAO,CAAC,KAAK,IAAI,SAAS,EAC1B,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC;IAEF,OAAO;QACL;YACE,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,UAAU,EAAV,sBAAU;YACV,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE;SAC1B;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,6 +1,9 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
2
|
import { Platform } from '@sonarwatch/portfolio-core';
|
3
3
|
export declare const platformId = "parcl";
|
4
|
+
export declare const platformImage = "https://sonar.watch/img/platforms/parcl.png";
|
5
|
+
export declare const platformWebsite = "https://app.parcl.co/";
|
6
|
+
export declare const platformName = "Parcl";
|
4
7
|
export declare const platform: Platform;
|
5
8
|
export declare const programId: PublicKey;
|
6
9
|
export declare const usdcMint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
@@ -1,14 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.distributorProgram = exports.merkleTree = exports.merkleApi = exports.prclDecimals = exports.prclMint = exports.allocationPrefix = exports.airdropApi = exports.usdcDecimals = exports.usdcMint = exports.programId = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.distributorProgram = exports.merkleTree = exports.merkleApi = exports.prclDecimals = exports.prclMint = exports.allocationPrefix = exports.airdropApi = exports.usdcDecimals = exports.usdcMint = exports.programId = exports.platform = exports.platformName = exports.platformWebsite = exports.platformImage = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'parcl';
|
6
|
+
exports.platformImage = 'https://sonar.watch/img/platforms/parcl.png';
|
7
|
+
exports.platformWebsite = 'https://app.parcl.co/';
|
8
|
+
exports.platformName = 'Parcl';
|
6
9
|
exports.platform = {
|
7
10
|
id: exports.platformId,
|
8
|
-
name:
|
9
|
-
image:
|
11
|
+
name: exports.platformName,
|
12
|
+
image: exports.platformImage,
|
10
13
|
defiLlamaId: 'parent#parcl', // from https://defillama.com/docs/api
|
11
|
-
website:
|
14
|
+
website: exports.platformWebsite,
|
12
15
|
twitter: 'https://twitter.com/Parcl',
|
13
16
|
};
|
14
17
|
exports.programId = new web3_js_1.PublicKey('3parcLrT7WnXAcyPfkCz49oofuuf2guUKkjuFkAhZW8Y');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,uBAAuB,CAAC;AAC1C,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,cAAc,EAAE,sCAAsC;IACnE,OAAO,EAAE,uBAAe;IACxB,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,UAAU,GAAG,yCAAyC,CAAC;AACvD,QAAA,gBAAgB,GAAG,GAAG,kBAAU,aAAa,CAAC;AAC9C,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,SAAS,GAAG,uCAAuC,CAAC;AACpD,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAC5D,QAAA,kBAAkB,GAC7B,8CAA8C,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Airdrop } from '@sonarwatch/portfolio-core';
|
2
|
+
import { Allocation } from './types';
|
3
|
+
import { Cache } from '../../Cache';
|
4
|
+
import { SolanaClient } from '../../utils/clients/types';
|
5
|
+
import { AirdropFetcher } from '../../AirdropFetcher';
|
6
|
+
export declare function fetchAllocation(owner: string, cache: Cache): Promise<Allocation>;
|
7
|
+
export declare const airdropStatics: {
|
8
|
+
id: string;
|
9
|
+
claimLink: string;
|
10
|
+
image: string;
|
11
|
+
label: string;
|
12
|
+
organizerLink: string;
|
13
|
+
organizerName: string;
|
14
|
+
claimStart: number;
|
15
|
+
claimEnd: number;
|
16
|
+
name: undefined;
|
17
|
+
};
|
18
|
+
export declare function fetchAirdrop(owner: string, client: SolanaClient, cache: Cache): Promise<Airdrop>;
|
19
|
+
export declare const airdropFetcher: AirdropFetcher;
|