@airgap/cosmos 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.
@@ -76445,12 +76445,6 @@ exports.NonExtendedProtocol = void 0;
76445
76445
  var NonExtendedProtocol = /** @class */ (function () {
76446
76446
  function NonExtendedProtocol() {
76447
76447
  }
76448
- NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
76449
- throw Promise.reject('extended public key support not implemented');
76450
- };
76451
- NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
76452
- throw Promise.reject('extended public key support not implemented');
76453
- };
76454
76448
  NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
76455
76449
  throw Promise.reject('extended private key support not implemented');
76456
76450
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airgap/cosmos",
3
- "version": "0.13.8-beta.6",
3
+ "version": "0.13.8-beta.8",
4
4
  "description": "The @airgap/cosmos is a Cosmos implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
5
5
  "keywords": [
6
6
  "airgap",
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "author": "Papers GmbH <contact@papers.ch> (https://papers.ch)",
33
33
  "peerDependencies": {
34
- "@airgap/coinlib-core": "^0.13.7-beta.0",
35
- "@airgap/module-kit": "^0.13.7-beta.0",
36
- "@airgap/serializer": "^0.13.7-beta.0"
34
+ "@airgap/coinlib-core": "^0.13.8-beta.7",
35
+ "@airgap/module-kit": "^0.13.8-beta.7",
36
+ "@airgap/serializer": "^0.13.8-beta.7"
37
37
  },
38
38
  "localDependencies": {},
39
39
  "nyc": {
@@ -1,14 +1,8 @@
1
- import { MainProtocolSymbols } from '@airgap/coinlib-core';
2
- import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, ProtocolConfiguration } from '@airgap/module-kit';
3
- declare type SupportedProtocols = MainProtocolSymbols.COSMOS;
4
- export declare class CosmosModule implements AirGapModule<{
5
- Protocols: SupportedProtocols;
6
- }> {
7
- private readonly networkRegistries;
8
- readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
9
- createOfflineProtocol(identifier: SupportedProtocols): Promise<AirGapOfflineProtocol | undefined>;
10
- createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
11
- createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<AirGapBlockExplorer | undefined>;
12
- private createProtocol;
1
+ import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, ProtocolNetwork } from '@airgap/module-kit';
2
+ export declare class CosmosModule implements AirGapModule {
3
+ private readonly networkRegistry;
4
+ readonly supportedNetworks: Record<string, ProtocolNetwork>;
5
+ createOfflineProtocol(): Promise<AirGapOfflineProtocol | undefined>;
6
+ createOnlineProtocol(networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
7
+ createBlockExplorer(networkId?: string): Promise<AirGapBlockExplorer | undefined>;
13
8
  }
14
- export {};
@@ -44,40 +44,35 @@ var MintscanBlockExplorer_1 = require("../block-explorer/MintscanBlockExplorer")
44
44
  var CosmosProtocol_1 = require("../protocol/CosmosProtocol");
45
45
  var CosmosModule = /** @class */ (function () {
46
46
  function CosmosModule() {
47
- var _a;
48
- this.networkRegistries = (_a = {},
49
- _a[coinlib_core_1.MainProtocolSymbols.COSMOS] = new module_kit_1.ModuleNetworkRegistry({
50
- supportedNetworks: [CosmosProtocol_1.COSMOS_MAINNET_PROTOCOL_NETWORK]
51
- }),
52
- _a);
53
- this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
47
+ this.networkRegistry = new module_kit_1.ModuleNetworkRegistry({
48
+ supportedNetworks: [CosmosProtocol_1.COSMOS_MAINNET_PROTOCOL_NETWORK]
49
+ });
50
+ this.supportedNetworks = this.networkRegistry.supportedNetworks;
54
51
  }
55
- CosmosModule.prototype.createOfflineProtocol = function (identifier) {
52
+ CosmosModule.prototype.createOfflineProtocol = function () {
56
53
  return __awaiter(this, void 0, void 0, function () {
57
54
  return __generator(this, function (_a) {
58
- return [2 /*return*/, this.createProtocol(identifier)];
55
+ return [2 /*return*/, (0, CosmosProtocol_1.createCosmosProtocol)()];
59
56
  });
60
57
  });
61
58
  };
62
- CosmosModule.prototype.createOnlineProtocol = function (identifier, networkId) {
63
- var _a;
59
+ CosmosModule.prototype.createOnlineProtocol = function (networkId) {
64
60
  return __awaiter(this, void 0, void 0, function () {
65
61
  var network;
66
- return __generator(this, function (_b) {
67
- network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
62
+ return __generator(this, function (_a) {
63
+ network = this.networkRegistry.findNetwork(networkId);
68
64
  if (network === undefined) {
69
65
  throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Protocol network type not supported.');
70
66
  }
71
- return [2 /*return*/, this.createProtocol(identifier, network)];
67
+ return [2 /*return*/, (0, CosmosProtocol_1.createCosmosProtocol)({ network: network })];
72
68
  });
73
69
  });
74
70
  };
75
- CosmosModule.prototype.createBlockExplorer = function (identifier, networkId) {
76
- var _a;
71
+ CosmosModule.prototype.createBlockExplorer = function (networkId) {
77
72
  return __awaiter(this, void 0, void 0, function () {
78
73
  var network;
79
- return __generator(this, function (_b) {
80
- network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
74
+ return __generator(this, function (_a) {
75
+ network = this.networkRegistry.findNetwork(networkId);
81
76
  if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
82
77
  throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Block Explorer network type not supported.');
83
78
  }
@@ -85,14 +80,6 @@ var CosmosModule = /** @class */ (function () {
85
80
  });
86
81
  });
87
82
  };
88
- CosmosModule.prototype.createProtocol = function (identifier, network) {
89
- switch (identifier) {
90
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
91
- return (0, CosmosProtocol_1.createCosmosProtocol)({ network: network });
92
- default:
93
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported."));
94
- }
95
- };
96
83
  return CosmosModule;
97
84
  }());
98
85
  exports.CosmosModule = CosmosModule;
@@ -1 +1 @@
1
- {"version":3,"file":"CosmosModule.js","sourceRoot":"","sources":["../../../src/v1/module/CosmosModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAU2B;AAE3B,iFAA+E;AAC/E,6DAAkG;AAIlG;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,MAAM,IAAG,IAAI,kCAAqB,CAAC;gBACtD,iBAAiB,EAAE,CAAC,gDAA+B,CAAC;aACrD,CAAC;gBACH;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAgC1I,CAAC;IA9Bc,4CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,2CAAoB,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,MAAM,EAAE,sCAAsC,CAAC,CAAA;iBACzF;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,0CAAmB,GAAhC,UAAiC,UAA8B,EAAE,SAAkB;;;;;gBAC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