@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.
Files changed (95) hide show
  1. package/CHANGELOG.md +1091 -1087
  2. package/README.md +3 -3
  3. package/package.json +3 -3
  4. package/src/plugins/aftermath/poolsJob.js +22 -20
  5. package/src/plugins/aftermath/poolsJob.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/bucket/collateralFetcher.js +5 -8
  8. package/src/plugins/bucket/collateralFetcher.js.map +1 -1
  9. package/src/plugins/cetus/clmmsFetcher.js +5 -5
  10. package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
  11. package/src/plugins/cetus/helpers.d.ts +4 -4
  12. package/src/plugins/cetus/helpers.js +23 -12
  13. package/src/plugins/cetus/helpers.js.map +1 -1
  14. package/src/plugins/cetus/poolsJob.js +5 -10
  15. package/src/plugins/cetus/poolsJob.js.map +1 -1
  16. package/src/plugins/navi/collateralFetcher.js +8 -7
  17. package/src/plugins/navi/collateralFetcher.js.map +1 -1
  18. package/src/plugins/navi/reservesJob.js +5 -4
  19. package/src/plugins/navi/reservesJob.js.map +1 -1
  20. package/src/plugins/scallop/helpers.d.ts +0 -49
  21. package/src/plugins/scallop/helpers.js +1 -39
  22. package/src/plugins/scallop/helpers.js.map +1 -1
  23. package/src/plugins/scallop/lendingsFetcher.js +17 -14
  24. package/src/plugins/scallop/lendingsFetcher.js.map +1 -1
  25. package/src/plugins/scallop/marketJob.js +16 -16
  26. package/src/plugins/scallop/marketJob.js.map +1 -1
  27. package/src/plugins/scallop/obligationsFetcher.js +25 -21
  28. package/src/plugins/scallop/obligationsFetcher.js.map +1 -1
  29. package/src/plugins/scallop/poolsJob.js +7 -12
  30. package/src/plugins/scallop/poolsJob.js.map +1 -1
  31. package/src/plugins/scallop/spoolsMarketJob.js +8 -15
  32. package/src/plugins/scallop/spoolsMarketJob.js.map +1 -1
  33. package/src/plugins/scallop/types/coin.d.ts +1 -1
  34. package/src/plugins/scallop/types/market.d.ts +3 -4
  35. package/src/plugins/scallop/types/market.js.map +1 -1
  36. package/src/plugins/sushiswap/helpers.js +24 -24
  37. package/src/plugins/tokens/fetchers/sui-nfts.js +47 -107
  38. package/src/plugins/tokens/fetchers/sui-nfts.js.map +1 -1
  39. package/src/plugins/tokens/types.d.ts +0 -48
  40. package/src/plugins/turbos/clmmsPositionsFetcher.js +18 -16
  41. package/src/plugins/turbos/clmmsPositionsFetcher.js.map +1 -1
  42. package/src/plugins/turbos/helper.d.ts +3 -3
  43. package/src/plugins/turbos/helper.js +6 -4
  44. package/src/plugins/turbos/helper.js.map +1 -1
  45. package/src/plugins/turbos/poolsJob.js +10 -10
  46. package/src/plugins/turbos/poolsJob.js.map +1 -1
  47. package/src/plugins/uniswap-v2/helpers.js +22 -22
  48. package/src/utils/clients/getClientSui.d.ts +2 -2
  49. package/src/utils/clients/getClientSui.js +8 -3
  50. package/src/utils/clients/getClientSui.js.map +1 -1
  51. package/src/utils/clients/types.d.ts +2 -0
  52. package/src/utils/sei/constants.js +8 -8
  53. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  54. package/src/utils/sui/getDynamicFieldObject.d.ts +4 -0
  55. package/src/utils/sui/{getMultipleObjectsSafe.js → getDynamicFieldObject.js} +9 -13
  56. package/src/utils/sui/getDynamicFieldObject.js.map +1 -0
  57. package/src/utils/sui/getDynamicFields.d.ts +3 -0
  58. package/src/utils/sui/getDynamicFields.js +38 -0
  59. package/src/utils/sui/getDynamicFields.js.map +1 -0
  60. package/src/utils/sui/getObject.d.ts +4 -0
  61. package/src/utils/sui/{getDynamicFieldsSafe.js → getObject.js} +8 -16
  62. package/src/utils/sui/getObject.js.map +1 -0
  63. package/src/utils/sui/getObjectDeletedResponse.d.ts +3 -0
  64. package/src/utils/sui/getObjectDeletedResponse.js +19 -0
  65. package/src/utils/sui/getObjectDeletedResponse.js.map +1 -0
  66. package/src/utils/sui/getObjectNotExistsResponse.d.ts +2 -0
  67. package/src/utils/sui/getObjectNotExistsResponse.js +14 -0
  68. package/src/utils/sui/getObjectNotExistsResponse.js.map +1 -0
  69. package/src/utils/sui/getOwnedObjects.d.ts +4 -0
  70. package/src/utils/sui/getOwnedObjects.js +36 -0
  71. package/src/utils/sui/getOwnedObjects.js.map +1 -0
  72. package/src/utils/sui/multiGetObjects.d.ts +4 -0
  73. package/src/utils/sui/multiGetObjects.js +32 -0
  74. package/src/utils/sui/multiGetObjects.js.map +1 -0
  75. package/src/utils/sui/queryEvents.d.ts +4 -0
  76. package/src/utils/sui/{queryEventSafe.js → queryEvents.js} +16 -12
  77. package/src/utils/sui/queryEvents.js.map +1 -0
  78. package/src/utils/sui/structs/kiosk.d.ts +7 -0
  79. package/src/utils/sui/structs/kiosk.js +3 -0
  80. package/src/utils/sui/structs/kiosk.js.map +1 -0
  81. package/src/utils/sui/structs/nft.d.ts +41 -0
  82. package/src/utils/sui/structs/nft.js +3 -0
  83. package/src/utils/sui/structs/nft.js.map +1 -0
  84. package/src/utils/sui/types.d.ts +23 -0
  85. package/src/utils/sui/types.js +3 -0
  86. package/src/utils/sui/types.js.map +1 -0
  87. package/src/utils/sui/getDynamicFieldsSafe.d.ts +0 -13
  88. package/src/utils/sui/getDynamicFieldsSafe.js.map +0 -1
  89. package/src/utils/sui/getFormattedCollectionNameAndId.d.ts +0 -4
  90. package/src/utils/sui/getFormattedCollectionNameAndId.js +0 -19
  91. package/src/utils/sui/getFormattedCollectionNameAndId.js.map +0 -1
  92. package/src/utils/sui/getMultipleObjectsSafe.d.ts +0 -67
  93. package/src/utils/sui/getMultipleObjectsSafe.js.map +0 -1
  94. package/src/utils/sui/queryEventSafe.d.ts +0 -14
  95. package/src/utils/sui/queryEventSafe.js.map +0 -1
