@airgap/moonbeam 0.13.8-beta.6 → 0.13.8-beta.8

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.
@@ -87701,12 +87701,6 @@ exports.NonExtendedProtocol = void 0;
87701
87701
  var NonExtendedProtocol = /** @class */ (function () {
87702
87702
  function NonExtendedProtocol() {
87703
87703
  }
87704
- NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
87705
- throw Promise.reject('extended public key support not implemented');
87706
- };
87707
- NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
87708
- throw Promise.reject('extended public key support not implemented');
87709
- };
87710
87704
  NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
87711
87705
  throw Promise.reject('extended private key support not implemented');
87712
87706
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airgap/moonbeam",
3
- "version": "0.13.8-beta.6",
3
+ "version": "0.13.8-beta.8",
4
4
  "description": "The @airgap/moonbeam is a Moonbeam implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
5
5
  "keywords": [
6
6
  "airgap",
@@ -33,10 +33,10 @@
33
33
  },
34
34
  "author": "Papers GmbH <contact@papers.ch> (https://papers.ch)",
35
35
  "peerDependencies": {
36
- "@airgap/coinlib-core": "^0.13.7-beta.0",
37
- "@airgap/module-kit": "^0.13.7-beta.0",
38
- "@airgap/serializer": "^0.13.7-beta.0",
39
- "@airgap/substrate": "^0.13.7-beta.0"
36
+ "@airgap/coinlib-core": "^0.13.8-beta.7",
37
+ "@airgap/module-kit": "^0.13.8-beta.7",
38
+ "@airgap/serializer": "^0.13.8-beta.7",
39
+ "@airgap/substrate": "^0.13.8-beta.7"
40
40
  },
41
41
  "localDependencies": {},
