@sonarwatch/portfolio-plugins 0.14.31 → 0.14.33
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1720 -1712
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/banx/loansFetcher.js +2 -1
- package/src/plugins/banx/loansFetcher.js.map +1 -1
- package/src/plugins/cetus/clmmsFetcher.js +5 -7
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/cetus/constants.d.ts +1 -0
- package/src/plugins/cetus/constants.js +17 -1
- package/src/plugins/cetus/constants.js.map +1 -1
- package/src/plugins/cetus/farmsFetcher.js +3 -7
- package/src/plugins/cetus/farmsFetcher.js.map +1 -1
- package/src/plugins/cetus/getPools.d.ts +3 -0
- package/src/plugins/cetus/getPools.js +50 -0
- package/src/plugins/cetus/getPools.js.map +1 -0
- package/src/plugins/cetus/poolsJob.js +4 -3
- package/src/plugins/cetus/poolsJob.js.map +1 -1
- package/src/plugins/cetus/types.d.ts +32 -31
- package/src/plugins/elixir/positionsFetcher.js +29 -51
- package/src/plugins/elixir/positionsFetcher.js.map +1 -1
- package/src/plugins/kai/constants.d.ts +9 -0
- package/src/plugins/kai/constants.js +37 -2
- package/src/plugins/kai/constants.js.map +1 -1
- package/src/plugins/kai/helpers.d.ts +8 -0
- package/src/plugins/kai/helpers.js +49 -0
- package/src/plugins/kai/helpers.js.map +1 -0
- package/src/plugins/kai/index.js +4 -2
- package/src/plugins/kai/index.js.map +1 -1
- package/src/plugins/kai/lpVaultsFetcher.js +112 -0
- package/src/plugins/kai/lpVaultsFetcher.js.map +1 -0
- package/src/plugins/kai/supplyPoolsJob.d.ts +3 -0
- package/src/plugins/kai/supplyPoolsJob.js +35 -0
- package/src/plugins/kai/supplyPoolsJob.js.map +1 -0
- package/src/plugins/kai/types.d.ts +107 -0
- package/src/plugins/kai/vaultsJob.js +19 -12
- package/src/plugins/kai/vaultsJob.js.map +1 -1
- package/src/plugins/metaplex/index.js +2 -2
- package/src/plugins/metaplex/index.js.map +1 -1
- package/src/plugins/metaplex/resizableNftFetcher.d.ts +3 -0
- package/src/plugins/metaplex/{positionsSolanaFetcher.js → resizableNftFetcher.js} +4 -2
- package/src/plugins/metaplex/resizableNftFetcher.js.map +1 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tensor/airdropPowerUsersFetcher.js +25 -21
- package/src/plugins/tensor/airdropPowerUsersFetcher.js.map +1 -1
- package/src/plugins/tensor/constants.d.ts +1 -3
- package/src/plugins/tensor/constants.js +2 -4
- package/src/plugins/tensor/constants.js.map +1 -1
- package/src/plugins/tensor/filters.d.ts +1 -1
- package/src/plugins/tensor/filters.js +5 -5
- package/src/plugins/tensor/filters.js.map +1 -1
- package/src/plugins/tensor/helpers.d.ts +1 -1
- package/src/plugins/tensor/helpers.js +4 -7
- package/src/plugins/tensor/helpers.js.map +1 -1
- package/src/plugins/tensor/sharedEscrowFetcher.js +14 -18
- package/src/plugins/tensor/sharedEscrowFetcher.js.map +1 -1
- package/src/plugins/tensor/struct.d.ts +5 -0
- package/src/plugins/tensor/struct.js +5 -1
- package/src/plugins/tensor/struct.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/whalesmarket/depositFetcher.js +1 -0
- package/src/plugins/whalesmarket/depositFetcher.js.map +1 -1
- package/src/plugins/zeta/airdropFetcher.js +14 -14
- package/src/utils/elementbuilder/ElementLiquidityBuilder.d.ts +2 -1
- package/src/utils/elementbuilder/ElementLiquidityBuilder.js +2 -2
- package/src/utils/elementbuilder/ElementLiquidityBuilder.js.map +1 -1
- package/src/utils/elementbuilder/LiquidityBuilder.d.ts +3 -1
- package/src/utils/elementbuilder/LiquidityBuilder.js +3 -1
- package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -1
- package/src/utils/elementbuilder/LiquidityParams.d.ts +3 -0
- package/src/utils/elementbuilder/LiquidityParams.js +3 -0
- package/src/utils/elementbuilder/LiquidityParams.js.map +1 -0
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/plugins/elixir/helpers.d.ts +0 -2
- package/src/plugins/elixir/helpers.js +0 -40
- package/src/plugins/elixir/helpers.js.map +0 -1
- package/src/plugins/metaplex/positionsSolanaFetcher.js.map +0 -1
- /package/src/plugins/{metaplex/positionsSolanaFetcher.d.ts → kai/lpVaultsFetcher.d.ts} +0 -0
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
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
|
|
36
36
|
const graphql_request_1 = __importStar(require("graphql-request"));
|
37
37
|
function getBalancerPoolsV2(url) {
|
38
38
|
return __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;
|
@@ -43,7 +43,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
43
43
|
acc.bondTradeTransactionState.perpetualRefinancedActive ||
|
44
44
|
acc.bondTradeTransactionState.perpetualManualTerminating ||
|
45
45
|
acc.bondTradeTransactionState.active) &&
|
46
|
-
acc.redeemedAt === '0'
|
46
|
+
acc.redeemedAt === '0' &&
|
47
|
+
!acc.redeemResult.instantRefinanced);
|
47
48
|
if (accounts.length === 0)
|
48
49
|
return [];
|
49
50
|
const [tokenPrices, fbondTokenMints, bondOffers, collections] = yield Promise.all([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/banx/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAGrC,iDAAsD;AACtD,oGAA4E;AAC5E,+CAK4B;AAC5B,8EAAgF;AAChF,wGAAqG;AACrG,qGAA6E;AAC7E,2CAKqB;AAOrB,uCAAwE;AACxE,uCAAuD;AACvD,kEAA+D;AAC/D,4DAAyD;AAEzD,MAAM,eAAe,GAAG,IAAI,6BAAa,CAIvC,+BAAmB,EACnB;IACE,MAAM,EAAE,uBAAW;IACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,CAC/C,CAAC;AAEF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAEtC,MAAM,QAAQ,GAAG,CACf,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,qCAA4B,EAC1B,UAAU,EACV,uBAAW,EACX,IAAA,sBAAY,EAAC,KAAK,CAAC,CACpB;QACD,IAAA,qCAA4B,EAC1B,UAAU,EACV,uBAAW,EACX,IAAA,sBAAY,EAAC,KAAK,CAAC,CACpB;KACF,CAAC,CACH;SACE,IAAI,EAAE;SACN,MAAM,CACL,CAAC,GAAG,EAAE,EAAE,CACN,CAAC,GAAG,CAAC,yBAAyB,CAAC,eAAe;QAC5C,GAAG,CAAC,yBAAyB,CAAC,sBAAsB;QACpD,GAAG,CAAC,yBAAyB,CAAC,yBAAyB;QACvD,GAAG,CAAC,yBAAyB,CAAC,0BAA0B;QACxD,GAAG,CAAC,yBAAyB,CAAC,MAAM,CAAC;QACvC,GAAG,CAAC,UAAU,KAAK,GAAG,
|
1
|
+
{"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/banx/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAGrC,iDAAsD;AACtD,oGAA4E;AAC5E,+CAK4B;AAC5B,8EAAgF;AAChF,wGAAqG;AACrG,qGAA6E;AAC7E,2CAKqB;AAOrB,uCAAwE;AACxE,uCAAuD;AACvD,kEAA+D;AAC/D,4DAAyD;AAEzD,MAAM,eAAe,GAAG,IAAI,6BAAa,CAIvC,+BAAmB,EACnB;IACE,MAAM,EAAE,uBAAW;IACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,CAC/C,CAAC;AAEF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,U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AAE;oBACJ,cAAc;oBACd,aAAa;oBACb,cAAc,EAAE,EAAE;oBAClB,cAAc;oBACd,aAAa;oBACb,cAAc,EAAE,EAAE;oBAClB,YAAY,EAAE,EAAE;oBAChB,WAAW;oBACX,WAAW,EAAE,IAAI;oBACjB,KAAK;iBACN;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -19,8 +19,8 @@ const clients_1 = require("../../utils/clients");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
20
20
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
21
21
|
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
22
|
-
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
23
22
|
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
23
|
+
const getPools_1 = require("./getPools");
|
24
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
25
|
const client = (0, clients_1.getClientSui)();
|
26
26
|
const ownerRes = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
@@ -49,12 +49,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
49
49
|
return [];
|
50
50
|
const poolsIds = clmmPositions.map((position) => position.pool);
|
51
51
|
const poolsById = new Map();
|
52
|
-
const poolsObjects = yield (0,
|
53
|
-
poolsObjects.forEach((
|
54
|
-
|
55
|
-
|
56
|
-
const pool = (0, helpers_1.getPoolFromObject)(poolObj);
|
57
|
-
poolsById.set(poolObj.data.objectId, pool);
|
52
|
+
const poolsObjects = yield (0, getPools_1.getPools)([...new Set(poolsIds)], cache);
|
53
|
+
poolsObjects.forEach((pool) => {
|
54
|
+
if (pool) {
|
55
|
+
poolsById.set(pool.poolAddress, pool);
|
58
56
|
}
|
59
57
|
});
|
60
58
|
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"clmmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/clmmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAAsE;AACtE,iDAAmD;AACnD,
|
1
|
+
{"version":3,"file":"clmmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/clmmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAAsE;AACtE,iDAAmD;AACnD,uCAKmB;AAGnB,wFAAyF;AACzF,qEAAkE;AAClE,gFAA6E;AAC7E,yCAAsC;AAEtC,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,KAAK,EAAE;QACpD,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;SAChB;QACD,MAAM,EAAE,EAAE,OAAO,EAAE,6BAAiB,EAAE;KACvC,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,aAAa,GAAe,EAAE,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE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kBAAe,OAAO,CAAC"}
|
@@ -7,6 +7,7 @@ export declare const clmmType = "0x1eabed72c53feb3805120a081dc15963c204dc8d09154
|
|
7
7
|
export declare const createPoolEvent = "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb::factory::CreatePoolEvent";
|
8
8
|
export declare const poolParentId = "0x4c9ab808d50ca1358cc699bb53b6334b9471d4718fb19bb621ff41c2e93bbce4";
|
9
9
|
export declare const firstPool = "0x58ec75646f31c384f485bd92a5f1d19aa60713eabe2447cbc1354c8c229b10b7";
|
10
|
+
export declare const hardCodedPools: string[];
|
10
11
|
export declare const vaultManagerMap = "0x9036bcc5aa7fd2cceec1659a6a1082871f45bc400c743f50063363457d1738bd";
|
11
12
|
export declare const farmNftType = "0x11ea791d82b5742cc8cab0bf7946035c97d9001d7c3803a93f119753da66f526::pool::WrappedPositionNFT";
|
12
13
|
export declare const limitPackageId = "0x533fab9a116080e2cb1c87f1832c1bf4231ab4c32318ced041e75cc28604bba9";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.dcaUserIndexerId = exports.devInspectTxSender = exports.limitUserIndexId = exports.limitPackageId = exports.farmNftType = exports.vaultManagerMap = exports.firstPool = exports.poolParentId = exports.createPoolEvent = exports.clmmType = exports.clmmPoolPackageId = exports.clmmPoolsPrefix = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.dcaUserIndexerId = exports.devInspectTxSender = exports.limitUserIndexId = exports.limitPackageId = exports.farmNftType = exports.vaultManagerMap = exports.hardCodedPools = exports.firstPool = exports.poolParentId = exports.createPoolEvent = exports.clmmType = exports.clmmPoolPackageId = exports.clmmPoolsPrefix = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'cetus';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -15,6 +15,22 @@ exports.clmmType = `${exports.clmmPoolPackageId}::position::Position`;
|
|
15
15
|
exports.createPoolEvent = `${exports.clmmPoolPackageId}::factory::CreatePoolEvent`;
|
16
16
|
exports.poolParentId = '0x4c9ab808d50ca1358cc699bb53b6334b9471d4718fb19bb621ff41c2e93bbce4';
|
17
17
|
exports.firstPool = '0x58ec75646f31c384f485bd92a5f1d19aa60713eabe2447cbc1354c8c229b10b7';
|
18
|
+
// add cetus poolIds here to be sure they're included in the job
|
19
|
+
// pools with most volume from https://app.cetus.zone/pool/list
|
20
|
+
exports.hardCodedPools = [
|
21
|
+
'0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105',
|
22
|
+
'0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630',
|
23
|
+
'0x1efc96c99c9d91ac0f54f0ca78d2d9a6ba11377d29354c0a192c86f0495ddec7',
|
24
|
+
'0xb785e6eed355c1f8367c06d2b0cb9303ab167f8359a129bb003891ee54c6fce0',
|
25
|
+
'0x4c50ba9d1e60d229800293a4222851c9c3f797aa5ba8a8d32cc67ec7e79fec60',
|
26
|
+
'0x59cf0d333464ad29443d92bfd2ddfd1f794c5830141a5ee4a815d1ef3395bf6c',
|
27
|
+
'0x2e041f3fd93646dcc877f783c1f2b7fa62d30271bdef1f21ef002cebf857bded',
|
28
|
+
'0xe01243f37f712ef87e556afb9b1d03d0fae13f96d324ec912daffc339dfdcbd2',
|
29
|
+
'0x6bd72983b0b5a77774af8c77567bb593b418ae3cd750a5926814fcd236409aaa',
|
30
|
+
'0xc8d7a1503dc2f9f5b05449a87d8733593e2f0f3e7bffd90541252782e4d2ca20',
|
31
|
+
'0x871d8a227114f375170f149f7e9d45be822dd003eba225e83c05ac80828596bc',
|
32
|
+
'0x0254747f5ca059a1972cd7f6016485d51392a3fde608107b93bbaebea550f703',
|
33
|
+
];
|
18
34
|
// VaultsManager : 0x25b82dd2f5ee486ed1c8af144b89a8931cd9c29dee3a86a1bfe194fdea9d04a6
|
19
35
|
// Vaults https://api-sui.cetus.zone/v2/sui/auto_pools
|
20
36
|
exports.vaultManagerMap = '0x9036bcc5aa7fd2cceec1659a6a1082871f45bc400c743f50063363457d1738bd';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,yBAAyB;CACnC,CAAC;AACW,QAAA,eAAe,GAAG,GAAG,kBAAU,YAAY,CAAC;AAE5C,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAE1D,QAAA,QAAQ,GAAG,GAAG,yBAAiB,sBAAsB,CAAC;AAEtD,QAAA,eAAe,GAAG,GAAG,yBAAiB,4BAA4B,CAAC;AACnE,QAAA,YAAY,GACvB,oEAAoE,CAAC;AAC1D,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAEvE,qFAAqF;AACrF,sDAAsD;AACzC,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,WAAW,GACtB,8FAA8F,CAAC;AAEpF,QAAA,cAAc,GACzB,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC;AAC1D,QAAA,kBAAkB,GAC7B,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,yBAAyB;CACnC,CAAC;AACW,QAAA,eAAe,GAAG,GAAG,kBAAU,YAAY,CAAC;AAE5C,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAE1D,QAAA,QAAQ,GAAG,GAAG,yBAAiB,sBAAsB,CAAC;AAEtD,QAAA,eAAe,GAAG,GAAG,yBAAiB,4BAA4B,CAAC;AACnE,QAAA,YAAY,GACvB,oEAAoE,CAAC;AAC1D,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAEvE,gEAAgE;AAChE,+DAA+D;AAClD,QAAA,cAAc,GAAG;IAC5B,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;CACrE,CAAC;AAEF,qFAAqF;AACrF,sDAAsD;AACzC,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,WAAW,GACtB,8FAA8F,CAAC;AAEpF,QAAA,cAAc,GACzB,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC;AAC1D,QAAA,kBAAkB,GAC7B,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC"}
|
@@ -22,6 +22,7 @@ const bitsToNumber_1 = require("../../utils/sui/bitsToNumber");
|
|
22
22
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
23
23
|
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
24
24
|
const helpers_1 = require("./helpers");
|
25
|
+
const getPools_1 = require("./getPools");
|
25
26
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
27
|
const client = (0, clients_1.getClientSui)();
|
27
28
|
const positions = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
@@ -38,14 +39,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
38
39
|
(0, multiGetObjects_1.multiGetObjects)(client, positions
|
39
40
|
.map((position) => { var _a, _b; return (_b = (_a = position.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.pool_id; })
|
40
41
|
.filter((s) => s !== null)),
|
41
|
-
|
42
|
-
.getItems(positions
|
42
|
+
(0, getPools_1.getPools)(positions
|
43
43
|
.map((position) => { var _a, _b; return (_b = (_a = position.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.clmm_postion.fields.pool; })
|
44
|
-
.filter((s) => s !== null),
|
45
|
-
prefix: constants_1.clmmPoolsPrefix,
|
46
|
-
networkId: portfolio_core_1.NetworkId.sui,
|
47
|
-
})
|
48
|
-
.then((res) => res.filter((p) => p !== null)),
|
44
|
+
.filter((s) => s !== null), cache).then((res) => res.filter((p) => p !== null)),
|
49
45
|
(0, helpers_1.fetchPosFeeAmount)(positions
|
50
46
|
.map((position) => {
|
51
47
|
var _a, _b;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,
|
1
|
+
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAAsD;AACtD,iDAAmD;AAQnD,qEAAkE;AAClE,qEAAkE;AAClE,+DAA4D;AAC5D,wFAAyF;AACzF,gFAA6E;AAC7E,uCAAuE;AACvE,yCAAsC;AAEtC,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9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AC,QAAQ;SACtB,CAAC,CAAC;QAEH,SAAS,CAAC,cAAc,CAAC;YACvB,OAAO,EAAE,IAAI,CAAC,SAAS;YACvB,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;QAEH,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;YACxD,SAAS,CAAC,cAAc,CAAC;gBACvB,OAAO,EAAE,kBAAkB,CAAC,YAAY;gBACxC,MAAM,EAAE,kBAAkB,CAAC,WAAW;aACvC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,YAAY,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,MAAM,EAAE;YAChD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,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,50 @@
|
|
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
|
+
exports.getPools = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
17
|
+
const helpers_1 = require("./helpers");
|
18
|
+
// always use this helper to get Cetus Pools
|
19
|
+
// use cache is available, get on-chain data otherwise
|
20
|
+
const getPools = (poolIds, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
var _a;
|
22
|
+
const pools = [];
|
23
|
+
const cachedPools = yield cache.getItems(poolIds, {
|
24
|
+
prefix: constants_1.clmmPoolsPrefix,
|
25
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
26
|
+
});
|
27
|
+
const client = (0, clients_1.getClientSui)();
|
28
|
+
for (const poolId of poolIds) {
|
29
|
+
const i = poolIds.indexOf(poolId);
|
30
|
+
const cachedPool = cachedPools[i];
|
31
|
+
if (cachedPool) {
|
32
|
+
pools.push(cachedPool);
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
const poolObject = yield (0, getObject_1.getObject)(client, poolId);
|
36
|
+
const pool = (0, helpers_1.getPoolFromObject)(poolObject);
|
37
|
+
if (((_a = poolObject.data) === null || _a === void 0 ? void 0 : _a.objectId) !== poolId || !pool) {
|
38
|
+
pools.push(null);
|
39
|
+
}
|
40
|
+
yield cache.setItem(poolId, pool, {
|
41
|
+
prefix: constants_1.clmmPoolsPrefix,
|
42
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
43
|
+
});
|
44
|
+
pools.push(pool);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return pools;
|
48
|
+
});
|
49
|
+
exports.getPools = getPools;
|
50
|
+
//# sourceMappingURL=getPools.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getPools.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/getPools.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;AAEvD,2CAA8C;AAE9C,iD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@ -25,7 +25,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
25
|
const client = (0, clients_1.getClientSui)();
|
26
26
|
const promises = [];
|
27
27
|
const cacheItems = [];
|
28
|
-
const poolsAddresses =
|
28
|
+
const poolsAddresses = new Set(constants_1.hardCodedPools);
|
29
29
|
let poolInfo;
|
30
30
|
let value;
|
31
31
|
do {
|
@@ -43,9 +43,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
43
|
},
|
44
44
|
});
|
45
45
|
if ((_c = poolInfo.data) === null || _c === void 0 ? void 0 : _c.content)
|
46
|
-
poolsAddresses.
|
46
|
+
poolsAddresses.add(poolInfo.data.content.fields.value.fields.value.fields.pool_id);
|
47
47
|
} while (poolInfo && ((_e = (_d = poolInfo.data) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.fields.value.fields.next));
|
48
|
-
const poolsObjects = yield (0, multiGetObjects_1.multiGetObjects)(client, poolsAddresses);
|
48
|
+
const poolsObjects = yield (0, multiGetObjects_1.multiGetObjects)(client, [...poolsAddresses]);
|
49
49
|
let poolId;
|
50
50
|
let pool;
|
51
51
|
for (let i = 0; i < poolsObjects.length; i++) {
|
@@ -61,6 +61,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
61
|
value: pool,
|
62
62
|
});
|
63
63
|
}
|
64
|
+
// always use getPools helper to retrieve cetus pools
|
64
65
|
yield cache.setItems(cacheItems, {
|
65
66
|
prefix: constants_1.clmmPoolsPrefix,
|
66
67
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,iDAAmD;AACnD,
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources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Ae,GAAG,CAAC"}
|
@@ -149,43 +149,44 @@ export type Vault = {
|
|
149
149
|
type: string;
|
150
150
|
}[];
|
151
151
|
};
|
152
|
-
export type
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
name: string;
|
158
|
-
};
|
159
|
-
type: string;
|
152
|
+
export type LpPosition = {
|
153
|
+
fields: {
|
154
|
+
coin_type_a: {
|
155
|
+
fields: {
|
156
|
+
name: string;
|
160
157
|
};
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
type: string;
|
159
|
+
};
|
160
|
+
coin_type_b: {
|
161
|
+
fields: {
|
162
|
+
name: string;
|
166
163
|
};
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
164
|
+
type: string;
|
165
|
+
};
|
166
|
+
description: string;
|
167
|
+
id: ID;
|
168
|
+
index: number;
|
169
|
+
liquidity: string;
|
170
|
+
name: string;
|
171
|
+
pool: SuiObjectIdType;
|
172
|
+
tick_lower_index: {
|
173
|
+
fields: {
|
174
|
+
bits: number;
|
178
175
|
};
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
176
|
+
type: string;
|
177
|
+
};
|
178
|
+
tick_upper_index: {
|
179
|
+
fields: {
|
180
|
+
bits: number;
|
184
181
|
};
|
185
|
-
|
182
|
+
type: string;
|
186
183
|
};
|
187
|
-
|
184
|
+
url: string;
|
188
185
|
};
|
186
|
+
type: string;
|
187
|
+
};
|
188
|
+
export type WrappedPositionNFT = {
|
189
|
+
clmm_postion: LpPosition;
|
189
190
|
id: ID;
|
190
191
|
pool_id: string;
|
191
192
|
url: string;
|
@@ -13,11 +13,11 @@ 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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
16
17
|
const constants_1 = require("./constants");
|
17
18
|
const clients_1 = require("../../utils/clients");
|
18
19
|
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
19
|
-
const
|
20
|
-
const helpers_1 = require("./helpers");
|
20
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
21
21
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
22
|
const client = (0, clients_1.getClientSui)();
|
23
23
|
const [vaultObjects, vaultTvls] = yield Promise.all([
|
@@ -69,24 +69,17 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
69
69
|
coinType: coinType[0].type,
|
70
70
|
};
|
71
71
|
}))).then((dfs) => dfs.filter((df) => df !== null));
|
72
|
-
const
|
73
|
-
activeShares.forEach((a) => {
|
74
|
-
if (a &&
|
75
|
-
a.coinType &&
|
76
|
-
!coinsTypes.includes((0, portfolio_core_1.formatMoveTokenAddress)(a.coinType)))
|
77
|
-
coinsTypes.push((0, portfolio_core_1.formatMoveTokenAddress)(a.coinType));
|
78
|
-
});
|
79
|
-
const tokenPrices = yield cache.getTokenPricesAsMap(coinsTypes, portfolio_core_1.NetworkId.sui);
|
80
|
-
const elements = [];
|
72
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
81
73
|
activeShares.forEach((a) => {
|
82
74
|
var _a;
|
83
|
-
const assets = [];
|
84
75
|
if (!a)
|
85
76
|
return;
|
86
|
-
const
|
87
|
-
|
88
|
-
|
89
|
-
const
|
77
|
+
const element = elementRegistry.addElementLiquidity({
|
78
|
+
label: 'LiquidityPool',
|
79
|
+
});
|
80
|
+
const liquidity = element.addLiquidity({
|
81
|
+
name: (_a = constants_1.vaults.find((v) => v.address === a.vault)) === null || _a === void 0 ? void 0 : _a.vaultName,
|
82
|
+
});
|
90
83
|
if (a.shares) {
|
91
84
|
let tvl;
|
92
85
|
vaultTvls.forEach((t) => {
|
@@ -95,50 +88,35 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
95
88
|
}
|
96
89
|
});
|
97
90
|
if (tvl) {
|
98
|
-
const userActiveAmounts =
|
99
|
-
|
100
|
-
|
101
|
-
if (
|
102
|
-
|
103
|
-
|
91
|
+
const userActiveAmounts = new bignumber_js_1.default(a.shares)
|
92
|
+
.multipliedBy(new bignumber_js_1.default(tvl.USDC.amount_wei).dividedBy(Math.pow(10, 27)))
|
93
|
+
.dividedBy(a.total_shares);
|
94
|
+
if (userActiveAmounts.gt(0)) {
|
95
|
+
liquidity.addAsset({
|
96
|
+
address: a.coinType,
|
97
|
+
amount: userActiveAmounts,
|
98
|
+
alreadyShifted: true,
|
99
|
+
});
|
100
|
+
liquidity.addYield((0, portfolio_core_1.yieldFromApy)(Number(tvl.pool_apy) / 100));
|
104
101
|
}
|
105
102
|
}
|
106
103
|
}
|
107
|
-
const pendingAmount = a.pending
|
108
|
-
? Number(a.pending) / Math.pow(10, tokenPrice.decimals)
|
109
|
-
: undefined;
|
104
|
+
const pendingAmount = a.pending ? Number(a.pending) : undefined;
|
110
105
|
if (pendingAmount) {
|
111
|
-
|
112
|
-
|
106
|
+
liquidity.addAsset({
|
107
|
+
address: a.coinType,
|
108
|
+
amount: pendingAmount,
|
109
|
+
attributes: {
|
110
|
+
isClaimable: true,
|
111
|
+
},
|
112
|
+
});
|
113
|
+
liquidity.addYield({
|
113
114
|
apr: 0,
|
114
115
|
apy: 0,
|
115
116
|
});
|
116
117
|
}
|
117
|
-
const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((as) => as.value));
|
118
|
-
const value = assetsValue;
|
119
|
-
if (assets.length > 0) {
|
120
|
-
const liquidities = [
|
121
|
-
{
|
122
|
-
value,
|
123
|
-
assets,
|
124
|
-
assetsValue,
|
125
|
-
rewardAssets: [],
|
126
|
-
rewardAssetsValue: null,
|
127
|
-
yields,
|
128
|
-
name: (_a = constants_1.vaults.find((v) => v.address === a.vault)) === null || _a === void 0 ? void 0 : _a.vaultName,
|
129
|
-
},
|
130
|
-
];
|
131
|
-
elements.push({
|
132
|
-
type: 'liquidity',
|
133
|
-
data: { liquidities },
|
134
|
-
label: 'LiquidityPool',
|
135
|
-
networkId: portfolio_core_1.NetworkId.sui,
|
136
|
-
platformId: constants_1.platformId,
|
137
|
-
value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((liq) => liq.value)),
|
138
|
-
});
|
139
|
-
}
|
140
118
|
});
|
141
|
-
return
|
119
|
+
return elementRegistry.getElements(cache);
|
142
120
|
});
|
143
121
|
const fetcher = {
|
144
122
|
id: `${constants_1.platformId}-positions`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/elixir/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/elixir/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAMqB;AAErB,iDAAmD;AACnD,iFAA8E;AAE9E,gFAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAClD,KAAK,CAAC,OAAO,CAA0B,qBAAS,EAAE;YAChD,MAAM,EAAE,wBAAY;YACpB,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC;QACF,KAAK,CAAC,OAAO,CAAa,wBAAY,EAAE;YACtC,MAAM,EAAE,wBAAY;YACpB,SAAS,EAAE,0BAAS,CAAC,GAA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GAAG,EAAE,CAAC;aACP,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -7,3 +7,12 @@ export declare const vaultsInfo: {
|
|
7
7
|
lpType: string;
|
8
8
|
decimals: number;
|
9
9
|
}[];
|
10
|
+
export declare const supplyPoolsCacheKey = "supply-pools";
|
11
|
+
export declare const vaults: {
|
12
|
+
name: string;
|
13
|
+
configId: string;
|
14
|
+
poolObjectId: string;
|
15
|
+
lendFacilCap: string;
|
16
|
+
supplyPoolXInfo: string;
|
17
|
+
supplyPoolYInfo: string;
|
18
|
+
}[];
|