@airgap/polkadot 0.13.8-beta.9 → 0.13.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/airgap-coinlib-polkadot.min.js +0 -6
- package/package.json +4 -5
- package/v1/index.d.ts +2 -1
- package/v1/index.js +3 -1
- package/v1/index.js.map +1 -1
- package/v1/module/KusamaModule.d.ts +9 -0
- package/v1/module/KusamaModule.js +38 -0
- package/v1/module/KusamaModule.js.map +1 -0
- package/v1/module/PolkadotBaseModule.d.ts +15 -0
- package/v1/module/PolkadotBaseModule.js +82 -0
- package/v1/module/PolkadotBaseModule.js.map +1 -0
- package/v1/module/PolkadotModule.d.ts +8 -15
- package/v1/module/PolkadotModule.js +26 -109
- package/v1/module/PolkadotModule.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.d.ts +4 -1
- package/v1/serializer/v3/validators/transaction-validator.js +10 -1
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.d.ts +0 -14
- package/v1/serializer/v3/serializer-companion.js +0 -189
- package/v1/serializer/v3/serializer-companion.js.map +0 -1
|
@@ -59754,12 +59754,6 @@ exports.NonExtendedProtocol = void 0;
|
|
|
59754
59754
|
var NonExtendedProtocol = /** @class */ (function () {
|
|
59755
59755
|
function NonExtendedProtocol() {
|
|
59756
59756
|
}
|
|
59757
|
-
NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
59758
|
-
throw Promise.reject('extended public key support not implemented');
|
|
59759
|
-
};
|
|
59760
|
-
NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
|
|
59761
|
-
throw Promise.reject('extended public key support not implemented');
|
|
59762
|
-
};
|
|
59763
59757
|
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
59764
59758
|
throw Promise.reject('extended private key support not implemented');
|
|
59765
59759
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/polkadot",
|
|
3
|
-
"version": "0.13.8
|
|
3
|
+
"version": "0.13.8",
|
|
4
4
|
"description": "The @airgap/polkadot is a Polkadot implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -33,10 +33,9 @@
|
|
|
33
33
|
},
|
|
34
34
|
"author": "Papers GmbH <contact@papers.ch> (https://papers.ch)",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@airgap/coinlib-core": "^0.13.8
|
|
37
|
-
"@airgap/module-kit": "^0.13.8
|
|
38
|
-
"@airgap/
|
|
39
|
-
"@airgap/substrate": "^0.13.8-beta.6"
|
|
36
|
+
"@airgap/coinlib-core": "^0.13.8",
|
|
37
|
+
"@airgap/module-kit": "^0.13.8",
|
|
38
|
+
"@airgap/substrate": "^0.13.8"
|
|
40
39
|
},
|
|
41
40
|
"localDependencies": {},
|
|
42
41
|
"nyc": {
|
package/v1/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createKusamaSubscanBlockExplorer, createPolkadotSubscanBlockExplorer } from './block-explorer/SubscanBlockExplorer';
|
|
2
|
+
import { KusamaModule } from './module/KusamaModule';
|
|
2
3
|
import { PolkadotModule } from './module/PolkadotModule';
|
|
3
4
|
import { createKusamaProtocol, KusamaProtocol } from './protocol/KusamaProtocol';
|
|
4
5
|
import { createPolkadotProtocol, PolkadotProtocol } from './protocol/PolkadotProtocol';
|
|
5
6
|
import { PolkadotProtocolConfiguration } from './types/configuration';
|
|
6
7
|
import { KusamaUnits, PolkadotProtocolNetwork, PolkadotProtocolOptions, PolkadotUnits } from './types/protocol';
|
|
7
|
-
export { PolkadotModule };
|
|
8
|
+
export { PolkadotModule, KusamaModule };
|
|
8
9
|
export { PolkadotProtocol, createPolkadotProtocol, KusamaProtocol, createKusamaProtocol };
|
|
9
10
|
export { createPolkadotSubscanBlockExplorer, createKusamaSubscanBlockExplorer };
|
|
10
11
|
export { PolkadotUnits, KusamaUnits, PolkadotProtocolNetwork, PolkadotProtocolOptions, PolkadotProtocolConfiguration };
|
package/v1/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createKusamaSubscanBlockExplorer = exports.createPolkadotSubscanBlockExplorer = exports.createKusamaProtocol = exports.createPolkadotProtocol = exports.PolkadotModule = void 0;
|
|
3
|
+
exports.createKusamaSubscanBlockExplorer = exports.createPolkadotSubscanBlockExplorer = exports.createKusamaProtocol = exports.createPolkadotProtocol = exports.KusamaModule = exports.PolkadotModule = void 0;
|
|
4
4
|
var SubscanBlockExplorer_1 = require("./block-explorer/SubscanBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "createKusamaSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createKusamaSubscanBlockExplorer; } });
|
|
6
6
|
Object.defineProperty(exports, "createPolkadotSubscanBlockExplorer", { enumerable: true, get: function () { return SubscanBlockExplorer_1.createPolkadotSubscanBlockExplorer; } });
|
|
7
|
+
var KusamaModule_1 = require("./module/KusamaModule");
|
|
8
|
+
Object.defineProperty(exports, "KusamaModule", { enumerable: true, get: function () { return KusamaModule_1.KusamaModule; } });
|
|
7
9
|
var PolkadotModule_1 = require("./module/PolkadotModule");
|
|
8
10
|
Object.defineProperty(exports, "PolkadotModule", { enumerable: true, get: function () { return PolkadotModule_1.PolkadotModule; } });
|
|
9
11
|
var KusamaProtocol_1 = require("./protocol/KusamaProtocol");
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAA4H;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAA4H;AAkB/E,iHAlBpC,uDAAgC,OAkBoC;AAApE,mHAlBkC,yDAAkC,OAkBlC;AAjB3C,sDAAoD;AAS3B,6FAThB,2BAAY,OASgB;AARrC,0DAAwD;AAQ/C,+FARA,+BAAc,OAQA;AAPvB,4DAAgF;AAWb,qGAX1D,qCAAoB,OAW0D;AAVvF,gEAAsF;AAU3D,uGAVlB,yCAAsB,OAUkB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirGapBlockExplorer, ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { PolkadotBaseProtocol } from '../protocol/PolkadotBaseProtocol';
|
|
3
|
+
import { PolkadotBaseModule } from './PolkadotBaseModule';
|
|
4
|
+
export declare class KusamaModule extends PolkadotBaseModule {
|
|
5
|
+
protected readonly name: string;
|
|
6
|
+
constructor();
|
|
7
|
+
createPolkadotProtocol(network?: ProtocolNetwork | undefined): PolkadotBaseProtocol;
|
|
8
|
+
createPolkadotBlockExplorer(network: ProtocolNetwork): AirGapBlockExplorer;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.KusamaModule = void 0;
|
|
19
|
+
var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
|
|
20
|
+
var KusamaProtocol_1 = require("../protocol/KusamaProtocol");
|
|
21
|
+
var PolkadotBaseModule_1 = require("./PolkadotBaseModule");
|
|
22
|
+
var KusamaModule = /** @class */ (function (_super) {
|
|
23
|
+
__extends(KusamaModule, _super);
|
|
24
|
+
function KusamaModule() {
|
|
25
|
+
var _this = _super.call(this, [KusamaProtocol_1.KUSAMA_MAINNET_PROTOCOL_NETWORK]) || this;
|
|
26
|
+
_this.name = 'Kusama';
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
KusamaModule.prototype.createPolkadotProtocol = function (network) {
|
|
30
|
+
return (0, KusamaProtocol_1.createKusamaProtocol)({ network: network });
|
|
31
|
+
};
|
|
32
|
+
KusamaModule.prototype.createPolkadotBlockExplorer = function (network) {
|
|
33
|
+
return (0, SubscanBlockExplorer_1.createKusamaSubscanBlockExplorer)();
|
|
34
|
+
};
|
|
35
|
+
return KusamaModule;
|
|
36
|
+
}(PolkadotBaseModule_1.PolkadotBaseModule));
|
|
37
|
+
exports.KusamaModule = KusamaModule;
|
|
38
|
+
//# sourceMappingURL=KusamaModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KusamaModule.js","sourceRoot":"","sources":["../../../src/v1/module/KusamaModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,+EAAyF;AACzF,6DAAkG;AAGlG,2DAAyD;AAEzD;IAAkC,gCAAkB;IAGlD;QAAA,YACE,kBAAM,CAAC,gDAA+B,CAAC,CAAC,SACzC;QAJkB,UAAI,GAAW,QAAQ,CAAA;;IAI1C,CAAC;IAEM,6CAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC1C,CAAC;IAEM,kDAA2B,GAAlC,UAAmC,OAAwB;QACzD,OAAO,IAAA,uDAAgC,GAAE,CAAA;IAC3C,CAAC;IACH,mBAAC;AAAD,CAAC,AAdD,CAAkC,uCAAkB,GAcnD;AAdY,oCAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AirGapModule, ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
import { AirGapBlockExplorer, BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
3
|
+
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
4
|
+
import { PolkadotBaseProtocol } from '../protocol/PolkadotBaseProtocol';
|
|
5
|
+
export declare abstract class PolkadotBaseModule 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 createPolkadotProtocol(network?: ProtocolNetwork): PolkadotBaseProtocol;
|
|
11
|
+
abstract createPolkadotBlockExplorer(network: ProtocolNetwork): AirGapBlockExplorer;
|
|
12
|
+
createOfflineProtocol(): Promise<OfflineProtocol<{}> | undefined>;
|
|
13
|
+
createOnlineProtocol(networkId?: string | undefined): Promise<OnlineProtocol<{}> | undefined>;
|
|
14
|
+
createBlockExplorer(networkId?: string | undefined): Promise<BlockExplorer | undefined>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.PolkadotBaseModule = 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 PolkadotBaseModule = /** @class */ (function () {
|
|
44
|
+
function PolkadotBaseModule(supportedNetworks, defaultNetwork) {
|
|
45
|
+
this.networkRegistry = new module_kit_1.ModuleNetworkRegistry({ supportedNetworks: supportedNetworks, defaultNetwork: defaultNetwork });
|
|
46
|
+
this.supportedNetworks = this.networkRegistry.supportedNetworks;
|
|
47
|
+
}
|
|
48
|
+
PolkadotBaseModule.prototype.createOfflineProtocol = function () {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
return [2 /*return*/, this.createPolkadotProtocol()];
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
PolkadotBaseModule.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.createPolkadotProtocol(network)];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
PolkadotBaseModule.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.createPolkadotBlockExplorer(network)];
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return PolkadotBaseModule;
|
|
80
|
+
}());
|
|
81
|
+
exports.PolkadotBaseModule = PolkadotBaseModule;
|
|
82
|
+
//# sourceMappingURL=PolkadotBaseModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolkadotBaseModule.js","sourceRoot":"","sources":["../../../src/v1/module/PolkadotBaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA6C;AAC7C,sDAAqE;AACrE,iDAAyF;AAKzF;IAME,4BAAsB,iBAAoC,EAAE,cAAgC;QAC1F,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAqB,CAAC,EAAE,iBAAiB,mBAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,CAAA;QACvF,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAA;IACjE,CAAC;IAKY,kDAAqB,GAAlC;;;gBACE,sBAAO,IAAI,CAAC,sBAAsB,EAAE,EAAA;;;KACrC;IAEY,iDAAoB,GAAjC,UAAkC,SAA8B;;;;gBACxD,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,gDAAyC,IAAI,CAAC,IAAI,MAAG,CAAC,CAAA;iBAC3G;gBAED,sBAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAA;;;KAC5C;IAEY,gDAAmB,GAAhC,UAAiC,SAA8B;;;;gBACvD,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,SAAS,EAAE;oBAC/B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,sDAA+C,IAAI,CAAC,IAAI,MAAG,CAAC,CAAA;iBACjH;gBAED,sBAAO,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,EAAA;;;KACjD;IACH,yBAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCqB,gDAAkB"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
1
|
+
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
3
2
|
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare class PolkadotModule
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
3
|
+
import { PolkadotBaseProtocol } from '../protocol/PolkadotBaseProtocol';
|
|
4
|
+
import { PolkadotBaseModule } from './PolkadotBaseModule';
|
|
5
|
+
export declare class PolkadotModule extends PolkadotBaseModule {
|
|
6
|
+
protected readonly name: string;
|
|
7
|
+
constructor();
|
|
8
|
+
createPolkadotProtocol(network?: ProtocolNetwork | undefined): PolkadotBaseProtocol;
|
|
9
|
+
createPolkadotBlockExplorer(network: ProtocolNetwork): BlockExplorer;
|
|
16
10
|
}
|
|
17
|
-
export {};
|
|
@@ -1,121 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
38
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
18
|
exports.PolkadotModule = void 0;
|
|
40
|
-
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
-
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
42
|
-
var module_kit_1 = require("@airgap/module-kit");
|
|
43
19
|
var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
|
|
44
|
-
var KusamaProtocol_1 = require("../protocol/KusamaProtocol");
|
|
45
20
|
var PolkadotProtocol_1 = require("../protocol/PolkadotProtocol");
|
|
46
|
-
var
|
|
47
|
-
var PolkadotModule = /** @class */ (function () {
|
|
21
|
+
var PolkadotBaseModule_1 = require("./PolkadotBaseModule");
|
|
22
|
+
var PolkadotModule = /** @class */ (function (_super) {
|
|
23
|
+
__extends(PolkadotModule, _super);
|
|
48
24
|
function PolkadotModule() {
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
supportedNetworks: [PolkadotProtocol_1.POLKADOT_MAINNET_PROTOCOL_NETWORK]
|
|
53
|
-
}),
|
|
54
|
-
_a[coinlib_core_1.MainProtocolSymbols.KUSAMA] = new module_kit_1.ModuleNetworkRegistry({
|
|
55
|
-
supportedNetworks: [KusamaProtocol_1.KUSAMA_MAINNET_PROTOCOL_NETWORK]
|
|
56
|
-
}),
|
|
57
|
-
_a);
|
|
58
|
-
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
25
|
+
var _this = _super.call(this, [PolkadotProtocol_1.POLKADOT_MAINNET_PROTOCOL_NETWORK]) || this;
|
|
26
|
+
_this.name = 'Polkadot';
|
|
27
|
+
return _this;
|
|
59
28
|
}
|
|
60
|
-
PolkadotModule.prototype.
|
|
61
|
-
return
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
return [2 /*return*/, this.createProtocol(identifier)];
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
PolkadotModule.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. (Polkadot)");
|
|
75
|
-
}
|
|
76
|
-
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
PolkadotModule.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. (Polkadot)");
|
|
88
|
-
}
|
|
89
|
-
switch (identifier) {
|
|
90
|
-
case coinlib_core_1.MainProtocolSymbols.POLKADOT:
|
|
91
|
-
return [2 /*return*/, (0, SubscanBlockExplorer_1.createPolkadotSubscanBlockExplorer)()];
|
|
92
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA:
|
|
93
|
-
return [2 /*return*/, (0, SubscanBlockExplorer_1.createKusamaSubscanBlockExplorer)()];
|
|
94
|
-
default:
|
|
95
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Polkadot)"));
|
|
96
|
-
}
|
|
97
|
-
return [2 /*return*/];
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
PolkadotModule.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.PolkadotV3SerializerCompanion()];
|
|
105
|
-
});
|
|
106
|
-
});
|
|
29
|
+
PolkadotModule.prototype.createPolkadotProtocol = function (network) {
|
|
30
|
+
return (0, PolkadotProtocol_1.createPolkadotProtocol)({ network: network });
|
|
107
31
|
};
|
|
108
|
-
PolkadotModule.prototype.
|
|
109
|
-
|
|
110
|
-
case coinlib_core_1.MainProtocolSymbols.POLKADOT:
|
|
111
|
-
return (0, PolkadotProtocol_1.createPolkadotProtocol)({ network: network });
|
|
112
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA:
|
|
113
|
-
return (0, KusamaProtocol_1.createKusamaProtocol)({ network: network });
|
|
114
|
-
default:
|
|
115
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Polkadot)"));
|
|
116
|
-
}
|
|
32
|
+
PolkadotModule.prototype.createPolkadotBlockExplorer = function (network) {
|
|
33
|
+
return (0, SubscanBlockExplorer_1.createPolkadotSubscanBlockExplorer)();
|
|
117
34
|
};
|
|
118
35
|
return PolkadotModule;
|
|
119
|
-
}());
|
|
36
|
+
}(PolkadotBaseModule_1.PolkadotBaseModule));
|
|
120
37
|
exports.PolkadotModule = PolkadotModule;
|
|
121
38
|
//# sourceMappingURL=PolkadotModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolkadotModule.js","sourceRoot":"","sources":["../../../src/v1/module/PolkadotModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PolkadotModule.js","sourceRoot":"","sources":["../../../src/v1/module/PolkadotModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,+EAA2F;AAE3F,iEAAwG;AACxG,2DAAyD;AAEzD;IAAoC,kCAAkB;IAGpD;QAAA,YACE,kBAAM,CAAC,oDAAiC,CAAC,CAAC,SAC3C;QAJkB,UAAI,GAAW,UAAU,CAAA;;IAI5C,CAAC;IAEM,+CAAsB,GAA7B,UAA8B,OAAqC;QACjE,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;IAC5C,CAAC;IAEM,oDAA2B,GAAlC,UAAmC,OAAwB;QACzD,OAAO,IAAA,yDAAkC,GAAE,CAAA;IAC7C,CAAC;IACH,qBAAC;AAAD,CAAC,AAdD,CAAoC,uCAAkB,GAcrD;AAdY,wCAAc"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { TransactionValidator } from '@airgap/serializer';
|
|
1
|
+
import { TransactionValidator, TransactionValidatorFactory } from '@airgap/serializer';
|
|
2
2
|
import { SubstrateTransactionValidator } from '@airgap/substrate/v1';
|
|
3
3
|
export declare class PolkadotTransactionValidator extends SubstrateTransactionValidator implements TransactionValidator {
|
|
4
4
|
}
|
|
5
|
+
export declare class PolkadotTransactionValidatorFactory implements TransactionValidatorFactory<PolkadotTransactionValidator> {
|
|
6
|
+
create(): PolkadotTransactionValidator;
|
|
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.PolkadotTransactionValidator = void 0;
|
|
18
|
+
exports.PolkadotTransactionValidatorFactory = exports.PolkadotTransactionValidator = void 0;
|
|
19
19
|
var v1_1 = require("@airgap/substrate/v1");
|
|
20
20
|
var PolkadotTransactionValidator = /** @class */ (function (_super) {
|
|
21
21
|
__extends(PolkadotTransactionValidator, _super);
|
|
@@ -25,4 +25,13 @@ var PolkadotTransactionValidator = /** @class */ (function (_super) {
|
|
|
25
25
|
return PolkadotTransactionValidator;
|
|
26
26
|
}(v1_1.SubstrateTransactionValidator));
|
|
27
27
|
exports.PolkadotTransactionValidator = PolkadotTransactionValidator;
|
|
28
|
+
var PolkadotTransactionValidatorFactory = /** @class */ (function () {
|
|
29
|
+
function PolkadotTransactionValidatorFactory() {
|
|
30
|
+
}
|
|
31
|
+
PolkadotTransactionValidatorFactory.prototype.create = function () {
|
|
32
|
+
return new PolkadotTransactionValidator();
|
|
33
|
+
};
|
|
34
|
+
return PolkadotTransactionValidatorFactory;
|
|
35
|
+
}());
|
|
36
|
+
exports.PolkadotTransactionValidatorFactory = PolkadotTransactionValidatorFactory;
|
|
28
37
|
//# 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;IAAkD,gDAA6B;IAA/E;;IAAiH,CAAC;IAAD,mCAAC;AAAD,CAAC,AAAlH,CAAkD,kCAA6B,GAAmC;AAArG,oEAA4B"}
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,2CAAoE;AAEpE;IAAkD,gDAA6B;IAA/E;;IAAiH,CAAC;IAAD,mCAAC;AAAD,CAAC,AAAlH,CAAkD,kCAA6B,GAAmC;AAArG,oEAA4B;AAEzC;IAAA;IAIA,CAAC;IAHQ,oDAAM,GAAb;QACE,OAAO,IAAI,4BAA4B,EAAE,CAAA;IAC3C,CAAC;IACH,0CAAC;AAAD,CAAC,AAJD,IAIC;AAJY,kFAAmC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 PolkadotV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
-
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
-
private readonly polkadotTransactionValidator;
|
|
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
|
-
}
|
|
@@ -1,189 +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.PolkadotV3SerializerCompanion = 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 polkadotTransactionSignRequest = require('./schemas/generated/transaction-sign-request-polkadot.json');
|
|
48
|
-
var polkadotTransactionSignResponse = require('./schemas/generated/transaction-sign-response-polkadot.json');
|
|
49
|
-
var PolkadotV3SerializerCompanion = /** @class */ (function () {
|
|
50
|
-
function PolkadotV3SerializerCompanion() {
|
|
51
|
-
this.schemas = [
|
|
52
|
-
{
|
|
53
|
-
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
54
|
-
schema: { schema: polkadotTransactionSignRequest },
|
|
55
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.POLKADOT
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
59
|
-
schema: { schema: polkadotTransactionSignResponse },
|
|
60
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.POLKADOT
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
64
|
-
schema: { schema: polkadotTransactionSignRequest },
|
|
65
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.KUSAMA
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
69
|
-
schema: { schema: polkadotTransactionSignResponse },
|
|
70
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.KUSAMA
|
|
71
|
-
}
|
|
72
|
-
];
|
|
73
|
-
this.polkadotTransactionValidator = new transaction_validator_1.PolkadotTransactionValidator();
|
|
74
|
-
Object.keys(validators_1.polkadotValidators).forEach(function (key) {
|
|
75
|
-
validate_1.validators[key] = validators_1.polkadotValidators[key];
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
PolkadotV3SerializerCompanion.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.POLKADOT:
|
|
83
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA:
|
|
84
|
-
return [2 /*return*/, (0, transaction_converter_1.polkadotUnsignedTransactionToRequest)(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
|
-
PolkadotV3SerializerCompanion.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.POLKADOT:
|
|
97
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA:
|
|
98
|
-
return [2 /*return*/, (0, transaction_converter_1.polkadotTransactionSignRequestToUnsigned)(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
|
-
PolkadotV3SerializerCompanion.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.POLKADOT: return [3 /*break*/, 1];
|
|
115
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA: 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.polkadotTransactionValidator.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
|
-
PolkadotV3SerializerCompanion.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.POLKADOT:
|
|
137
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA:
|
|
138
|
-
return [2 /*return*/, (0, transaction_converter_1.polkadotSignedTransactionToResponse)(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
|
-
PolkadotV3SerializerCompanion.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.POLKADOT:
|
|
151
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA:
|
|
152
|
-
return [2 /*return*/, (0, transaction_converter_1.polkadotTransactionSignResponseToSigned)(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
|
-
PolkadotV3SerializerCompanion.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.POLKADOT: return [3 /*break*/, 1];
|
|
169
|
-
case coinlib_core_1.MainProtocolSymbols.KUSAMA: 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.polkadotTransactionValidator.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 PolkadotV3SerializerCompanion;
|
|
187
|
-
}());
|
|
188
|
-
exports.PolkadotV3SerializerCompanion = PolkadotV3SerializerCompanion;
|
|
189
|
-
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,4EAAiF;AACjF,sDAA4D;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