@@ -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 { JsonRpcProvider } from '@mysten/sui.js';
2
- export default function getClientSui(): JsonRpcProvider;
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 sui_js_1 = require("@mysten/sui.js");
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 sui_js_1.JsonRpcProvider(undefined, {
13
- rpcClient: new sui_js_1.JsonRpcClient(rpcEndpoint.url, httpHeaders),
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,2CAAgE;AAChE,+DAAuD;AACvD,qEAAkE;AAClE,2CAA6C;AAE7C,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;IACd,OAAO,IAAI,wBAAe,CAAC,SAAS,EAAE;QACpC,SAAS,EAAE,IAAI,sBAAa,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC;AAXD,+BAWC"}
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,2 +1,4 @@
1
+ import { SuiClient as MystenSuiClient } from '@mysten/sui.js/client';
1
2
  import { PublicClient } from 'viem';
2
3
  export type EvmClient = PublicClient;
4
+ export type SuiClient = MystenSuiClient;
@@ -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
- function getMultipleSuiObjectsSafe(client, ids, options) {
12
+ exports.getDynamicFieldObject = void 0;
13
+ function getDynamicFieldObject(client, params) {
13
14
  return __awaiter(this, void 0, void 0, function* () {
14
- const objects = [];
15
- for (let i = 0; i < ids.length / 50; i++) {
16
- const tempAddresses = ids.slice(i * 50, i * 50 + 50);
17
- const tempObjects = yield client.multiGetObjects({
18
- ids: tempAddresses,
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.default = getMultipleSuiObjectsSafe;
27
- //# sourceMappingURL=getMultipleObjectsSafe.js.map
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,3 @@
1
+ import { DynamicFieldInfo } from '@mysten/sui.js/client';
2
+ import { SuiClient } from '../clients/types';
3
+ export declare function getDynamicFields(client: SuiClient, parentId: string, objectOnly?: boolean): Promise<DynamicFieldInfo[]>;
@@ -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
- function getDynamicFieldsSafe(client, parentId) {
12
+ exports.getObject = void 0;
13
+ function getObject(client, id, options) {
13
14
  return __awaiter(this, void 0, void 0, function* () {
14
- const dynamicFields = [];
15
- let resp;
16
- let cursor;
17
- do {
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.default = getDynamicFieldsSafe;
30
- //# sourceMappingURL=getDynamicFieldsSafe.js.map
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,3 @@
1
+ import { SuiObjectRef } from '@mysten/sui.js/client';
2
+ import { ObjectResponse } from './types';
3
+ export declare function getObjectDeletedResponse<K>(resp: ObjectResponse<K>): SuiObjectRef | undefined;
@@ -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,2 @@
1
+ import { ObjectResponse } from './types';
2
+ export declare function getObjectNotExistsResponse<K>(resp: ObjectResponse<K>): string | undefined;
@@ -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>[]>;
@@ -0,0 +1,32 @@
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.multiGetObjects = void 0;
13
+ const maxSize = 50;
14
+ function multiGetObjects(client, ids, options) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ if (ids.length === 0)
17
+ return [];
18
+ const items = [];
19
+ const idsToFetch = [...ids];
20
+ while (idsToFetch.length !== 0) {
21
+ const currIdsToFetch = idsToFetch.splice(0, maxSize);
22
+ const currItems = (yield client.multiGetObjects({
23
+ ids: currIdsToFetch,
24
+ options: Object.assign(Object.assign({}, options), { showType: true, showContent: true }),
25
+ }));
26
+ items.push(...currItems);
27
+ }
28
+ return items;
29
+ });
30
+ }
31
+ exports.multiGetObjects = multiGetObjects;
32
+ //# sourceMappingURL=multiGetObjects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiGetObjects.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/multiGetObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,SAAsB,eAAe,CACnC,MAAiB,EACjB,GAAa,EACb,OAA8B;;QAE9B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEhC,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QAC5B,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACrD,MAAM,SAAS,GAAG,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC;gBAC9C,GAAG,EAAE,cAAc;gBACnB,OAAO,kCACF,OAAO,KACV,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,IAAI,GAClB;aACF,CAAC,CAAwB,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAtBD,0CAsBC"}
@@ -0,0 +1,4 @@
1
+ import { SuiEventFilter } from '@mysten/sui.js/client';
2
+ import { SuiClient } from '../clients/types';
3
+ import { Event } from './types';
4
+ export declare function queryEvents<K>(client: SuiClient, query: SuiEventFilter): Promise<Event<K>[]>;
@@ -9,22 +9,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- function queryEventsSafe(client, query) {
12
+ exports.queryEvents = void 0;
13
+ const maxPage = 25;
14
+ function queryEvents(client, query) {
13
15
  return __awaiter(this, void 0, void 0, function* () {
14
- const eventsData = [];
15
- let resp;
16
+ let page = 0;
17
+ let hasNextPage = true;
16
18
  let cursor;
19
+ const objects = [];
17
20
  do {
18
- resp = yield client.queryEvents({
19
- query,
21
+ const res = yield client.queryEvents({
20
22
  cursor,
23
+ query,
21
24
  });
22
- cursor = resp.nextCursor;
23
- if (resp.data.length > 0)
24
- eventsData.push(...resp.data);
25
- } while (resp.hasNextPage);
26
- return eventsData;
25
+ objects.push(...res.data);
26
+ cursor = res.nextCursor;
27
+ hasNextPage = res.hasNextPage;
28
+ page += 1;
29
+ } while (hasNextPage && page <= maxPage);
30
+ return objects;
27
31
  });
28
32
  }
29
- exports.default = queryEventsSafe;
30
- //# sourceMappingURL=queryEventSafe.js.map
33
+ exports.queryEvents = queryEvents;
34
+ //# sourceMappingURL=queryEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryEvents.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/queryEvents.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,SAAsB,WAAW,CAAI,MAAiB,EAAE,KAAqB;;QAC3E,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,WAAW,GAAG,IAAI,CAAC;QACvB,IAAI,MAAkC,CAAC;QAEvC,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,GAAG,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC;gBACnC,MAAM;gBACN,KAAK;aACN,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAI,GAAG,CAAC,IAAmB,CAAC,CAAC;YAC1C,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;AAlBD,kCAkBC"}
@@ -0,0 +1,7 @@
1
+ export type KioskStruct = {
2
+ id: {
3
+ id: string;
4
+ };
5
+ kiosk: string;
6
+ owner: string;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=kiosk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kiosk.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/sui/structs/kiosk.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ export type NftStruct = {
2
+ id?: {
3
+ id: string;
4
+ };
5
+ name?: string;
6
+ description?: string;
7
+ url?: string;
8
+ collection_id?: string;
9
+ animation_url?: string;
10
+ external_url?: string;
11
+ attributes_keys?: string[];
12
+ attributes_values?: string[];
13
+ amount?: number | string;
14
+ tick?: string;
15
+ attributes?: {
16
+ type: string;
17
+ fields: {
18
+ map: {
19
+ type: string;
20
+ fields: {
21
+ contents: Attribute[];
22
+ };
23
+ };
24
+ };
25
+ };
26
+ };
27
+ export type Attribute = {
28
+ type: string;
29
+ fields: {
30
+ key: string;
31
+ value: string;
32
+ };
33
+ };
34
+ export type NftDisplayData = {
35
+ name?: string;
36
+ description?: string;
37
+ creator?: string;
38
+ image_url?: string;
39
+ project_url?: string;
40
+ external_link?: string;
41
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=nft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nft.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/sui/structs/nft.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import { SuiEvent, SuiObjectData, SuiObjectResponse } from '@mysten/sui.js/client';
2
+ export type ParsedData<K> = {
3
+ hasPublicTransfer: boolean;
4
+ type: string;
5
+ dataType: 'moveObject';
6
+ fields: K;
7
+ };
8
+ export type ParsedDataPackage = {
9
+ dataType: 'package';
10
+ disassembled: {
11
+ [key: string]: unknown;
12
+ };
13
+ };
14
+ export type ObjectData<K> = SuiObjectData & {
15
+ type: string;
16
+ content: ParsedData<K> | null;
17
+ };
18
+ export type ObjectResponse<K> = SuiObjectResponse & {
19
+ data?: ObjectData<K> | null;
20
+ };
21
+ export type Event<K> = SuiEvent & {
22
+ parsedJson?: K;
23
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/types.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- import { JsonRpcProvider } from '@mysten/sui.js';
2
- export default function getDynamicFieldsSafe(client: JsonRpcProvider, parentId: string): Promise<{
3
- type: "DynamicField" | "DynamicObject";
4
- objectType: string;
5
- objectId: string;
6
- version: number;
7
- digest: string;
8
- name: {
9
- type: string;
10
- value?: any;
11
- };
12
- bcsName: string;
13
- }[]>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDynamicFieldsSafe.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getDynamicFieldsSafe.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,SAA8B,oBAAoB,CAChD,MAAuB,EACvB,QAAgB;;QAEhB,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC;QACT,IAAI,MAAM,CAAC;QACX,GAAG,CAAC;YACF,IAAI,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;gBACnC,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;YACzB,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;gBAAE,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC,QAAQ,IAAI,CAAC,WAAW,EAAE;QAC3B,OAAO,aAAa,CAAC;IACvB,CAAC;CAAA;AAhBD,uCAgBC"}
@@ -1,4 +0,0 @@
1
- export default function getFormattedCollectionNameAndId(type: string): {
2
- collectionName: string | undefined;
3
- collectionId: string | undefined;
4
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const aptos_1 = require("../aptos");
4
- function getFormattedCollectionNameAndId(type) {
5
- const types = (0, aptos_1.parseTypeString)(type);
6
- let module;
7
- let tempTypes = types;
8
- while (tempTypes.struct && tempTypes.keys && tempTypes.keys.length === 1) {
9
- module = module ? `${module} ${tempTypes.struct}` : tempTypes.struct;
10
- [tempTypes] = tempTypes.keys;
11
- }
12
- module = module ? `${module} ${tempTypes.struct}` : tempTypes.struct;
13
- return {
14
- collectionName: module,
15
- collectionId: types.type,
16
- };
17
- }
18
- exports.default = getFormattedCollectionNameAndId;
19
- //# sourceMappingURL=getFormattedCollectionNameAndId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFormattedCollectionNameAndId.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/getFormattedCollectionNameAndId.ts"],"names":[],"mappings":";;AAAA,oCAA2C;AAE3C,SAAwB,+BAA+B,CAAC,IAAY;IAIlE,MAAM,KAAK,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,CAAC;IAEpC,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;QACrE,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC;IAC/B,CAAC;IACD,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;IAErE,OAAO;QACL,cAAc,EAAE,MAAM;QACtB,YAAY,EAAE,KAAK,CAAC,IAAI;KACzB,CAAC;AACJ,CAAC;AAlBD,kDAkBC"}