@airgap/astar 0.13.45-beta.3 → 0.13.45-beta.5

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 (41) hide show
  1. package/package.json +5 -5
  2. package/v0/index.js +6 -6
  3. package/v0/index.js.map +1 -1
  4. package/v0/protocol/astar/AstarProtocol.js +40 -21
  5. package/v0/protocol/astar/AstarProtocol.js.map +1 -1
  6. package/v0/protocol/astar/AstarProtocolOptions.js +79 -39
  7. package/v0/protocol/astar/AstarProtocolOptions.js.map +1 -1
  8. package/v0/protocol/shiden/ShidenProtocol.js +37 -18
  9. package/v0/protocol/shiden/ShidenProtocol.js.map +1 -1
  10. package/v0/protocol/shiden/ShidenProtocolOptions.js +66 -30
  11. package/v0/protocol/shiden/ShidenProtocolOptions.js.map +1 -1
  12. package/v1/controller/AstarAccountController.js +23 -3
  13. package/v1/controller/AstarAccountController.js.map +1 -1
  14. package/v1/controller/AstarTransactionController.js +23 -3
  15. package/v1/controller/AstarTransactionController.js.map +1 -1
  16. package/v1/index.js +3 -3
  17. package/v1/index.js.map +1 -1
  18. package/v1/module/AstarModule.d.ts +1 -1
  19. package/v1/module/AstarModule.js +98 -40
  20. package/v1/module/AstarModule.js.map +1 -1
  21. package/v1/module.js +3 -2
  22. package/v1/module.js.map +1 -1
  23. package/v1/node/AstarNodeClient.js +23 -3
  24. package/v1/node/AstarNodeClient.js.map +1 -1
  25. package/v1/protocol/AstarBaseProtocol.js +88 -26
  26. package/v1/protocol/AstarBaseProtocol.js.map +1 -1
  27. package/v1/protocol/AstarProtocol.js +49 -18
  28. package/v1/protocol/AstarProtocol.js.map +1 -1
  29. package/v1/protocol/ShidenProtocol.js +50 -19
  30. package/v1/protocol/ShidenProtocol.js.map +1 -1
  31. package/v1/serializer/v3/schemas/converter/transaction-converter.js +6 -5
  32. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
  33. package/v1/serializer/v3/serializer-companion.js +154 -75
  34. package/v1/serializer/v3/serializer-companion.js.map +1 -1
  35. package/v1/serializer/v3/validators/transaction-validator.js +23 -3
  36. package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
  37. package/v1/serializer/v3/validators/validators.js +1 -1
  38. package/v1/serializer/v3/validators/validators.js.map +1 -1
  39. package/v1/types/configuration.d.ts +1 -1
  40. package/v1/types/crypto.d.ts +1 -1
  41. package/v1/types/protocol.d.ts +2 -2
@@ -3,7 +3,7 @@ import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from
3
3
  import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
4
4
  import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
5
5
  import { AstarProtocolNetwork } from '../types/protocol';
