@sonarwatch/portfolio-plugins 0.11.132 → 0.11.134

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.134](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.133...plugins-0.11.134) (2024-03-20)
6
+
7
+
8
+
9
+ ## [0.11.133](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.132...plugins-0.11.133) (2024-03-19)
10
+
11
+
12
+
5
13
  ## [0.11.132](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.131...plugins-0.11.132) (2024-03-19)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.132",
3
+ "version": "0.11.134",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.132"
44
+ "@sonarwatch/portfolio-core": "0.11.134"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -14,3 +14,5 @@ export declare const marketCoinPackageId = "0xefe8b36d5b2e43728cc323298626b83177
14
14
  export declare const obligationKeyPackageId = "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::obligation::ObligationKey";
15
15
  export declare const scallopPlatform: Platform;
16
16
  export declare const baseIndexRate = 1000000000;
17
+ export declare const scaAddress = "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
18
+ export declare const scaDecimals = 9;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseIndexRate = exports.scallopPlatform = exports.obligationKeyPackageId = exports.marketCoinPackageId = exports.spoolAccountPackageId = exports.spoolsKey = exports.poolsKey = exports.marketKey = exports.addressKey = exports.addressEndpoint = exports.spoolsPrefix = exports.poolsPrefix = exports.marketPrefix = exports.addressPrefix = exports.platformId = void 0;
3
+ exports.scaDecimals = exports.scaAddress = exports.baseIndexRate = exports.scallopPlatform = exports.obligationKeyPackageId = exports.marketCoinPackageId = exports.spoolAccountPackageId = exports.spoolsKey = exports.poolsKey = exports.marketKey = exports.addressKey = exports.addressEndpoint = exports.spoolsPrefix = exports.poolsPrefix = exports.marketPrefix = exports.addressPrefix = exports.platformId = void 0;
4
4
  const PROTOCOL_OBJECT_ID = '0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf';
5
5
  exports.platformId = 'scallop';
6
6
  exports.addressPrefix = `${exports.platformId}-address`;
@@ -23,4 +23,6 @@ exports.scallopPlatform = {
23
23
  website: 'https://app.scallop.io/',
24
24
  };
25
25
  exports.baseIndexRate = 1000000000;
26
+ exports.scaAddress = '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA';
27
+ exports.scaDecimals = 9;
26
28
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/constants.ts"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GACtB,oEAAoE,CAAC;AAC1D,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,YAAY,GAAG,GAAG,kBAAU,eAAe,CAAC;AAE5C,QAAA,eAAe,GAC1B,+DAA+D,CAAC;AACrD,QAAA,UAAU,GAAG,qBAAqB,CAAC;AACnC,QAAA,SAAS,GAAG,oBAAoB,CAAC;AACj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,SAAS;IACf,KAAK,EAAE,qCAAqC,kBAAU,MAAM;IAC5D,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,yBAAyB;CACnC,CAAC;AAEW,QAAA,aAAa,GAAG,UAAa,CAAC;AAC9B,QAAA,UAAU,GACrB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC"}
@@ -9,9 +9,14 @@ const addressJob_1 = __importDefault(require("./addressJob"));
9
9
  const marketJob_1 = __importDefault(require("./marketJob"));
10
10
  const spoolsMarketJob_1 = __importDefault(require("./spoolsMarketJob"));
11
11
  const lendingsFetcher_1 = __importDefault(require("./lendingsFetcher"));
12
+ const veScaFetcher_1 = __importDefault(require("./veScaFetcher"));
12
13
  const obligationsFetcher_1 = __importDefault(require("./obligationsFetcher"));
13
14
  const constants_1 = require("./constants");
14
15
  exports.jobs = [addressJob_1.default, poolsJob_1.default, marketJob_1.default, spoolsMarketJob_1.default];