42
42
  "nyc": {
package/v1/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { createMoonbaseSubscanBlockExplorer, createMoonbeamSubscanBlockExplorer, createMoonriverSubscanBlockExplorer } from './block-explorer/SubscanBlockExplorer';
2
+ import { MoonbaseModule } from './module/MoonbaseModule';
2
3
  import { MoonbeamModule } from './module/MoonbeamModule';
4
+ import { MoonriverModule } from './module/MoonriverModule';
3
5
  import { createMoonbaseProtocol, MoonbaseProtocol } from './protocol/MoonbaseProtocol';
4
6
  import { createMoonbeamProtocol, MoonbeamProtocol } from './protocol/MoonbeamProtocol';
5
7
  import { createMoonriverProtocol, MoonriverProtocol } from './protocol/MoonriverProtocol';
6
8
  import { MoonbeamProtocolConfiguration } from './types/configuration';
7
9
  import { MoonbaseUnits, MoonbeamProtocolNetwork, MoonbeamProtocolOptions, MoonbeamUnits, MoonriverUnits } from './types/protocol';
8
- export { MoonbeamModule };
10
+ export { MoonbeamModule, MoonriverModule, MoonbaseModule };
9
11
  export { MoonbeamProtocol, createMoonbeamProtocol, MoonriverProtocol, createMoonriverProtocol, MoonbaseProtocol, createMoonbaseProtocol };
10
12
  export { createMoonbeamSubscanBlockExplorer, createMoonriverSubscanBlockExplorer, createMoonbaseSubscanBlockExplorer };
11
13
  export { MoonbeamUnits, MoonriverUnits, MoonbaseUnits, MoonbeamProtocolNetwork, MoonbeamProtocolOptions, MoonbeamProtocolConfiguration };
package/v1/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMoonbaseSubscanBlockExplorer = exports.createMoonriverSubscanBlockExplorer = exports.createMoonbeamSubscanBlockExplorer = exports.createMoonbaseProtocol = exports.createMoonriverProtocol = exports.createMoonbeamProtocol = exports.MoonbeamModule = void 0;
3
+ exports.createMoonbaseSubscanBlockExplorer = exports.createMoonriverSubscanBlockExplorer = exports.createMoonbeamSubscanBlockExplorer = exports.createMoonbaseProtocol = exports.createMoonriverProtocol = exports.createMoonbeamProtocol = exports.MoonbaseModule = exports.MoonriverModule = exports.MoonbeamModule = void 0;
4
4
  var SubscanBlockExplorer_1 = require("./block-explorer/SubscanBlockExplorer");
5
5
  Object.defineProperty(exports, "createMoonbaseSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createMoonbaseSubscanBlockExplorer; } });
6
6
  Object.defineProperty(exports, "createMoonbeamSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createMoonbeamSubscanBlockExplorer; } });
7
7
  Object.defineProperty(exports, "createMoonriverSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createMoonriverSubscanBlockExplorer; } });
8
+ var MoonbaseModule_1 = require("./module/MoonbaseModule");
9
+ Object.defineProperty(exports, "MoonbaseModule", { enumerable: true, get: function () { return MoonbaseModule_1.MoonbaseModule; } });
8
10
  var MoonbeamModule_1 = require("./module/MoonbeamModule");
9
11
  Object.defineProperty(exports, "MoonbeamModule", { enumerable: true, get: function () { return MoonbeamModule_1.MoonbeamModule; } });
12
+ var MoonriverModule_1 = require("./module/MoonriverModule");
13
+ Object.defineProperty(exports, "MoonriverModule", { enumerable: true, get: function () { return MoonriverModule_1.MoonriverModule; } });
10
14
  var MoonbaseProtocol_1 = require("./protocol/MoonbaseProtocol");
11
15
  Object.defineProperty(exports, "createMoonbaseProtocol", { enumerable: true, get: function () { return MoonbaseProtocol_1.createMoonbaseProtocol; } });
12
16
  var MoonbeamProtocol_1 = require("./protocol/MoonbeamProtocol");
package/v1/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAI8C;AAkBoC,mHArBhF,yDAAkC,OAqBgF;AAA3G,mHApBP,yDAAkC,OAoBO;AAAE,oHAnB3C,0DAAmC,OAmB2C;AAjBhF,0DAAwD;AAS/C,+FATA,+BAAc,OASA;AARvB,gEAAsF;AAY2B,uGAZxG,yCAAsB,OAYwG;AAXvI,gEAAsF;AAW3D,uGAXlB,yCAAsB,OAWkB;AAVjD,kEAAyF;AAUnB,wGAV7D,2CAAuB,OAU6D"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAI8C;AAoBoC,mHAvBhF,yDAAkC,OAuBgF;AAA3G,mHAtBP,yDAAkC,OAsBO;AAAE,oHArB3C,0DAAmC,OAqB2C;AAnBhF,0DAAwD;AAWd,+FAXjC,+BAAc,OAWiC;AAVxD,0DAAwD;AAU/C,+FAVA,+BAAc,OAUA;AATvB,4DAA0D;AASjC,gGAThB,iCAAe,OASgB;AARxC,gEAAsF;AAY2B,uGAZxG,yCAAsB,OAYwG;AAXvI,gEAAsF;AAW3D,uGAXlB,yCAAsB,OAWkB;AAVjD,kEAAyF;AAUnB,wGAV7D,2CAAuB,OAU6D"}
@@ -0,0 +1,10 @@
1
+ import { ProtocolNetwork } from '@airgap/module-kit';
2
+ import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
3
+ import { MoonbeamBaseProtocol } from '../protocol/MoonbeamBaseProtocol';
4
+ import { MoonbeamBaseModule } from './MoonbeamBaseModule';
5
+ export declare class MoonbaseModule extends MoonbeamBaseModule {
6
+ protected readonly name: string;
7
+ constructor();
8
+ createMoonbeamProtocol(network?: ProtocolNetwork | undefined): MoonbeamBaseProtocol;
9
+ createMoonbeamBlockExplorer(network: ProtocolNetwork): BlockExplorer;
10
+ }
@@ -0,0 +1,38 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.MoonbaseModule = void 0;
19
+ var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
20
+ var MoonbaseProtocol_1 = require("../protocol/MoonbaseProtocol");
21
+ var MoonbeamBaseModule_1 = require("./MoonbeamBaseModule");
22
+ var MoonbaseModule = /** @class */ (function (_super) {
23
+ __extends(MoonbaseModule, _super);
24
+ function MoonbaseModule() {
25
+ var _this = _super.call(this, [MoonbaseProtocol_1.MOONBASE_MAINNET_PROTOCOL_NETWORK]) || this;
26
+ _this.name = 'Moonbase';
27
+ return _this;
28
+ }
29
+ MoonbaseModule.prototype.createMoonbeamProtocol = function (network) {
30
+ return (0, MoonbaseProtocol_1.createMoonbaseProtocol)({ network: network });
31
+ };
32
+ MoonbaseModule.prototype.createMoonbeamBlockExplorer = function (network) {
33
+ return (0, SubscanBlockExplorer_1.createMoonbaseSubscanBlockExplorer)();
34
+ };
35
+ return MoonbaseModule;
36
+ }(MoonbeamBaseModule_1.MoonbeamBaseModule));
37
+ exports.MoonbaseModule = MoonbaseModule;
38
+ //# sourceMappingURL=MoonbaseModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoonbaseModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonbaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,+EAA2F;AAC3F,iEAAwG;AAGxG,2DAAyD;AAEzD;IAAoC,kCAAkB;IAGpD;QAAA,YACE,kBAAM,CAAC,oDAAiC,CAAC,CAAC,SAC3C;QAJkB,UAAI,GAAW,UAAU,CAAA;;IAI5C,CAAC;IAEM,+CAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC5C,CAAC;IAEM,oDAA2B,GAAlC,UAAmC,OAAwB;QACzD,OAAO,IAAA,yDAAkC,GAAE,CAAA;IAC7C,CAAC;IACH,qBAAC;AAAD,CAAC,AAdD,CAAoC,uCAAkB,GAcrD;AAdY,wCAAc"}
@@ -0,0 +1,15 @@
1
+ import { AirGapModule, ProtocolNetwork } from '@airgap/module-kit';
2
+ import { AirGapBlockExplorer, BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
3
+ import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
4
+ import { MoonbeamBaseProtocol } from '../protocol/MoonbeamBaseProtocol';
5
+ export declare abstract class MoonbeamBaseModule implements AirGapModule {
6
+ protected abstract readonly name: string;
7
+ readonly supportedNetworks: Record<string, ProtocolNetwork>;
8
+ private readonly networkRegistry;
9
+ protected constructor(supportedNetworks: ProtocolNetwork[], defaultNetwork?: ProtocolNetwork);
10
+ abstract createMoonbeamProtocol(network?: ProtocolNetwork): MoonbeamBaseProtocol;
11
+ abstract createMoonbeamBlockExplorer(network: ProtocolNetwork): AirGapBlockExplorer;
12
+ createOfflineProtocol(): Promise<OfflineProtocol<{}> | undefined>;
13
+ createOnlineProtocol(networkId?: string | undefined): Promise<OnlineProtocol<{}> | undefined>;
14
+ createBlockExplorer(networkId?: string | undefined): Promise<BlockExplorer | undefined>;
15
+ }
@@ -0,0 +1,82 @@
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
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.MoonbeamBaseModule = void 0;
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 MoonbeamBaseModule = /** @class */ (function () {
44
+ function MoonbeamBaseModule(supportedNetworks, defaultNetwork) {
45
+ this.networkRegistry = new module_kit_1.ModuleNetworkRegistry({ supportedNetworks: supportedNetworks, defaultNetwork: defaultNetwork });
46
+ this.supportedNetworks = this.networkRegistry.supportedNetworks;
47
+ }
48
+ MoonbeamBaseModule.prototype.createOfflineProtocol = function () {
49
+ return __awaiter(this, void 0, void 0, function () {
50
+ return __generator(this, function (_a) {
51
+ return [2 /*return*/, this.createMoonbeamProtocol()];
52
+ });
53
+ });
54
+ };
55
+ MoonbeamBaseModule.prototype.createOnlineProtocol = function (networkId) {
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ var network;
58
+ return __generator(this, function (_a) {
59
+ network = this.networkRegistry.findNetwork(networkId);
60
+ if (network === undefined) {
61
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol network type not supported. (".concat(this.name, ")"));
62
+ }
63
+ return [2 /*return*/, this.createMoonbeamProtocol(network)];
64
+ });
65
+ });
66
+ };
67
+ MoonbeamBaseModule.prototype.createBlockExplorer = function (networkId) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var network;
70
+ return __generator(this, function (_a) {
71
+ network = this.networkRegistry.findNetwork(networkId);
72
+ if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
73
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Block Explorer network type not supported. (".concat(this.name, ")"));
74
+ }
75
+ return [2 /*return*/, this.createMoonbeamBlockExplorer(network)];
76
+ });
77
+ });
78
+ };
79
+ return MoonbeamBaseModule;
80
+ }());
81
+ exports.MoonbeamBaseModule = MoonbeamBaseModule;
82
+ //# sourceMappingURL=MoonbeamBaseModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoonbeamBaseModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonbeamBaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6C;AAC7C,sDAAqE;AACrE,iDAAyF;AAMzF;IAME,4BAAsB,iBAAoC,EAAE,cAAgC;QAC1F,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAqB,CAAC,EAAE,iBAAiB,mBAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,CAAA;QACvF,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAA;IACjE,CAAC;IAKY,kDAAqB,GAAlC;;;gBACE,sBAAO,IAAI,CAAC,sBAAsB,EAAE,EAAA;;;KACrC;IAEY,iDAAoB,GAAjC,UAAkC,SAA8B;;;;gBACxD,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,gDAAyC,IAAI,CAAC,IAAI,MAAG,CAAC,CAAA;iBAC3G;gBAED,sBAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAA;;;KAC5C;IAEY,gDAAmB,GAAhC,UAAiC,SAA8B;;;;gBACvD,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,SAAS,EAAE;oBAC/B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,sDAA+C,IAAI,CAAC,IAAI,MAAG,CAAC,CAAA;iBACjH;gBAED,sBAAO,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,EAAA;;;KACjD;IACH,yBAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCqB,gDAAkB"}
@@ -1,16 +1,10 @@
1
- import { MainProtocolSymbols } from '@airgap/coinlib-core';
2
- import { AirGapModule, ProtocolConfiguration } from '@airgap/module-kit';
1
+ import { ProtocolNetwork } from '@airgap/module-kit';
3
2
  import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
