@sonarwatch/portfolio-plugins 0.2.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/generators/fetcher/generator.js +1 -1
  4. package/src/generators/fetcher/generator.js.map +1 -1
  5. package/src/utils/aptos/MoveResource.d.ts +4 -0
  6. package/src/utils/aptos/MoveResource.js +3 -0
  7. package/src/utils/aptos/MoveResource.js.map +1 -0
  8. package/src/utils/aptos/constants.d.ts +5 -0
  9. package/src/utils/aptos/constants.js +9 -0
  10. package/src/utils/aptos/constants.js.map +1 -0
  11. package/src/utils/aptos/getAccountResource.d.ts +3 -0
  12. package/src/utils/aptos/getAccountResource.js +27 -0
  13. package/src/utils/aptos/getAccountResource.js.map +1 -0
  14. package/src/utils/aptos/getAccountResources.d.ts +5 -0
  15. package/src/utils/aptos/getAccountResources.js +25 -0
  16. package/src/utils/aptos/getAccountResources.js.map +1 -0
  17. package/src/utils/aptos/getCoinAddressFromCoinType.d.ts +1 -0
  18. package/src/utils/aptos/getCoinAddressFromCoinType.js +11 -0
  19. package/src/utils/aptos/getCoinAddressFromCoinType.js.map +1 -0
  20. package/src/utils/aptos/getCoinInfoResource.d.ts +3 -0
  21. package/src/utils/aptos/getCoinInfoResource.js +12 -0
  22. package/src/utils/aptos/getCoinInfoResource.js.map +1 -0
  23. package/src/utils/aptos/getCoinStoreResource.d.ts +3 -0
  24. package/src/utils/aptos/getCoinStoreResource.js +10 -0
  25. package/src/utils/aptos/getCoinStoreResource.js.map +1 -0
  26. package/src/utils/aptos/getCoinStoreResources.d.ts +5 -0
  27. package/src/utils/aptos/getCoinStoreResources.js +23 -0
  28. package/src/utils/aptos/getCoinStoreResources.js.map +1 -0
  29. package/src/utils/aptos/getCoinTypeFromCoinRessourceType.d.ts +1 -0
  30. package/src/utils/aptos/getCoinTypeFromCoinRessourceType.js +11 -0
  31. package/src/utils/aptos/getCoinTypeFromCoinRessourceType.js.map +1 -0
  32. package/src/utils/aptos/getCoinTypeFromRessourceType.d.ts +1 -0
  33. package/src/utils/aptos/getCoinTypeFromRessourceType.js +11 -0
  34. package/src/utils/aptos/getCoinTypeFromRessourceType.js.map +1 -0
  35. package/src/utils/aptos/getNestedType.d.ts +1 -0
  36. package/src/utils/aptos/getNestedType.js +9 -0
  37. package/src/utils/aptos/getNestedType.js.map +1 -0
  38. package/src/utils/aptos/getTableItem.d.ts +3 -0
  39. package/src/utils/aptos/getTableItem.js +23 -0
  40. package/src/utils/aptos/getTableItem.js.map +1 -0
  41. package/src/utils/aptos/getTableItemsByHandles.d.ts +3 -0
  42. package/src/utils/aptos/getTableItemsByHandles.js +39 -0
  43. package/src/utils/aptos/getTableItemsByHandles.js.map +1 -0
  44. package/src/utils/aptos/getTableItemsByKeys.d.ts +2 -0
  45. package/src/utils/aptos/getTableItemsByKeys.js +43 -0
  46. package/src/utils/aptos/getTableItemsByKeys.js.map +1 -0
  47. package/src/utils/aptos/getView.d.ts +3 -0
  48. package/src/utils/aptos/getView.js +25 -0
  49. package/src/utils/aptos/getView.js.map +1 -0
  50. package/src/utils/aptos/index.d.ts +23 -0
  51. package/src/utils/aptos/index.js +40 -0
  52. package/src/utils/aptos/index.js.map +1 -0
  53. package/src/utils/aptos/isAccountNotFoundError.d.ts +1 -0
  54. package/src/utils/aptos/isAccountNotFoundError.js +9 -0
  55. package/src/utils/aptos/isAccountNotFoundError.js.map +1 -0
  56. package/src/utils/aptos/isCoinStoreRessource.d.ts +2 -0
  57. package/src/utils/aptos/isCoinStoreRessource.js +10 -0
  58. package/src/utils/aptos/isCoinStoreRessource.js.map +1 -0
  59. package/src/utils/aptos/isCoinStoreRessourceType.d.ts +1 -0
  60. package/src/utils/aptos/isCoinStoreRessourceType.js +10 -0
  61. package/src/utils/aptos/isCoinStoreRessourceType.js.map +1 -0
  62. package/src/utils/aptos/isResourceNotFoundError.d.ts +1 -0
  63. package/src/utils/aptos/isResourceNotFoundError.js +9 -0
  64. package/src/utils/aptos/isResourceNotFoundError.js.map +1 -0
  65. package/src/utils/aptos/parseTypeString.d.ts +2 -0
  66. package/src/utils/aptos/parseTypeString.js +71 -0
  67. package/src/utils/aptos/parseTypeString.js.map +1 -0
  68. package/src/utils/aptos/resources/coinInfo.d.ts +29 -0
  69. package/src/utils/aptos/resources/coinInfo.js +3 -0
  70. package/src/utils/aptos/resources/coinInfo.js.map +1 -0
  71. package/src/utils/aptos/resources/coinStore.d.ts +26 -0
  72. package/src/utils/aptos/resources/coinStore.js +3 -0
  73. package/src/utils/aptos/resources/coinStore.js.map +1 -0
  74. package/src/utils/aptos/types.d.ts +18 -0
  75. package/src/utils/aptos/types.js +3 -0
  76. package/src/utils/aptos/types.js.map +1 -0
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.4.0](https://github.com/sonarwatch/portfolio/compare/plugins-0.3.0...plugins-0.4.0) (2023-07-07)
6
+
7
+
8
+
9
+ # [0.3.0](https://github.com/sonarwatch/portfolio/compare/plugins-0.2.3...plugins-0.3.0) (2023-07-07)
10
+
11
+
12
+
5
13
  ## [0.2.3](https://github.com/sonarwatch/portfolio/compare/plugins-0.2.2...plugins-0.2.3) (2023-07-07)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -21,7 +21,7 @@
21
21
  "viem": "^1.2.9"
22
22
  },
