@sonarwatch/portfolio-plugins 0.11.97 → 0.11.98
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1091 -1087
- package/README.md +3 -3
- package/package.json +3 -3
- package/src/plugins/aftermath/poolsJob.js +22 -20
- package/src/plugins/aftermath/poolsJob.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/bucket/collateralFetcher.js +5 -8
- package/src/plugins/bucket/collateralFetcher.js.map +1 -1
- package/src/plugins/cetus/clmmsFetcher.js +5 -5
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/cetus/helpers.d.ts +4 -4
- package/src/plugins/cetus/helpers.js +23 -12
- package/src/plugins/cetus/helpers.js.map +1 -1
- package/src/plugins/cetus/poolsJob.js +5 -10
- package/src/plugins/cetus/poolsJob.js.map +1 -1
- package/src/plugins/navi/collateralFetcher.js +8 -7
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/navi/reservesJob.js +5 -4
- package/src/plugins/navi/reservesJob.js.map +1 -1
- package/src/plugins/scallop/helpers.d.ts +0 -49
- package/src/plugins/scallop/helpers.js +1 -39
- package/src/plugins/scallop/helpers.js.map +1 -1
- package/src/plugins/scallop/lendingsFetcher.js +17 -14
- package/src/plugins/scallop/lendingsFetcher.js.map +1 -1
- package/src/plugins/scallop/marketJob.js +16 -16
- package/src/plugins/scallop/marketJob.js.map +1 -1
- package/src/plugins/scallop/obligationsFetcher.js +25 -21
- package/src/plugins/scallop/obligationsFetcher.js.map +1 -1
- package/src/plugins/scallop/poolsJob.js +7 -12
- package/src/plugins/scallop/poolsJob.js.map +1 -1
- package/src/plugins/scallop/spoolsMarketJob.js +8 -15
- package/src/plugins/scallop/spoolsMarketJob.js.map +1 -1
- package/src/plugins/scallop/types/coin.d.ts +1 -1
- package/src/plugins/scallop/types/market.d.ts +3 -4
- package/src/plugins/scallop/types/market.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tokens/fetchers/sui-nfts.js +47 -107
- package/src/plugins/tokens/fetchers/sui-nfts.js.map +1 -1
- package/src/plugins/tokens/types.d.ts +0 -48
- package/src/plugins/turbos/clmmsPositionsFetcher.js +18 -16
- package/src/plugins/turbos/clmmsPositionsFetcher.js.map +1 -1
- package/src/plugins/turbos/helper.d.ts +3 -3
- package/src/plugins/turbos/helper.js +6 -4
- package/src/plugins/turbos/helper.js.map +1 -1
- package/src/plugins/turbos/poolsJob.js +10 -10
- package/src/plugins/turbos/poolsJob.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/clients/getClientSui.d.ts +2 -2
- package/src/utils/clients/getClientSui.js +8 -3
- package/src/utils/clients/getClientSui.js.map +1 -1
- package/src/utils/clients/types.d.ts +2 -0
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/sui/getDynamicFieldObject.d.ts +4 -0
- package/src/utils/sui/{getMultipleObjectsSafe.js → getDynamicFieldObject.js} +9 -13
- package/src/utils/sui/getDynamicFieldObject.js.map +1 -0
- package/src/utils/sui/getDynamicFields.d.ts +3 -0
- package/src/utils/sui/getDynamicFields.js +38 -0
- package/src/utils/sui/getDynamicFields.js.map +1 -0
- package/src/utils/sui/getObject.d.ts +4 -0
- package/src/utils/sui/{getDynamicFieldsSafe.js → getObject.js} +8 -16
- package/src/utils/sui/getObject.js.map +1 -0
- package/src/utils/sui/getObjectDeletedResponse.d.ts +3 -0
- package/src/utils/sui/getObjectDeletedResponse.js +19 -0
- package/src/utils/sui/getObjectDeletedResponse.js.map +1 -0
- package/src/utils/sui/getObjectNotExistsResponse.d.ts +2 -0
- package/src/utils/sui/getObjectNotExistsResponse.js +14 -0
- package/src/utils/sui/getObjectNotExistsResponse.js.map +1 -0
- package/src/utils/sui/getOwnedObjects.d.ts +4 -0
- package/src/utils/sui/getOwnedObjects.js +36 -0
- package/src/utils/sui/getOwnedObjects.js.map +1 -0
- package/src/utils/sui/multiGetObjects.d.ts +4 -0
- package/src/utils/sui/multiGetObjects.js +32 -0
- package/src/utils/sui/multiGetObjects.js.map +1 -0
- package/src/utils/sui/queryEvents.d.ts +4 -0
- package/src/utils/sui/{queryEventSafe.js → queryEvents.js} +16 -12
- package/src/utils/sui/queryEvents.js.map +1 -0
- package/src/utils/sui/structs/kiosk.d.ts +7 -0
- package/src/utils/sui/structs/kiosk.js +3 -0
- package/src/utils/sui/structs/kiosk.js.map +1 -0
- package/src/utils/sui/structs/nft.d.ts +41 -0
- package/src/utils/sui/structs/nft.js +3 -0
- package/src/utils/sui/structs/nft.js.map +1 -0
- package/src/utils/sui/types.d.ts +23 -0
- package/src/utils/sui/types.js +3 -0
- package/src/utils/sui/types.js.map +1 -0
- package/src/utils/sui/getDynamicFieldsSafe.d.ts +0 -13
- package/src/utils/sui/getDynamicFieldsSafe.js.map +0 -1
- package/src/utils/sui/getFormattedCollectionNameAndId.d.ts +0 -4
- package/src/utils/sui/getFormattedCollectionNameAndId.js +0 -19
- package/src/utils/sui/getFormattedCollectionNameAndId.js.map +0 -1
- package/src/utils/sui/getMultipleObjectsSafe.d.ts +0 -67
- package/src/utils/sui/getMultipleObjectsSafe.js.map +0 -1
- package/src/utils/sui/queryEventSafe.d.ts +0 -14
- package/src/utils/sui/queryEventSafe.js.map +0 -1
@@ -13,12 +13,13 @@ 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 sui_js_1 = require("@mysten/sui.js");
|
17
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const constants_1 = require("./constants");
|
19
18
|
const clients_1 = require("../../utils/clients");
|
19
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
20
20
|
const client = (0, clients_1.getClientSui)();
|
21
21
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
var _a, _b;
|
22
23
|
const address = yield cache.getItem(constants_1.addressKey, {
|
23
24
|
prefix: constants_1.addressPrefix,
|
24
25
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -34,22 +35,14 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
35
|
continue;
|
35
36
|
const { id: poolId, rewardPoolId } = detail;
|
36
37
|
const [stakeObjectResponse, rewardObjectResponse] = yield Promise.all([
|
37
|
-
|
38
|
-
|
39
|
-
options: {
|
40
|
-
showContent: true,
|
41
|
-
},
|
42
|
-
}),
|
43
|
-
client.getObject({
|
44
|
-
id: rewardPoolId,
|
45
|
-
options: {
|
46
|
-
showContent: true,
|
47
|
-
},
|
48
|
-
}),
|
38
|
+
(0, getObject_1.getObject)(client, poolId),
|
39
|
+
(0, getObject_1.getObject)(client, rewardPoolId),
|
49
40
|
]);
|
50
41
|
if (stakeObjectResponse.data && rewardObjectResponse.data) {
|
51
|
-
|
52
|
-
const
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
43
|
+
const stakeFields = (_a = stakeObjectResponse.data.content) === null || _a === void 0 ? void 0 : _a.fields;
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
45
|
+
const rewardFields = (_b = rewardObjectResponse.data.content) === null || _b === void 0 ? void 0 : _b.fields;
|
53
46
|
if (!stakeFields || !rewardFields)
|
54
47
|
continue;
|
55
48
|
const staked = stakeFields['stakes'];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"spoolsMarketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/spoolsMarketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,
|
1
|
+
{"version":3,"file":"spoolsMarketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/spoolsMarketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAM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AK,CAAC,CAAC,IAAI,CACtC,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;oBAC5C,CAAC,CAAC,IAAA,sBAAS,EAAC,yBAAa,CAAC;yBACrB,YAAY,CAAC,iBAAiB,CAAC;yBAC/B,SAAS,CAAC,MAAM,CAAC;oBACtB,CAAC,CAAC,IAAA,sBAAS,EAAC,CAAC,CAAC,CACjB;gBACD,uBAAuB,EAAE,MAAM,CAC7B,YAAY,CAAC,yBAAyB,CAAC,CACxC;gBACD,qBAAqB,EAAE,MAAM,CAC3B,YAAY,CAAC,2BAA2B,CAAC,CAC1C;aACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,qBAAS,EAAE,eAAe,EAAE;QAC9C,MAAM,EAAN,wBAAM;QACN,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,wBAAM;IACV,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CoinMetadata } from '@mysten/sui.js';
|
1
|
+
import { CoinMetadata } from '@mysten/sui.js/client';
|
2
2
|
export declare const COIN_NAMES: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus"];
|
3
3
|
export declare const MARKET_COIN_NAMES: readonly ["seth", "sbtc", "susdc", "susdt", "ssui", "sapt", "ssol", "scetus"];
|
4
4
|
export declare const SUPPORTED_SPOOL_COIN_NAMES: readonly ["ssui", "susdc"];
|
@@ -1,14 +1,13 @@
|
|
1
|
-
import { ObjectContentFields } from '@mysten/sui.js';
|
2
1
|
import BigNumber from 'bignumber.js';
|
3
2
|
import { BasicField, IdField, WitTable } from './basic';
|
4
3
|
export type BalanceSheet = {
|
5
|
-
[k in string]?:
|
4
|
+
[k in string]?: any;
|
6
5
|
};
|
7
6
|
export type BorrowIndexes = {
|
8
|
-
[k in string]?:
|
7
|
+
[k in string]?: any;
|
9
8
|
};
|
10
9
|
export type InterestModel = {
|
11
|
-
[k in string]?:
|
10
|
+
[k in string]?: any;
|
12
11
|
};
|
13
12
|
export type InterestModelData = {
|
14
13
|
base_borrow_rate_per_sec: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/market.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/market.ts"],"names":[],"mappings":";;AAsFA,MAAM,kBAAkB,GAAG;IACzB,qBAAqB;IACrB,iBAAiB;IACjB,kBAAkB;IAClB,IAAI;IACJ,iBAAiB;IACjB,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,OAAO;CACC,CAAC;AAEX,MAAM,YAAY,GAAG;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,IAAI;IACJ,sBAAsB;IACtB,qBAAqB;CACb,CAAC"}
|
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
|
|
54
54
|
}
|
55
55
|
function getV3PairsAddresses(url, length = 300) {
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
57
|
-
const query = (0, graphql_request_1.gql) `
|
58
|
-
{
|
59
|
-
pools(
|
60
|
-
orderBy: totalValueLockedUSD
|
61
|
-
first: ${length}
|
62
|
-
orderDirection: desc
|
63
|
-
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
-
) {
|
65
|
-
id
|
66
|
-
token0Price
|
67
|
-
token1Price
|
68
|
-
liquidity
|
69
|
-
token0 {
|
70
|
-
id
|
71
|
-
totalSupply
|
72
|
-
decimals
|
73
|
-
}
|
74
|
-
token1 {
|
75
|
-
id
|
76
|
-
totalSupply
|
77
|
-
decimals
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
57
|
+
const query = (0, graphql_request_1.gql) `
|
58
|
+
{
|
59
|
+
pools(
|
60
|
+
orderBy: totalValueLockedUSD
|
61
|
+
first: ${length}
|
62
|
+
orderDirection: desc
|
63
|
+
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
+
) {
|
65
|
+
id
|
66
|
+
token0Price
|
67
|
+
token1Price
|
68
|
+
liquidity
|
69
|
+
token0 {
|
70
|
+
id
|
71
|
+
totalSupply
|
72
|
+
decimals
|
73
|
+
}
|
74
|
+
token1 {
|
75
|
+
id
|
76
|
+
totalSupply
|
77
|
+
decimals
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
81
|
`;
|
82
82
|
const res = yield (0, graphql_request_1.default)(url, query);
|
83
83
|
const pools = res.pools;
|
@@ -8,124 +8,64 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const sui_js_1 = require("@mysten/sui.js");
|
17
13
|
const clients_1 = require("../../../utils/clients");
|
18
|
-
const getFormattedCollectionNameAndId_1 = __importDefault(require("../../../utils/sui/getFormattedCollectionNameAndId"));
|
19
14
|
const constants_1 = require("../constants");
|
20
15
|
const constants_2 = require("../../../utils/sui/constants");
|
21
|
-
const
|
16
|
+
const getOwnedObjects_1 = require("../../../utils/sui/getOwnedObjects");
|
17
|
+
const getDynamicFields_1 = require("../../../utils/sui/getDynamicFields");
|
18
|
+
const multiGetObjects_1 = require("../../../utils/sui/multiGetObjects");
|
22
19
|
const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
var _a;
|
23
21
|
const client = (0, clients_1.getClientSui)();
|
22
|
+
const ownedObjects = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
23
|
+
options: {
|
24
|
+
showDisplay: true,
|
25
|
+
},
|
26
|
+
});
|
27
|
+
if (ownedObjects.length === 0)
|
28
|
+
return [];
|
29
|
+
const nftObjects = [...ownedObjects.filter((o) => { var _a, _b; return (_b = (_a = o.data) === null || _a === void 0 ? void 0 : _a.display) === null || _b === void 0 ? void 0 : _b.data; })];
|
30
|
+
const obKioskObject = ownedObjects.find((o) => { var _a; return ((_a = o.data) === null || _a === void 0 ? void 0 : _a.type) === constants_2.obKioskStructType; });
|
31
|
+
if (obKioskObject) {
|
32
|
+
const kioskDynamicObjects = yield (0, getDynamicFields_1.getDynamicFields)(client, ((_a = obKioskObject === null || obKioskObject === void 0 ? void 0 : obKioskObject.data) === null || _a === void 0 ? void 0 : _a.content).fields.kiosk, true);
|
33
|
+
const ownerKioskObjects = yield (0, multiGetObjects_1.multiGetObjects)(client, kioskDynamicObjects.map((o) => o.objectId));
|
34
|
+
nftObjects.push(...ownerKioskObjects);
|
35
|
+
}
|
36
|
+
// TODO add Kiosk objects
|
24
37
|
const assets = [];
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
});
|
40
|
-
cursor = obKioskObjects.nextCursor;
|
41
|
-
for (const obKioskObject of obKioskObjects.data) {
|
42
|
-
if (!obKioskObject.data || !obKioskObject.data.content)
|
43
|
-
continue;
|
44
|
-
const contentObject = obKioskObject.data.content;
|
45
|
-
if (!contentObject.fields.kiosk)
|
46
|
-
continue;
|
47
|
-
const dynamicFields = yield client.getDynamicFields({
|
48
|
-
parentId: contentObject.fields.kiosk,
|
49
|
-
});
|
50
|
-
if (dynamicFields.data.length === 0)
|
51
|
-
continue;
|
52
|
-
const dynamicObjects = dynamicFields.data.filter((field) => field.type === 'DynamicObject');
|
53
|
-
if (dynamicObjects.length !== 1 ||
|
54
|
-
dynamicObjects[0].name.type !== constants_2.kioskItemType)
|
55
|
-
continue;
|
56
|
-
kioskItemsAddresses.add(dynamicObjects[0].objectId);
|
38
|
+
nftObjects.forEach((object) => {
|
39
|
+
var _a, _b, _c;
|
40
|
+
if (!object.data)
|
41
|
+
return;
|
42
|
+
if (object.data.type === obKioskObject)
|
43
|
+
return;
|
44
|
+
const display = (_a = object.data.display) === null || _a === void 0 ? void 0 : _a.data;
|
45
|
+
const content = object.data.content;
|
46
|
+
let attributes;
|
47
|
+
if ((_b = content.fields.attributes) === null || _b === void 0 ? void 0 : _b.fields.map.fields.contents) {
|
48
|
+
attributes = (_c = content.fields.attributes) === null || _c === void 0 ? void 0 : _c.fields.map.fields.contents.map((c) => ({
|
49
|
+
trait_type: c.fields.key,
|
50
|
+
value: c.fields.value,
|
51
|
+
}));
|
57
52
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
showType: true,
|
72
|
-
showDisplay: true,
|
73
|
-
showOwner: true,
|
53
|
+
assets.push({
|
54
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
55
|
+
type: portfolio_core_1.PortfolioAssetType.collectible,
|
56
|
+
value: null,
|
57
|
+
attributes: {},
|
58
|
+
data: {
|
59
|
+
address: object.data.type,
|
60
|
+
amount: Number(content.fields.amount || 1),
|
61
|
+
price: null,
|
62
|
+
description: (display === null || display === void 0 ? void 0 : display.description) || content.fields.description,
|
63
|
+
imageUri: (display === null || display === void 0 ? void 0 : display.image_url) || content.fields.url,
|
64
|
+
name: (display === null || display === void 0 ? void 0 : display.name) || content.fields.name || content.fields.tick,
|
65
|
+
attributes,
|
74
66
|
},
|
75
|
-
cursor,
|
76
67
|
});
|
77
|
-
|
78
|
-
const ownedObjects = nftKioskObjects.length > 0
|
79
|
-
? [...ownedNFTsObjects.data, ...nftKioskObjects]
|
80
|
-
: ownedNFTsObjects.data;
|
81
|
-
for (const ownedObject of ownedObjects) {
|
82
|
-
if (!ownedObject.data || !ownedObject.data.content)
|
83
|
-
continue;
|
84
|
-
const type = (0, sui_js_1.getObjectType)(ownedObject);
|
85
|
-
if (!type)
|
86
|
-
continue;
|
87
|
-
const object = ownedObject.data.content;
|
88
|
-
const display = (0, sui_js_1.getObjectDisplay)(ownedObject);
|
89
|
-
const displayData = display.data;
|
90
|
-
const metadatas = (0, sui_js_1.getObjectFields)(object);
|
91
|
-
if (displayData === null && metadatas === null)
|
92
|
-
continue;
|
93
|
-
const objectId = (0, sui_js_1.getObjectId)(ownedObject);
|
94
|
-
const { collectionName, collectionId } = (0, getFormattedCollectionNameAndId_1.default)(type);
|
95
|
-
let imageUri;
|
96
|
-
let name;
|
97
|
-
if (displayData && displayData.image_url) {
|
98
|
-
imageUri = displayData.image_url;
|
99
|
-
name = displayData.name;
|
100
|
-
}
|
101
|
-
else if (metadatas && (metadatas.image_url || metadatas.url)) {
|
102
|
-
imageUri = metadatas.image_url || metadatas.url;
|
103
|
-
name = metadatas.name;
|
104
|
-
}
|
105
|
-
else
|
106
|
-
continue;
|
107
|
-
assets.push({
|
108
|
-
networkId: portfolio_core_1.NetworkId.sui,
|
109
|
-
type: portfolio_core_1.PortfolioAssetType.collectible,
|
110
|
-
value: null,
|
111
|
-
attributes: {},
|
112
|
-
data: {
|
113
|
-
address: objectId,
|
114
|
-
amount: 1,
|
115
|
-
price: null,
|
116
|
-
imageUri,
|
117
|
-
name,
|
118
|
-
collection: {
|
119
|
-
floorPrice: null,
|
120
|
-
id: collectionId || '',
|
121
|
-
name: collectionName || '',
|
122
|
-
},
|
123
|
-
},
|
124
|
-
});
|
125
|
-
continue;
|
126
|
-
}
|
127
|
-
nftKioskObjects = [];
|
128
|
-
} while (ownedNFTsObjects.hasNextPage);
|
68
|
+
});
|
129
69
|
if (assets.length === 0)
|
130
70
|
return [];
|
131
71
|
const element = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sui-nfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/sui-nfts.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"sui-nfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/sui-nfts.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAOoC;AAEpC,oDAAsD;AACtD,4CAAkD;AAClD,4DAAiE;AACjE,wEAAqE;AAIrE,0EAAuE;AACvE,wEAAqE;AAErE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,EAAE;;IACxD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,KAAK,EAAE;QACxD,OAAO,EAAE;YACP,WAAW,EAAE,IAAI;SAClB;KACF,CAAC,CAAC;IACH,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,MAAM,UAAU,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,OAAO,0CAAE,IAAI,CAAA,EAAA,CAAC,CAAC,CAAC;IAE1E,MAAM,aAAa,GAAG,YAAY,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,IAAI,MAAK,6BAAiB,CAAA,EAAA,CAC1C,CAAC;IACF,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,mBAAmB,GAAG,MAAM,IAAA,mCAAgB,EAChD,MAAM,EACN,CAAC,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,0CAAE,OAAmC,CAAA,CAAC,MAAM,CA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;
|
39
|
-
fields: {
|
40
|
-
map: {
|
41
|
-
type: string;
|
42
|
-
fields: {
|
43
|
-
contents: Attribute[];
|
44
|
-
};
|
45
|
-
};
|
46
|
-
};
|
47
|
-
};
|
48
|
-
id: {
|
49
|
-
id: string;
|
50
|
-
};
|
51
|
-
name: string;
|
52
|
-
description?: string;
|
53
|
-
url?: string;
|
54
|
-
image_url?: string;
|
55
|
-
index?: string;
|
56
|
-
};
|
57
|
-
export type Attribute = {
|
58
|
-
[key: number]: {
|
59
|
-
type: string;
|
60
|
-
fields: {
|
61
|
-
key: string;
|
62
|
-
value: string;
|
63
|
-
};
|
64
|
-
};
|
65
|
-
};
|
66
|
-
export type DisplayInfo = {
|
67
|
-
description: string;
|
68
|
-
image_url: string;
|
69
|
-
link: string;
|
70
|
-
name: string;
|
71
|
-
};
|
72
|
-
export type KioskContent = {
|
73
|
-
dataType: string;
|
74
|
-
type: string;
|
75
|
-
hasPublicTransfer: boolean;
|
76
|
-
fields: {
|
77
|
-
id: {
|
78
|
-
id: string;
|
79
|
-
};
|
80
|
-
kiosk: string;
|
81
|
-
owner: string;
|
82
|
-
};
|
83
|
-
};
|
@@ -13,17 +13,18 @@ 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 sui_js_1 = require("@mysten/sui.js");
|
17
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const constants_1 = require("./constants");
|
19
18
|
const clients_1 = require("../../utils/clients");
|
20
19
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
21
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
21
|
const helper_1 = require("./helper");
|
22
|
+
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
23
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
23
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
var _a, _b;
|
24
26
|
const client = (0, clients_1.getClientSui)();
|
25
|
-
const nftsPositionsRes = yield
|
26
|
-
owner,
|
27
|
+
const nftsPositionsRes = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
27
28
|
options: {
|
28
29
|
showType: true,
|
29
30
|
showContent: true,
|
@@ -32,18 +33,20 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
32
33
|
},
|
33
34
|
filter: { Package: constants_1.packageIdOriginal },
|
34
35
|
});
|
35
|
-
if (
|
36
|
+
if (nftsPositionsRes.length === 0)
|
36
37
|
return [];
|
37
38
|
const clmmPoolsIds = [];
|
38
39
|
const clmmPositionsIds = [];
|
39
40
|
const nftPositionByPositionId = new Map();
|
40
|
-
for (let i = 0; i < nftsPositionsRes.
|
41
|
-
const nftData = nftsPositionsRes
|
41
|
+
for (let i = 0; i < nftsPositionsRes.length; i++) {
|
42
|
+
const nftData = nftsPositionsRes[i].data;
|
42
43
|
if (!nftData)
|
43
44
|
continue;
|
44
45
|
if (nftData.type !== constants_1.clmmNftType)
|
45
46
|
continue;
|
46
|
-
|
47
|
+
if (!nftData.content)
|
48
|
+
continue;
|
49
|
+
const nftPositionFields = nftData.content.fields;
|
47
50
|
clmmPoolsIds.push(nftPositionFields.pool_id);
|
48
51
|
clmmPositionsIds.push(nftPositionFields.position_id);
|
49
52
|
nftPositionByPositionId.set(nftPositionFields.position_id, nftPositionFields);
|
@@ -60,19 +63,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
60
63
|
poolsById.set(pool.objectId, pool);
|
61
64
|
}
|
62
65
|
});
|
63
|
-
const clmmPositionsRes = yield
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
showDisplay: true,
|
69
|
-
showOwner: true,
|
70
|
-
},
|
66
|
+
const clmmPositionsRes = yield (0, multiGetObjects_1.multiGetObjects)(client, clmmPositionsIds, {
|
67
|
+
showType: true,
|
68
|
+
showContent: true,
|
69
|
+
showDisplay: true,
|
70
|
+
showOwner: true,
|
71
71
|
});
|
72
72
|
const assets = [];
|
73
73
|
let totalLiquidityValue = 0;
|
74
74
|
for (let i = 0; i < clmmPositionsRes.length; i++) {
|
75
|
-
const clmmPosition = (
|
75
|
+
const clmmPosition = (_b = (_a = clmmPositionsRes[i].data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
|
76
|
+
if (!clmmPosition)
|
77
|
+
continue;
|
76
78
|
const nftPosition = nftPositionByPositionId.get(clmmPosition.id.id);
|
77
79
|
if (!nftPosition)
|
78
80
|
continue;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"clmmsPositionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/clmmsPositionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,
|
1
|
+
{"version":3,"file":"clmmsPositionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/clmmsPositionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AAEnD,wFAAyF;AACzF,qGAA6E;AAC7E,qCAAyD;AACzD,qEAAkE;AAClE,qEAAkE;AAElE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,gBAAgB,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,KAAK,EAAE;QAC5D,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;SAChB;QACD,MAAM,EA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IAC/B,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,CAAC,cAAc,CAAC;YACtB,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE;gBACJ,WAAW,EAAE,MAAM;aACpB;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,kBAAkB;IACnC,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { Bits, Pool, PoolFields, Types } from './types';
|
2
|
+
import { ObjectResponse } from '../../utils/sui/types';
|
3
3
|
export declare function parsePoolType(type: string, length: 2): [string, string];
|
4
4
|
export declare function parsePoolType(type: string, length: 3): Types;
|
5
5
|
export declare function parsePoolType(type: string): string[];
|
6
|
-
export declare function parsePool(pool:
|
6
|
+
export declare function parsePool(pool: ObjectResponse<PoolFields>): Pool;
|
7
7
|
export declare function formatForNative(coin: string): string;
|
8
8
|
export declare function bitsToNumber(bits: Bits): number;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.bitsToNumber = exports.formatForNative = exports.parsePool = exports.parsePoolType = void 0;
|
4
|
-
const sui_js_1 = require("@mysten/sui.js");
|
5
4
|
const helpers_1 = require("../cetus/helpers");
|
6
5
|
function parsePoolType(type, length) {
|
7
6
|
var _a;
|
@@ -13,9 +12,12 @@ function parsePoolType(type, length) {
|
|
13
12
|
}
|
14
13
|
exports.parsePoolType = parsePoolType;
|
15
14
|
function parsePool(pool) {
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
var _a, _b, _c, _d, _e;
|
16
|
+
if (!((_a = pool.data) === null || _a === void 0 ? void 0 : _a.content))
|
17
|
+
throw new Error('turbos parsePool error');
|
18
|
+
const fields = (_c = (_b = pool.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields;
|
19
|
+
const objectId = (_d = pool.data) === null || _d === void 0 ? void 0 : _d.objectId;
|
20
|
+
const type = (_e = pool.data) === null || _e === void 0 ? void 0 : _e.type;
|
19
21
|
return Object.assign(Object.assign({}, fields), { objectId,
|
20
22
|
type, types: parsePoolType(type, 3) });
|
21
23
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/helper.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/helper.ts"],"names":[],"mappings":";;;AACA,8CAA0C;AAM1C,SAAgB,aAAa,CAAC,IAAY,EAAE,MAAe;;IACzD,MAAM,KAAK,GAAG,CAAA,MAAA,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,MAAM,CAAC,KAAI,EAAE,CAAC;IAEvE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AARD,sCAQC;AACD,SAAgB,SAAS,CAAC,IAAgC;;IACxD,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAA;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC;IAC1C,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAC;IACrC,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,CAAC;IAC7B,uCACK,MAAM,KACT,QAAQ;QACR,IAAI,EACJ,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAC7B;AACJ,CAAC;AAXD,8BAWC;AAED,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI;QACT,8EAA8E;QAC9E,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AALD,0CAKC;AAED,SAAgB,YAAY,CAAC,IAAU;IACrC,OAAO,IAAA,gBAAM,EAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"}
|
@@ -12,31 +12,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const sui_js_1 = require("@mysten/sui.js");
|
16
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const constants_1 = require("./constants");
|
19
18
|
const clients_1 = require("../../utils/clients");
|
20
19
|
const helper_1 = require("./helper");
|
21
20
|
const tokenPricesFromSqrt_1 = __importDefault(require("../../utils/clmm/tokenPricesFromSqrt"));
|
22
|
-
const
|
23
|
-
const
|
21
|
+
const getDynamicFields_1 = require("../../utils/sui/getDynamicFields");
|
22
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
24
23
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
24
|
const client = (0, clients_1.getClientSui)();
|
26
|
-
const poolFactories = yield (0,
|
27
|
-
const poolFactoryIds = poolFactories.map(
|
25
|
+
const poolFactories = yield (0, getDynamicFields_1.getDynamicFields)(client, constants_1.poolTableId);
|
26
|
+
const poolFactoryIds = poolFactories.map((p) => p.objectId);
|
28
27
|
if (!poolFactoryIds.length)
|
29
28
|
return;
|
30
|
-
const poolFactoryInfos = yield (0,
|
29
|
+
const poolFactoryInfos = yield (0, multiGetObjects_1.multiGetObjects)(client, poolFactoryIds, {
|
30
|
+
showContent: true,
|
31
|
+
});
|
31
32
|
const poolIds = poolFactoryInfos.map((info) => {
|
32
|
-
|
33
|
+
var _a, _b;
|
34
|
+
const fields = (_b = (_a = info.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
|
33
35
|
return fields.value.fields.pool_id;
|
34
36
|
});
|
35
37
|
if (!poolIds.length)
|
36
38
|
return;
|
37
|
-
const pools = yield (0,
|
38
|
-
showContent: true,
|
39
|
-
});
|
39
|
+
const pools = yield (0, multiGetObjects_1.multiGetObjects)(client, poolIds);
|
40
40
|
const promises = [];
|
41
41
|
for (const pool of pools) {
|
42
42
|
const parsedPool = (0, helper_1.parsePool)(pool);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAAuE;AACvE,iDAAmD;AACnD,qCAAqC;AACrC,+FAA4E;AAC5E,uEAAoE;AACpE,qEAAkE;AAGlE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG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