@airgap/astar 0.13.7-beta.27 → 0.13.8-beta.10
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 +32 -17
- package/package.json +6 -6
- 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 +15 -8
- package/v1/module/AstarModule.js +109 -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/serializer/v3/serializer-companion.d.ts +14 -0
- package/v1/serializer/v3/serializer-companion.js +189 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +1 -4
- package/v1/serializer/v3/validators/transaction-validator.js +1 -10
- package/v1/serializer/v3/validators/transaction-validator.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
|
@@ -60136,6 +60136,12 @@ exports.NonExtendedProtocol = void 0;
|
|
|
60136
60136
|
var NonExtendedProtocol = /** @class */ (function () {
|
|
60137
60137
|
function NonExtendedProtocol() {
|
|
60138
60138
|
}
|
|
60139
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
60140
|
+
throw Promise.reject('extended public key support not implemented');
|
|
60141
|
+
};
|
|
60142
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
|
|
60143
|
+
throw Promise.reject('extended public key support not implemented');
|
|
60144
|
+
};
|
|
60139
60145
|
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
60140
60146
|
throw Promise.reject('extended private key support not implemented');
|
|
60141
60147
|
};
|
|
@@ -63847,30 +63853,30 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
63847
63853
|
}
|
|
63848
63854
|
switch (type) {
|
|
63849
63855
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.BOND_NOMINATE:
|
|
63850
|
-
(0, assert_1.assertFields)("".concat(
|
|
63856
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets', 'value', 'payee');
|
|
63851
63857
|
return [2 /*return*/, this.prepareNomination(publicKey, data.tip || 0, data.targets, data.controller || publicKey, data.value, data.payee)];
|
|
63852
63858
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.REBOND_NOMINATE:
|
|
63853
|
-
(0, assert_1.assertFields)("".concat(
|
|
63859
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets', 'value');
|
|
63854
63860
|
return [2 /*return*/, this.prepareRebondNominate(publicKey, data.tip || 0, data.targets, data.value)];
|
|
63855
63861
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.NOMINATE:
|
|
63856
|
-
(0, assert_1.assertFields)("".concat(
|
|
63862
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets');
|
|
63857
63863
|
return [2 /*return*/, this.prepareNomination(publicKey, data.tip || 0, data.targets)];
|
|
63858
63864
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.CANCEL_NOMINATION:
|
|
63859
63865
|
return [2 /*return*/, this.prepareScheduleUndelegate(publicKey, data.tip || 0, data.value)];
|
|
63860
63866
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.CHANGE_NOMINATION:
|
|
63861
|
-
(0, assert_1.assertFields)("".concat(
|
|
63867
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'targets');
|
|
63862
63868
|
return [2 /*return*/, this.prepareChangeValidator(publicKey, data.tip || 0, data.targets)];
|
|
63863
63869
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.UNBOND:
|
|
63864
|
-
(0, assert_1.assertFields)("".concat(
|
|
63870
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63865
63871
|
return [2 /*return*/, this.prepareUnbond(publicKey, data.tip || 0, data.value)];
|
|
63866
63872
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.REBOND:
|
|
63867
|
-
(0, assert_1.assertFields)("".concat(
|
|
63873
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63868
63874
|
return [2 /*return*/, this.prepareRebond(publicKey, data.tip || 0, data.value)];
|
|
63869
63875
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.BOND_EXTRA:
|
|
63870
|
-
(0, assert_1.assertFields)("".concat(
|
|
63876
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63871
63877
|
return [2 /*return*/, this.prepareBondExtra(publicKey, data.tip || 0, data.value)];
|
|
63872
63878
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.REBOND_EXTRA:
|
|
63873
|
-
(0, assert_1.assertFields)("".concat(
|
|
63879
|
+
(0, assert_1.assertFields)("".concat(type, " action"), data, 'value');
|
|
63874
63880
|
return [2 /*return*/, this.prepareRebondExtra(publicKey, data.tip || 0, data.value)];
|
|
63875
63881
|
case SubstrateStakingActionType_1.SubstrateStakingActionType.WITHDRAW_UNBONDED:
|
|
63876
63882
|
return [2 /*return*/, this.prepareWithdrawUnbonded(publicKey, data.tip || 0)];
|
|
@@ -65844,7 +65850,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
65844
65850
|
exports.SubstrateTransactionController = void 0;
|
|
65845
65851
|
var wasm_crypto_1 = require("@polkadot/wasm-crypto");
|
|
65846
65852
|
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
65853
|
+
// @ts-ignore
|
|
65847
65854
|
var keccak = require("@airgap/coinlib-core/dependencies/src/keccak-1.0.2/js");
|
|
65855
|
+
// @ts-ignore
|
|
65848
65856
|
var secp256k1 = __importStar(require("@airgap/coinlib-core/dependencies/src/secp256k1-4.0.2/elliptic"));
|
|
65849
65857
|
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
65850
65858
|
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
@@ -66327,6 +66335,7 @@ exports.SubstrateAccountInfo = SubstrateAccountInfo;
|
|
|
66327
66335
|
"use strict";
|
|
66328
66336
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66329
66337
|
exports.SubstrateAddress = void 0;
|
|
66338
|
+
// @ts-ignore
|
|
66330
66339
|
var bs58 = require("@airgap/coinlib-core/dependencies/src/bs58-4.0.1");
|
|
66331
66340
|
var blake2b_1 = require("@airgap/coinlib-core/utils/blake2b");
|
|
66332
66341
|
var hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
@@ -66940,9 +66949,10 @@ var MetadataV11 = /** @class */ (function (_super) {
|
|
|
66940
66949
|
};
|
|
66941
66950
|
MetadataV11.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
66942
66951
|
if (storage) {
|
|
66943
|
-
return storage.storageEntries.elements
|
|
66952
|
+
return (storage.storageEntries.elements
|
|
66953
|
+
// @ts-ignore
|
|
66944
66954
|
.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); });
|
|
66955
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
66946
66956
|
}
|
|
66947
66957
|
return undefined;
|
|
66948
66958
|
};
|
|
@@ -67566,9 +67576,10 @@ var MetadataV12 = /** @class */ (function (_super) {
|
|
|
67566
67576
|
};
|
|
67567
67577
|
MetadataV12.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
67568
67578
|
if (storage) {
|
|
67569
|
-
return storage.storageEntries.elements
|
|
67579
|
+
return (storage.storageEntries.elements
|
|
67580
|
+
// @ts-ignore
|
|
67570
67581
|
.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); });
|
|
67582
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
67572
67583
|
}
|
|
67573
67584
|
return undefined;
|
|
67574
67585
|
};
|
|
@@ -67706,9 +67717,10 @@ var MetadataV13 = /** @class */ (function (_super) {
|
|
|
67706
67717
|
};
|
|
67707
67718
|
MetadataV13.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
67708
67719
|
if (storage) {
|
|
67709
|
-
return storage.storageEntries.elements
|
|
67720
|
+
return (storage.storageEntries.elements
|
|
67721
|
+
// @ts-ignore
|
|
67710
67722
|
.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); });
|
|
67723
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
67712
67724
|
}
|
|
67713
67725
|
return undefined;
|
|
67714
67726
|
};
|
|
@@ -68169,9 +68181,10 @@ var MetadataV14 = /** @class */ (function (_super) {
|
|
|
68169
68181
|
};
|
|
68170
68182
|
MetadataV14.prototype.createDecoratedStorageEntries = function (storage, supportedStorageEntries) {
|
|
68171
68183
|
if (storage) {
|
|
68172
|
-
return storage.storageEntries.elements
|
|
68184
|
+
return (storage.storageEntries.elements
|
|
68185
|
+
// @ts-ignore
|
|
68173
68186
|
.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); });
|
|
68187
|
+
.map(function (entry) { return entry.type.decorate(storage.prefix.value, entry.name.value); }));
|
|
68175
68188
|
}
|
|
68176
68189
|
return undefined;
|
|
68177
68190
|
};
|
|
@@ -70610,7 +70623,8 @@ var SCALETuple = /** @class */ (function (_super) {
|
|
|
70610
70623
|
return new SCALETuple(firstParam, secondParam);
|
|
70611
70624
|
}
|
|
70612
70625
|
else {
|
|
70613
|
-
|
|
70626
|
+
var tuple = firstParam;
|
|
70627
|
+
return new SCALETuple(tuple[0], tuple[1]);
|
|
70614
70628
|
}
|
|
70615
70629
|
};
|
|
70616
70630
|
SCALETuple.decode = function (network, runtimeVersion, hex, decodeFirst, decodeSecond) {
|
|
@@ -73104,6 +73118,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
73104
73118
|
};
|
|
73105
73119
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73106
73120
|
exports.MoonbeamAddress = void 0;
|
|
73121
|
+
// @ts-ignore
|
|
73107
73122
|
var ethUtil = __importStar(require("@airgap/coinlib-core/dependencies/src/ethereumjs-util-5.2.0/index"));
|
|
73108
73123
|
var hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
73109
73124
|
var MoonbeamAddress = /** @class */ (function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/astar",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.8-beta.10",
|
|
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"
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@polkadot/wasm-crypto": "0.20.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@airgap/coinlib-core": "^0.13.
|
|
41
|
-
"@airgap/module-kit": "^0.13.
|
|
42
|
-
"@airgap/serializer": "^0.13.
|
|
43
|
-
"@airgap/substrate": "^0.13.
|
|
40
|
+
"@airgap/coinlib-core": "^0.13.8-beta.6",
|
|
41
|
+
"@airgap/module-kit": "^0.13.8-beta.6",
|
|
42
|
+
"@airgap/serializer": "^0.13.8-beta.6",
|
|
43
|
+
"@airgap/substrate": "^0.13.8-beta.6"
|
|
44
44
|
},
|
|
45
45
|
"localDependencies": {},
|
|
46
46
|
"nyc": {
|
|
@@ -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,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
|
+
import { AirGapModule, AirGapV3SerializerCompanion, 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
|
+
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
15
|
+
private createProtocol;
|
|
10
16
|
}
|
|
17
|
+
export {};
|
package/v1/module/AstarModule.js
CHANGED
|
@@ -1,38 +1,121 @@
|
|
|
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
|
|
23
|
-
|
|
45
|
+
var ShidenProtocol_1 = require("../protocol/ShidenProtocol");
|
|
46
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
47
|
+
var AstarModule = /** @class */ (function () {
|
|
24
48
|
function AstarModule() {
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
var _a;
|
|
50
|
+
this.networkRegistries = (_a = {},
|
|
51
|
+
_a[coinlib_core_1.MainProtocolSymbols.ASTAR] = new module_kit_1.ModuleNetworkRegistry({
|
|
52
|
+
supportedNetworks: [AstarProtocol_1.ASTAR_MAINNET_PROTOCOL_NETWORK]
|
|
53
|
+
}),
|
|
54
|
+
_a[coinlib_core_1.MainProtocolSymbols.SHIDEN] = new module_kit_1.ModuleNetworkRegistry({
|
|
55
|
+
supportedNetworks: [ShidenProtocol_1.SHIDEN_MAINNET_PROTOCOL_NETWORK]
|
|
56
|
+
}),
|
|
57
|
+
_a);
|
|
58
|
+
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
28
59
|
}
|
|
29
|
-
AstarModule.prototype.
|
|
30
|
-
return (0,
|
|
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, networkId) {
|
|
68
|
+
var _a;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var network;
|
|
71
|
+
return __generator(this, function (_b) {
|
|
72
|
+
network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
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, networkId) {
|
|
81
|
+
var _a;
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var network;
|
|
84
|
+
return __generator(this, function (_b) {
|
|
85
|
+
network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
86
|
+
if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
|
|
87
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Block Explorer network type not supported. (Astar)");
|
|
88
|
+
}
|
|
89
|
+
switch (identifier) {
|
|
90
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
91
|
+
return [2 /*return*/, (0, SubscanBlockExplorer_1.createAstarSubscanBlockExplorer)()];
|
|
92
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
93
|
+
return [2 /*return*/, (0, SubscanBlockExplorer_1.createShidenSubscanBlockExplorer)()];
|
|
94
|
+
default:
|
|
95
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Astar)"));
|
|
96
|
+
}
|
|
97
|
+
return [2 /*return*/];
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
AstarModule.prototype.createV3SerializerCompanion = function () {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
return [2 /*return*/, new serializer_companion_1.AstarV3SerializerCompanion()];
|
|
105
|
+
});
|
|
106
|
+
});
|
|
31
107
|
};
|
|
32
|
-
AstarModule.prototype.
|
|
33
|
-
|
|
108
|
+
AstarModule.prototype.createProtocol = function (identifier, network) {
|
|
109
|
+
switch (identifier) {
|
|
110
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
111
|
+
return (0, AstarProtocol_1.createAstarProtocol)({ network: network });
|
|
112
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
113
|
+
return (0, ShidenProtocol_1.createShidenProtocol)({ network: network });
|
|
114
|
+
default:
|
|
115
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Astar)"));
|
|
116
|
+
}
|
|
34
117
|
};
|
|
35
118
|
return AstarModule;
|
|
36
|
-
}(
|
|
119
|
+
}());
|
|
37
120
|
exports.AstarModule = AstarModule;
|
|
38
121
|
//# 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/Ast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MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAAA;iBAC1G;gBAED,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,KAAK;wBAC5B,sBAAO,IAAA,sDAA+B,GAAE,EAAA;oBAC1C,KAAK,kCAAmB,CAAC,MAAM;wBAC7B,sBAAO,IAAA,uDAAgC,GAAE,EAAA;oBAC3C;wBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,4BAAyB,CAAC,CAAA;iBACvG;;;;KACF;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,AAtDD,IAsDC;AAtDY,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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAO6B;AAE7B,+EAA6E;AAC7E,uFAAqF;AACrF,2DAAyD;AAQzD,gBAAgB;AAEhB;IACU,yCAOP;IAED,+BAAmB,OAAyC;QAC1D,IAAM,UAAU,GAAoB,IAAI,iCAAe,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAEtG,IAAM,iBAAiB,GAA2B,IAAI,+CAAsB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAC/G,IAAM,qBAAqB,GAA+B,IAAI,uDAA0B,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAE3H,IAAM,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,AA3CD,CACU,0BAAqB,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,M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IACf,MAAM,EAAE,yCAAyC;IACjD,gBAAgB,EAAE,qDAAqD;CACxE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShidenProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/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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AA+B,GAAK,OAAO,CAAE;KAC5D,CAAA;AACH,CAAC;AAJD,kEAIC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@airgap/module-kit';
|
|
2
|
+
import { V3SchemaConfiguration } from '@airgap/module-kit/types/serializer';
|
|
3
|
+
import { TransactionSignRequest, TransactionSignResponse } from '@airgap/serializer';
|
|
4
|
+
export declare class AstarV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
+
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
+
private readonly astarTransactionValidator;
|
|
7
|
+
constructor();
|
|
8
|
+
toTransactionSignRequest(identifier: string, unsignedTransaction: UnsignedTransaction, publicKey: string, callbackUrl?: string): Promise<TransactionSignRequest>;
|
|
9
|
+
fromTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<UnsignedTransaction>;
|
|
10
|
+
validateTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<boolean>;
|
|
11
|
+
toTransactionSignResponse(identifier: string, signedTransaction: SignedTransaction, accountIdentifier: string): Promise<TransactionSignResponse>;
|
|
12
|
+
fromTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<SignedTransaction>;
|
|
13
|
+
validateTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<boolean>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
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.AstarV3SerializerCompanion = void 0;
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
42
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
43
|
+
var serializer_1 = require("@airgap/serializer");
|
|
44
|
+
var transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
45
|
+
var transaction_validator_1 = require("./validators/transaction-validator");
|
|
46
|
+
var validators_1 = require("./validators/validators");
|
|
47
|
+
var astarTransactionSignRequest = require('./schemas/generated/transaction-sign-request-astar.json');
|
|
48
|
+
var astarTransactionSignResponse = require('./schemas/generated/transaction-sign-response-astar.json');
|
|
49
|
+
var AstarV3SerializerCompanion = /** @class */ (function () {
|
|
50
|
+
function AstarV3SerializerCompanion() {
|
|
51
|
+
this.schemas = [
|
|
52
|
+
{
|
|
53
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
54
|
+
schema: { schema: astarTransactionSignRequest },
|
|
55
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.ASTAR
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
59
|
+
schema: { schema: astarTransactionSignResponse },
|
|
60
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.ASTAR
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
64
|
+
schema: { schema: astarTransactionSignRequest },
|
|
65
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.SHIDEN
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
69
|
+
schema: { schema: astarTransactionSignResponse },
|
|
70
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.SHIDEN
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
this.astarTransactionValidator = new transaction_validator_1.AstarTransactionValidator();
|
|
74
|
+
Object.keys(validators_1.astarValidators).forEach(function (key) {
|
|
75
|
+
validate_1.validators[key] = validators_1.astarValidators[key];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
AstarV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (identifier) {
|
|
82
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
83
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
84
|
+
return [2 /*return*/, (0, transaction_converter_1.astarUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
85
|
+
default:
|
|
86
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
87
|
+
}
|
|
88
|
+
return [2 /*return*/];
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
AstarV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (identifier) {
|
|
96
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
97
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
98
|
+
return [2 /*return*/, (0, transaction_converter_1.astarTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
99
|
+
default:
|
|
100
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
101
|
+
}
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
AstarV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
return __generator(this, function (_c) {
|
|
110
|
+
switch (_c.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
_a = identifier;
|
|
113
|
+
switch (_a) {
|
|
114
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR: return [3 /*break*/, 1];
|
|
115
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN: return [3 /*break*/, 1];
|
|
116
|
+
}
|
|
117
|
+
return [3 /*break*/, 4];
|
|
118
|
+
case 1:
|
|
119
|
+
_c.trys.push([1, 3, , 4]);
|
|
120
|
+
return [4 /*yield*/, this.astarTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
121
|
+
case 2:
|
|
122
|
+
_c.sent();
|
|
123
|
+
return [2 /*return*/, true];
|
|
124
|
+
case 3:
|
|
125
|
+
_b = _c.sent();
|
|
126
|
+
return [2 /*return*/, false];
|
|
127
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
AstarV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (identifier) {
|
|
136
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
137
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
138
|
+
return [2 /*return*/, (0, transaction_converter_1.astarSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
139
|
+
default:
|
|
140
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
141
|
+
}
|
|
142
|
+
return [2 /*return*/];
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
AstarV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (identifier) {
|
|
150
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
151
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
152
|
+
return [2 /*return*/, (0, transaction_converter_1.astarTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
153
|
+
default:
|
|
154
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
155
|
+
}
|
|
156
|
+
return [2 /*return*/];
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
AstarV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
return __generator(this, function (_c) {
|
|
164
|
+
switch (_c.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
_a = identifier;
|
|
167
|
+
switch (_a) {
|
|
168
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR: return [3 /*break*/, 1];
|
|
169
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN: return [3 /*break*/, 1];
|
|
170
|
+
}
|
|
171
|
+
return [3 /*break*/, 4];
|
|
172
|
+
case 1:
|
|
173
|
+
_c.trys.push([1, 3, , 4]);
|
|
174
|
+
return [4 /*yield*/, this.astarTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
175
|
+
case 2:
|
|
176
|
+
_c.sent();
|
|
177
|
+
return [2 /*return*/, true];
|
|
178
|
+
case 3:
|
|
179
|
+
_b = _c.sent();
|
|
180
|
+
return [2 /*return*/, false];
|
|
181
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
return AstarV3SerializerCompanion;
|
|
187
|
+
}());
|
|
188
|
+
exports.AstarV3SerializerCompanion = AstarV3SerializerCompanion;
|
|
189
|
+
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,8FAA8F;AAC9F,sDAA8D;AAG9D,iDAAgH;AAGhH,mFAKkD;AAClD,4EAA8E;AAC9E,sDAAyD;AAEzD,IAAM,2BAA2B,GAAe,OAAO,CAAC,yDAAyD,CAAC,CAAA;AAClH,IAAM,4BAA4B,GAAe,OAAO,CAAC,0DAA0D,CAAC,CAAA;AAEpH;IA0BE;QAzBgB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,2BAA2B,EAAE;gBAC/C,kBAAkB,EAAE,kCAAmB,CAAC,KAAK;aAC9C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,4BAA4B,EAAE;gBAChD,kBAAkB,EAAE,kCAAmB,CAAC,KAAK;aAC9C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,2BAA2B,EAAE;gBA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C,yBAAyB,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,EAAA;;wBAAvF,SAAuF,CAAA;wBAEvF,sBAAO,IAAI,EAAA;;;wBAEX,sBAAO,KAAK,EAAA;4BAGd,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;;KAEzF;IACH,iCAAC;AAAD,CAAC,AAtHD,IAsHC;AAtHY,gEAA0B"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { TransactionValidator
|
|
1
|
+
import { TransactionValidator } from '@airgap/serializer';
|
|
2
2
|
import { SubstrateTransactionValidator } from '@airgap/substrate/v1';
|
|
3
3
|
export declare class AstarTransactionValidator extends SubstrateTransactionValidator implements TransactionValidator {
|
|
4
4
|
}
|
|
5
|
-
export declare class AstarTransactionValidatorFactory implements TransactionValidatorFactory<AstarTransactionValidator> {
|
|
6
|
-
create(): AstarTransactionValidator;
|
|
7
|
-
}
|
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.AstarTransactionValidator = void 0;
|
|
19
19
|
var v1_1 = require("@airgap/substrate/v1");
|
|
20
20
|
var AstarTransactionValidator = /** @class */ (function (_super) {
|
|
21
21
|
__extends(AstarTransactionValidator, _super);
|
|
@@ -25,13 +25,4 @@ var AstarTransactionValidator = /** @class */ (function (_super) {
|
|
|
25
25
|
return AstarTransactionValidator;
|
|
26
26
|
}(v1_1.SubstrateTransactionValidator));
|
|
27
27
|
exports.AstarTransactionValidator = AstarTransactionValidator;
|
|
28
|
-
var AstarTransactionValidatorFactory = /** @class */ (function () {
|
|
29
|
-
function AstarTransactionValidatorFactory() {
|
|
30
|
-
}
|
|
31
|
-
AstarTransactionValidatorFactory.prototype.create = function () {
|
|
32
|
-
return new AstarTransactionValidator();
|
|
33
|
-
};
|
|
34
|
-
return AstarTransactionValidatorFactory;
|
|
35
|
-
}());
|
|
36
|
-
exports.AstarTransactionValidatorFactory = AstarTransactionValidatorFactory;
|
|
37
28
|
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,2CAAoE;AAEpE;IAA+C,6CAA6B;IAA5E;;IAA8G,CAAC;IAAD,gCAAC;AAAD,CAAC,AAA/G,CAA+C,kCAA6B,GAAmC;AAAlG,8DAAyB
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,2CAAoE;AAEpE;IAA+C,6CAA6B;IAA5E;;IAA8G,CAAC;IAAD,gCAAC;AAAD,CAAC,AAA/G,CAA+C,kCAA6B,GAAmC;AAAlG,8DAAyB"}
|
|
@@ -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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AstarBaseModule.js","sourceRoot":"","sources":["../../../src/v1/module/AstarBaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6C;AAC7C,sDAAqE;AACrE,iDAAyF;AAKzF;IAME,yBAAsB,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,+CAAqB,GAAlC;;;gBACE,sBAAO,IAAI,CAAC,mBAAmB,EAAE,EAAA;;;KAClC;IAEY,8CAAoB,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,mBAAmB,CAAC,OAAO,CAAC,EAAA;;;KACzC;IAEY,6CAAmB,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,wBAAwB,CAAC,OAAO,CAAC,EAAA;;;KAC9C;IACH,sBAAC;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"}
|