6
- type SupportedProtocols = MainProtocolSymbols.ASTAR | MainProtocolSymbols.SHIDEN;
6
+ declare type SupportedProtocols = MainProtocolSymbols.ASTAR | MainProtocolSymbols.SHIDEN;
7
7
  export declare class AstarModule implements AirGapModule<{
8
8
  Protocols: SupportedProtocols;
9
9
  ProtocolNetwork: AstarProtocolNetwork;
@@ -1,55 +1,113 @@
1
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 __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
39
  exports.AstarModule = void 0;
4
- const coinlib_core_1 = require("@airgap/coinlib-core");
5
- const errors_1 = require("@airgap/coinlib-core/errors");
6
- const module_kit_1 = require("@airgap/module-kit");
7
- const substrate_1 = require("@airgap/substrate");
8
- const AstarProtocol_1 = require("../protocol/AstarProtocol");
9
- const ShidenProtocol_1 = require("../protocol/ShidenProtocol");
10
- const serializer_companion_1 = require("../serializer/v3/serializer-companion");
11
- class AstarModule {
12
- constructor() {
13
- this.networkRegistries = {
14
- [coinlib_core_1.MainProtocolSymbols.ASTAR]: new module_kit_1.ModuleNetworkRegistry({
40
+ var coinlib_core_1 = require("@airgap/coinlib-core");
41
+ var errors_1 = require("@airgap/coinlib-core/errors");
42
+ var module_kit_1 = require("@airgap/module-kit");
43
+ var substrate_1 = require("@airgap/substrate");
44
+ var AstarProtocol_1 = require("../protocol/AstarProtocol");
45
+ var ShidenProtocol_1 = require("../protocol/ShidenProtocol");
46
+ var serializer_companion_1 = require("../serializer/v3/serializer-companion");
47
+ var AstarModule = /** @class */ (function () {
48
+ function AstarModule() {
49
+ var _a;
50
+ this.networkRegistries = (_a = {},
51
+ _a[coinlib_core_1.MainProtocolSymbols.ASTAR] = new module_kit_1.ModuleNetworkRegistry({
15
52
  supportedNetworks: [AstarProtocol_1.ASTAR_MAINNET_PROTOCOL_NETWORK]
16
53
  }),
17
- [coinlib_core_1.MainProtocolSymbols.SHIDEN]: new module_kit_1.ModuleNetworkRegistry({
54
+ _a[coinlib_core_1.MainProtocolSymbols.SHIDEN] = new module_kit_1.ModuleNetworkRegistry({
18
55
  supportedNetworks: [ShidenProtocol_1.SHIDEN_MAINNET_PROTOCOL_NETWORK]
19
- })
20
- };
56
+ }),
57
+ _a);
21
58
  this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
22
59
  }
23
- async createOfflineProtocol(identifier) {
24
- return this.createProtocol(identifier);
25
- }
26
- async createOnlineProtocol(identifier, networkOrId) {
27
- const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
28
- if (network === undefined) {
29
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, `Protocol network type not supported. (Astar)`);
30
- }
31
- return this.createProtocol(identifier, network);
32
- }
33
- async createBlockExplorer(identifier, networkOrId) {
34
- const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
35
- if (network === undefined) {
36
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, `Block Explorer network type not supported. (Astar)`);
37
- }
38
- return new substrate_1.SubscanBlockExplorer(network.blockExplorerUrl);
39
- }
40
- async createV3SerializerCompanion() {
41
- return new serializer_companion_1.AstarV3SerializerCompanion();
42
- }
43
- createProtocol(identifier, network) {
60
+ AstarModule.prototype.createOfflineProtocol = function (identifier) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ return __generator(this, function (_a) {
63
+ return [2 /*return*/, this.createProtocol(identifier)];
64
+ });
65
+ });
66
+ };
67
+ AstarModule.prototype.createOnlineProtocol = function (identifier, networkOrId) {
68
+ var _a;
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var network;
71
+ return __generator(this, function (_b) {
72
+ network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
73
+ if (network === undefined) {
74
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol network type not supported. (Astar)");
75
+ }
76
+ return [2 /*return*/, this.createProtocol(identifier, network)];
77
+ });
78
+ });
79
+ };
80
+ AstarModule.prototype.createBlockExplorer = function (identifier, networkOrId) {
81
+ var _a;
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var network;
84
+ return __generator(this, function (_b) {
85
+ network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
86
+ if (network === undefined) {
87
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Block Explorer network type not supported. (Astar)");
88
+ }
89
+ return [2 /*return*/, new substrate_1.SubscanBlockExplorer(network.blockExplorerUrl)];
90
+ });
91
+ });
92
+ };
93
+ AstarModule.prototype.createV3SerializerCompanion = function () {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ return __generator(this, function (_a) {
96
+ return [2 /*return*/, new serializer_companion_1.AstarV3SerializerCompanion()];
97
+ });
98
+ });
99
+ };
100
+ AstarModule.prototype.createProtocol = function (identifier, network) {
44
101
  switch (identifier) {
45
102
  case coinlib_core_1.MainProtocolSymbols.ASTAR:
46
- return (0, AstarProtocol_1.createAstarProtocol)({ network });
103
+ return (0, AstarProtocol_1.createAstarProtocol)({ network: network });
47
104
  case coinlib_core_1.MainProtocolSymbols.SHIDEN:
48
- return (0, ShidenProtocol_1.createShidenProtocol)({ network });
105
+ return (0, ShidenProtocol_1.createShidenProtocol)({ network: network });
49
106
  default:
50
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported. (Astar)`);
107
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Astar)"));
51
108
  }
52
- }
53
- }
109
+ };
110
+ return AstarModule;
111
+ }());
54
112
  exports.AstarModule = AstarModule;
55
113
  //# sourceMappingURL=AstarModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AstarModule.js","sourceRoot":"","sources":["../../../src/v1/module/AstarModule.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAClE,wDAAqE;AACrE,mDAO2B;AAG3B,iDAAwD;AAExD,6DAA+F;AAC/F,+DAAkG;AAClG,gFAAkF;AAKlF,MAAa,WAAW;IAAxB;QACmB,sBAAiB,GAAsD;YACtF,CAAC,kCAAmB,CAAC,KAAK,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBACrD,iBAAiB,EAAE,CAAC,8CAA8B,CAAC;aACpD,CAAC;YACF,CAAC,kCAAmB,CAAC,MAAM,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBACtD,iBAAiB,EAAE,CAAC,gDAA+B,CAAC;aACrD,CAAC;SACH,CAAA;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAgD1I,CAAC;IA9CQ,KAAK,CAAC,qBAAqB,CAAC,UAA8B;QAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;IA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AAmB,GAAhC,UACE,UAA8B,EAC9B,WAA2C;;;;;gBAErC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAAA;iBAC1G;gBAED,sBAAO,IAAI,gCAAoB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAA;;;KAC1D;IAEY,iDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,iDAA0B,EAAE,EAAA;;;KACxC;IAEO,oCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE;YAClB,KAAK,kCAAmB,CAAC,KAAK;gBAC5B,OAAO,IAAA,mCAAmB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YACzC,KAAK,kCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC1C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,4BAAyB,CAAC,CAAA;SACvG;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,kCAAW"}
package/v1/module.js CHANGED
@@ -14,10 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.create = create;
18
- const AstarModule_1 = require("./module/AstarModule");
17
+ exports.create = void 0;
18
+ var AstarModule_1 = require("./module/AstarModule");
19
19
  __exportStar(require("./index"), exports);
20
20
  function create() {
21
21
  return new AstarModule_1.AstarModule();
22
22
  }
23
+ exports.create = create;
23
24
  //# sourceMappingURL=module.js.map
package/v1/module.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,wBAEC;AAND,sDAAkD;AAElD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,yBAAW,EAAE,CAAA;AAC1B,CAAC"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,oDAAkD;AAElD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,yBAAW,EAAE,CAAA;AAC1B,CAAC;AAFD,wBAEC"}
@@ -1,8 +1,28 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.AstarNodeClient = void 0;
4
- const v1_1 = require("@airgap/substrate/v1");
5
- class AstarNodeClient extends v1_1.SubstrateCommonNodeClient {
6
- }
19
+ var v1_1 = require("@airgap/substrate/v1");
20
+ var AstarNodeClient = /** @class */ (function (_super) {
21
+ __extends(AstarNodeClient, _super);
22
+ function AstarNodeClient() {
23
+ return _super !== null && _super.apply(this, arguments) || this;
24
+ }
25
+ return AstarNodeClient;
26
+ }(v1_1.SubstrateCommonNodeClient));
7
27
  exports.AstarNodeClient = AstarNodeClient;
8
28
  //# sourceMappingURL=AstarNodeClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AstarNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/AstarNodeClient.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAIhE,MAAa,eAAgB,SAAQ,8BAAqD;CAAG;AAA7F,0CAA6F"}
1
+ {"version":3,"file":"AstarNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/AstarNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAgE;AAIhE;IAAqC,mCAAqD;IAA1F;;IAA4F,CAAC;IAAD,sBAAC;AAAD,CAAC,AAA7F,CAAqC,8BAAyB,GAA+B;AAAhF,0CAAe"}
@@ -1,34 +1,96 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
2
53
  Object.defineProperty(exports, "__esModule", { value: true });
3
54
  exports.AstarBaseProtocolImpl = void 0;
4
- const v1_1 = require("@airgap/substrate/v1");
5
- const AstarAccountController_1 = require("../controller/AstarAccountController");
6
- const AstarTransactionController_1 = require("../controller/AstarTransactionController");
7
- const AstarNodeClient_1 = require("../node/AstarNodeClient");
55
+ var v1_1 = require("@airgap/substrate/v1");
56
+ var AstarAccountController_1 = require("../controller/AstarAccountController");
57
+ var AstarTransactionController_1 = require("../controller/AstarTransactionController");
58
+ var AstarNodeClient_1 = require("../node/AstarNodeClient");
8
59
  // Implemenation
9
- class AstarBaseProtocolImpl extends v1_1.SubstrateProtocolImpl {
10
- constructor(options) {
11
- const nodeClient = new AstarNodeClient_1.AstarNodeClient(options.configuration, options.network.rpcUrl);
12
- const accountController = new AstarAccountController_1.AstarAccountController(options.configuration, nodeClient);
13
- const transactionController = new AstarTransactionController_1.AstarTransactionController(options.configuration, nodeClient);
14
- const blockExplorer = new v1_1.SubscanBlockExplorerClient(options.network.blockExplorerApi);
15
- super(options, nodeClient, accountController, transactionController, blockExplorer);
60
+ var AstarBaseProtocolImpl = /** @class */ (function (_super) {
61
+ __extends(AstarBaseProtocolImpl, _super);
62
+ function AstarBaseProtocolImpl(options) {
63
+ var nodeClient = new AstarNodeClient_1.AstarNodeClient(options.configuration, options.network.rpcUrl);
64
+ var accountController = new AstarAccountController_1.AstarAccountController(options.configuration, nodeClient);
65
+ var transactionController = new AstarTransactionController_1.AstarTransactionController(options.configuration, nodeClient);
66
+ var blockExplorer = new v1_1.SubscanBlockExplorerClient(options.network.blockExplorerApi);
67
+ return _super.call(this, options, nodeClient, accountController, transactionController, blockExplorer) || this;
16
68
  }
17
- async getFutureRequiredTransactions(accountId, intention) {
18
- const balance = await this.accountController.getBalance(accountId);
19
- const transferableBalance = balance.transferable.minus(balance.existentialDeposit);
20
- const requiredTransactions = [];
21
- if (intention === 'transfer') {
22
- requiredTransactions.push([
23
- 'transfer',
24
- {
25
- to: v1_1.SubstrateSS58Address.createPlaceholder(),
26
- value: transferableBalance
69
+ AstarBaseProtocolImpl.prototype.getFutureRequiredTransactions = function (accountId, intention) {
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ var balance, transferableBalance, requiredTransactions;
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0: return [4 /*yield*/, this.accountController.getBalance(accountId)];
75
+ case 1:
76
+ balance = _a.sent();
77
+ transferableBalance = balance.transferable.minus(balance.existentialDeposit);
78
+ requiredTransactions = [];
79
+ if (intention === 'transfer') {
80
+ requiredTransactions.push([
81
+ 'transfer',
82
+ {
83
+ to: v1_1.SubstrateSS58Address.createPlaceholder(),
84
+ value: transferableBalance
85
+ }
86
+ ]);
87
+ }
88
+ return [2 /*return*/, requiredTransactions];
27
89
  }
28
- ]);
29
- }
30
- return requiredTransactions;
31
- }
32
- }
90
+ });
91
+ });
92
+ };
93
+ return AstarBaseProtocolImpl;
94
+ }(v1_1.SubstrateProtocolImpl));
33
95
  exports.AstarBaseProtocolImpl = AstarBaseProtocolImpl;
34
96
  //# sourceMappingURL=AstarBaseProtocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AstarBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarBaseProtocol.ts"],"names":[],"mappings":";;;AAAA,6CAO6B;AAE7B,iFAA6E;AAC7E,yFAAqF;AACrF,6DAAyD;AAUzD,gBAAgB;AAEhB,MAAsB,qBACpB,SAAQ,0BAOP;IAGD,YAAmB,OAAyC;QAC1D,MAAM,UAAU,GAAoB,IAAI,iCAAe,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAEtG,MAAM,iBAAiB,GAA2B,IAAI,+CAAsB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAC/G,MAAM,qBAAqB,GAA+B,IAAI,uDAA0B,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAE3H,MAAM,aAAa,GAA+B,IAAI,+BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAA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aAAa,GAA+B,IAAI,+BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;eAElH,kBAAM,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,CAAC;IACrF,CAAC;IAEe,6DAA6B,GAA7C,UACE,SAAmD,EACnD,SAA+B;;;;;4BAEf,qBAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAA;;wBAA5D,OAAO,GAAG,SAAkD;wBAE5D,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;wBAE5E,oBAAoB,GAAkE,EAAE,CAAA;wBAE9F,IAAI,SAAS,KAAK,UAAU,EAAE;4BAC5B,oBAAoB,CAAC,IAAI,CAAC;gCACxB,UAAU;gCACV;oCACE,EAAE,EAAE,yBAAoB,CAAC,iBAAiB,EAAE;oCAC5C,KAAK,EAAE,mBAAmB;iCAC3B;6BACF,CAAC,CAAA;yBACH;wBAED,sBAAO,oBAAoB,EAAA;;;;KAC5B;IACH,4BAAC;AAAD,CAAC,AA5CD,CACU,0BAAqB,GA2C9B;AA5CqB,sDAAqB"}
@@ -1,10 +1,34 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ASTAR_MAINNET_PROTOCOL_NETWORK = exports.AstarProtocolImpl = exports.ASTAR_CONFIGURATION = exports.ASTAR_METADATA = void 0;
4
- exports.createAstarProtocol = createAstarProtocol;
5
- exports.createAstarProtocolOptions = createAstarProtocolOptions;
6
- const coinlib_core_1 = require("@airgap/coinlib-core");
7
- const AstarBaseProtocol_1 = require("./AstarBaseProtocol");
29
+ exports.createAstarProtocolOptions = exports.ASTAR_MAINNET_PROTOCOL_NETWORK = exports.createAstarProtocol = exports.AstarProtocolImpl = exports.ASTAR_CONFIGURATION = exports.ASTAR_METADATA = void 0;
30
+ var coinlib_core_1 = require("@airgap/coinlib-core");
31
+ var AstarBaseProtocol_1 = require("./AstarBaseProtocol");
8
32
  // Implementation
9
33
  exports.ASTAR_METADATA = {
10
34
  identifier: coinlib_core_1.MainProtocolSymbols.ASTAR,
@@ -41,10 +65,10 @@ exports.ASTAR_METADATA = {
41
65
  },
42
66
  mainUnit: 'ASTR',
43
67
  account: {
44
- standardDerivationPath: `m/44'/810'/0'/0/0`,
68
+ standardDerivationPath: "m/44'/810'/0'/0/0",
45
69
  address: {
46
70
  isCaseSensitive: true,
47
- placeholder: `ABC...`,
71
+ placeholder: "ABC...",
48
72
  regex: '^[a-km-zA-HJ-NP-Z1-9]+$'
49
73
  }
50
74
  }
@@ -59,19 +83,24 @@ exports.ASTAR_CONFIGURATION = {
59
83
  types: {}
60
84
  }
61
85
  };