23
23
  "peerDependencies": {
24
- "@sonarwatch/portfolio-core": "0.2.3"
24
+ "@sonarwatch/portfolio-core": "0.4.0"
25
25
  },
26
26
  "main": "./src/index.js",
27
27
  "types": "./src/index.d.ts"
@@ -43,7 +43,7 @@ function fetcherGenerator(tree, options) {
43
43
  const fetcherName = (0, helpers_1.toKebabCase)(options.fetcherName);
44
44
  const pluginId = (0, helpers_1.toKebabCase)(options.pluginId);
45
45
  const { networkId } = options;
46
- (0, portfolio_core_1.assetNetworkId)(networkId);
46
+ (0, portfolio_core_1.assertNetworkId)(networkId);
47
47
  const libraryRoot = (0, devkit_1.readProjectConfiguration)(tree, 'plugins').root;
48
48
  if (!(0, node_fs_1.existsSync)(`${libraryRoot}/src/plugins/${pluginId}`)) {
49
49
  throw new Error(`The provided plugin does not exist: ${pluginId}`);
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/generators/fetcher/generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAKoB;AACpB,qCAAqC;AACrC,2CAA6B;AAC7B,+DAA4D;AAE5D,wCAAyC;AAEzC,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAA+B;;QAE/B,MAAM,WAAW,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QAC9B,IAAA,+BAAc,EAAC,SAAS,CAAC,CAAC;QAE1B,MAAM,WAAW,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC;QAEnE,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,WAAW,gBAAgB,QAAQ,EAAE,CAAC,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,uCAAuC,QAAQ,EAAE,CAAC,CAAC;SACpE;QAED,MAAM,aAAa,GAAG;YACpB,QAAQ;YACR,WAAW;YACX,SAAS;SACV,CAAC;QAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAC7B,WAAW,EACX,aAAa,CACd,CAAC;QACF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA5BD,4CA4BC;AAED,kBAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/generators/fetcher/generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAKoB;AACpB,qCAAqC;AACrC,2CAA6B;AAC7B,+DAA6D;AAE7D,wCAAyC;AAEzC,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAA+B;;QAE/B,MAAM,WAAW,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QAC9B,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;QAE3B,MAAM,WAAW,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC;QAEnE,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,WAAW,gBAAgB,QAAQ,EAAE,CAAC,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,uCAAuC,QAAQ,EAAE,CAAC,CAAC;SACpE;QAED,MAAM,aAAa,GAAG;YACpB,QAAQ;YACR,WAAW;YACX,SAAS;SACV,CAAC;QAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAC7B,WAAW,EACX,aAAa,CACd,CAAC;QACF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA5BD,4CA4BC;AAED,kBAAe,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type MoveResource<T> = {
2
+ type: string;
3
+ data: T;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=MoveResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoveResource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/MoveResource.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare const nativeType = "0x1::aptos_coin::AptosCoin";
2
+ export declare const nativeDecimals = 8;
3
+ export declare const nativeFactor: number;
4
+ export declare const coinInfo = "0x1::coin::CoinInfo";
5
+ export declare const coinStore = "0x1::coin::CoinStore";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coinStore = exports.coinInfo = exports.nativeFactor = exports.nativeDecimals = exports.nativeType = void 0;
4
+ exports.nativeType = '0x1::aptos_coin::AptosCoin';
5
+ exports.nativeDecimals = 8;
6
+ exports.nativeFactor = Math.pow(10, exports.nativeDecimals);
7
+ exports.coinInfo = '0x1::coin::CoinInfo';
8
+ exports.coinStore = '0x1::coin::CoinStore';
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,4BAA4B,CAAC;AAC1C,QAAA,cAAc,GAAG,CAAC,CAAC;AACnB,QAAA,YAAY,GAAG,SAAA,EAAE,EAAI,sBAAc,CAAA,CAAC;AACpC,QAAA,QAAQ,GAAG,qBAAqB,CAAC;AACjC,QAAA,SAAS,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AptosClient } from 'aptos';
2
+ import { MoveResource } from './MoveResource';
3
+ export declare function getAccountResource<T>(client: AptosClient, accountAddress: string, resourceType: string): Promise<MoveResource<T> | null>;
@@ -0,0 +1,27 @@
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.getAccountResource = void 0;
13
+ function getAccountResource(client, accountAddress, resourceType) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const resource = yield client
16
+ .getAccountResource(accountAddress, resourceType)
17
+ .catch((e) => {
18
+ if (!e.status || e.status !== 404)
19
+ throw e;
20
+ });
21
+ if (!resource)
22
+ return null;
23
+ return resource;
24
+ });
25
+ }
26
+ exports.getAccountResource = getAccountResource;
27
+ //# sourceMappingURL=getAccountResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccountResource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getAccountResource.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,SAAsB,kBAAkB,CACtC,MAAmB,EACnB,cAAsB,EACtB,YAAoB;;QAEpB,MAAM,QAAQ,GAAG,MAAM,MAAM;aAC1B,kBAAkB,CAAC,cAAc,EAAE,YAAY,CAAC;aAChD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG;gBAAE,MAAM,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC3B,OAAO,QAA2B,CAAC;IACrC,CAAC;CAAA;AAZD,gDAYC"}
@@ -0,0 +1,5 @@
1
+ import { AptosClient } from 'aptos';
2
+ export declare function getAccountResources(client: AptosClient, accountAddress: string): Promise<{
3
+ type: string;
4
+ data: {};
5
+ }[] | null>;
@@ -0,0 +1,25 @@
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.getAccountResources = void 0;
13
+ function getAccountResources(client, accountAddress) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const resources = yield client
16
+ .getAccountResources(accountAddress)
17
+ .catch((e) => {
18
+ if (!e.status || e.status !== 404)
19
+ throw e;
20
+ });
21
+ return resources || null;
22
+ });
23
+ }
24
+ exports.getAccountResources = getAccountResources;
25
+ //# sourceMappingURL=getAccountResources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccountResources.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getAccountResources.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,SAAsB,mBAAmB,CACvC,MAAmB,EACnB,cAAsB;;QAEtB,MAAM,SAAS,GAAG,MAAM,MAAM;aAC3B,mBAAmB,CAAC,cAAc,CAAC;aACnC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG;gBAAE,MAAM,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QACL,OAAO,SAAS,IAAI,IAAI,CAAC;IAC3B,CAAC;CAAA;AAVD,kDAUC"}
@@ -0,0 +1 @@
1
+ export declare function getCoinAddressFromCoinType(coinType: string): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCoinAddressFromCoinType = void 0;
4
+ function getCoinAddressFromCoinType(coinType) {
5
+ const coinAddress = coinType.split('::').at(0);
6
+ if (!coinAddress)
7
+ throw new Error('coinType is not valid');
8
+ return coinAddress;
9
+ }
10
+ exports.getCoinAddressFromCoinType = getCoinAddressFromCoinType;
11
+ //# sourceMappingURL=getCoinAddressFromCoinType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoinAddressFromCoinType.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getCoinAddressFromCoinType.ts"],"names":[],"mappings":";;;AAAA,SAAgB,0BAA0B,CAAC,QAAgB;IACzD,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3D,OAAO,WAAW,CAAC;AACrB,CAAC;AAJD,gEAIC"}
@@ -0,0 +1,3 @@
1
+ import { AptosClient } from 'aptos';
2
+ import { CoinInfoData } from './resources/coinInfo';
3
+ export declare function getCoinInfoResource(client: AptosClient, coinType: string): Promise<import("./MoveResource").MoveResource<CoinInfoData> | null>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCoinInfoResource = void 0;
4
+ const constants_1 = require("./constants");
5
+ const getAccountResource_1 = require("./getAccountResource");
6
+ const getCoinAddressFromCoinType_1 = require("./getCoinAddressFromCoinType");
7
+ function getCoinInfoResource(client, coinType) {
8
+ const address = (0, getCoinAddressFromCoinType_1.getCoinAddressFromCoinType)(coinType);
9
+ return (0, getAccountResource_1.getAccountResource)(client, address, `${constants_1.coinInfo}<${coinType}>`);
10
+ }
11
+ exports.getCoinInfoResource = getCoinInfoResource;
12
+ //# sourceMappingURL=getCoinInfoResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoinInfoResource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getCoinInfoResource.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AACvC,6DAA0D;AAC1D,6EAA0E;AAG1E,SAAgB,mBAAmB,CAAC,MAAmB,EAAE,QAAgB;IACvE,MAAM,OAAO,GAAG,IAAA,uDAA0B,EAAC,QAAQ,CAAC,CAAC;IACrD,OAAO,IAAA,uCAAkB,EACvB,MAAM,EACN,OAAO,EACP,GAAG,oBAAQ,IAAI,QAAQ,GAAG,CAC3B,CAAC;AACJ,CAAC;AAPD,kDAOC"}
@@ -0,0 +1,3 @@
1
+ import { AptosClient } from 'aptos';
2
+ import { CoinStoreData } from './resources/coinStore';
3
+ export declare function getCoinStoreResource(client: AptosClient, owner: string, coinType: string): Promise<import("./MoveResource").MoveResource<CoinStoreData> | null>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCoinStoreResource = void 0;
4
+ const constants_1 = require("./constants");
5
+ const getAccountResource_1 = require("./getAccountResource");
6
+ function getCoinStoreResource(client, owner, coinType) {
7
+ return (0, getAccountResource_1.getAccountResource)(client, owner, `${constants_1.coinStore}<${coinType}>`);
8
+ }
9
+ exports.getCoinStoreResource = getCoinStoreResource;
10
+ //# sourceMappingURL=getCoinStoreResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoinStoreResource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getCoinStoreResource.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,6DAA0D;AAG1D,SAAgB,oBAAoB,CAClC,MAAmB,EACnB,KAAa,EACb,QAAgB;IAEhB,OAAO,IAAA,uCAAkB,EACvB,MAAM,EACN,KAAK,EACL,GAAG,qBAAS,IAAI,QAAQ,GAAG,CAC5B,CAAC;AACJ,CAAC;AAVD,oDAUC"}
@@ -0,0 +1,5 @@
1
+ import { AptosClient } from 'aptos';
2
+ export declare function getCoinStoreResources(client: AptosClient, owner: string): Promise<{
3
+ type: string;
4
+ data: {};
5
+ }[] | null>;
@@ -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.getCoinStoreResources = void 0;
13
+ const getAccountResources_1 = require("./getAccountResources");
14
+ const isCoinStoreRessource_1 = require("./isCoinStoreRessource");
15
+ function getCoinStoreResources(client, owner) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const resources = yield (0, getAccountResources_1.getAccountResources)(client, owner);
18
+ const coinStoreRessources = resources === null || resources === void 0 ? void 0 : resources.filter((resource) => (0, isCoinStoreRessource_1.isCoinStoreRessource)(resource));
19
+ return coinStoreRessources || null;
20
+ });
21
+ }
22
+ exports.getCoinStoreResources = getCoinStoreResources;
23
+ //# sourceMappingURL=getCoinStoreResources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoinStoreResources.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getCoinStoreResources.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+DAA4D;AAC5D,iEAA8D;AAE9D,SAAsB,qBAAqB,CACzC,MAAmB,EACnB,KAAa;;QAEb,MAAM,SAAS,GAAG,MAAM,IAAA,yCAAmB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC3D,MAAM,mBAAmB,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzD,IAAA,2CAAoB,EAAC,QAAQ,CAAC,CAC/B,CAAC;QACF,OAAO,mBAAmB,IAAI,IAAI,CAAC;IACrC,CAAC;CAAA;AATD,sDASC"}
@@ -0,0 +1 @@
1
+ export declare function getCoinTypeFromCoinRessourceType(coinRessourceType: string): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCoinTypeFromCoinRessourceType = void 0;
4
+ const isCoinStoreRessourceType_1 = require("./isCoinStoreRessourceType");
5
+ function getCoinTypeFromCoinRessourceType(coinRessourceType) {
6
+ if (!(0, isCoinStoreRessourceType_1.isCoinStoreRessourceType)(coinRessourceType))
7
+ throw new Error(`ressourceType ${coinRessourceType} is not a CoinRessourceType`);
8
+ return coinRessourceType.slice(20, -1);
9
+ }
10
+ exports.getCoinTypeFromCoinRessourceType = getCoinTypeFromCoinRessourceType;
11
+ //# sourceMappingURL=getCoinTypeFromCoinRessourceType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoinTypeFromCoinRessourceType.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getCoinTypeFromCoinRessourceType.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAEtE,SAAgB,gCAAgC,CAAC,iBAAyB;IACxE,IAAI,CAAC,IAAA,mDAAwB,EAAC,iBAAiB,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,iBAAiB,iBAAiB,6BAA6B,CAChE,CAAC;IAEJ,OAAO,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAPD,4EAOC"}
@@ -0,0 +1 @@
1
+ export declare function getCoinTypeFromRessourceType(ressourceType: string): string | null;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCoinTypeFromRessourceType = void 0;
4
+ const isCoinStoreRessourceType_1 = require("./isCoinStoreRessourceType");
5
+ function getCoinTypeFromRessourceType(ressourceType) {
6
+ if (!(0, isCoinStoreRessourceType_1.isCoinStoreRessourceType)(ressourceType))
7
+ return null;
8
+ return ressourceType.slice(21, -1);
9
+ }
10
+ exports.getCoinTypeFromRessourceType = getCoinTypeFromRessourceType;
11
+ //# sourceMappingURL=getCoinTypeFromRessourceType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoinTypeFromRessourceType.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getCoinTypeFromRessourceType.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAEtE,SAAgB,4BAA4B,CAAC,aAAqB;IAChE,IAAI,CAAC,IAAA,mDAAwB,EAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,OAAO,aAAa,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAHD,oEAGC"}
@@ -0,0 +1 @@
1
+ export declare function getNestedType(type: string): string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNestedType = void 0;
4
+ function getNestedType(type) {
5
+ const index = type.indexOf('<');
6
+ return type.slice(index + 1, -1);
7
+ }
8
+ exports.getNestedType = getNestedType;
9
+ //# sourceMappingURL=getNestedType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNestedType.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getNestedType.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,IAAY;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAHD,sCAGC"}
@@ -0,0 +1,3 @@
1
+ import { AptosClient } from 'aptos';
2
+ import { TableItemRequest } from './types';
3
+ export declare function getTableItem<T>(client: AptosClient, handle: string, data: TableItemRequest): Promise<NonNullable<T> | null>;
@@ -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.getTableItem = void 0;
13
+ function getTableItem(client, handle, data) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const item = yield client.getTableItem(handle, data).catch((e) => {
16
+ if (!e.status || e.status !== 404)
17
+ throw e;
18
+ });
19
+ return item || null;
20
+ });
21
+ }
22
+ exports.getTableItem = getTableItem;
23
+ //# sourceMappingURL=getTableItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTableItem.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getTableItem.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,SAAsB,YAAY,CAChC,MAAmB,EACnB,MAAc,EACd,IAAsB;;QAEtB,MAAM,IAAI,GAAa,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACzE,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG;gBAAE,MAAM,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,IAAI,IAAI,CAAC;IACtB,CAAC;CAAA;AATD,oCASC"}
@@ -0,0 +1,3 @@
1
+ import { AptosClient } from 'aptos';
2
+ import { TableItemRequest } from './types';
3
+ export declare function getTableItemsByHandles<T>(client: AptosClient, handles: string[], data: TableItemRequest): Promise<(Awaited<NonNullable<T>> | null)[]>;
@@ -0,0 +1,39 @@
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.getTableItemsByHandles = void 0;
13
+ const getTableItem_1 = require("./getTableItem");
14
+ const MAX = 20;
15
+ function getTableItemsByHandles(client, handles, data) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const items = [];
18
+ const handlesToFetch = [...handles];
19
+ while (handlesToFetch.length !== 0) {
20
+ const currHandlesToFetch = handlesToFetch.splice(0, MAX);
21
+ const currItems = yield iGetTableItemsByHandles(client, currHandlesToFetch, data);
22
+ items.push(...currItems);
23
+ }
24
+ return items;
25
+ });
26
+ }
27
+ exports.getTableItemsByHandles = getTableItemsByHandles;
28
+ function iGetTableItemsByHandles(client, handles, data) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const promises = handles.map((handle) => (0, getTableItem_1.getTableItem)(client, handle, data));
31
+ const results = yield Promise.allSettled(promises);
32
+ return results.map((result) => {
33
+ if (result.status === 'rejected')
34
+ return null;
35
+ return result.value;
36
+ });
37
+ });
38
+ }
39
+ //# sourceMappingURL=getTableItemsByHandles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTableItemsByHandles.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getTableItemsByHandles.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAA8C;AAG9C,MAAM,GAAG,GAAG,EAAE,CAAC;AAEf,SAAsB,sBAAsB,CAC1C,MAAmB,EACnB,OAAiB,EACjB,IAAsB;;QAEtB,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,cAAc,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACzD,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAC7C,MAAM,EACN,kBAAkB,EAClB,IAAI,CACL,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;SAC1B;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAjBD,wDAiBC;AAED,SAAe,uBAAuB,CACpC,MAAmB,EACnB,OAAiB,EACjB,IAAsB;;QAEtB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACtC,IAAA,2BAAY,EAAI,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CACtC,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC5B,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU;gBAAE,OAAO,IAAI,CAAC;YAC9C,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA"}
@@ -0,0 +1,2 @@
1
+ import { AptosClient } from 'aptos';
2
+ export declare function getTableItemsByKeys<T>(client: AptosClient, handle: string, keys: string[], keyType: string, valueType: string): Promise<(Awaited<NonNullable<T>> | null)[]>;
@@ -0,0 +1,43 @@
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.getTableItemsByKeys = void 0;
13
+ const getTableItem_1 = require("./getTableItem");
14
+ const MAX = 20;
15
+ function getTableItemsByKeys(client, handle, keys, keyType, valueType) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const items = [];
18
+ const keysToFetch = [...keys];
19
+ while (keysToFetch.length !== 0) {
20
+ const currKeysToFetch = keysToFetch.splice(0, MAX);
21
+ const currItems = yield iGetTableItemsByKeys(client, handle, currKeysToFetch, keyType, valueType);
22
+ items.push(...currItems);
23
+ }
24
+ return items;
25
+ });
26
+ }
27
+ exports.getTableItemsByKeys = getTableItemsByKeys;
28
+ function iGetTableItemsByKeys(client, handle, keys, keyType, valueType) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const promises = keys.map((key) => (0, getTableItem_1.getTableItem)(client, handle, {
31
+ key,
32
+ key_type: keyType,
33
+ value_type: valueType,
34
+ }));
35
+ const results = yield Promise.allSettled(promises);
36
+ return results.map((result) => {
37
+ if (result.status === 'rejected')
38
+ return null;
39
+ return result.value;
40
+ });
41
+ });
42
+ }
43
+ //# sourceMappingURL=getTableItemsByKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTableItemsByKeys.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getTableItemsByKeys.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAA8C;AAE9C,MAAM,GAAG,GAAG,EAAE,CAAC;AAEf,SAAsB,mBAAmB,CACvC,MAAmB,EACnB,MAAc,EACd,IAAc,EACd,OAAe,EACf,SAAiB;;QAEjB,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9B,OAAO,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACnD,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAC1C,MAAM,EACN,MAAM,EACN,eAAe,EACf,OAAO,EACP,SAAS,CACV,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;SAC1B;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AArBD,kDAqBC;AAED,SAAe,oBAAoB,CACjC,MAAmB,EACnB,MAAc,EACd,IAAc,EACd,OAAe,EACf,SAAiB;;QAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAChC,IAAA,2BAAY,EAAI,MAAM,EAAE,MAAM,EAAE;YAC9B,GAAG;YACH,QAAQ,EAAE,OAAO;YACjB,UAAU,EAAE,SAAS;SACtB,CAAC,CACH,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC5B,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU;gBAAE,OAAO,IAAI,CAAC;YAC9C,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA"}
@@ -0,0 +1,3 @@
1
+ import { AptosClient } from 'aptos';
2
+ import { ViewRequest } from './types';
3
+ export declare function getView(client: AptosClient, payload: ViewRequest): Promise<(string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | (string | number | boolean | {} | any)[])[])[])[])[])[])[])[])[])[])[])[] | null>;
@@ -0,0 +1,25 @@
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.getView = void 0;
13
+ function getView(client, payload) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const resource = yield client.view(payload).catch((e) => {
16
+ if (!e.status || e.status !== 404)
17
+ throw e;
18
+ });
19
+ if (!resource)
20
+ return null;
21
+ return resource;
22
+ });
23
+ }
24
+ exports.getView = getView;
25
+ //# sourceMappingURL=getView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getView.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/getView.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,SAAsB,OAAO,CAAC,MAAmB,EAAE,OAAoB;;QACrE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACtD,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG;gBAAE,MAAM,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAND,0BAMC"}
@@ -0,0 +1,23 @@
1
+ export * from './MoveResource';
2
+ export * from './types';
3
+ export * from './constants';
4
+ export * from './resources/coinInfo';
5
+ export * from './resources/coinStore';
6
+ export * from './isCoinStoreRessource';
7
+ export * from './isCoinStoreRessourceType';
8
+ export * from './isResourceNotFoundError';
9
+ export * from './isAccountNotFoundError';
10
+ export * from './getCoinInfoResource';
11
+ export * from './getCoinStoreResource';
12
+ export * from './getCoinStoreResources';
13
+ export * from './getNestedType';
14
+ export * from './getCoinTypeFromRessourceType';
15
+ export * from './getCoinTypeFromCoinRessourceType';
16
+ export * from './getCoinAddressFromCoinType';
17
+ export * from './getTableItem';
18
+ export * from './getTableItemsByHandles';
19
+ export * from './getTableItemsByKeys';
20
+ export * from './getView';
21
+ export * from './getAccountResource';
22
+ export * from './getAccountResources';
23
+ export * from './parseTypeString';
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./MoveResource"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ __exportStar(require("./constants"), exports);
20
+ __exportStar(require("./resources/coinInfo"), exports);
21
+ __exportStar(require("./resources/coinStore"), exports);
22
+ __exportStar(require("./isCoinStoreRessource"), exports);
23
+ __exportStar(require("./isCoinStoreRessourceType"), exports);
24
+ __exportStar(require("./isResourceNotFoundError"), exports);
25
+ __exportStar(require("./isAccountNotFoundError"), exports);
26
+ __exportStar(require("./getCoinInfoResource"), exports);
27
+ __exportStar(require("./getCoinStoreResource"), exports);
28
+ __exportStar(require("./getCoinStoreResources"), exports);
29
+ __exportStar(require("./getNestedType"), exports);
30
+ __exportStar(require("./getCoinTypeFromRessourceType"), exports);
31
+ __exportStar(require("./getCoinTypeFromCoinRessourceType"), exports);
32
+ __exportStar(require("./getCoinAddressFromCoinType"), exports);
33
+ __exportStar(require("./getTableItem"), exports);
34
+ __exportStar(require("./getTableItemsByHandles"), exports);
35
+ __exportStar(require("./getTableItemsByKeys"), exports);
36
+ __exportStar(require("./getView"), exports);
37
+ __exportStar(require("./getAccountResource"), exports);
38
+ __exportStar(require("./getAccountResources"), exports);
39
+ __exportStar(require("./parseTypeString"), exports);
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,0CAAwB;AACxB,8CAA4B;AAE5B,uDAAqC;AACrC,wDAAsC;AAEtC,yDAAuC;AACvC,6DAA2C;AAC3C,4DAA0C;AAC1C,2DAAyC;AACzC,wDAAsC;AACtC,yDAAuC;AACvC,0DAAwC;AACxC,kDAAgC;AAChC,iEAA+C;AAC/C,qEAAmD;AACnD,+DAA6C;AAC7C,iDAA+B;AAC/B,2DAAyC;AACzC,wDAAsC;AACtC,4CAA0B;AAC1B,uDAAqC;AACrC,wDAAsC;AACtC,oDAAkC"}
@@ -0,0 +1 @@
1
+ export declare function isAccountNotFoundError(error: any): boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAccountNotFoundError = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ function isAccountNotFoundError(error) {
6
+ return error.errorCode === 'account_not_found';
7
+ }
8
+ exports.isAccountNotFoundError = isAccountNotFoundError;
9
+ //# sourceMappingURL=isAccountNotFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAccountNotFoundError.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/isAccountNotFoundError.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AAC9D,SAAgB,sBAAsB,CAAC,KAAU;IAC/C,OAAO,KAAK,CAAC,SAAS,KAAK,mBAAmB,CAAC;AACjD,CAAC;AAFD,wDAEC"}
@@ -0,0 +1,2 @@
1
+ import { MoveResource } from './MoveResource';
2
+ export declare function isCoinStoreRessource<T>(resource: MoveResource<T>): boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCoinStoreRessource = void 0;
4
+ const constants_1 = require("./constants");
5
+ const prefix = `${constants_1.coinStore}<`;
6
+ function isCoinStoreRessource(resource) {
7
+ return resource.type.startsWith(prefix);
8
+ }
9
+ exports.isCoinStoreRessource = isCoinStoreRessource;
10
+ //# sourceMappingURL=isCoinStoreRessource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCoinStoreRessource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/isCoinStoreRessource.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAGxC,MAAM,MAAM,GAAG,GAAG,qBAAS,GAAG,CAAC;AAE/B,SAAgB,oBAAoB,CAAI,QAAyB;IAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAFD,oDAEC"}
@@ -0,0 +1 @@
1
+ export declare function isCoinStoreRessourceType(ressourceType: string): boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCoinStoreRessourceType = void 0;
4
+ const constants_1 = require("./constants");
5
+ const prefix = `${constants_1.coinStore}<`;
6
+ function isCoinStoreRessourceType(ressourceType) {
7
+ return ressourceType.startsWith(prefix);
8
+ }
9
+ exports.isCoinStoreRessourceType = isCoinStoreRessourceType;
10
+ //# sourceMappingURL=isCoinStoreRessourceType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCoinStoreRessourceType.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/isCoinStoreRessourceType.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAExC,MAAM,MAAM,GAAG,GAAG,qBAAS,GAAG,CAAC;AAE/B,SAAgB,wBAAwB,CAAC,aAAqB;IAC5D,OAAO,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAFD,4DAEC"}
@@ -0,0 +1 @@
1
+ export declare function isResourceNotFoundError(error: any): boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isResourceNotFoundError = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ function isResourceNotFoundError(error) {
6
+ return error.errorCode === 'resource_not_found';
7
+ }
8
+ exports.isResourceNotFoundError = isResourceNotFoundError;
9
+ //# sourceMappingURL=isResourceNotFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isResourceNotFoundError.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/isResourceNotFoundError.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AAC9D,SAAgB,uBAAuB,CAAC,KAAU;IAChD,OAAO,KAAK,CAAC,SAAS,KAAK,oBAAoB,CAAC;AAClD,CAAC;AAFD,0DAEC"}
@@ -0,0 +1,2 @@
1
+ import { MoveType } from './types';
2
+ export declare function parseTypeString(typeString: string): MoveType;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseTypeString = void 0;
4
+ function splitTypeString(typeString) {
5
+ const index = typeString.indexOf('<');
6
+ const root = index === -1 ? typeString : typeString.slice(0, index);
7
+ const keys = index === -1 ? undefined : typeString.slice(index + 1, -1);
8
+ return {
9
+ root,
10
+ keys,
11
+ };
12
+ }
13
+ function splitRootString(root) {
14
+ const splits = root.split('::');
15
+ if (splits.length > 3)
16
+ throw new Error(`Root type not splittable: ${root}`);
17
+ const address = splits.at(0);
18
+ const module = splits.at(1);
19
+ const struct = splits.at(2);
20
+ if (!address)
21
+ throw new Error(`Root type not splittable: ${root}`);
22
+ return {
23
+ address,
24
+ module,
25
+ struct,
26
+ };
27
+ }
28
+ function splitKeysString(keysString) {
29
+ let depth = 0;
30
+ const indexes = [];
31
+ for (let i = 0; i < keysString.length; i++) {
32
+ const char = keysString.at(i);
33
+ const nextChar = keysString.at(i + 1);
34
+ if (char === '>')
35
+ depth -= 1;
36
+ if (char === '<')
37
+ depth += 1;
38
+ if (depth === 0 && char === ',' && nextChar === ' ')
39
+ indexes.push(i);
40
+ }
41
+ const typeStrings = [];
42
+ let cKeysString = `${keysString}`;
43
+ for (let i = 0; i < indexes.length; i++) {
44
+ const index = indexes[i];
45
+ typeStrings.push(cKeysString.slice(0, index));
46
+ cKeysString = cKeysString.slice(index + 2);
47
+ if (i === indexes.length - 1) {
48
+ typeStrings.push(cKeysString);
49
+ }
50
+ }
51
+ return typeStrings;
52
+ }
53
+ function parseTypeString(typeString) {
54
+ const { root, keys: keysString } = splitTypeString(typeString);
55
+ const { address, module, struct } = splitRootString(root);
56
+ let keys;
57
+ if (keysString) {
58
+ const splittedKeys = splitKeysString(keysString);
59
+ keys = splittedKeys.map((cTypeString) => parseTypeString(cTypeString));
60
+ }
61
+ return {
62
+ type: typeString,
63
+ root,
64
+ address,
65
+ module,
66
+ struct,
67
+ keys,
68
+ };
69
+ }
70
+ exports.parseTypeString = parseTypeString;
71
+ //# sourceMappingURL=parseTypeString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseTypeString.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/aptos/parseTypeString.ts"],"names":[],"mappings":";;;AAEA,SAAS,eAAe,CAAC,UAAkB;IAIzC,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO;QACL,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5B,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;IACnE,OAAO;QACL,OAAO;QACP,MAAM;QACN,MAAM;KACP,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,UAAkB;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,QAAQ,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACtC,IAAI,IAAI,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAC7B,IAAI,IAAI,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAC7B,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACtE;IACD,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAI,WAAW,GAAG,GAAG,UAAU,EAAE,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9C,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC/B;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAE1D,IAAI,IAA4B,CAAC;IACjC,IAAI,UAAU,EAAE;QACd,MAAM,YAAY,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;KACxE;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,IAAI;QACJ,OAAO;QACP,MAAM;QACN,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC;AAlBD,0CAkBC"}
@@ -0,0 +1,29 @@
1
+ import { MoveResource } from '../MoveResource';
2
+ export type CoinInfoResource = MoveResource<CoinInfoData>;
3
+ export type CoinInfoData = {
4
+ decimals: number;
5
+ name: string;
6
+ symbol: string;
7
+ supply?: {
8
+ vec: [
9
+ {
10
+ aggregator: {
11
+ vec: [
12
+ {
13
+ limit: string;
14
+ value: string;
15
+ }
16
+ ] | [];
17
+ };
18
+ integer: {
19
+ vec: [
20
+ {
21
+ limit: string;
22
+ value: string;
23
+ }
24
+ ] | [];
25
+ };
26
+ }
27
+ ] | [];
28
+ };
29
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=coinInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coinInfo.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/aptos/resources/coinInfo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { MoveResource } from '../MoveResource';
2
+ export type CoinStoreResource = MoveResource<CoinStoreData>;
3
+ export type CoinStoreData = {
4
+ coin: {
5
+ value: string;
6
+ };
7
+ deposit_events: {
8
+ counter: string;
9
+ guid: {
10
+ id: {
11
+ addr: string;
12
+ creation_num: string;
13
+ };
14
+ };
15
+ };
16
+ frozen: boolean;
17
+ withdraw_events: {
18
+ counter: string;
19
+ guid: {
20
+ id: {
21
+ addr: string;
22
+ creation_num: string;
23
+ };
24
+ };
25
+ };
26
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=coinStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coinStore.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/aptos/resources/coinStore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export type TableItemRequest = {
2
+ key_type: string;
3
+ value_type: string;
4
+ key: string;
5
+ };
6
+ export type ViewRequest = {
7
+ function: string;
8
+ type_arguments: string[];
9
+ arguments: string[];
10
+ };
11
+ export type MoveType = {
12
+ type: string;
13
+ root: string;
14
+ address: string;
15
+ module?: string;
16
+ struct?: string;
17
+ keys?: MoveType[];
18
+ };
@@ -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/aptos/types.ts"],"names":[],"mappings":""}