4
- import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
5
- declare type SupportedProtocols = MainProtocolSymbols.MOONBEAM | MainProtocolSymbols.MOONRIVER;
6
- export declare class MoonbeamModule implements AirGapModule<{
7
- Protocols: SupportedProtocols;
8
- }> {
9
- private readonly networkRegistries;
10
- readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
11
- createOfflineProtocol(identifier: SupportedProtocols): Promise<OfflineProtocol | undefined>;
12
- createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<OnlineProtocol | undefined>;
13
- createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<BlockExplorer | undefined>;
14
- private createProtocol;
3
+ import { MoonbeamBaseProtocol } from '../protocol/MoonbeamBaseProtocol';
4
+ import { MoonbeamBaseModule } from './MoonbeamBaseModule';
5
+ export declare class MoonbeamModule extends MoonbeamBaseModule {
6
+ protected readonly name: string;
7
+ constructor();
8
+ createMoonbeamProtocol(network?: ProtocolNetwork | undefined): MoonbeamBaseProtocol;
9
+ createMoonbeamBlockExplorer(network: ProtocolNetwork): BlockExplorer;
15
10
  }
16
- export {};
@@ -1,113 +1,38 @@
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
+ 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
+ })();
38
17
  Object.defineProperty(exports, "__esModule", { value: true });
