@sonarwatch/portfolio-plugins 0.12.169 → 0.12.171
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/Cache.d.ts +2 -1
- package/src/Cache.js +3 -3
- package/src/Cache.js.map +1 -1
- package/src/TokenPriceMap.d.ts +8 -0
- package/src/TokenPriceMap.js +21 -0
- package/src/TokenPriceMap.js.map +1 -0
- package/src/index.js +16 -0
- package/src/index.js.map +1 -1
- package/src/plugins/adrastea/constants.d.ts +9 -0
- package/src/plugins/adrastea/constants.js +19 -0
- package/src/plugins/adrastea/constants.js.map +1 -0
- package/src/plugins/adrastea/index.d.ts +6 -0
- package/src/plugins/adrastea/index.js +13 -0
- package/src/plugins/adrastea/index.js.map +1 -0
- package/src/plugins/adrastea/positionsFetcher.js +61 -0
- package/src/plugins/adrastea/positionsFetcher.js.map +1 -0
- package/src/plugins/adrastea/positionsJob.d.ts +3 -0
- package/src/plugins/adrastea/positionsJob.js +53 -0
- package/src/plugins/adrastea/positionsJob.js.map +1 -0
- package/src/plugins/adrastea/structs.d.ts +45 -0
- package/src/plugins/adrastea/structs.js +44 -0
- package/src/plugins/adrastea/structs.js.map +1 -0
- package/src/plugins/adrastea/types.d.ts +4 -0
- package/src/plugins/adrastea/types.js +3 -0
- package/src/plugins/adrastea/types.js.map +1 -0
- package/src/plugins/banx/stakingFetcher.js +11 -15
- package/src/plugins/banx/stakingFetcher.js.map +1 -1
- package/src/plugins/bluemove/constants.d.ts +7 -0
- package/src/plugins/bluemove/constants.js +17 -0
- package/src/plugins/bluemove/constants.js.map +1 -0
- package/src/plugins/bluemove/index.d.ts +6 -0
- package/src/plugins/bluemove/index.js +12 -0
- package/src/plugins/bluemove/index.js.map +1 -0
- package/src/plugins/bluemove/poolsJob.d.ts +3 -0
- package/src/plugins/bluemove/poolsJob.js +97 -0
- package/src/plugins/bluemove/poolsJob.js.map +1 -0
- package/src/plugins/bluemove/types.d.ts +21 -0
- package/src/plugins/bluemove/types.js +3 -0
- package/src/plugins/bluemove/types.js.map +1 -0
- package/src/plugins/cetus/clmmsFetcher.js +3 -3
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/cetus/constants.d.ts +4 -0
- package/src/plugins/cetus/constants.js +5 -1
- package/src/plugins/cetus/constants.js.map +1 -1
- package/src/plugins/cetus/dcaFetcher.js +77 -0
- package/src/plugins/cetus/dcaFetcher.js.map +1 -0
- package/src/plugins/cetus/farmsFetcher.js +2 -4
- package/src/plugins/cetus/farmsFetcher.js.map +1 -1
- package/src/plugins/cetus/index.js +8 -1
- package/src/plugins/cetus/index.js.map +1 -1
- package/src/plugins/cetus/limitFetcher.d.ts +3 -0
- package/src/plugins/cetus/limitFetcher.js +66 -0
- package/src/plugins/cetus/limitFetcher.js.map +1 -0
- package/src/plugins/cetus/types.d.ts +32 -0
- package/src/plugins/deepbook/constants.d.ts +3 -0
- package/src/plugins/deepbook/constants.js +4 -1
- package/src/plugins/deepbook/constants.js.map +1 -1
- package/src/plugins/deepbook/helpers.d.ts +4 -0
- package/src/plugins/deepbook/helpers.js +142 -0
- package/src/plugins/deepbook/helpers.js.map +1 -0
- package/src/plugins/deepbook/index.js +7 -2
- package/src/plugins/deepbook/index.js.map +1 -1
- package/src/plugins/deepbook/ordersFetcher.d.ts +3 -0
- package/src/plugins/deepbook/ordersFetcher.js +74 -0
- package/src/plugins/deepbook/ordersFetcher.js.map +1 -0
- package/src/plugins/deepbook/poolsJob.d.ts +3 -0
- package/src/plugins/deepbook/poolsJob.js +30 -0
- package/src/plugins/deepbook/poolsJob.js.map +1 -0
- package/src/plugins/deepbook/types.d.ts +12 -0
- package/src/plugins/deepbook/types.js +3 -0
- package/src/plugins/deepbook/types.js.map +1 -0
- package/src/plugins/flowx/stakingPoolFetcher.js +1 -1
- package/src/plugins/flowx/stakingPoolFetcher.js.map +1 -1
- package/src/plugins/flowx/stakingPoolV3Fetcher.js +1 -1
- package/src/plugins/flowx/stakingPoolV3Fetcher.js.map +1 -1
- package/src/plugins/foo/constants.d.ts +1 -1
- package/src/plugins/foo/constants.js +2 -2
- package/src/plugins/foo/constants.js.map +1 -1
- package/src/plugins/foo/index.js +2 -2
- package/src/plugins/foo/index.js.map +1 -1
- package/src/plugins/foo/marketsJob.js +3 -3
- package/src/plugins/foo/marketsJob.js.map +1 -1
- package/src/plugins/foo/positionsEthereumFetcher.d.ts +3 -0
- package/src/plugins/foo/positionsEthereumFetcher.js +33 -0
- package/src/plugins/foo/positionsEthereumFetcher.js.map +1 -0
- package/src/plugins/foo/positionsSolanaFetcher.js +10 -26
- package/src/plugins/foo/positionsSolanaFetcher.js.map +1 -1
- package/src/plugins/foo/positionsSuiFetcher.d.ts +3 -0
- package/src/plugins/foo/positionsSuiFetcher.js +46 -0
- package/src/plugins/foo/positionsSuiFetcher.js.map +1 -0
- package/src/plugins/foo/types.d.ts +5 -0
- package/src/plugins/foo/types.js +3 -0
- package/src/plugins/foo/types.js.map +1 -0
- package/src/plugins/francium/constants.d.ts +19 -0
- package/src/plugins/francium/constants.js +839 -0
- package/src/plugins/francium/constants.js.map +1 -0
- package/src/plugins/francium/helpers.d.ts +14 -0
- package/src/plugins/francium/helpers.js +85 -0
- package/src/plugins/francium/helpers.js.map +1 -0
- package/src/plugins/francium/index.d.ts +6 -0
- package/src/plugins/francium/index.js +13 -0
- package/src/plugins/francium/index.js.map +1 -0
- package/src/plugins/francium/lendingFetcher.d.ts +3 -0
- package/src/plugins/francium/lendingFetcher.js +70 -0
- package/src/plugins/francium/lendingFetcher.js.map +1 -0
- package/src/plugins/francium/lendingPoolJob.d.ts +3 -0
- package/src/plugins/francium/lendingPoolJob.js +49 -0
- package/src/plugins/francium/lendingPoolJob.js.map +1 -0
- package/src/plugins/francium/structs.d.ts +59 -0
- package/src/plugins/francium/structs.js +49 -0
- package/src/plugins/francium/structs.js.map +1 -0
- package/src/plugins/francium/tokens.d.ts +9 -0
- package/src/plugins/francium/tokens.js +524 -0
- package/src/plugins/francium/tokens.js.map +1 -0
- package/src/plugins/francium/types.d.ts +16 -0
- package/src/plugins/francium/types.js +3 -0
- package/src/plugins/francium/types.js.map +1 -0
- package/src/plugins/kamino/lendsFetcher.js +64 -167
- package/src/plugins/kamino/lendsFetcher.js.map +1 -1
- package/src/plugins/kriya/farmsFetcher.js +23 -48
- package/src/plugins/kriya/farmsFetcher.js.map +1 -1
- package/src/plugins/kriya/leverageVaultsFetcher.js +5 -5
- package/src/plugins/kriya/leverageVaultsFetcher.js.map +1 -1
- package/src/plugins/meteora/dlmmPositionsFetcher.js +5 -4
- package/src/plugins/meteora/dlmmPositionsFetcher.js.map +1 -1
- package/src/plugins/meteora/farmsFetcher.js +19 -68
- package/src/plugins/meteora/farmsFetcher.js.map +1 -1
- package/src/plugins/nxfinance/positionsFetcher.js +32 -80
- package/src/plugins/nxfinance/positionsFetcher.js.map +1 -1
- package/src/plugins/quarry/positionsFetcher.js +1 -1
- package/src/plugins/quarry/positionsFetcher.js.map +1 -1
- package/src/plugins/raydium/farmsFetcher.js +30 -74
- package/src/plugins/raydium/farmsFetcher.js.map +1 -1
- package/src/plugins/raydium/getRaydiumCLMMPositions.js +4 -4
- package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
- package/src/plugins/raydium/helpers.d.ts +3 -2
- package/src/plugins/raydium/helpers.js +5 -7
- package/src/plugins/raydium/helpers.js.map +1 -1
- package/src/plugins/raydium/index.js +1 -2
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/raydium/lpTokensJob.js +1 -1
- package/src/plugins/raydium/lpTokensJob.js.map +1 -1
- package/src/plugins/stabble/constants.d.ts +8 -0
- package/src/plugins/stabble/constants.js +27 -0
- package/src/plugins/stabble/constants.js.map +1 -0
- package/src/plugins/stabble/filters.d.ts +3 -0
- package/src/plugins/stabble/filters.js +20 -0
- package/src/plugins/stabble/filters.js.map +1 -0
- package/src/plugins/stabble/index.d.ts +6 -0
- package/src/plugins/stabble/index.js +12 -0
- package/src/plugins/stabble/index.js.map +1 -0
- package/src/plugins/stabble/poolsJob.d.ts +3 -0
- package/src/plugins/stabble/poolsJob.js +84 -0
- package/src/plugins/stabble/poolsJob.js.map +1 -0
- package/src/plugins/stabble/stableIdl.d.ts +40 -0
- package/src/plugins/stabble/stableIdl.js +104 -0
- package/src/plugins/stabble/stableIdl.js.map +1 -0
- package/src/plugins/stabble/types.d.ts +40 -0
- package/src/plugins/stabble/types.js +3 -0
- package/src/plugins/stabble/types.js.map +1 -0
- package/src/plugins/stabble/weightedIdl.d.ts +40 -0
- package/src/plugins/stabble/weightedIdl.js +96 -0
- package/src/plugins/stabble/weightedIdl.js.map +1 -0
- package/src/utils/bitcoin/getBalance.js +1 -0
- package/src/utils/bitcoin/getBalance.js.map +1 -1
- package/src/utils/elementbuilder/AssetBuilder.d.ts +11 -0
- package/src/utils/elementbuilder/AssetBuilder.js +28 -0
- package/src/utils/elementbuilder/AssetBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +27 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +110 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementBuilder.d.ts +12 -0
- package/src/utils/elementbuilder/ElementBuilder.js +13 -0
- package/src/utils/elementbuilder/ElementBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementLiquidityBuilder.d.ts +12 -0
- package/src/utils/elementbuilder/ElementLiquidityBuilder.js +42 -0
- package/src/utils/elementbuilder/ElementLiquidityBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementMultipleBuilder.d.ts +13 -0
- package/src/utils/elementbuilder/ElementMultipleBuilder.js +40 -0
- package/src/utils/elementbuilder/ElementMultipleBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementParams.d.ts +7 -0
- package/src/utils/elementbuilder/ElementParams.js +3 -0
- package/src/utils/elementbuilder/ElementParams.js.map +1 -0
- package/src/utils/elementbuilder/ElementRegistry.d.ts +17 -0
- package/src/utils/elementbuilder/ElementRegistry.js +49 -0
- package/src/utils/elementbuilder/ElementRegistry.js.map +1 -0
- package/src/utils/elementbuilder/LiquidityBuilder.d.ts +15 -0
- package/src/utils/elementbuilder/LiquidityBuilder.js +52 -0
- package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -0
- package/src/utils/elementbuilder/PortfolioAssetParams.d.ts +7 -0
- package/src/utils/elementbuilder/PortfolioAssetParams.js +3 -0
- package/src/utils/elementbuilder/PortfolioAssetParams.js.map +1 -0
- package/src/plugins/foo/positionsFetcher.js +0 -49
- package/src/plugins/foo/positionsFetcher.js.map +0 -1
- package/src/plugins/raydium/stakingFetcher.js +0 -50
- package/src/plugins/raydium/stakingFetcher.js.map +0 -1
- /package/src/plugins/{foo → adrastea}/positionsFetcher.d.ts +0 -0
- /package/src/plugins/{raydium/stakingFetcher.d.ts → cetus/dcaFetcher.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,2BAA2B;IACpC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AACW,QAAA,eAAe,GAAG,SAAS,CAAC;AAE5B,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,UAAU,GAAG,CAAC,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
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 poolsJob_1 = __importDefault(require("./poolsJob"));
|
9
|
+
exports.platforms = [constants_1.platform];
|
10
|
+
exports.jobs = [poolsJob_1.default];
|
11
|
+
exports.fetchers = [];
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0DAAkC;AAErB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,CAAC,CAAC;AACzB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
|
@@ -0,0 +1,97 @@
|
|
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 constants_1 = require("./constants");
|
13
|
+
const clients_1 = require("../../utils/clients");
|
14
|
+
const getDynamicFieldObjects_1 = require("../../utils/sui/getDynamicFieldObjects");
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const getLpTokenSourceRaw_1 = require("../../utils/misc/getLpTokenSourceRaw");
|
17
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
+
const client = (0, clients_1.getClientSui)();
|
19
|
+
const pools = yield (0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, constants_1.dexInfoId);
|
20
|
+
const mints = new Set();
|
21
|
+
pools.forEach((pool) => {
|
22
|
+
var _a, _b, _c, _d, _e;
|
23
|
+
if (((_b = (_a = pool.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.is_freeze) ||
|
24
|
+
!((_c = pool.data) === null || _c === void 0 ? void 0 : _c.type) ||
|
25
|
+
!((_e = (_d = pool.data) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.fields.lsp_supply.type))
|
26
|
+
return;
|
27
|
+
let { keys: coinTypeKeys } = (0, portfolio_core_1.parseTypeString)(pool.data.type);
|
28
|
+
if (!coinTypeKeys)
|
29
|
+
return;
|
30
|
+
const coinTypeX = coinTypeKeys[0].type;
|
31
|
+
const coinTypeY = coinTypeKeys[1].type;
|
32
|
+
if (!coinTypeX || !coinTypeY)
|
33
|
+
return;
|
34
|
+
mints.add(coinTypeX);
|
35
|
+
mints.add(coinTypeY);
|
36
|
+
});
|
37
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.sui);
|
38
|
+
const lpSources = [];
|
39
|
+
pools.forEach((pool) => {
|
40
|
+
var _a, _b, _c, _d, _e;
|
41
|
+
if (((_b = (_a = pool.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.is_freeze) ||
|
42
|
+
!((_c = pool.data) === null || _c === void 0 ? void 0 : _c.type) ||
|
43
|
+
!((_e = (_d = pool.data) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.fields.lsp_supply.type))
|
44
|
+
return;
|
45
|
+
let { keys: coinTypeKeys } = (0, portfolio_core_1.parseTypeString)(pool.data.type);
|
46
|
+
if (!coinTypeKeys)
|
47
|
+
return;
|
48
|
+
const coinTypeX = coinTypeKeys[0].type;
|
49
|
+
const coinTypeY = coinTypeKeys[1].type;
|
50
|
+
const { keys: lpCoinTypeKeys } = (0, portfolio_core_1.parseTypeString)(pool.data.content.fields.lsp_supply.type);
|
51
|
+
if (!lpCoinTypeKeys)
|
52
|
+
return;
|
53
|
+
const lpCoinType = lpCoinTypeKeys[0].type;
|
54
|
+
if (!coinTypeX || !coinTypeY || !lpCoinType)
|
55
|
+
return;
|
56
|
+
const tokenPriceX = tokenPrices.get(coinTypeX);
|
57
|
+
const tokenPriceY = tokenPrices.get(coinTypeY);
|
58
|
+
if (!tokenPriceX || !tokenPriceY)
|
59
|
+
return;
|
60
|
+
const newLpSources = (0, getLpTokenSourceRaw_1.getLpTokenSourceRaw)({
|
61
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
62
|
+
sourceId: lpCoinType,
|
63
|
+
platformId: constants_1.platformId,
|
64
|
+
priceUnderlyings: true,
|
65
|
+
lpDetails: {
|
66
|
+
address: lpCoinType,
|
67
|
+
decimals: constants_1.lpDecimals,
|
68
|
+
supplyRaw: pool.data.content.fields.lsp_supply.fields.value,
|
69
|
+
},
|
70
|
+
poolUnderlyingsRaw: [
|
71
|
+
{
|
72
|
+
address: (0, portfolio_core_1.formatTokenAddress)(coinTypeX, portfolio_core_1.NetworkId.sui),
|
73
|
+
decimals: tokenPriceX.decimals,
|
74
|
+
reserveAmountRaw: pool.data.content.fields.reserve_x,
|
75
|
+
weight: 0.5,
|
76
|
+
tokenPrice: tokenPriceX,
|
77
|
+
},
|
78
|
+
{
|
79
|
+
address: (0, portfolio_core_1.formatTokenAddress)(coinTypeY, portfolio_core_1.NetworkId.sui),
|
80
|
+
decimals: tokenPriceY.decimals,
|
81
|
+
reserveAmountRaw: pool.data.content.fields.reserve_y,
|
82
|
+
weight: 0.5,
|
83
|
+
tokenPrice: tokenPriceY,
|
84
|
+
},
|
85
|
+
],
|
86
|
+
});
|
87
|
+
lpSources.push(...newLpSources);
|
88
|
+
});
|
89
|
+
yield cache.setTokenPriceSources(lpSources);
|
90
|
+
});
|
91
|
+
const job = {
|
92
|
+
id: `${constants_1.platformId}-pools`,
|
93
|
+
executor,
|
94
|
+
label: 'normal',
|
95
|
+
};
|
96
|
+
exports.default = job;
|
97
|
+
//# sourceMappingURL=poolsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,2CAAgE;AAChE,iDAAmD;AACnD,mFAAgF;AAEhF,+DAKoC;AACpC,8EAA2E;AAE3E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,KAAK,GAAG,MAAM,IAAA,+CAAsB,EAAO,MAAM,EAAE,qBAAS,CAAC,CAAC;IAEpE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;;QACrB,IACE,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,SAAS;YACpC,CAAC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,CAAA;YAChB,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAA;YAE3C,OAAO;QAET,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAA,gCAAe,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,YAAY;YAAE,OAAO;QAC1B,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACvC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI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AAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ID } from '../../utils/sui/structs/id';
|
2
|
+
export type Pool = {
|
3
|
+
creator: string;
|
4
|
+
fee_amount: string;
|
5
|
+
fee_x: string;
|
6
|
+
fee_y: string;
|
7
|
+
id: ID;
|
8
|
+
is_freeze: boolean;
|
9
|
+
k_last: string;
|
10
|
+
lsp_supply: {
|
11
|
+
fields: {
|
12
|
+
value: string;
|
13
|
+
};
|
14
|
+
type: string;
|
15
|
+
};
|
16
|
+
minimum_liq: string;
|
17
|
+
reserve_x: string;
|
18
|
+
reserve_y: string;
|
19
|
+
token_x: string;
|
20
|
+
token_y: string;
|
21
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/types.ts"],"names":[],"mappings":""}
|
@@ -66,7 +66,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
66
66
|
if ((_b = (_a = poolObj.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields) {
|
67
67
|
const pool = (0, helpers_1.getPoolFromObject)(poolObj);
|
68
68
|
poolsById.set(poolObj.data.objectId, pool);
|
69
|
-
mints.push(
|
69
|
+
mints.push(pool.coinTypeA, pool.coinTypeB);
|
70
70
|
}
|
71
71
|
});
|
72
72
|
const tokenPriceById = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.sui);
|
@@ -77,11 +77,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
77
77
|
if (!pool)
|
78
78
|
continue;
|
79
79
|
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(clmmPosition.liquidity), pool.current_tick_index, clmmPosition.tick_lower_index, clmmPosition.tick_upper_index, false);
|
80
|
-
const tokenPriceA = tokenPriceById.get(
|
80
|
+
const tokenPriceA = tokenPriceById.get(pool.coinTypeA);
|
81
81
|
if (!tokenPriceA)
|
82
82
|
continue;
|
83
83
|
const assetTokenA = (0, tokenPriceToAssetToken_1.default)(pool.coinTypeA, tokenAmountA.dividedBy(Math.pow(10, tokenPriceA.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceA);
|
84
|
-
const tokenPriceB = tokenPriceById.get(
|
84
|
+
const tokenPriceB = tokenPriceById.get(pool.coinTypeB);
|
85
85
|
if (!tokenPriceB)
|
86
86
|
continue;
|
87
87
|
const assetTokenB = (0, tokenPriceToAssetToken_1.default)(pool.coinTypeB, tokenAmountB.dividedBy(Math.pow(10, tokenPriceB.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceB);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"clmmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/clmmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"clmmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/clmmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAAsE;AACtE,iDAAmD;AACnD,uCAImB;AAGnB,qGAA6E;AAC7E,wFAAyF;AACzF,qEAAkE;AAClE,qEAAkE;AAElE,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,IAA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AAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -9,3 +9,7 @@ export declare const poolParentId = "0x4c9ab808d50ca1358cc699bb53b6334b9471d4718
|
|
9
9
|
export declare const firstPool = "0x58ec75646f31c384f485bd92a5f1d19aa60713eabe2447cbc1354c8c229b10b7";
|
10
10
|
export declare const vaultManagerMap = "0x9036bcc5aa7fd2cceec1659a6a1082871f45bc400c743f50063363457d1738bd";
|
11
11
|
export declare const farmNftType = "0x11ea791d82b5742cc8cab0bf7946035c97d9001d7c3803a93f119753da66f526::pool::WrappedPositionNFT";
|
12
|
+
export declare const limitPackageId = "0x533fab9a116080e2cb1c87f1832c1bf4231ab4c32318ced041e75cc28604bba9";
|
13
|
+
export declare const limitUserIndexId = "0x7f851ac19e438f97e78a5335eed4f12766a3a0ae94340bab7956a402f0e6212e";
|
14
|
+
export declare const devInspectTxSender = "0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb";
|
15
|
+
export declare const dcaUserIndexerId = "0x0ae365f60f2fa692831f9496c9e49b2440c74f14e8eab6f88dbb418c443b5020";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
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.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,
|
@@ -19,4 +19,8 @@ exports.firstPool = '0x58ec75646f31c384f485bd92a5f1d19aa60713eabe2447cbc1354c8c2
|
|
19
19
|
// Vaults https://api-sui.cetus.zone/v2/sui/auto_pools
|
20
20
|
exports.vaultManagerMap = '0x9036bcc5aa7fd2cceec1659a6a1082871f45bc400c743f50063363457d1738bd';
|
21
21
|
exports.farmNftType = '0x11ea791d82b5742cc8cab0bf7946035c97d9001d7c3803a93f119753da66f526::pool::WrappedPositionNFT';
|
22
|
+
exports.limitPackageId = '0x533fab9a116080e2cb1c87f1832c1bf4231ab4c32318ced041e75cc28604bba9';
|
23
|
+
exports.limitUserIndexId = '0x7f851ac19e438f97e78a5335eed4f12766a3a0ae94340bab7956a402f0e6212e';
|
24
|
+
exports.devInspectTxSender = '0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb';
|
25
|
+
exports.dcaUserIndexerId = '0x0ae365f60f2fa692831f9496c9e49b2440c74f14e8eab6f88dbb418c443b5020';
|
22
26
|
//# sourceMappingURL=constants.js.map
|
@@ -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,OAAO;IACpB,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"}
|
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,OAAO;IACpB,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"}
|
@@ -0,0 +1,77 @@
|
|
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 multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
16
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
17
|
+
const helpers_1 = require("./helpers");
|
18
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
19
|
+
const getDynamicFields_1 = require("../../utils/sui/getDynamicFields");
|
20
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
var _a, _b;
|
22
|
+
const client = (0, clients_1.getClientSui)();
|
23
|
+
const userIndexField = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
24
|
+
parentId: constants_1.dcaUserIndexerId,
|
25
|
+
name: {
|
26
|
+
type: 'address',
|
27
|
+
value: owner,
|
28
|
+
},
|
29
|
+
});
|
30
|
+
if (!userIndexField)
|
31
|
+
return [];
|
32
|
+
const fields = yield (0, getDynamicFields_1.getDynamicFields)(client, ((_b = (_a = userIndexField.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields)
|
33
|
+
.value.fields.id.id);
|
34
|
+
if (!fields.length)
|
35
|
+
return [];
|
36
|
+
const orders = yield (0, multiGetObjects_1.multiGetObjects)(client, fields.map((f) => f.name.value));
|
37
|
+
if (!orders.length)
|
38
|
+
return [];
|
39
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
40
|
+
const element = elementRegistry.addElementMultiple({
|
41
|
+
label: 'Deposit',
|
42
|
+
name: `DCA Orders`,
|
43
|
+
});
|
44
|
+
orders.forEach((order) => {
|
45
|
+
var _a;
|
46
|
+
if (!((_a = order.data) === null || _a === void 0 ? void 0 : _a.content))
|
47
|
+
return;
|
48
|
+
const orderFields = order.data.content.fields;
|
49
|
+
if (orderFields.in_withdrawn !== '0' &&
|
50
|
+
orderFields.in_withdrawn === orderFields.in_deposited)
|
51
|
+
return; // Close
|
52
|
+
if (orderFields.in_withdrawn !== '0' && orderFields.out_withdrawn !== '0')
|
53
|
+
return; // PartialDeal
|
54
|
+
if (orderFields.amount_left_next_cycle === '0' &&
|
55
|
+
orderFields.next_cycle_at === '0')
|
56
|
+
return; // AllDeal
|
57
|
+
const structTag = (0, helpers_1.extractStructTagFromType)(order.data.type);
|
58
|
+
if (order.data.content.fields.in_balance !== '0')
|
59
|
+
element.addAsset({
|
60
|
+
address: structTag.type_arguments[0],
|
61
|
+
amount: order.data.content.fields.in_balance,
|
62
|
+
});
|
63
|
+
if (order.data.content.fields.out_balance !== '0')
|
64
|
+
element.addAsset({
|
65
|
+
address: structTag.type_arguments[1],
|
66
|
+
amount: order.data.content.fields.out_balance,
|
67
|
+
});
|
68
|
+
});
|
69
|
+
return elementRegistry.dump(cache);
|
70
|
+
});
|
71
|
+
const fetcher = {
|
72
|
+
id: `${constants_1.platformId}-dca`,
|
73
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
74
|
+
executor,
|
75
|
+
};
|
76
|
+
exports.default = fetcher;
|
77
|
+
//# sourceMappingURL=dcaFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dcaFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/dcaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAA2D;AAC3D,iDAAmD;AAEnD,qEAAkE;AAClE,gFAA6E;AAC7E,uCAAqD;AACrD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owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
75
75
|
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(position.data.content.fields.clmm_postion.fields.liquidity), pool.current_tick_index, tickLowerIndex < effectiveTickLower ? effectiveTickLower : tickLowerIndex, tickUpperIndex < effectiveTickUpper ? tickUpperIndex : effectiveTickUpper, false);
|
76
76
|
if (tokenAmountA.isZero() && tokenAmountB.isZero())
|
77
77
|
return;
|
78
|
-
const
|
79
|
-
const
|
80
|
-
const tokenPriceA = tokenPrices.get(coinTypeA);
|
81
|
-
const tokenPriceB = tokenPrices.get(coinTypeB);
|
78
|
+
const tokenPriceA = tokenPrices.get(pool.coinTypeA);
|
79
|
+
const tokenPriceB = tokenPrices.get(pool.coinTypeB);
|
82
80
|
const assets = [];
|
83
81
|
if (tokenAmountA.isGreaterThan(0) && tokenPriceA) {
|
84
82
|
assets.push((0, tokenPriceToAssetToken_1.default)(tokenPriceA.address, tokenAmountA.dividedBy(Math.pow(10, tokenPriceA.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceA));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAGrC,2CAAuE;AACvE,iDAAmD;AAEnD,qGAA6E;AAC7E,qEAAkE;AAClE,qEAAkE;AAClE,+DAA4D;AAC5D,wFAAyF;AAEzF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,MAAM,IAAA,iCAAe,EAAqB,MAAM,EAAE,KAAK,EAAE;QACzE,OAAO,EAAE;YACP,WAAW,EAAE,IAAI;SAClB;QACD,MAA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e,OAAO,CAAC"}
|
@@ -9,7 +9,14 @@ const clmmsFetcher_1 = __importDefault(require("./clmmsFetcher"));
|
|
9
9
|
const constants_1 = require("./constants");
|
10
10
|
const vaultsJob_1 = __importDefault(require("./vaultsJob"));
|
11
11
|
const farmsFetcher_1 = __importDefault(require("./farmsFetcher"));
|
12
|
+
const limitFetcher_1 = __importDefault(require("./limitFetcher"));
|
13
|
+
const dcaFetcher_1 = __importDefault(require("./dcaFetcher"));
|
12
14
|
exports.platforms = [constants_1.platform];
|
13
15
|
exports.jobs = [poolsJob_1.default, vaultsJob_1.default];
|
14
|
-
exports.fetchers = [
|
16
|
+
exports.fetchers = [
|
17
|
+
clmmsFetcher_1.default,
|
18
|
+
farmsFetcher_1.default,
|
19
|
+
limitFetcher_1.default,
|
20
|
+
dcaFetcher_1.default,
|
21
|
+
];
|
15
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/index.ts"],"names":[],"mappings":";;;;;;AAGA,0DAAkC;AAClC,kEAAiD;AACjD,2CAAuC;AACvC,4DAAoC;AACpC,kEAA0C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/index.ts"],"names":[],"mappings":";;;;;;AAGA,0DAAkC;AAClC,kEAAiD;AACjD,2CAAuC;AACvC,4DAAoC;AACpC,kEAA0C;AAC1C,kEAA0C;AAC1C,8DAAsC;AAEzB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,EAAE,mBAAS,CAAC,CAAC;AACpC,QAAA,QAAQ,GAAc;IACjC,sBAAmB;IACnB,sBAAY;IACZ,sBAAY;IACZ,oBAAU;CACX,CAAC"}
|
@@ -0,0 +1,66 @@
|
|
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 transactions_1 = require("@mysten/sui.js/transactions");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
17
|
+
const multipleGetDynamicFieldsObjects_1 = require("../../utils/sui/multipleGetDynamicFieldsObjects");
|
18
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
19
|
+
const helpers_1 = require("./helpers");
|
20
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
const client = (0, clients_1.getClientSui)();
|
22
|
+
const tx = new transactions_1.TransactionBlock();
|
23
|
+
tx.moveCall({
|
24
|
+
target: `${constants_1.limitPackageId}::limit_order::get_orders_indexer_by_owner`,
|
25
|
+
arguments: [tx.pure.address(owner), tx.object(constants_1.limitUserIndexId)],
|
26
|
+
typeArguments: [],
|
27
|
+
});
|
28
|
+
const dir = yield client.devInspectTransactionBlock({
|
29
|
+
sender: constants_1.devInspectTxSender,
|
30
|
+
transactionBlock: tx,
|
31
|
+
});
|
32
|
+
if (!dir.events.length)
|
33
|
+
return [];
|
34
|
+
const ordersTableIds = dir.events.map((e) => e.parsedJson.orders_table_id);
|
35
|
+
const fields = yield (0, multipleGetDynamicFieldsObjects_1.multipleGetDynamicFieldsObjects)(client, ordersTableIds);
|
36
|
+
if (!fields.length)
|
37
|
+
return [];
|
38
|
+
const orders = yield (0, multiGetObjects_1.multiGetObjects)(client, fields.flat().map((o) => { var _a, _b; return ((_b = (_a = o.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields).name; }));
|
39
|
+
if (!orders.length)
|
40
|
+
return [];
|
41
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
42
|
+
const element = elementRegistry.addElementMultiple({
|
43
|
+
label: 'Deposit',
|
44
|
+
name: `Limit Orders`,
|
45
|
+
});
|
46
|
+
orders.forEach((order) => {
|
47
|
+
var _a;
|
48
|
+
if (!((_a = order.data) === null || _a === void 0 ? void 0 : _a.content))
|
49
|
+
return;
|
50
|
+
if (order.data.content.fields.pay_balance === '0')
|
51
|
+
return;
|
52
|
+
const structTag = (0, helpers_1.extractStructTagFromType)(order.data.type);
|
53
|
+
element.addAsset({
|
54
|
+
address: structTag.type_arguments[0],
|
55
|
+
amount: order.data.content.fields.pay_balance,
|
56
|
+
});
|
57
|
+
});
|
58
|
+
return elementRegistry.dump(cache);
|
59
|
+
});
|
60
|
+
const fetcher = {
|
61
|
+
id: `${constants_1.platformId}-limit`,
|
62
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
63
|
+
executor,
|
64
|
+
};
|
65
|
+
exports.default = fetcher;
|
66
|
+
//# sourceMappingURL=limitFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"limitFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/cetus/limitFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,8DAA+D;AAG/D,2CAKqB;AACrB,iDAAmD;AAEnD,qEAAkE;AAClE,qGAAkG;AAClG,gFAA6E;AAC7E,uCAAqD;AAErD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAA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C;IACvE,MAAM,OAAO,GAAG,eAAe,CAAC,kBAAkB,CAAC;QACjD,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,cAAc;KACrB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;;QACvB,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,OAAO,CAAA;YAAE,OAAO;QACjC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,KAAK,GAAG;YAAE,OAAO;QAC1D,MAAM,SAAS,GAAG,IAAA,kCAAwB,EAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5D,OAAO,CAAC,QAAQ,CAAC;YACf,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;YACpC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW;SAC9C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,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"}
|
@@ -218,3 +218,35 @@ export type Farm = {
|
|
218
218
|
sqrt_price: string;
|
219
219
|
total_share: string;
|
220
220
|
};
|
221
|
+
export type LimitOrder = {
|
222
|
+
canceled_ts: string;
|
223
|
+
claimed_amount: string;
|
224
|
+
created_ts: string;
|
225
|
+
expire_ts: string;
|
226
|
+
id: ID;
|
227
|
+
obtained_amount: string;
|
228
|
+
owner: string;
|
229
|
+
pay_balance: string;
|
230
|
+
rate: string;
|
231
|
+
rate_order_indexer_id: string;
|
232
|
+
target_balance: string;
|
233
|
+
total_pay_amount: string;
|
234
|
+
};
|
235
|
+
export type DcaOrder = {
|
236
|
+
amount_left_next_cycle: string;
|
237
|
+
created_at: string;
|
238
|
+
cycle_frequency: string;
|
239
|
+
fee_rate: string;
|
240
|
+
id: ID;
|
241
|
+
in_amount_per_cycle: string;
|
242
|
+
in_balance: string;
|
243
|
+
in_deposited: string;
|
244
|
+
in_withdrawn: string;
|
245
|
+
max_out_amount_per_cycle: string;
|
246
|
+
min_out_amount_per_cycle: string;
|
247
|
+
next_cycle_at: string;
|
248
|
+
out_balance: string;
|
249
|
+
out_withdrawn: string;
|
250
|
+
status: string;
|
251
|
+
user: string;
|
252
|
+
};
|
@@ -5,3 +5,6 @@ export declare const platform: Platform;
|
|
5
5
|
export declare const airdropStatics: AirdropStatics;
|
6
6
|
export declare const deepMint = "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP";
|
7
7
|
export declare const deepDecimals = 6;
|
8
|
+
export declare const PACKAGE_ID = "0xdee9";
|
9
|
+
export declare const MODULE_CLOB = "clob_v2";
|
10
|
+
export declare const poolsCacheKey = "pools";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.deepDecimals = exports.deepMint = exports.airdropStatics = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.poolsCacheKey = exports.MODULE_CLOB = exports.PACKAGE_ID = exports.deepDecimals = exports.deepMint = exports.airdropStatics = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'deepbook';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -20,4 +20,7 @@ exports.airdropStatics = {
|
|
20
20
|
};
|
21
21
|
exports.deepMint = '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP';
|
22
22
|
exports.deepDecimals = 6;
|
23
|
+
exports.PACKAGE_ID = '0xdee9';
|
24
|
+
exports.MODULE_CLOB = 'clob_v2';
|
25
|
+
exports.poolsCacheKey = 'pools';
|
23
26
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/deepbook/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,UAAU;IACvB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,iDAAiD;IACxD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/deepbook/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,UAAU;IACvB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,iDAAiD;IACxD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,YAAY,GAAG,CAAC,CAAC;AAEjB,QAAA,UAAU,GAAG,QAAQ,CAAC;AAEtB,QAAA,WAAW,GAAG,SAAS,CAAC;AAExB,QAAA,aAAa,GAAG,OAAO,CAAC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { SuiClient } from '../../utils/clients/types';
|
2
|
+
import { PoolSummary, UserPosition } from './types';
|
3
|
+
export declare const getUserPosition: (pool: PoolSummary, accountCap: string, suiClient: SuiClient) => Promise<UserPosition>;
|
4
|
+
export declare const getAllPools: (suiClient: SuiClient) => Promise<PoolSummary[]>;
|