62
- class AstarProtocolImpl extends AstarBaseProtocol_1.AstarBaseProtocolImpl {
63
- constructor(options = {}) {
64
- const completeOptions = createAstarProtocolOptions(options.network);
65
- const metadata = exports.ASTAR_METADATA;
66
- const configuration = exports.ASTAR_CONFIGURATION;
67
- super({ metadata, configuration, network: completeOptions.network });
86
+ var AstarProtocolImpl = /** @class */ (function (_super) {
87
+ __extends(AstarProtocolImpl, _super);
88
+ function AstarProtocolImpl(options) {
89
+ if (options === void 0) { options = {}; }
90
+ var completeOptions = createAstarProtocolOptions(options.network);
91
+ var metadata = exports.ASTAR_METADATA;
92
+ var configuration = exports.ASTAR_CONFIGURATION;
93
+ return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
68
94
  }
69
- }
95
+ return AstarProtocolImpl;
96
+ }(AstarBaseProtocol_1.AstarBaseProtocolImpl));
70
97
  exports.AstarProtocolImpl = AstarProtocolImpl;
71
98
  // Factory
72
- function createAstarProtocol(options = {}) {
99
+ function createAstarProtocol(options) {
100
+ if (options === void 0) { options = {}; }
73
101
  return new AstarProtocolImpl(options);
74
102
  }
103
+ exports.createAstarProtocol = createAstarProtocol;
75
104
  exports.ASTAR_MAINNET_PROTOCOL_NETWORK = {
76
105
  name: 'Mainnet',
77
106
  type: 'mainnet',
@@ -79,10 +108,12 @@ exports.ASTAR_MAINNET_PROTOCOL_NETWORK = {
79
108
  blockExplorerUrl: 'https://astar.subscan.io',
80
109
  blockExplorerApi: 'https://astar.subscan.prod.gke.papers.tech/api/v2/scan'
81
110
  };
82
- const DEFAULT_ASTAR_PROTOCOL_NETWORK = exports.ASTAR_MAINNET_PROTOCOL_NETWORK;
83
- function createAstarProtocolOptions(network = {}) {
111
+ var DEFAULT_ASTAR_PROTOCOL_NETWORK = exports.ASTAR_MAINNET_PROTOCOL_NETWORK;
112
+ function createAstarProtocolOptions(network) {
113
+ if (network === void 0) { network = {}; }
84
114
  return {
85
- network: { ...DEFAULT_ASTAR_PROTOCOL_NETWORK, ...network }
115
+ network: __assign(__assign({}, DEFAULT_ASTAR_PROTOCOL_NETWORK), network)
86
116
  };
87
117
  }
118
+ exports.createAstarProtocolOptions = createAstarProtocolOptions;
88
119
  //# sourceMappingURL=AstarProtocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AstarProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarProtocol.ts"],"names":[],"mappings":";;;AAoFA,kDAEC;AAYD,gEAIC;AAtGD,uDAA0D;AAM1D,2DAA8E;AAM9E,iBAAiB;AAEJ,QAAA,cAAc,GAAiC;IAC1D,UAAU,EAAE,kCAAmB,CAAC,KAAK;IACrC,IAAI,EAAE,OAAO;IAEb,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,EAAE;SACb;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,EAAE;SACb;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,EAAE;SACb;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,CAAC;SACZ;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,CAAC;SACZ;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,CAAC;SACZ;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,CAAC;SACZ;KACF;IACD,QAAQ,EAAE,MAAM;IAEhB,OAAO,EAAE;QACP,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE;YACP,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,QAAQ;YACrB,KAAK,EAAE,yBAAyB;SACjC;KACF;CACF,CAAA;AAEY,QAAA,mBAAmB,GAA+B;IAC7D,OAAO,EAAE;QACP,IAAI,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,kBAAM,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC;IACtE,CAAC;IACH,wBAAC;AAAD,CAAC,AATD,CAAuC,yCAAqB,GAS3D;AATY,8CAAiB;AAW9B,UAAU;AAEV,SAAgB,mBAAmB,CAAC,OAAoD;IAApD,wBAAA,EAAA,YAAoD;IACtF,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAA;AACvC,CAAC;AAFD,kDAEC;AAEY,QAAA,8BAA8B,GAAyB;IAClE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,yCAAyC;IACjD,gBAAgB,EAAE,0BAA0B;IAC5C,gBAAgB,EAAE,wDAAwD;CAC3E,CAAA;AAED,IAAM,8BAA8B,GAAyB,sCAA8B,CAAA;AAE3F,SAAgB,0BAA0B,CAAC,OAA2C;IAA3C,wBAAA,EAAA,YAA2C;IACpF,OAAO;QACL,OAAO,wBAAO,8BAA8B,GAAK,OAAO,CAAE;KAC3D,CAAA;AACH,CAAC;AAJD,gEAIC"}
@@ -1,11 +1,35 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = exports.ShidenProtocolImpl = exports.SHIDEN_CONFIGURATION = exports.SHIDEN_METADATA = void 0;
4
- exports.createShidenProtocol = createShidenProtocol;
5
- exports.createShidenProtocolOptions = createShidenProtocolOptions;
6
- const coinlib_core_1 = require("@airgap/coinlib-core");
7
- const AstarBaseProtocol_1 = require("./AstarBaseProtocol");
8
- const AstarProtocol_1 = require("./AstarProtocol");
29
+ exports.createShidenProtocolOptions = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = exports.createShidenProtocol = exports.ShidenProtocolImpl = exports.SHIDEN_CONFIGURATION = exports.SHIDEN_METADATA = void 0;
30
+ var coinlib_core_1 = require("@airgap/coinlib-core");
31
+ var AstarBaseProtocol_1 = require("./AstarBaseProtocol");
32
+ var AstarProtocol_1 = require("./AstarProtocol");
9
33
  // Implementation
10
34
  exports.SHIDEN_METADATA = {
11
35
  identifier: coinlib_core_1.MainProtocolSymbols.SHIDEN,
@@ -42,28 +66,33 @@ exports.SHIDEN_METADATA = {
42
66
  },
43
67
  mainUnit: 'SDN',
44
68
  account: {
45
- standardDerivationPath: `m/44'/810'/0'/0/0`,
69
+ standardDerivationPath: "m/44'/810'/0'/0/0",
46
70
  address: {
47
71
  isCaseSensitive: true,
48
- placeholder: `ABC...`,
72
+ placeholder: "ABC...",
49
73
  regex: '^[a-km-zA-HJ-NP-Z1-9]+$'
50
74
  }
51
75
  }
52
76
  };
53
77
  exports.SHIDEN_CONFIGURATION = AstarProtocol_1.ASTAR_CONFIGURATION;
54
- class ShidenProtocolImpl extends AstarBaseProtocol_1.AstarBaseProtocolImpl {
55
- constructor(options = {}) {
56
- const completeOptions = createShidenProtocolOptions(options.network);
57
- const metadata = exports.SHIDEN_METADATA;
58
- const configuration = exports.SHIDEN_CONFIGURATION;
59
- super({ metadata, configuration, network: completeOptions.network });
78
+ var ShidenProtocolImpl = /** @class */ (function (_super) {
79
+ __extends(ShidenProtocolImpl, _super);
80
+ function ShidenProtocolImpl(options) {
81
+ if (options === void 0) { options = {}; }
82
+ var completeOptions = createShidenProtocolOptions(options.network);
83
+ var metadata = exports.SHIDEN_METADATA;
84
+ var configuration = exports.SHIDEN_CONFIGURATION;
85
+ return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
60
86
  }
61
- }
87
+ return ShidenProtocolImpl;
88
+ }(AstarBaseProtocol_1.AstarBaseProtocolImpl));
62
89
  exports.ShidenProtocolImpl = ShidenProtocolImpl;
63
90
  // Factory
64
- function createShidenProtocol(options = {}) {
91
+ function createShidenProtocol(options) {
92
+ if (options === void 0) { options = {}; }
65
93
  return new ShidenProtocolImpl(options);
66
94
  }
95
+ exports.createShidenProtocol = createShidenProtocol;
67
96
  exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = {
68
97
  name: 'Mainnet',
69
98
  type: 'mainnet',
@@ -71,10 +100,12 @@ exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = {
71
100
  blockExplorerUrl: 'https://shiden.subscan.io',
72
101
  blockExplorerApi: 'https://shiden.subscan.prod.gke.papers.tech/api/v2/scan'
73
102
  };
74
- const DEFAULT_SHIDEN_PROTOCOL_NETWORK = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK;
75
- function createShidenProtocolOptions(network = {}) {
103
+ var DEFAULT_SHIDEN_PROTOCOL_NETWORK = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK;
104
+ function createShidenProtocolOptions(network) {
105
+ if (network === void 0) { network = {}; }
76
106
  return {
77
- network: { ...DEFAULT_SHIDEN_PROTOCOL_NETWORK, ...network }
107
+ network: __assign(__assign({}, DEFAULT_SHIDEN_PROTOCOL_NETWORK), network)
78
108
  };
79
109
  }
110
+ exports.createShidenProtocolOptions = createShidenProtocolOptions;
80
111
  //# sourceMappingURL=ShidenProtocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShidenProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/ShidenProtocol.ts"],"names":[],"mappings":";;;AA4EA,oDAEC;AAYD,kEAIC;AA9FD,uDAA0D;AAM1D,2DAA8E;AAC9E,mDAAqD;AAMrD,iBAAiB;AAEJ,QAAA,eAAe,GAAkC;IAC5D,UAAU,EAAE,kCAAmB,CAAC,MAAM;IACtC,IAAI,EAAE,QAAQ;IAEd,KAAK,EAAE;QACL,GAAG,EAAE;YACH,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;YACxB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;KACF;IACD,QAAQ,EAAE,KAAK;IAEf,OAAO,EAAE;QACP,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE;YACP,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,QAAQ;YACrB,KAAK,EAAE,yBAAyB;SACjC;KACF;CACF,CAAA;AAE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