39
18
  exports.MoonbeamModule = void 0;
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
19
  var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
44
20
  var MoonbeamProtocol_1 = require("../protocol/MoonbeamProtocol");
45
- var MoonriverProtocol_1 = require("../protocol/MoonriverProtocol");
46
- var MoonbeamModule = /** @class */ (function () {
21
+ var MoonbeamBaseModule_1 = require("./MoonbeamBaseModule");
22
+ var MoonbeamModule = /** @class */ (function (_super) {
23
+ __extends(MoonbeamModule, _super);
47
24
  function MoonbeamModule() {
48
- var _a;
49
- this.networkRegistries = (_a = {},
50
- _a[coinlib_core_1.MainProtocolSymbols.MOONBEAM] = new module_kit_1.ModuleNetworkRegistry({
51
- supportedNetworks: [MoonbeamProtocol_1.MOONBEAM_MAINNET_PROTOCOL_NETWORK]
52
- }),
53
- _a[coinlib_core_1.MainProtocolSymbols.MOONRIVER] = new module_kit_1.ModuleNetworkRegistry({
54
- supportedNetworks: [MoonriverProtocol_1.MOONRIVER_MAINNET_PROTOCOL_NETWORK]
55
- }),
56
- _a);
57
- this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
25
+ var _this = _super.call(this, [MoonbeamProtocol_1.MOONBEAM_MAINNET_PROTOCOL_NETWORK]) || this;
26
+ _this.name = 'Moonbeam';
27
+ return _this;
58
28
  }
59
- MoonbeamModule.prototype.createOfflineProtocol = function (identifier) {
60
- return __awaiter(this, void 0, void 0, function () {
61
- return __generator(this, function (_a) {
62
- return [2 /*return*/, this.createProtocol(identifier)];
63
- });
64
- });
65
- };
66
- MoonbeamModule.prototype.createOnlineProtocol = function (identifier, networkId) {
67
- var _a;
68
- return __awaiter(this, void 0, void 0, function () {
69
- var network;
70
- return __generator(this, function (_b) {
71
- network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
72
- if (network === undefined) {
73
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol network type not supported. (Moonbeam)");
74
- }
75
- return [2 /*return*/, this.createProtocol(identifier, network)];
76
- });
77
- });
78
- };
79
- MoonbeamModule.prototype.createBlockExplorer = function (identifier, networkId) {
80
- var _a;
81
- return __awaiter(this, void 0, void 0, function () {
82
- var network;
83
- return __generator(this, function (_b) {
84
- network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
85
- if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
86
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Block Explorer network type not supported. (Moonbeam)");
87
- }
88
- switch (identifier) {
89
- case coinlib_core_1.MainProtocolSymbols.MOONBEAM:
90
- return [2 /*return*/, (0, SubscanBlockExplorer_1.createMoonbeamSubscanBlockExplorer)()];
91
- case coinlib_core_1.MainProtocolSymbols.MOONRIVER:
92
- return [2 /*return*/, (0, SubscanBlockExplorer_1.createMoonriverSubscanBlockExplorer)()];
93
- default:
94
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Moonbeam)"));
95
- }
96
- return [2 /*return*/];
97
- });
98
- });
29
+ MoonbeamModule.prototype.createMoonbeamProtocol = function (network) {
30
+ return (0, MoonbeamProtocol_1.createMoonbeamProtocol)({ network: network });
99
31
  };
100
- MoonbeamModule.prototype.createProtocol = function (identifier, network) {
101
- switch (identifier) {
102
- case coinlib_core_1.MainProtocolSymbols.MOONBEAM:
103
- return (0, MoonbeamProtocol_1.createMoonbeamProtocol)({ network: network });
104
- case coinlib_core_1.MainProtocolSymbols.MOONRIVER:
105
- return (0, MoonriverProtocol_1.createMoonriverProtocol)({ network: network });
106
- default:
107
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Moonbeam)"));
108
- }
32
+ MoonbeamModule.prototype.createMoonbeamBlockExplorer = function (network) {
33
+ return (0, SubscanBlockExplorer_1.createMoonbeamSubscanBlockExplorer)();
109
34
  };
110
35
  return MoonbeamModule;
111
- }());
36
+ }(MoonbeamBaseModule_1.MoonbeamBaseModule));
112
37
  exports.MoonbeamModule = MoonbeamModule;
