@airgap/aeternity 0.13.8-beta.3 → 0.13.8-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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/aeternity",
|
|
3
|
-
"version": "0.13.8-beta.
|
|
3
|
+
"version": "0.13.8-beta.5",
|
|
4
4
|
"description": "The @airgap/aeternity is an Aeternity implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
25
25
|
"lint-ci": "tslint -t json -o ../../lint-reports/aeternity.json --project . || true",
|
|
26
26
|
"lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
|
|
27
|
-
"test": "nyc mocha --bail --require ts-node/register --require source-map-support/register --full-trace --delay --timeout 40000 ./test/**/**.spec.ts",
|
|
27
|
+
"test": "TS_NODE_PROJECT='./test/tsconfig.json' nyc mocha --bail --require ts-node/register --require source-map-support/register --full-trace --delay --timeout 40000 ./test/**/**.spec.ts",
|
|
28
28
|
"test-ci": "nyc --reporter=lcov npm test",
|
|
29
29
|
"test-legacy": "",
|
|
30
30
|
"browserify": "browserify ./dist/index.js -p realpathify -s airgapCoinLibAeternity > ./dist/airgap-coinlib-aeternity.min.js"
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
|
+
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, ProtocolConfiguration } from '@airgap/module-kit';
|
|
3
|
+
declare type SupportedProtocols = MainProtocolSymbols.AE;
|
|
4
|
+
export declare class AeternityModule 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;
|
|
8
13
|
}
|
|
14
|
+
export {};
|
|
@@ -44,35 +44,40 @@ var AeternityBlockExplorer_1 = require("../block-explorer/AeternityBlockExplorer
|
|
|
44
44
|
var AeternityProtocol_1 = require("../protocol/AeternityProtocol");
|
|
45
45
|
var AeternityModule = /** @class */ (function () {
|
|
46
46
|
function AeternityModule() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
var _a;
|
|
48
|
+
this.networkRegistries = (_a = {},
|
|
49
|
+
_a[coinlib_core_1.MainProtocolSymbols.AE] = new module_kit_1.ModuleNetworkRegistry({
|
|
50
|
+
supportedNetworks: [AeternityProtocol_1.AETERNITY_MAINNET_PROTOCOL_NETWORK]
|
|
51
|
+
}),
|
|
52
|
+
_a);
|
|
53
|
+
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
51
54
|
}
|
|
52
|
-
AeternityModule.prototype.createOfflineProtocol = function () {
|
|
55
|
+
AeternityModule.prototype.createOfflineProtocol = function (identifier) {
|
|
53
56
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
57
|
return __generator(this, function (_a) {
|
|
55
|
-
return [2 /*return*/,
|
|
58
|
+
return [2 /*return*/, this.createProtocol(identifier)];
|
|
56
59
|
});
|
|
57
60
|
});
|
|
58
61
|
};
|
|
59
|
-
AeternityModule.prototype.createOnlineProtocol = function (networkId) {
|
|
62
|
+
AeternityModule.prototype.createOnlineProtocol = function (identifier, networkId) {
|
|
63
|
+
var _a;
|
|
60
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
65
|
var network;
|
|
62
|
-
return __generator(this, function (
|
|
63
|
-
network = this.
|
|
66
|
+
return __generator(this, function (_b) {
|
|
67
|
+
network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
64
68
|
if (network === undefined) {
|
|
65
69
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.AETERNITY, 'Protocol network not supported.');
|
|
66
70
|
}
|
|
67
|
-
return [2 /*return*/, (
|
|
71
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
68
72
|
});
|
|
69
73
|
});
|
|
70
74
|
};
|
|
71
|
-
AeternityModule.prototype.createBlockExplorer = function (networkId) {
|
|
75
|
+
AeternityModule.prototype.createBlockExplorer = function (identifier, networkId) {
|
|
76
|
+
var _a;
|
|
72
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
78
|
var network;
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
network = this.
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
76
81
|
if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
|
|
77
82
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.AETERNITY, 'Block Explorer network not supported.');
|
|
78
83
|
}
|
|
@@ -80,6 +85,14 @@ var AeternityModule = /** @class */ (function () {
|
|
|
80
85
|
});
|
|
81
86
|
});
|
|
82
87
|
};
|
|
88
|
+
AeternityModule.prototype.createProtocol = function (identifier, network) {
|
|
89
|
+
switch (identifier) {
|
|
90
|
+
case coinlib_core_1.MainProtocolSymbols.AE:
|
|
91
|
+
return (0, AeternityProtocol_1.createAeternityProtocol)({ network: network });
|
|
92
|
+
default:
|
|
93
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported."));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
83
96
|
return AeternityModule;
|
|
84
97
|
}());
|
|
85
98
|
exports.AeternityModule = AeternityModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeternityModule.js","sourceRoot":"","sources":["../../../src/v1/module/AeternityModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"AeternityModule.js","sourceRoot":"","sources":["../../../src/v1/module/AeternityModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAU2B;AAE3B,mFAAiF;AACjF,mEAA2G;AAI3G;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,EAAE,IAAG,IAAI,kCAAqB,CAAC;gBAClD,iBAAiB,EAAE,CAAC,sDAAkC,CAAC;aACxD,CAAC;gBACH;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAgC1I,CAAC;IA9Bc,+CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,8CAAoB,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,iCAAiC,CAAC,CAAA;iBACvF;gBAED,sBAAO,IAAI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