@sonarwatch/portfolio-plugins 0.11.96 → 0.11.98
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1095 -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/jupiter/constants.d.ts +2 -0
- package/src/plugins/jupiter/constants.js +3 -1
- package/src/plugins/jupiter/constants.js.map +1 -1
- package/src/plugins/jupiter/filters.d.ts +1 -0
- package/src/plugins/jupiter/filters.js +11 -1
- package/src/plugins/jupiter/filters.js.map +1 -1
- package/src/plugins/jupiter/helpers.d.ts +1 -0
- package/src/plugins/jupiter/helpers.js +10 -1
- package/src/plugins/jupiter/helpers.js.map +1 -1
- package/src/plugins/jupiter/index.js +6 -1
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/jupiter/structs.d.ts +14 -0
- package/src/plugins/jupiter/structs.js +14 -1
- package/src/plugins/jupiter/structs.js.map +1 -1
- package/src/plugins/jupiter/voteFetcher.d.ts +3 -0
- package/src/plugins/jupiter/voteFetcher.js +56 -0
- package/src/plugins/jupiter/voteFetcher.js.map +1 -0
- 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
@@ -33,51 +33,3 @@ export type Token = {
|
|
33
33
|
index?: string;
|
34
34
|
};
|
35
35
|
};
|
36
|
-
export type SuiNFTMetadata = {
|
37
|
-
attributes?: {
|
38
|
-
type: string;
|
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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W,CAAC,KAAK,CAAC;QACpD,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;YAClC,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,EAAE;YAChB,iBAAiB,EAAE,CAAC;YACpB,KAAK;YACL,MAAM,EAAE,EAAE;SACX,CAAC,CAAC;QACH,mBAAmB,IAAI,KAAK,CAAC;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":["../../../../../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CAAC,MAAM,GAAG,CAAC;YAChB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;YACzB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EACzB,CAAC;YACD,QAAQ,CAAC,IAAI,CACX,IAAA,6BAAwB,EACtB,KAAK,EACL,0BAAS,CAAC,GAAG,EACb,UAAU,CAAC,EAAE,CAAC,EAAE,EAChB,IAAI,sBAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAChC,IAAI,sBAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAChC,IAAI,sBAAS,CAAC,UAAU,CAAC,UAAU,CAAC,EACpC,KAAK,CAAC,CAAC,CAAC,EACR,KAAK,CAAC,CAAC,CAAC,CACT,CACF,CAAC;YACF,QAAQ,CAAC,IAAI,CACX,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE;gBAC7C,MAAM,EAAE,2BAAe;gBACvB,SAAS,EAAE,0BAAS,CAAC,GAAG;aACzB,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -40,28 +40,28 @@ function getPairKey(version) {
|
|
40
40
|
exports.getPairKey = getPairKey;
|
41
41
|
function getPairsV2FromTheGraph(url, length = 300) {
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
43
|
-
const query = (0, graphql_request_1.gql) `
|
44
|
-
{
|
45
|
-
pairs(
|
46
|
-
orderBy: reserveUSD
|
47
|
-
first: ${length}
|
48
|
-
orderDirection: desc
|
49
|
-
where: { trackedReserveETH_not: "0" }
|
50
|
-
) {
|
51
|
-
id
|
52
|
-
reserve0
|
53
|
-
reserve1
|
54
|
-
totalSupply
|
55
|
-
token0 {
|
56
|
-
id
|
57
|
-
decimals
|
58
|
-
}
|
59
|
-
token1 {
|
60
|
-
id
|
61
|
-
decimals
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
43
|
+
const query = (0, graphql_request_1.gql) `
|
44
|
+
{
|
45
|
+
pairs(
|
46
|
+
orderBy: reserveUSD
|
47
|
+
first: ${length}
|
48
|
+
orderDirection: desc
|
49
|
+
where: { trackedReserveETH_not: "0" }
|
50
|
+
) {
|
51
|
+
id
|
52
|
+
reserve0
|
53
|
+
reserve1
|
54
|
+
totalSupply
|
55
|
+
token0 {
|
56
|
+
id
|
57
|
+
decimals
|
58
|
+
}
|
59
|
+
token1 {
|
60
|
+
id
|
61
|
+
decimals
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
65
|
`;
|
66
66
|
const res = yield (0, graphql_request_1.default)(url, query);
|
67
67
|
const pairs = res.pairs;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export default function getClientSui():
|
1
|
+
import { SuiClient } from './types';
|
2
|
+
export default function getClientSui(): SuiClient;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const
|
3
|
+
const client_1 = require("@mysten/sui.js/client");
|
4
4
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
5
|
const getBasicAuthHeaders_1 = require("../misc/getBasicAuthHeaders");
|
6
6
|
const constants_1 = require("./constants");
|
@@ -9,8 +9,13 @@ function getClientSui() {
|
|
9
9
|
const httpHeaders = rpcEndpoint.basicAuth
|
10
10
|
? (0, getBasicAuthHeaders_1.getBasicAuthHeaders)(rpcEndpoint.basicAuth.username, rpcEndpoint.basicAuth.password)
|
11
11
|
: undefined;
|
12
|
-
return new
|
13
|
-
|
12
|
+
return new client_1.SuiClient({
|
13
|
+
transport: new client_1.SuiHTTPTransport({
|
14
|
+
url: rpcEndpoint.url,
|
15
|
+
rpc: {
|
16
|
+
headers: httpHeaders,
|
17
|
+
},
|
18
|
+
}),
|
14
19
|
});
|
15
20
|
}
|
16
21
|
exports.default = getClientSui;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getClientSui.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/clients/getClientSui.ts"],"names":[],"mappings":";;AAAA,
|
1
|
+
{"version":3,"file":"getClientSui.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/clients/getClientSui.ts"],"names":[],"mappings":";;AAAA,kDAG+B;AAC/B,+DAAuD;AACvD,qEAAkE;AAClE,2CAA6C;AAG7C,SAAwB,YAAY;IAClC,MAAM,WAAW,GAAG,IAAA,0BAAc,EAAC,0BAAS,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS;QACvC,CAAC,CAAC,IAAA,yCAAmB,EACjB,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAC/B;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,IAAI,kBAAe,CAAC;QACzB,SAAS,EAAE,IAAI,yBAAgB,CAAC;YAC9B,GAAG,EAAE,WAAW,CAAC,GAAG;YACpB,GAAG,EAAE;gBACH,OAAO,EAAE,WAAW;aACrB;SACF,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAjBD,+BAiBC"}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
|
4
|
-
exports.infoQueryMsg = JSON.parse(`{
|
5
|
-
"info": {}
|
4
|
+
exports.infoQueryMsg = JSON.parse(`{
|
5
|
+
"info": {}
|
6
6
|
}`);
|
7
|
-
exports.tokenInfoQueryMsg = JSON.parse(`{
|
8
|
-
"token_info": {}
|
7
|
+
exports.tokenInfoQueryMsg = JSON.parse(`{
|
8
|
+
"token_info": {}
|
9
9
|
}`);
|
10
|
-
exports.minterQueryMsg = JSON.parse(`{
|
11
|
-
"minter": {}
|
10
|
+
exports.minterQueryMsg = JSON.parse(`{
|
11
|
+
"minter": {}
|
12
12
|
}`);
|
13
|
-
exports.poolQueryMsg = JSON.parse(`{
|
14
|
-
"pool": {}
|
13
|
+
exports.poolQueryMsg = JSON.parse(`{
|
14
|
+
"pool": {}
|
15
15
|
}`);
|
16
16
|
//# sourceMappingURL=constants.js.map
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
function getQueryBalanceByOwner(owner) {
|
4
|
-
return JSON.parse(`{
|
5
|
-
"balance": {
|
6
|
-
"address": "${owner}"
|
7
|
-
}
|
4
|
+
return JSON.parse(`{
|
5
|
+
"balance": {
|
6
|
+
"address": "${owner}"
|
7
|
+
}
|
8
8
|
}`);
|
9
9
|
}
|
10
10
|
exports.default = getQueryBalanceByOwner;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { GetDynamicFieldObjectParams } from '@mysten/sui.js/client';
|
2
|
+
import { SuiClient } from '../clients/types';
|
3
|
+
import { ObjectResponse } from './types';
|
4
|
+
export declare function getDynamicFieldObject<K>(client: SuiClient, params: GetDynamicFieldObjectParams): Promise<ObjectResponse<K>>;
|
@@ -9,19 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
|
12
|
+
exports.getDynamicFieldObject = void 0;
|
13
|
+
function getDynamicFieldObject(client, params) {
|
13
14
|
return __awaiter(this, void 0, void 0, function* () {
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
options,
|
20
|
-
});
|
21
|
-
objects.push(...tempObjects);
|
22
|
-
}
|
23
|
-
return objects;
|
15
|
+
const res = yield client.getDynamicFieldObject({
|
16
|
+
parentId: params.parentId,
|
17
|
+
name: params.name,
|
18
|
+
});
|
19
|
+
return res;
|
24
20
|
});
|
25
21
|
}
|
26
|
-
exports.
|
27
|
-
//# sourceMappingURL=
|
22
|
+
exports.getDynamicFieldObject = getDynamicFieldObject;
|
23
|
+
//# sourceMappingURL=getDynamicFieldObject.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDynamicFieldObject.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getDynamicFieldObject.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,SAAsB,qBAAqB,CACzC,MAAiB,EACjB,MAAmC;;QAEnC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;YAC7C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAC;QACH,OAAO,GAAwB,CAAC;IAClC,CAAC;CAAA;AATD,sDASC"}
|
@@ -0,0 +1,38 @@
|
|
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.getDynamicFields = void 0;
|
13
|
+
const maxPage = 25;
|
14
|
+
function getDynamicFields(client, parentId, objectOnly) {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
let page = 0;
|
17
|
+
let hasNextPage = true;
|
18
|
+
let cursor;
|
19
|
+
const objects = [];
|
20
|
+
do {
|
21
|
+
const res = yield client.getDynamicFields({
|
22
|
+
parentId,
|
23
|
+
cursor,
|
24
|
+
});
|
25
|
+
res.data.forEach((o) => {
|
26
|
+
if (objectOnly && o.type !== 'DynamicObject')
|
27
|
+
return;
|
28
|
+
objects.push(o);
|
29
|
+
});
|
30
|
+
cursor = res.nextCursor;
|
31
|
+
hasNextPage = res.hasNextPage;
|
32
|
+
page += 1;
|
33
|
+
} while (hasNextPage && page <= maxPage);
|
34
|
+
return objects;
|
35
|
+
});
|
36
|
+
}
|
37
|
+
exports.getDynamicFields = getDynamicFields;
|
38
|
+
//# sourceMappingURL=getDynamicFields.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDynamicFields.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getDynamicFields.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,SAAsB,gBAAgB,CACpC,MAAiB,EACjB,QAAgB,EAChB,UAAoB;;QAEpB,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,WAAW,GAAG,IAAI,CAAC;QACvB,IAAI,MAAiC,CAAC;QAEtC,MAAM,OAAO,GAAuB,EAAE,CAAC;QACvC,GAAG,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;gBACxC,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACrB,IAAI,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,eAAe;oBAAE,OAAO;gBACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC;YACxB,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;YAC9B,IAAI,IAAI,CAAC,CAAC;QACZ,CAAC,QAAQ,WAAW,IAAI,IAAI,IAAI,OAAO,EAAE;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAxBD,4CAwBC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { SuiObjectDataOptions } from '@mysten/sui.js/client';
|
2
|
+
import { SuiClient } from '../clients/types';
|
3
|
+
import { ObjectResponse } from './types';
|
4
|
+
export declare function getObject<K>(client: SuiClient, id: string, options?: SuiObjectDataOptions): Promise<ObjectResponse<K>>;
|
@@ -9,22 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
|
12
|
+
exports.getObject = void 0;
|
13
|
+
function getObject(client, id, options) {
|
13
14
|
return __awaiter(this, void 0, void 0, function* () {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
resp = yield client.getDynamicFields({
|
19
|
-
parentId,
|
20
|
-
cursor,
|
21
|
-
});
|
22
|
-
cursor = resp.nextCursor;
|
23
|
-
if (resp.data.length > 0)
|
24
|
-
dynamicFields.push(...resp.data);
|
25
|
-
} while (resp.hasNextPage);
|
26
|
-
return dynamicFields;
|
15
|
+
return (yield client.getObject({
|
16
|
+
id,
|
17
|
+
options: Object.assign(Object.assign({}, options), { showType: true, showContent: true }),
|
18
|
+
}));
|
27
19
|
});
|
28
20
|
}
|
29
|
-
exports.
|
30
|
-
//# sourceMappingURL=
|
21
|
+
exports.getObject = getObject;
|
22
|
+
//# sourceMappingURL=getObject.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getObject.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getObject.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,SAAsB,SAAS,CAC7B,MAAiB,EACjB,EAAU,EACV,OAA8B;;QAE9B,OAAO,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC;YAC7B,EAAE;YACF,OAAO,kCACF,OAAO,KACV,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,IAAI,GAClB;SACF,CAAC,CAAsB,CAAC;IAC3B,CAAC;CAAA;AAbD,8BAaC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getObjectDeletedResponse = void 0;
|
4
|
+
function getObjectDeletedResponse(resp) {
|
5
|
+
if (resp.error &&
|
6
|
+
'object_id' in resp.error &&
|
7
|
+
'version' in resp.error &&
|
8
|
+
'digest' in resp.error) {
|
9
|
+
const { error } = resp;
|
10
|
+
return {
|
11
|
+
objectId: error.object_id,
|
12
|
+
version: error.version,
|
13
|
+
digest: error.digest,
|
14
|
+
};
|
15
|
+
}
|
16
|
+
return undefined;
|
17
|
+
}
|
18
|
+
exports.getObjectDeletedResponse = getObjectDeletedResponse;
|
19
|
+
//# sourceMappingURL=getObjectDeletedResponse.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getObjectDeletedResponse.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getObjectDeletedResponse.ts"],"names":[],"mappings":";;;AAGA,SAAgB,wBAAwB,CACtC,IAAuB;IAEvB,IACE,IAAI,CAAC,KAAK;QACV,WAAW,IAAI,IAAI,CAAC,KAAK;QACzB,SAAS,IAAI,IAAI,CAAC,KAAK;QACvB,QAAQ,IAAI,IAAI,CAAC,KAAK,EACtB,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACvB,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,SAAS;YACzB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM;SACL,CAAC;IACpB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAlBD,4DAkBC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getObjectNotExistsResponse = void 0;
|
4
|
+
function getObjectNotExistsResponse(resp) {
|
5
|
+
if (resp.error &&
|
6
|
+
'object_id' in resp.error &&
|
7
|
+
!('version' in resp.error) &&
|
8
|
+
!('digest' in resp.error)) {
|
9
|
+
return resp.error.object_id;
|
10
|
+
}
|
11
|
+
return undefined;
|
12
|
+
}
|
13
|
+
exports.getObjectNotExistsResponse = getObjectNotExistsResponse;
|
14
|
+
//# sourceMappingURL=getObjectNotExistsResponse.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getObjectNotExistsResponse.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getObjectNotExistsResponse.ts"],"names":[],"mappings":";;;AAEA,SAAgB,0BAA0B,CACxC,IAAuB;IAEvB,IACE,IAAI,CAAC,KAAK;QACV,WAAW,IAAI,IAAI,CAAC,KAAK;QACzB,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC;QAC1B,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,EACzB,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAbD,gEAaC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { SuiObjectResponseQuery } from '@mysten/sui.js/client';
|
2
|
+
import { SuiClient } from '../clients/types';
|
3
|
+
import { ObjectResponse } from './types';
|
4
|
+
export declare function getOwnedObjects<K>(client: SuiClient, owner: string, query?: SuiObjectResponseQuery): Promise<ObjectResponse<K>[]>;
|
@@ -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
|
+
exports.getOwnedObjects = void 0;
|
13
|
+
const maxPage = 25;
|
14
|
+
function getOwnedObjects(client, owner, query) {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
let page = 0;
|
17
|
+
let hasNextPage = true;
|
18
|
+
let cursor;
|
19
|
+
const objects = [];
|
20
|
+
do {
|
21
|
+
const res = yield client.getOwnedObjects({
|
22
|
+
owner,
|
23
|
+
options: Object.assign(Object.assign({}, query === null || query === void 0 ? void 0 : query.options), { showType: true, showContent: true }),
|
24
|
+
filter: query === null || query === void 0 ? void 0 : query.filter,
|
25
|
+
cursor,
|
26
|
+
});
|
27
|
+
objects.push(...res.data);
|
28
|
+
cursor = res.nextCursor;
|
29
|
+
hasNextPage = res.hasNextPage;
|
30
|
+
page += 1;
|
31
|
+
} while (hasNextPage && page <= maxPage);
|
32
|
+
return objects;
|
33
|
+
});
|
34
|
+
}
|
35
|
+
exports.getOwnedObjects = getOwnedObjects;
|
36
|
+
//# sourceMappingURL=getOwnedObjects.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getOwnedObjects.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getOwnedObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,SAAsB,eAAe,CACnC,MAAiB,EACjB,KAAa,EACb,KAA8B;;QAE9B,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,WAAW,GAAG,IAAI,CAAC;QACvB,IAAI,MAAiC,CAAC;QAEtC,MAAM,OAAO,GAAwB,EAAE,CAAC;QAExC,GAAG,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC;gBACvC,KAAK;gBACL,OAAO,kCACF,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,KACjB,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,IAAI,GAClB;gBACD,MAAM,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM;gBACrB,MAAM;aACP,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAI,GAAG,CAAC,IAA4B,CAAC,CAAC;YACnD,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC;YACxB,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;YAC9B,IAAI,IAAI,CAAC,CAAC;QACZ,CAAC,QAAQ,WAAW,IAAI,IAAI,IAAI,OAAO,EAAE;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AA5BD,0CA4BC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { SuiObjectDataOptions } from '@mysten/sui.js/client';
|
2
|
+
import { SuiClient } from '../clients/types';
|
3
|
+
import { ObjectResponse } from './types';
|
4
|
+
export declare function multiGetObjects<K>(client: SuiClient, ids: string[], options?: SuiObjectDataOptions): Promise<ObjectResponse<K>[]>;
|