113
38
  //# sourceMappingURL=MoonbeamModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MoonbeamModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonbeamModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAA0I;AAI1I,+EAAgI;AAChI,iEAAwG;AACxG,mEAA2G;AAI3G;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,QAAQ,IAAG,IAAI,kCAAqB,CAAC;gBACxD,iBAAiB,EAAE,CAAC,oDAAiC,CAAC;aACvD,CAAC;YACF,GAAC,kCAAmB,CAAC,SAAS,IAAG,IAAI,kCAAqB,CAAC;gBACzD,iBAAiB,EAAE,CAAC,sDAAkC,CAAC;aACxD,CAAC;gBACH;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAyC1I,CAAC;IAvCc,8CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,6CAAoB,GAAjC,UAAkC,UAA8B,EAAE,SAAkB;;;;;gBAC5E,OAAO,GAAgC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;gBACvG,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,iDAAiD,CAAC,CAAA;iBACvG;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,4CAAmB,GAAhC,UAAiC,UAA8B,EAAE,SAAkB;;;;;gBAC3E,OAAO,GAAgC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;gBACvG,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,SAAS,EAAE;oBAC/B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,uDAAuD,CAAC,CAAA;iBAC7G;gBAED,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,QAAQ;wBAC/B,sBAAO,IAAA,yDAAkC,GAAE,EAAA;oBAC7C,KAAK,kCAAmB,CAAC,SAAS;wBAChC,sBAAO,IAAA,0DAAmC,GAAE,EAAA;oBAC9C;wBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,+BAA4B,CAAC,CAAA;iBAC1G;;;;KACF;IAEO,uCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE;YAClB,KAAK,kCAAmB,CAAC,QAAQ;gBAC/B,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC5C,KAAK,kCAAmB,CAAC,SAAS;gBAChC,OAAO,IAAA,2CAAuB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC7C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,+BAA4B,CAAC,CAAA;SAC1G;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAlDD,IAkDC;AAlDY,wCAAc"}