15
- exports.fetchers = [lendingsFetcher_1.default, obligationsFetcher_1.default];
16
+ exports.fetchers = [
17
+ lendingsFetcher_1.default,
18
+ obligationsFetcher_1.default,
19
+ veScaFetcher_1.default,
20
+ ];
16
21
  exports.platforms = [constants_1.scallopPlatform];
17
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/index.ts"],"names":[],"mappings":";;;;;;AAGA,0DAAkC;AAClC,8DAAsC;AACtC,4DAAoC;AACpC,wEAAgD;AAEhD,wEAA+C;AAC/C,8EAAsD;AACtD,2CAA8C;AAEjC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,kBAAQ,EAAE,mBAAS,EAAE,yBAAe,CAAC,CAAC;AACjE,QAAA,QAAQ,GAAc,CAAC,yBAAc,EAAE,4BAAkB,CAAC,CAAC;AAC3D,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/index.ts"],"names":[],"mappings":";;;;;;AAGA,0DAAkC;AAClC,8DAAsC;AACtC,4DAAoC;AACpC,wEAAgD;AAEhD,wEAAgD;AAChD,kEAA0C;AAC1C,8EAAsD;AACtD,2CAA8C;AAEjC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,kBAAQ,EAAE,mBAAS,EAAE,yBAAe,CAAC,CAAC;AACjE,QAAA,QAAQ,GAAc;IACjC,yBAAe;IACf,4BAAkB;IAClB,sBAAY;CACb,CAAC;AACW,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type VeSca = {
2
+ id: {
3
+ id: string;
4
+ };
5
+ name: string;
6
+ value: {
7
+ type: string;
8
+ fields: {
9
+ locked_sca_amount: string;
10
+ unlock_at: string;
11
+ };
12
+ };
13
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=vesca.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vesca.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/vesca.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const constants_1 = require("./constants");
18
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
19
+ const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
20
+ const clients_1 = require("../../utils/clients");
21
+ const multiDynamicFieldObjects_1 = require("../../utils/sui/multiDynamicFieldObjects");
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24
+ const client = (0, clients_1.getClientSui)();
25
+ const veScaKeys = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
26
+ filter: {
27
+ StructType: '0xcfe2d87aa5712b67cad2732edb6a2201bfdf592377e5c0968b7cb02099bd8e21::ve_sca::VeScaKey',
28
+ },
29
+ });
30
+ if (veScaKeys.length === 0)
31
+ return [];
32
+ const objectIds = veScaKeys
33
+ .map((r) => { var _a; return (_a = r.data) === null || _a === void 0 ? void 0 : _a.objectId; })
34
+ .filter((i) => i !== undefined);
35
+ const veScaObjects = yield (0, multiDynamicFieldObjects_1.multiDynamicFieldObjects)(client, {
36
+ parentId: '0x0a0b7f749baeb61e3dfee2b42245e32d0e6b484063f0a536b33e771d573d7246',
37
+ type: '0x2::object::ID',
38
+ values: objectIds,
39
+ });
40
+ if (veScaObjects.length === 0)
41
+ return [];
42
+ const scaTokenPrice = yield cache.getTokenPrice(constants_1.scaAddress, portfolio_core_1.NetworkId.sui);
43
+ const assets = [];
44
+ for (let i = 0; i < veScaObjects.length; i++) {
45
+ const veScaObject = veScaObjects[i];
46
+ const scaAmountRaw = (_e = (_d = (_c = (_b = (_a = veScaObject.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.fields) === null || _e === void 0 ? void 0 : _e.locked_sca_amount;
47
+ if (!scaAmountRaw || scaAmountRaw === '0')
48
+ continue;
49
+ const lockedUntil = Number(((_k = (_j = (_h = (_g = (_f = veScaObject.data) === null || _f === void 0 ? void 0 : _f.content) === null || _g === void 0 ? void 0 : _g.fields) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.fields) === null || _k === void 0 ? void 0 : _k.unlock_at) || 0) *
50
+ 1000 || undefined;
51
+ assets.push((0, tokenPriceToAssetToken_1.default)(constants_1.scaAddress, new bignumber_js_1.default(scaAmountRaw).div(Math.pow(10, constants_1.scaDecimals)).toNumber(), portfolio_core_1.NetworkId.sui, scaTokenPrice, undefined, {
52
+ lockedUntil,
53
+ }));
54
+ }
55
+ if (assets.length === 0)
56
+ return [];
57
+ return [
58
+ {
59
+ type: portfolio_core_1.PortfolioElementType.multiple,
60
+ networkId: portfolio_core_1.NetworkId.sui,
61
+ label: 'Staked',
62
+ platformId: constants_1.platformId,
63
+ data: {
64
+ assets,
65
+ },
66
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
67
+ name: 'veSca',
68
+ },
69
+ ];
70
+ });
71
+ const fetcher = {
72
+ id: `${constants_1.platformId}-vesca`,
73
+ networkId: portfolio_core_1.NetworkId.sui,
74
+ executor,
75
+ };
76
+ exports.default = fetcher;
77
+ //# sourceMappingURL=veScaFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"veScaFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/veScaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AAGrC,2CAAkE;AAClE,qGAA6E;AAC7E,qEAAkE;AAClE,iDAAmD;AACnD,uFAAoF;AAGpF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE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AM,WAAW,GACf,MAAM,CAAC,CAAA,MAAA,MAAA,MAAA,MAAA,MAAA,WAAW,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,0CAAE,KAAK,0CAAE,MAAM,0CAAE,SAAS,KAAI,CAAC,CAAC;YACtE,IAAI,IAAI,SAAS,CAAC;QAEtB,MAAM,CAAC,IAAI,CACT,IAAA,gCAAsB,EACpB,sBAAU,EACV,IAAI,sBAAS,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,uBAAW,CAAA,CAAC,CAAC,QAAQ,EAAE,EAC7D,0BAAS,CAAC,GAAG,EACb,aAAa,EACb,SAAS,EACT;YACE,WAAW;SACZ,CACF,CACF,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,KAAK,EAAE,QAAQ;YACf,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE;gBACJ,MAAM;aACP;YACD,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,EAAE,OAAO;SACd;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -28,10 +28,7 @@ function jobGenerator(networkId) {
28
28
  return;
29
29
  const tokensData = yield (0, helpers_1.getTokensData)(tokenListResponse.data);
30
30
  const sources = yield (0, helpers_1.getCoingeckoSources)(networkId, tokensData);
31
- for (let i = 0; i < sources.length; i += 1) {
32
- const source = sources[i];
33
- yield cache.setTokenPriceSource(source);
34
- }
31
+ yield cache.setTokenPriceSources(sources);
35
32
  });
36
33
  return {
37
34
  executor,
@@ -1 +1 @@
1
- {"version":3,"file":"jobGenerator.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tokens/jobGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,kDAA6C;AAC7C,uCAA+D;AAG/D,mEAA2C;AAC3C,2CAAmD;AAEnD,SAAwB,YAAY,CAAC,SAAwB;IAC3D,MAAM,OAAO,GAAG,yBAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,CAAO,KAAY,EAAE,EAAE;QACtC,MAAM,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;QACnB,MAAM,iBAAiB,GAAuC,MAAM,eAAK;aACtE,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;aACzB,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,iBAAiB;YAAE,OAAO;QAE/B,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAa,EAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAmB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,CAAA,CAAC;IACF,OAAO;QACL,QAAQ;QACR,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,SAAS,EAAE;QAC7C,KAAK,EAAE,WAAW;KACnB,CAAC;AACJ,CAAC;AArBD,+BAqBC"}
1
+ {"version":3,"file":"jobGenerator.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tokens/jobGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,kDAA6C;AAC7C,uCAA+D;AAG/D,mEAA2C;AAC3C,2CAAmD;AAEnD,SAAwB,YAAY,CAAC,SAAwB;IAC3D,MAAM,OAAO,GAAG,yBAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,CAAO,KAAY,EAAE,EAAE;QACtC,MAAM,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;QACnB,MAAM,iBAAiB,GAAuC,MAAM,eAAK;aACtE,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;aACzB,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,iBAAiB;YAAE,OAAO;QAE/B,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAa,EAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAmB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjE,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAA,CAAC;IACF,OAAO;QACL,QAAQ;QACR,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,SAAS,EAAE;QAC7C,KAAK,EAAE,WAAW;KACnB,CAAC;AACJ,CAAC;AAlBD,+BAkBC"}
@@ -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 getDynamicFieldObjects<K>(client: SuiClient, parentId: string, options?: SuiObjectDataOptions): Promise<ObjectResponse<K>[]>;
@@ -0,0 +1,23 @@
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.getDynamicFieldObjects = void 0;
13
+ const getDynamicFields_1 = require("./getDynamicFields");
14
+ const multiGetObjects_1 = require("./multiGetObjects");
15
+ function getDynamicFieldObjects(client, parentId, options) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const res = yield (0, getDynamicFields_1.getDynamicFields)(client, parentId);
18
+ const ids = res.map((r) => r.objectId);
19
+ return (0, multiGetObjects_1.multiGetObjects)(client, ids, options);
20
+ });
21
+ }
22
+ exports.getDynamicFieldObjects = getDynamicFieldObjects;
23
+ //# sourceMappingURL=getDynamicFieldObjects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDynamicFieldObjects.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getDynamicFieldObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,yDAAsD;AACtD,uDAAoD;AAEpD,SAAsB,sBAAsB,CAC1C,MAAiB,EACjB,QAAgB,EAChB,OAA8B;;QAE9B,MAAM,GAAG,GAAG,MAAM,IAAA,mCAAgB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACvC,OAAO,IAAA,iCAAe,EAAI,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CAAA;AARD,wDAQC"}
@@ -0,0 +1,7 @@
1
+ import { SuiClient } from '../clients/types';
2
+ import { ObjectResponse } from './types';
3
+ export declare function multiDynamicFieldObjects<K>(client: SuiClient, params: {
4
+ parentId: string;
5
+ type: string;
6
+ values: string[];
7
+ }): Promise<ObjectResponse<K>[]>;
@@ -0,0 +1,34 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.multiDynamicFieldObjects = void 0;
16
+ const getDynamicFieldObject_1 = require("./getDynamicFieldObject");
17
+ const runInBatch_1 = __importDefault(require("../misc/runInBatch"));
18
+ function multiDynamicFieldObjects(client, params) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const { parentId, values, type } = params;
21
+ if (values.length === 0)
22
+ return [];
23
+ const result = yield (0, runInBatch_1.default)(values.map((value) => () => (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
24
+ name: {
25
+ type,
26
+ value,
27
+ },
28
+ parentId,
29
+ })), 10);
30
+ return result.flatMap((r) => (r.status === 'fulfilled' ? [r.value] : []));
31
+ });
32
+ }
33
+ exports.multiDynamicFieldObjects = multiDynamicFieldObjects;
34
+ //# sourceMappingURL=multiDynamicFieldObjects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiDynamicFieldObjects.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/multiDynamicFieldObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,mEAAgE;AAChE,oEAA4C;AAE5C,SAAsB,wBAAwB,CAC5C,MAAiB,EACjB,MAIC;;QAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEnC,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAU,EAC7B,MAAM,CAAC,GAAG,CACR,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,EAAE,CACd,IAAA,6CAAqB,EAAI,MAAM,EAAE;YAC/B,IAAI,EAAE;gBACJ,IAAI;gBACJ,KAAK;aACN;YACD,QAAQ;SACT,CAAC,CACL,EACD,EAAE,CACH,CAAC;QACF,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;CAAA;AAzBD,4DAyBC"}