@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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/marketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,
|
1
|
+
{"version":3,"file":"marketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/marketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,iDAAmD;AACnD,2CAOqB;AAarB,6EAAqD;AACrD,yDAAsD;AACtD,iFAA8E;AAE9E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,OAAO,CAAc,sBAAU,EAAE;QAC/D,MAAM,EAAE,yBAAa;QACrB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,WAAW;QAAE,OAAO;IAEzB,wBAAwB;IACxB,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,CAAQ,oBAAQ,EAAE;QACjD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,MAAM,QAAQ,GAAY,WAAW,CAAC,OAAO,CAAC,IAAa,CAAC,MAAM,CAAC;IAEnE,kBAAkB;IAClB,MAAM,YAAY,GAAG,MAAM,IAAA,qBAAS,EAAa,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,MAAA,MAAA,YAAY,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,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CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,IAAA,sBAAS,EAAC,CAAC,CAAC,CAAC;QACjB,IAAI,UAAU,GAAG,IAAA,sBAAS,EAAC,oBAAoB,CAAC;aAC7C,YAAY,CAAC,eAAe,CAAC;aAC7B,YAAY,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;QACnC,UAAU,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,sBAAS,EAAC,CAAC,CAAC,CAAC;QAE/D,MAAM,CAAC,KAAK,CAAC,GAAG;YACd,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,MAAA,MAAA,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,0CAAE,QAAQ,mCAAI,CAAC;YAC7C,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ;YAC/B,cAAc,EAAE,cAAc,CAAC,QAAQ,EAAE;YACzC,kBAAkB,EAAE,IAAI,CAAC,GAAG,CAC1B,oBAAoB,EACpB,uBAAuB,CACxB;YACD,kBAAkB,EAAE,UAAU,CAAC,QAAQ,EAAE;YACzC,IAAI;YACJ,IAAI;YACJ,gBAAgB;YAChB,OAAO;SACR,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,qBAAS,EAAE,MAAM,EAAE;QACrC,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;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -13,13 +13,16 @@ 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
|
16
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const constants_1 = require("./constants");
|
19
19
|
const helpers_1 = require("./helpers");
|
20
20
|
const clients_1 = require("../../utils/clients");
|
21
21
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
22
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
23
|
+
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
24
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
25
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
23
26
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
27
|
var _a, _b, _c, _d, _e, _f;
|
25
28
|
const client = (0, clients_1.getClientSui)();
|
@@ -42,7 +45,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
42
45
|
],
|
43
46
|
};
|
44
47
|
const [ownedObligationKeys, marketData] = yield Promise.all([
|
45
|
-
(0,
|
48
|
+
(0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
49
|
+
filter: filterOwnerObject,
|
50
|
+
}),
|
46
51
|
cache.getItem(constants_1.marketKey, {
|
47
52
|
prefix: constants_1.marketPrefix,
|
48
53
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -52,7 +57,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
57
|
return [];
|
53
58
|
const userObligations = {};
|
54
59
|
const debtsAndCollateralCalculationPromises = ownedObligationKeys.map((obligationKey) => () => __awaiter(void 0, void 0, void 0, function* () {
|
55
|
-
|
60
|
+
var _g, _h, _j, _k;
|
61
|
+
const obligationKeyFields = (_h = (_g = obligationKey.data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields;
|
56
62
|
if (!obligationKeyFields)
|
57
63
|
return;
|
58
64
|
const obligationId = obligationKeyFields.ownership.fields.of;
|
@@ -62,12 +68,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
62
68
|
debts: {},
|
63
69
|
};
|
64
70
|
}
|
65
|
-
const
|
66
|
-
|
67
|
-
options: {
|
68
|
-
showContent: true,
|
69
|
-
},
|
70
|
-
}));
|
71
|
+
const getObjectRes = yield (0, getObject_1.getObject)(client, obligationId);
|
72
|
+
const account = (_k = (_j = getObjectRes.data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields;
|
71
73
|
if (!account)
|
72
74
|
return;
|
73
75
|
const accountCollateralsId = account.collaterals.fields.table.fields.id.id;
|
@@ -76,12 +78,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
76
78
|
const accountDebtsAssets = account.debts.fields.keys.fields.contents;
|
77
79
|
// get user collateral
|
78
80
|
const accountCollateralsAssetsPromises = accountCollateralsAssets.map(({ fields }) => () => __awaiter(void 0, void 0, void 0, function* () {
|
79
|
-
var
|
81
|
+
var _l, _m, _o;
|
80
82
|
if (!userObligations[obligationId].collaterals[fields.name]) {
|
81
83
|
userObligations[obligationId].collaterals[fields.name] =
|
82
84
|
(0, bignumber_js_1.default)(0);
|
83
85
|
}
|
84
|
-
const
|
86
|
+
const rAsset = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
85
87
|
parentId: accountCollateralsId,
|
86
88
|
name: {
|
87
89
|
type: '0x1::type_name::TypeName',
|
@@ -89,17 +91,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
89
91
|
name: fields.name,
|
90
92
|
},
|
91
93
|
},
|
92
|
-
})
|
94
|
+
});
|
95
|
+
const asset = (_m = (_l = rAsset.data) === null || _l === void 0 ? void 0 : _l.content) === null || _m === void 0 ? void 0 : _m.fields;
|
93
96
|
if (!asset)
|
94
97
|
return;
|
95
98
|
userObligations[obligationId].collaterals[fields.name] =
|
96
|
-
userObligations[obligationId].collaterals[fields.name].plus((0, bignumber_js_1.default)((
|
99
|
+
userObligations[obligationId].collaterals[fields.name].plus((0, bignumber_js_1.default)((_o = asset.value.fields.amount) !== null && _o !== void 0 ? _o : 0));
|
97
100
|
}));
|
98
101
|
// get user debt
|
99
102
|
const accountDebtsAssetsPromises = accountDebtsAssets.map(({ fields }) => () => __awaiter(void 0, void 0, void 0, function* () {
|
100
|
-
var
|
101
|
-
const coinName = (
|
102
|
-
.find((value) => value.coinType === (0,
|
103
|
+
var _p, _q, _r, _s, _t;
|
104
|
+
const coinName = (_q = (_p = ctmValues
|
105
|
+
.find((value) => value.coinType === (0, utils_1.normalizeStructTag)(fields.name))) === null || _p === void 0 ? void 0 : _p.metadata) === null || _q === void 0 ? void 0 : _q.symbol.toLowerCase();
|
103
106
|
if (!coinName)
|
104
107
|
return;
|
105
108
|
const market = marketData[coinName];
|
@@ -108,7 +111,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
108
111
|
if (!userObligations[obligationId].debts[fields.name]) {
|
109
112
|
userObligations[obligationId].debts[fields.name] = (0, bignumber_js_1.default)(0);
|
110
113
|
}
|
111
|
-
const
|
114
|
+
const rAsset = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
112
115
|
parentId: accountDebtsId,
|
113
116
|
name: {
|
114
117
|
type: '0x1::type_name::TypeName',
|
@@ -116,10 +119,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
116
119
|
name: fields.name,
|
117
120
|
},
|
118
121
|
},
|
119
|
-
})
|
122
|
+
});
|
123
|
+
const asset = (_s = (_r = rAsset.data) === null || _r === void 0 ? void 0 : _r.content) === null || _s === void 0 ? void 0 : _s.fields;
|
120
124
|
if (!asset)
|
121
125
|
return;
|
122
|
-
userObligations[obligationId].debts[fields.name] = userObligations[obligationId].debts[fields.name].plus((0, bignumber_js_1.default)((
|
126
|
+
userObligations[obligationId].debts[fields.name] = userObligations[obligationId].debts[fields.name].plus((0, bignumber_js_1.default)((_t = asset.value.fields.amount) !== null && _t !== void 0 ? _t : 0).multipliedBy(market.growthInterest + 1));
|
123
127
|
}));
|
124
128
|
yield Promise.all([
|
125
129
|
(0, runInBatch_1.default)(accountCollateralsAssetsPromises, 5),
|
@@ -142,14 +146,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
142
146
|
const suppliedYields = [];
|
143
147
|
const { collaterals, debts } = userObligations[account];
|
144
148
|
for (const coinType of Object.keys(collaterals)) {
|
145
|
-
const metadata = ctmValues.find((value) => value.coinType === (0,
|
149
|
+
const metadata = ctmValues.find((value) => value.coinType === (0, utils_1.normalizeStructTag)(coinType));
|
146
150
|
const address = (0, portfolio_core_1.formatMoveTokenAddress)(`0x${coinType}`);
|
147
151
|
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(address, collaterals[coinType]
|
148
152
|
.shiftedBy(-1 * ((_b = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.metadata) === null || _a === void 0 ? void 0 : _a.decimals) !== null && _b !== void 0 ? _b : 0))
|
149
153
|
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrices.get(address)));
|
150
154
|
}
|
151
155
|
for (const coinType of Object.keys(debts)) {
|
152
|
-
const metadata = ctmValues.find((value) => value.coinType === (0,
|
156
|
+
const metadata = ctmValues.find((value) => value.coinType === (0, utils_1.normalizeStructTag)(coinType));
|
153
157
|
const coinName = (_d = (_c = metadata === null || metadata === void 0 ? void 0 : metadata.metadata) === null || _c === void 0 ? void 0 : _c.symbol.toLowerCase()) !== null && _d !== void 0 ? _d : '';
|
154
158
|
const market = marketData[coinName];
|
155
159
|
if (!market)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,
|
1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gDAA0D;AAC1D,gEAAqC;AAIrC,2CAOqB;AAQrB,uCAA2C;AAC3C,iDAAmD;AACnD,qGAA6E;AAC7E,6EAAqD;AAErD,qEAAkE;AAClE,yDAAsD;AACtD,iFAA8E;AAE9E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAQ,oBAAQ,EAAE;QAC5D,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,gBAAgB;QAAE,OAAO,EAAE,CAAC;IAEjC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAClD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEtC,MAAM,iBAAiB,GAAwB;QAC7C,QAAQ,EAAE;YACR;gBACE,UAAU,EAAE,kCAAsB;aACnC;SACF;KACF,CAAC;IAEF,MAAM,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC1D,IAAA,iCAAe,EAAsB,MAAM,EAAE,KAAK,EAAE;YAClD,MAAM,EAAE,iBAAiB;SAC1B,CAAC;QACF,KAAK,CAAC,OAAO,CAAkB,qBAAS,EAAE;YACxC,MAAM,EAAN,wBAAM;YACN,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC;KACH,CAAC,CAAC;IACH,IAAI,CAAC,UAA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AE,MAAM,CAAC,kBAAkB;oBAC9B,GAAG,EAAE,IAAA,yBAAQ,EAAC,MAAM,CAAC,kBAAkB,CAAC;iBACzC;aACF,CAAC,CAAC;QACL,CAAC;QACD,IACE,cAAc,CAAC,MAAM,KAAK,CAAC;YAC3B,cAAc,CAAC,MAAM,KAAK,CAAC;YAC3B,YAAY,CAAC,MAAM,KAAK,CAAC;YAEzB,SAAS;QACX,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,GACxD,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QACxE,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,GAAG,IAAA,wBAAc,EAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,cAAc;YACpD,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -9,14 +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
|
-
const sui_js_1 = require("@mysten/sui.js");
|
13
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
14
14
|
const constants_1 = require("./constants");
|
15
15
|
const clients_1 = require("../../utils/clients");
|
16
|
-
const
|
16
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
17
|
+
const SUI_TYPE = (0, utils_1.normalizeStructTag)(utils_1.SUI_TYPE_ARG);
|
17
18
|
const client = (0, clients_1.getClientSui)();
|
18
19
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
-
var _a;
|
20
|
+
var _a, _b, _c;
|
20
21
|
const address = yield cache.getItem(constants_1.addressKey, {
|
21
22
|
prefix: constants_1.addressPrefix,
|
22
23
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -37,15 +38,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
38
|
};
|
38
39
|
}
|
39
40
|
else {
|
40
|
-
const object = yield
|
41
|
-
|
42
|
-
|
43
|
-
showType: true,
|
44
|
-
showContent: true,
|
45
|
-
},
|
46
|
-
});
|
47
|
-
const objType = (0, sui_js_1.normalizeStructTag)((_a = (0, sui_js_1.getObjectType)(object)) !== null && _a !== void 0 ? _a : '');
|
48
|
-
const objFields = (0, sui_js_1.getObjectFields)(object);
|
41
|
+
const object = yield (0, getObject_1.getObject)(client, detail.metaData);
|
42
|
+
const objType = (0, utils_1.normalizeStructTag)(((_a = object.data) === null || _a === void 0 ? void 0 : _a.type) || '');
|
43
|
+
const objFields = (_c = (_b = object.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields;
|
49
44
|
if (!objType || !objFields)
|
50
45
|
return;
|
51
46
|
coinTypes[coinName] = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plug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AAC;YACtE,MAAM,OAAO,GAAG,IAAA,0BAAkB,EAAC,CAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,IAAI,KAAI,EAAE,CAAC,CAAC;YAC5D,MAAM,SAAS,GAAG,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC;YAC/C,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS;gBAAE,OAAO;YACnC,SAAS,CAAC,QAAQ,CAAC,GAAG;gBACpB,QAAQ,EAAE,OAAO,CAAC,SAAS,CACzB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EACxB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CACrB;gBACD,QAAQ,EAAE,SAAS;aACpB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,SAAS,EAAE;QACvC,MAAM,EAAN,uBAAM;QACN,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,uBAAM;IACV,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -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,2CAMqB;AAErB,iDAAmD;AACnD,yDAA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BAAiB,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,CAAC,KAAK,EACtE,IAAI,CACL,CA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