1
+ {"version":3,"file":"MoonbeamModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonbeamModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,+EAA2F;AAE3F,iEAAwG;AAExG,2DAAyD;AAEzD;IAAoC,kCAAkB;IAGpD;QAAA,YACE,kBAAM,CAAC,oDAAiC,CAAC,CAAC,SAC3C;QAJkB,UAAI,GAAW,UAAU,CAAA;;IAI5C,CAAC;IAEM,+CAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC5C,CAAC;IAEM,oDAA2B,GAAlC,UAAmC,OAAwB;QACzD,OAAO,IAAA,yDAAkC,GAAE,CAAA;IAC7C,CAAC;IACH,qBAAC;AAAD,CAAC,AAdD,CAAoC,uCAAkB,GAcrD;AAdY,wCAAc"}
@@ -0,0 +1,10 @@
1
+ import { ProtocolNetwork } from '@airgap/module-kit';
2
+ import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
3
+ import { MoonbeamBaseProtocol } from '../protocol/MoonbeamBaseProtocol';
4
+ import { MoonbeamBaseModule } from './MoonbeamBaseModule';
5
+ export declare class MoonriverModule extends MoonbeamBaseModule {
6
+ protected readonly name: string;
7
+ constructor();
8
+ createMoonbeamProtocol(network?: ProtocolNetwork | undefined): MoonbeamBaseProtocol;
9
+ createMoonbeamBlockExplorer(network: ProtocolNetwork): BlockExplorer;
10
+ }
@@ -0,0 +1,38 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.MoonriverModule = void 0;
19
+ var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
20
+ var MoonriverProtocol_1 = require("../protocol/MoonriverProtocol");
21
+ var MoonbeamBaseModule_1 = require("./MoonbeamBaseModule");
22
+ var MoonriverModule = /** @class */ (function (_super) {
23
+ __extends(MoonriverModule, _super);
24
+ function MoonriverModule() {
25
+ var _this = _super.call(this, [MoonriverProtocol_1.MOONRIVER_MAINNET_PROTOCOL_NETWORK]) || this;
26
+ _this.name = 'Moonriver';
27
+ return _this;
28
+ }
29
+ MoonriverModule.prototype.createMoonbeamProtocol = function (network) {
30
+ return (0, MoonriverProtocol_1.createMoonriverProtocol)({ network: network });
31
+ };
32
+ MoonriverModule.prototype.createMoonbeamBlockExplorer = function (network) {
33
+ return (0, SubscanBlockExplorer_1.createMoonriverSubscanBlockExplorer)();
34
+ };
35
+ return MoonriverModule;
36
+ }(MoonbeamBaseModule_1.MoonbeamBaseModule));
37
+ exports.MoonriverModule = MoonriverModule;
38
+ //# sourceMappingURL=MoonriverModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoonriverModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonriverModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,+EAA4F;AAE5F,mEAA2G;AAE3G,2DAAyD;AAEzD;IAAqC,mCAAkB;IAGrD;QAAA,YACE,kBAAM,CAAC,sDAAkC,CAAC,CAAC,SAC5C;QAJkB,UAAI,GAAW,WAAW,CAAA;;IAI7C,CAAC;IAEM,gDAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,2CAAuB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC7C,CAAC;IAEM,qDAA2B,GAAlC,UAAmC,OAAwB;QACzD,OAAO,IAAA,0DAAmC,GAAE,CAAA;IAC9C,CAAC;IACH,sBAAC;AAAD,CAAC,AAdD,CAAqC,uCAAkB,GActD;AAdY,0CAAe"}