@sonarwatch/portfolio-plugins 0.14.50 → 0.14.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/plugins/bluemove/constants.d.ts +1 -2
- package/src/plugins/bluemove/constants.js +2 -3
- package/src/plugins/bluemove/constants.js.map +1 -1
- package/src/plugins/bluemove/index.js +4 -2
- package/src/plugins/bluemove/index.js.map +1 -1
- package/src/plugins/bluemove/lockLpFetcher.d.ts +3 -0
- package/src/plugins/bluemove/lockLpFetcher.js +66 -0
- package/src/plugins/bluemove/lockLpFetcher.js.map +1 -0
- package/src/plugins/bluemove/lockLpJob.d.ts +3 -0
- package/src/plugins/bluemove/lockLpJob.js +36 -0
- package/src/plugins/bluemove/lockLpJob.js.map +1 -0
- package/src/plugins/bluemove/types.d.ts +24 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.14.51](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.50...plugins-0.14.51) (2024-12-03)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.14.50](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.49...plugins-0.14.50) (2024-12-03)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Platform } from '@sonarwatch/portfolio-core';
|
2
2
|
export declare const platformId = "bluemove";
|
3
3
|
export declare const platform: Platform;
|
4
|
-
export declare const
|
5
|
-
export declare const packageId = "0xb24b6789e088b876afabca733bed2299fbc9e2d6369be4d1acfa17d8145454d9";
|
4
|
+
export declare const lockedLpDataCacheKey = "locked-lp-data";
|
6
5
|
export declare const dexInfoId = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
|
7
6
|
export declare const lpDecimals = 9;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.lpDecimals = exports.dexInfoId = exports.
|
3
|
+
exports.lpDecimals = exports.dexInfoId = exports.lockedLpDataCacheKey = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'bluemove';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -10,8 +10,7 @@ exports.platform = {
|
|
10
10
|
twitter: 'https://x.com/BlueMove_OA',
|
11
11
|
defiLlamaId: 'parent#bluemove', // from https://defillama.com/docs/api
|
12
12
|
};
|
13
|
-
exports.
|
14
|
-
exports.packageId = '0xb24b6789e088b876afabca733bed2299fbc9e2d6369be4d1acfa17d8145454d9';
|
13
|
+
exports.lockedLpDataCacheKey = `locked-lp-data`;
|
15
14
|
exports.dexInfoId = '0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92';
|
16
15
|
exports.lpDecimals = 9;
|
17
16
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +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,iBAAiB,EAAE,sCAAsC;CACvE,CAAC;AACW,QAAA,
|
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,iBAAiB,EAAE,sCAAsC;CACvE,CAAC;AACW,QAAA,oBAAoB,GAAG,gBAAgB,CAAC;AAExC,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,UAAU,GAAG,CAAC,CAAC"}
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const poolsJob_1 = __importDefault(require("./poolsJob"));
|
9
|
+
const lockLpJob_1 = __importDefault(require("./lockLpJob"));
|
10
|
+
const lockLpFetcher_1 = __importDefault(require("./lockLpFetcher"));
|
9
11
|
exports.platforms = [constants_1.platform];
|
10
|
-
exports.jobs = [poolsJob_1.default];
|
11
|
-
exports.fetchers = [];
|
12
|
+
exports.jobs = [poolsJob_1.default, lockLpJob_1.default];
|
13
|
+
exports.fetchers = [lockLpFetcher_1.default];
|
12
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0DAAkC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0DAAkC;AAClC,4DAAoC;AACpC,oEAA4C;AAE/B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,EAAE,mBAAS,CAAC,CAAC;AACpC,QAAA,QAAQ,GAAc,CAAC,uBAAa,CAAC,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 constants_1 = require("./constants");
|
14
|
+
const clients_1 = require("../../utils/clients");
|
15
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
16
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
17
|
+
const getDynamicFieldObjects_1 = require("../../utils/sui/getDynamicFieldObjects");
|
18
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
19
|
+
const lockLpMemo = new MemoizedCache_1.MemoizedCache(constants_1.lockedLpDataCacheKey, {
|
20
|
+
prefix: constants_1.platformId,
|
21
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
22
|
+
});
|
23
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
var _a, _b, _c, _d;
|
25
|
+
const client = (0, clients_1.getClientSui)();
|
26
|
+
const poolUserInfo = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
27
|
+
parentId: '0xb848554079decb6164da129851595e7725b1c4ee3e687801a30ed8de975b54d2',
|
28
|
+
name: {
|
29
|
+
type: 'address',
|
30
|
+
value: owner,
|
31
|
+
},
|
32
|
+
});
|
33
|
+
if (!((_b = (_a = poolUserInfo === null || poolUserInfo === void 0 ? void 0 : poolUserInfo.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.id.id))
|
34
|
+
return [];
|
35
|
+
const userInfos = yield (0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, (_d = (_c = poolUserInfo.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.id.id);
|
36
|
+
if (!userInfos.length)
|
37
|
+
return [];
|
38
|
+
const lpTokens = yield lockLpMemo.getItem(cache);
|
39
|
+
if (!lpTokens)
|
40
|
+
return [];
|
41
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
42
|
+
const element = elementRegistry.addElementLiquidity({
|
43
|
+
label: 'LiquidityPool',
|
44
|
+
});
|
45
|
+
userInfos.forEach((userInfo) => {
|
46
|
+
var _a, _b;
|
47
|
+
(_b = (_a = userInfo.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.items.fields.contents.forEach((item) => {
|
48
|
+
const liquidity = element.addLiquidity();
|
49
|
+
liquidity.addAsset({
|
50
|
+
address: lpTokens[Number(item.fields.value.fields.pool_id)],
|
51
|
+
amount: item.fields.value.fields.locked_amout,
|
52
|
+
attributes: {
|
53
|
+
lockedUntil: Number(item.fields.value.fields.locked_until),
|
54
|
+
},
|
55
|
+
});
|
56
|
+
});
|
57
|
+
});
|
58
|
+
return elementRegistry.getElements(cache);
|
59
|
+
});
|
60
|
+
const fetcher = {
|
61
|
+
id: `${constants_1.platformId}-lock-lp`,
|
62
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
63
|
+
executor,
|
64
|
+
};
|
65
|
+
exports.default = fetcher;
|
66
|
+
//# sourceMappingURL=lockLpFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"lockLpFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/lockLpFetcher.ts"],"names":[],"mapp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C;IAEH,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;;QAC7B,MAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACpE,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;YACzC,SAAS,CAAC,QAAQ,CAAC;gBACjB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC3D,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY;gBAC7C,UAAU,EAAE;oBACV,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;iBAC3D;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,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,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,36 @@
|
|
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 getObject_1 = require("../../utils/sui/getObject");
|
16
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
var _a, _b;
|
18
|
+
const client = (0, clients_1.getClientSui)();
|
19
|
+
const LPData = yield (0, getObject_1.getObject)(client, '0x97ca02bd340ae343fee72dd8b9924f758ea1ceb2b034ffcc83719992e803cdb2');
|
20
|
+
if (!((_b = (_a = LPData.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.pool_info))
|
21
|
+
return;
|
22
|
+
yield cache.setItem(constants_1.lockedLpDataCacheKey, LPData.data.content.fields.pool_info.map((pool_info) => (0, portfolio_core_1.uniformTokenAddress)(`0x${pool_info.fields.lp_type
|
23
|
+
.replace('<0', '<0x0')
|
24
|
+
.replace(',', ', 0x')
|
25
|
+
.replace(portfolio_core_1.suiNativeAddress, '0x2::sui::SUI')}`, portfolio_core_1.NetworkId.sui)), {
|
26
|
+
prefix: constants_1.platformId,
|
27
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
28
|
+
});
|
29
|
+
});
|
30
|
+
const job = {
|
31
|
+
id: `${constants_1.platformId}-lock-lp`,
|
32
|
+
executor,
|
33
|
+
label: 'normal',
|
34
|
+
};
|
35
|
+
exports.default = job;
|
36
|
+
//# sourceMappingURL=lockLpJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"lockLpJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluemove/lockLpJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAA+D;AAC/D,iDAAmD;AACnD,yDAAsD;AAEtD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAS,EAa5B,MAAM,EACN,oEAAoE,CACrE,CAAC;IAEF,IAAI,CAAC,CAAA,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,SAAS,CAAA;QAAE,OAAO;IAEpD,MAAM,KAAK,CAAC,OAAO,CACjB,gCAAoB,EACpB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CACrD,IAAA,oCAAmB,EACjB,KAAK,SAAS,CAAC,MAAM,CAAC,OAAO;SAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC;SACpB,OAAO,CAAC,iCAAgB,EAAE,eAAe,CAAC,EAAE,EAC/C,0BAAS,CAAC,GAAG,CACd,CACF,EACD;QACE,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CACF,CAAC;AACJ,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -19,3 +19,27 @@ export type Pool = {
|
|
19
19
|
token_x: string;
|
20
20
|
token_y: string;
|
21
21
|
};
|
22
|
+
export type LockLpUserInfo = {
|
23
|
+
items: {
|
24
|
+
fields: {
|
25
|
+
contents: {
|
26
|
+
fields: {
|
27
|
+
key: string;
|
28
|
+
value: {
|
29
|
+
fields: {
|
30
|
+
duration: string;
|
31
|
+
locked_amout: string;
|
32
|
+
locked_until: string;
|
33
|
+
pool_id: string;
|
34
|
+
start_time: string;
|
35
|
+
};
|
36
|
+
type: string;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
type: string;
|
40
|
+
}[];
|
41
|
+
type: string;
|
42
|
+
};
|
43
|
+
type: string;
|
44
|
+
};
|
45
|
+
};
|