@airgap/astar 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/airgap-coinlib-astar.min.js +26 -17
- package/package.json +2 -2
- package/v1/controller/AstarAccountController.js.map +1 -1
- package/v1/controller/AstarTransactionController.js.map +1 -1
- package/v1/index.d.ts +1 -2
- package/v1/index.js +1 -3
- package/v1/index.js.map +1 -1
- package/v1/module/AstarModule.d.ts +14 -8
- package/v1/module/AstarModule.js +101 -26
- package/v1/module/AstarModule.js.map +1 -1
- package/v1/node/AstarNodeClient.js.map +1 -1
- package/v1/protocol/AstarBaseProtocol.js.map +1 -1
- package/v1/protocol/AstarProtocol.js.map +1 -1
- package/v1/protocol/ShidenProtocol.js.map +1 -1
- package/v1/module/AstarBaseModule.d.ts +0 -15
- package/v1/module/AstarBaseModule.js +0 -82
- package/v1/module/AstarBaseModule.js.map +0 -1
- package/v1/module/ShidenModule.d.ts +0 -10
- package/v1/module/ShidenModule.js +0 -38
- package/v1/module/ShidenModule.js.map +0 -1
|
@@ -63847,30 +63847,30 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
63847
63847
|
}
|
|
63848
63848
|
switch (type) {
|
|
63849
63849
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.BOND_NOMINATE:
|
|
63850
|
-
(0, assert_1.assertFields)("".concat(
|
|
63850
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets', 'value', 'payee');
|
|
63851
63851
|
return [2 /*return*/, this.prepareNomination(publicKey, data.tip || 0, data.targets, data.controller || publicKey, data.value, data.payee)];
|
|
63852
63852
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.REBOND_NOMINATE:
|
|
63853
|
-
(0, assert_1.assertFields)("".concat(
|
|
63853
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets', 'value');
|
|
63854
63854
|
return [2 /*return*/, this.prepareRebondNominate(publicKey, data.tip || 0, data.targets, data.value)];
|
|
63855
63855
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.NOMINATE:
|
|
63856
|
-
(0, assert_1.assertFields)("".concat(
|
|
63856
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets');
|
|
63857
63857
|
return [2 /*return*/, this.prepareNomination(publicKey, data.tip || 0, data.targets)];
|
|
63858
63858
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.CANCEL_NOMINATION:
|
|
63859
63859
|
return [2 /*return*/, this.prepareScheduleUndelegate(publicKey, data.tip || 0, data.value)];
|
|
63860
63860
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.CHANGE_NOMINATION:
|
|
63861
|
-
(0, assert_1.assertFields)("".concat(
|
|
63861
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets');
|
|
63862
63862
|
return [2 /*return*/, this.prepareChangeValidator(publicKey, data.tip || 0, data.targets)];
|
|
63863
63863
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.UNBOND:
|
|
63864
|
-
(0, assert_1.assertFields)("".concat(
|
|
63864
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63865
63865
|
return [2 /*return*/, this.prepareUnbond(publicKey, data.tip || 0, data.value)];
|
|
63866
63866
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.REBOND:
|
|
63867
|
-
(0, assert_1.assertFields)("".concat(
|
|
63867
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63868
63868
|
return [2 /*return*/, this.prepareRebond(publicKey, data.tip || 0, data.value)];
|
|
63869
63869
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.BOND_EXTRA:
|
|
63870
|
-
(0, assert_1.assertFields)("".concat(
|
|
63870
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63871
63871
|
return [2 /*return*/, this.prepareBondExtra(publicKey, data.tip || 0, data.value)];
|
|
63872
63872
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.REBOND_EXTRA:
|
|
63873
|
-
(0, assert_1.assertFields)("".concat(
|
|
63873
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63874
63874
|
return [2 /*return*/, this.prepareRebondExtra(publicKey, data.tip || 0, data.value)];
|
|
63875
63875
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.WITHDRAW_UNBONDED:
|
|
63876
63876
|
return [2 /*return*/, this.prepareWithdrawUnbonded(publicKey, data.tip || 0)];
|
|
@@ -65844,7 +65844,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
65844
65844
|
exports.SubstrateTransactionController = void 0;
|
|
65845
65845
|
var wasm_crypto_1 = require("@polkadot/wasm-crypto");
|
|
65846
65846
|
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
65847
|
+
// @ts-ignore
|
|
65847
65848
|
var keccak = require("@airgap/coinlib-core/dependencies/src/keccak-1.0.2/js");
|
|
65849
|
+
// @ts-ignore
|
|
65848
65850
|
var secp256k1 = __importStar(require("@airgap/coinlib-core/dependencies/src/secp256k1-4.0.2/elliptic"));
|
|
65849
65851
|
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
65850
65852
|
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
@@ -66327,6 +66329,7 @@ exports.SubstrateAccountInfo = SubstrateAccountInfo;
|
|
|
66327
66329
|
"use strict";
|
|
66328
66330
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66329
66331
|
exports.SubstrateAddress = void 0;
|
|
66332
|
+
// @ts-ignore
|
|
66330
66333
|
var bs58 = require("@airgap/coinlib-core/dependencies/src/bs58-4.0.1");
|
|
66331
66334
|
var blake2b_1 = require("@airgap/coinlib-core/utils/blake2b");
|
|
66332
66335
|
var hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
@@ -66940,9 +66943,10 @@ var MetadataV11 = /** @class */ (function (_super) {
|
|
|
66940
66943
|
};
|
|
66941
66944
|
MetadataV11.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
66942
66945
|
if (storage) {
|
|
66943
|
-
return storage.storageEntries.elements
|
|
66946
|
+
return (storage.storageEntries.elements
|
|
66947
|
+
// @ts-ignore
|
|
66944
66948
|
.filter(function (entry) { return supportedStorageEntries[storage.prefix.value].includes(entry.name.value); })
|
|
66945
|
-
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); });
|
|
66949
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
66946
66950
|
}
|
|
66947
66951
|
return undefined;
|
|
66948
66952
|
};
|
|
@@ -67566,9 +67570,10 @@ var MetadataV12 = /** @class */ (function (_super) {
|
|
|
67566
67570
|
};
|
|
67567
67571
|
MetadataV12.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
67568
67572
|
if (storage) {
|
|
67569
|
-
return storage.storageEntries.elements
|
|
67573
|
+
return (storage.storageEntries.elements
|
|
67574
|
+
// @ts-ignore
|
|
67570
67575
|
.filter(function (entry) { return supportedStorageEntries[storage.prefix.value].includes(entry.name.value); })
|
|
67571
|
-
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); });
|
|
67576
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
67572
67577
|
}
|
|
67573
67578
|
return undefined;
|
|
67574
67579
|
};
|
|
@@ -67706,9 +67711,10 @@ var MetadataV13 = /** @class */ (function (_super) {
|
|
|
67706
67711
|
};
|
|
67707
67712
|
MetadataV13.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
67708
67713
|
if (storage) {
|
|
67709
|
-
return storage.storageEntries.elements
|
|
67714
|
+
return (storage.storageEntries.elements
|
|
67715
|
+
// @ts-ignore
|
|
67710
67716
|
.filter(function (entry) { return supportedStorageEntries[storage.prefix.value].includes(entry.name.value); })
|
|
67711
|
-
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); });
|
|
67717
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
67712
67718
|
}
|
|
67713
67719
|
return undefined;
|
|
67714
67720
|
};
|
|
@@ -68169,9 +68175,10 @@ var MetadataV14 = /** @class */ (function (_super) {
|
|
|
68169
68175
|
};
|
|
68170
68176
|
MetadataV14.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
68171
68177
|
if (storage) {
|
|
68172
|
-
return storage.storageEntries.elements
|
|
68178
|
+
return (storage.storageEntries.elements
|
|
68179
|
+
// @ts-ignore
|
|
68173
68180
|
.filter(function (entry) { return supportedStorageEntries[storage.prefix.value].includes(entry.name.value); })
|
|
68174
|
-
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); });
|
|
68181
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
68175
68182
|
}
|
|
68176
68183
|
return undefined;
|
|
68177
68184
|
};
|
|
@@ -70610,7 +70617,8 @@ var SCALETuple = /** @class */ (function (_super) {
|
|
|
70610
70617
|
return new SCALETuple(firstParam, secondParam);
|
|
70611
70618
|
}
|
|
70612
70619
|
else {
|
|
70613
|
-
|
|
70620
|
+
var tuple = firstParam;
|
|
70621
|
+
return new SCALETuple(tuple[0], tuple[1]);
|
|
70614
70622
|
}
|
|
70615
70623
|
};
|
|
70616
70624
|
SCALETuple.decode = function (network, runtimeVersion, hex, decodeFirst, decodeSecond) {
|
|
@@ -73104,6 +73112,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
73104
73112
|
};
|
|
73105
73113
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73106
73114
|
exports.MoonbeamAddress = void 0;
|
|
73115
|
+
// @ts-ignore
|
|
73107
73116
|
var ethUtil = __importStar(require("@airgap/coinlib-core/dependencies/src/ethereumjs-util-5.2.0/index"));
|
|
73108
73117
|
var hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
73109
73118
|
var MoonbeamAddress = /** @class */ (function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/astar",
|
|
3
|
-
"version": "0.13.8-beta.
|
|
3
|
+
"version": "0.13.8-beta.5",
|
|
4
4
|
"description": "The @airgap/astar is an Astar implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
27
27
|
"lint-ci": "tslint -t json -o ../../lint-reports/astar.json --project . || true",
|
|
28
28
|
"lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
|
|
29
|
-
"test": "nyc mocha --bail --require ts-node/register --require source-map-support/register --full-trace --delay --timeout 40000 ./test/**/**.spec.ts",
|
|
29
|
+
"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",
|
|
30
30
|
"test-ci": "nyc --reporter=lcov npm test",
|
|
31
31
|
"test-legacy": "",
|
|
32
32
|
"browserify": "browserify ./dist/index.js -p realpathify -s airgapCoinLibAstar > ./dist/airgap-coinlib-astar.min.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstarAccountController.js","sourceRoot":"","sources":["../../../src/v1/controller/AstarAccountController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAuE;
|
|
1
|
+
{"version":3,"file":"AstarAccountController.js","sourceRoot":"","sources":["../../../src/v1/controller/AstarAccountController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAuE;AAKvE;IAA4C,0CAA6E;IAAzH;;IAA2H,CAAC;IAAD,6BAAC;AAAD,CAAC,AAA5H,CAA4C,qCAAgC,GAAgD;AAA/G,wDAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstarTransactionController.js","sourceRoot":"","sources":["../../../src/v1/controller/AstarTransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA2E;
|
|
1
|
+
{"version":3,"file":"AstarTransactionController.js","sourceRoot":"","sources":["../../../src/v1/controller/AstarTransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA2E;AAK3E;IAAgD,8CAAiF;IAAjI;;IAAmI,CAAC;IAAD,iCAAC;AAAD,CAAC,AAApI,CAAgD,yCAAoC,GAAgD;AAAvH,gEAA0B"}
|
package/v1/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createAstarSubscanBlockExplorer, createShidenSubscanBlockExplorer } from './block-explorer/SubscanBlockExplorer';
|
|
2
2
|
import { AstarModule } from './module/AstarModule';
|
|
3
|
-
import { ShidenModule } from './module/ShidenModule';
|
|
4
3
|
import { AstarProtocol, createAstarProtocol } from './protocol/AstarProtocol';
|
|
5
4
|
import { createShidenProtocol, ShidenProtocol } from './protocol/ShidenProtocol';
|
|
6
5
|
import { AstarProtocolConfiguration } from './types/configuration';
|
|
7
6
|
import { AstarProtocolNetwork, AstarProtocolOptions, AstarUnits, ShidenUnits } from './types/protocol';
|
|
8
|
-
export { AstarModule
|
|
7
|
+
export { AstarModule };
|
|
9
8
|
export { AstarProtocol, createAstarProtocol, ShidenProtocol, createShidenProtocol };
|
|
10
9
|
export { createAstarSubscanBlockExplorer, createShidenSubscanBlockExplorer };
|
|
11
10
|
export { AstarUnits, ShidenUnits, AstarProtocolNetwork, AstarProtocolOptions, AstarProtocolConfiguration };
|
package/v1/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createShidenSubscanBlockExplorer = exports.createAstarSubscanBlockExplorer = exports.createShidenProtocol = exports.createAstarProtocol = exports.
|
|
3
|
+
exports.createShidenSubscanBlockExplorer = exports.createAstarSubscanBlockExplorer = exports.createShidenProtocol = exports.createAstarProtocol = exports.AstarModule = void 0;
|
|
4
4
|
var SubscanBlockExplorer_1 = require("./block-explorer/SubscanBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "createAstarSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createAstarSubscanBlockExplorer; } });
|
|
6
6
|
Object.defineProperty(exports, "createShidenSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createShidenSubscanBlockExplorer; } });
|
|
7
7
|
var AstarModule_1 = require("./module/AstarModule");
|
|
8
8
|
Object.defineProperty(exports, "AstarModule", { enumerable: true, get: function () { return AstarModule_1.AstarModule; } });
|
|
9
|
-
var ShidenModule_1 = require("./module/ShidenModule");
|
|
10
|
-
Object.defineProperty(exports, "ShidenModule", { enumerable: true, get: function () { return ShidenModule_1.ShidenModule; } });
|
|
11
9
|
var AstarProtocol_1 = require("./protocol/AstarProtocol");
|
|
12
10
|
Object.defineProperty(exports, "createAstarProtocol", { enumerable: true, get: function () { return AstarProtocol_1.createAstarProtocol; } });
|
|
13
11
|
var ShidenProtocol_1 = require("./protocol/ShidenProtocol");
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAAyH;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAAyH;AAiBhH,gHAjBA,sDAA+B,OAiBA;AAAE,iHAjBA,uDAAgC,OAiBA;AAhB1E,oDAAkD;AAQzC,4FARA,yBAAW,OAQA;AAPpB,0DAA6E;AAWrD,oGAXA,mCAAmB,OAWA;AAV3C,4DAAgF;AAUnB,qGAVpD,qCAAoB,OAUoD"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
|
+
import { AirGapModule, ProtocolConfiguration } from '@airgap/module-kit';
|
|
2
3
|
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare class AstarModule
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
5
|
+
declare type SupportedProtocols = MainProtocolSymbols.ASTAR | MainProtocolSymbols.SHIDEN;
|
|
6
|
+
export declare class AstarModule 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;
|
|
10
15
|
}
|
|
16
|
+
export {};
|
package/v1/module/AstarModule.js
CHANGED
|
@@ -1,38 +1,113 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
};
|
|
17
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
39
|
exports.AstarModule = 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");
|
|
19
43
|
var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
|
|
20
44
|
var AstarProtocol_1 = require("../protocol/AstarProtocol");
|
|
21
|
-
var
|
|
22
|
-
var AstarModule = /** @class */ (function (
|
|
23
|
-
__extends(AstarModule, _super);
|
|
45
|
+
var ShidenProtocol_1 = require("../protocol/ShidenProtocol");
|
|
46
|
+
var AstarModule = /** @class */ (function () {
|
|
24
47
|
function AstarModule() {
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
48
|
+
var _a;
|
|
49
|
+
this.networkRegistries = (_a = {},
|
|
50
|
+
_a[coinlib_core_1.MainProtocolSymbols.ASTAR] = new module_kit_1.ModuleNetworkRegistry({
|
|
51
|
+
supportedNetworks: [AstarProtocol_1.ASTAR_MAINNET_PROTOCOL_NETWORK]
|
|
52
|
+
}),
|
|
53
|
+
_a[coinlib_core_1.MainProtocolSymbols.SHIDEN] = new module_kit_1.ModuleNetworkRegistry({
|
|
54
|
+
supportedNetworks: [ShidenProtocol_1.SHIDEN_MAINNET_PROTOCOL_NETWORK]
|
|
55
|
+
}),
|
|
56
|
+
_a);
|
|
57
|
+
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
28
58
|
}
|
|
29
|
-
AstarModule.prototype.
|
|
30
|
-
return (0,
|
|
59
|
+
AstarModule.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
|
+
AstarModule.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. (Astar)");
|
|
74
|
+
}
|
|
75
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
AstarModule.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. (Astar)");
|
|
87
|
+
}
|
|
88
|
+
switch (identifier) {
|
|
89
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
90
|
+
return [2 /*return*/, (0, SubscanBlockExplorer_1.createAstarSubscanBlockExplorer)()];
|
|
91
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
92
|
+
return [2 /*return*/, (0, SubscanBlockExplorer_1.createShidenSubscanBlockExplorer)()];
|
|
93
|
+
default:
|
|
94
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Astar)"));
|
|
95
|
+
}
|
|
96
|
+
return [2 /*return*/];
|
|
97
|
+
});
|
|
98
|
+
});
|
|
31
99
|
};
|
|
32
|
-
AstarModule.prototype.
|
|
33
|
-
|
|
100
|
+
AstarModule.prototype.createProtocol = function (identifier, network) {
|
|
101
|
+
switch (identifier) {
|
|
102
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
103
|
+
return (0, AstarProtocol_1.createAstarProtocol)({ network: network });
|
|
104
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
105
|
+
return (0, ShidenProtocol_1.createShidenProtocol)({ network: network });
|
|
106
|
+
default:
|
|
107
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Astar)"));
|
|
108
|
+
}
|
|
34
109
|
};
|
|
35
110
|
return AstarModule;
|
|
36
|
-
}(
|
|
111
|
+
}());
|
|
37
112
|
exports.AstarModule = AstarModule;
|
|
38
113
|
//# sourceMappingURL=AstarModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstarModule.js","sourceRoot":"","sources":["../../../src/v1/module/AstarModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AstarModule.js","sourceRoot":"","sources":["../../../src/v1/module/AstarModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAA0I;AAI1I,+EAA0H;AAC1H,2DAA+F;AAC/F,6DAAkG;AAIlG;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,KAAK,IAAG,IAAI,kCAAqB,CAAC;gBACrD,iBAAiB,EA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AAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,4BAAyB,CAAC,CAAA;iBACvG;;;;KACF;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,AAlDD,IAkDC;AAlDY,kCAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstarNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/AstarNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAgE;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstarBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarBaseProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAO6B;
|
|
1
|
+
{"version":3,"file":"AstarBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarBaseProtocol.ts"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,GA0C9B;AA3CqB,sDAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstarProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;
|
|
1
|
+
{"version":3,"file":"AstarProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAM1D,yDAA8E;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,OAA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ocol/ShidenProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;
|
|
1
|
+
{"version":3,"file":"ShidenProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/ShidenProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAM1D,yDAA8E;AAC9E,iDAAqD;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;AAEY,QAAA,oBAAoB,GAA+B,mCAAmB,CAAA;AAEnF;IAAwC,sCAAkC;IACxE,4BAAmB,OAAoD;QAApD,wBAAA,EAAA,YAAoD;QACrE,IAAM,eAAe,GAAyB,2BAA2B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAE1F,IAAM,QAAQ,GAAkC,uBAAe,CAAA;QAC/D,IAAM,aAAa,GAA+B,4BAAoB,CAAA;eAEtE,kBAAM,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC;IACtE,CAAC;IACH,yBAAC;AAAD,CAAC,AATD,CAAwC,yCAAqB,GAS5D;AATY,gDAAkB;AAW/B,UAAU;AAEV,SAAgB,oBAAoB,CAAC,OAAoD;IAApD,wBAAA,EAAA,YAAoD;IACvF,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACxC,CAAC;AAFD,oDAEC;AAEY,QAAA,+BAA+B,GAAyB;IACnE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,0CAA0C;IAClD,gBAAgB,EAAE,sDAAsD;CACzE,CAAA;AAED,IAAM,+BAA+B,GAAyB,uCAA+B,CAAA;AAE7F,SAAgB,2BAA2B,CAAC,OAA2C;IAA3C,wBAAA,EAAA,YAA2C;IACrF,OAAO;QACL,OAAO,wBAAO,+BAA+B,GAAK,OAAO,CAAE;KAC5D,CAAA;AACH,CAAC;AAJD,kEAIC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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 { AstarBaseProtocol } from '../protocol/AstarBaseProtocol';
|
|
5
|
-
export declare abstract class AstarBaseModule 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 createAstarProtocol(network?: ProtocolNetwork): AstarBaseProtocol;
|
|
11
|
-
abstract createAstarBlockExplorer(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
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
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.AstarBaseModule = 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 AstarBaseModule = /** @class */ (function () {
|
|
44
|
-
function AstarBaseModule(supportedNetworks, defaultNetwork) {
|
|
45
|
-
this.networkRegistry = new module_kit_1.ModuleNetworkRegistry({ supportedNetworks: supportedNetworks, defaultNetwork: defaultNetwork });
|
|
46
|
-
this.supportedNetworks = this.networkRegistry.supportedNetworks;
|
|
47
|
-
}
|
|
48
|
-
AstarBaseModule.prototype.createOfflineProtocol = function () {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
return __generator(this, function (_a) {
|
|
51
|
-
return [2 /*return*/, this.createAstarProtocol()];
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
AstarBaseModule.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.createAstarProtocol(network)];
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
AstarBaseModule.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.createAstarBlockExplorer(network)];
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
return AstarBaseModule;
|
|
80
|
-
}());
|
|
81
|
-
exports.AstarBaseModule = AstarBaseModule;
|
|
82
|
-
//# sourceMappingURL=AstarBaseModule.js.map
|
|
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;AAAD,CAAC,AAnCD,IAmCC;AAnCqB,0CAAe"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
-
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
3
|
-
import { AstarBaseProtocol } from '../protocol/AstarBaseProtocol';
|
|
4
|
-
import { AstarBaseModule } from './AstarBaseModule';
|
|
5
|
-
export declare class ShidenModule extends AstarBaseModule {
|
|
6
|
-
protected readonly name: string;
|
|
7
|
-
constructor();
|
|
8
|
-
createAstarProtocol(network?: ProtocolNetwork | undefined): AstarBaseProtocol;
|
|
9
|
-
createAstarBlockExplorer(network: ProtocolNetwork): BlockExplorer;
|
|
10
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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.ShidenModule = void 0;
|
|
19
|
-
var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
|
|
20
|
-
var ShidenProtocol_1 = require("../protocol/ShidenProtocol");
|
|
21
|
-
var AstarBaseModule_1 = require("./AstarBaseModule");
|
|
22
|
-
var ShidenModule = /** @class */ (function (_super) {
|
|
23
|
-
__extends(ShidenModule, _super);
|
|
24
|
-
function ShidenModule() {
|
|
25
|
-
var _this = _super.call(this, [ShidenProtocol_1.SHIDEN_MAINNET_PROTOCOL_NETWORK]) || this;
|
|
26
|
-
_this.name = 'Shiden';
|
|
27
|
-
return _this;
|
|
28
|
-
}
|
|
29
|
-
ShidenModule.prototype.createAstarProtocol = function (network) {
|
|
30
|
-
return (0, ShidenProtocol_1.createShidenProtocol)({ network: network });
|
|
31
|
-
};
|
|
32
|
-
ShidenModule.prototype.createAstarBlockExplorer = function (network) {
|
|
33
|
-
return (0, SubscanBlockExplorer_1.createShidenSubscanBlockExplorer)();
|
|
34
|
-
};
|
|
35
|
-
return ShidenModule;
|
|
36
|
-
}(AstarBaseModule_1.AstarBaseModule));
|
|
37
|
-
exports.ShidenModule = ShidenModule;
|
|
38
|
-
//# sourceMappingURL=ShidenModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ShidenModule.js","sourceRoot":"","sources":["../../../src/v1/module/ShidenModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,+EAAyF;AAEzF,6DAAkG;AAClG,qDAAmD;AAEnD;IAAkC,gCAAe;IAG/C;QAAA,YACE,kBAAM,CAAC,gDAA+B,CAAC,CAAC,SACzC;QAJkB,UAAI,GAAW,QAAQ,CAAA;;IAI1C,CAAC;IAEM,0CAAmB,GAA1B,UAA2B,OAAqC;QAC9D,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC1C,CAAC;IAEM,+CAAwB,GAA/B,UAAgC,OAAwB;QACtD,OAAO,IAAA,uDAAgC,GAAE,CAAA;IAC3C,CAAC;IACH,mBAAC;AAAD,CAAC,AAdD,CAAkC,iCAAe,GAchD;AAdY,oCAAY"}
|