@airgap/moonbeam 0.13.8-beta.5 → 0.13.8-beta.7
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-moonbeam.min.js +6 -0
- package/package.json +5 -5
- package/v1/module/MoonbeamModule.d.ts +2 -1
- package/v1/module/MoonbeamModule.js +8 -0
- package/v1/module/MoonbeamModule.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
|
@@ -87701,6 +87701,12 @@ exports.NonExtendedProtocol = void 0;
|
|
|
87701
87701
|
var NonExtendedProtocol = /** @class */ (function () {
|
|
87702
87702
|
function NonExtendedProtocol() {
|
|
87703
87703
|
}
|
|
87704
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
87705
|
+
throw Promise.reject('extended public key support not implemented');
|
|
87706
|
+
};
|
|
87707
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
|
|
87708
|
+
throw Promise.reject('extended public key support not implemented');
|
|
87709
|
+
};
|
|
87704
87710
|
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
87705
87711
|
throw Promise.reject('extended private key support not implemented');
|
|
87706
87712
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/moonbeam",
|
|
3
|
-
"version": "0.13.8-beta.
|
|
3
|
+
"version": "0.13.8-beta.7",
|
|
4
4
|
"description": "The @airgap/moonbeam is a Moonbeam implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"author": "Papers GmbH <contact@papers.ch> (https://papers.ch)",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@airgap/coinlib-core": "^0.13.
|
|
37
|
-
"@airgap/module-kit": "^0.13.
|
|
38
|
-
"@airgap/serializer": "^0.13.
|
|
39
|
-
"@airgap/substrate": "^0.13.
|
|
36
|
+
"@airgap/coinlib-core": "^0.13.8-beta.6",
|
|
37
|
+
"@airgap/module-kit": "^0.13.8-beta.6",
|
|
38
|
+
"@airgap/serializer": "^0.13.8-beta.6",
|
|
39
|
+
"@airgap/substrate": "^0.13.8-beta.6"
|
|
40
40
|
},
|
|
41
41
|
"localDependencies": {},
|
|
42
42
|
"nyc": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
|
-
import { AirGapModule, ProtocolConfiguration } from '@airgap/module-kit';
|
|
2
|
+
import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
3
3
|
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
4
4
|
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
5
5
|
declare type SupportedProtocols = MainProtocolSymbols.MOONBEAM | MainProtocolSymbols.MOONRIVER;
|
|
@@ -11,6 +11,7 @@ export declare class MoonbeamModule implements AirGapModule<{
|
|
|
11
11
|
createOfflineProtocol(identifier: SupportedProtocols): Promise<OfflineProtocol | undefined>;
|
|
12
12
|
createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<OnlineProtocol | undefined>;
|
|
13
13
|
createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<BlockExplorer | undefined>;
|
|
14
|
+
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
14
15
|
private createProtocol;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
@@ -43,6 +43,7 @@ var module_kit_1 = require("@airgap/module-kit");
|
|
|
43
43
|
var SubscanBlockExplorer_1 = require("../block-explorer/SubscanBlockExplorer");
|
|
44
44
|
var MoonbeamProtocol_1 = require("../protocol/MoonbeamProtocol");
|
|
45
45
|
var MoonriverProtocol_1 = require("../protocol/MoonriverProtocol");
|
|
46
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
46
47
|
var MoonbeamModule = /** @class */ (function () {
|
|
47
48
|
function MoonbeamModule() {
|
|
48
49
|
var _a;
|
|
@@ -97,6 +98,13 @@ var MoonbeamModule = /** @class */ (function () {
|
|
|
97
98
|
});
|
|
98
99
|
});
|
|
99
100
|
};
|
|
101
|
+
MoonbeamModule.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.MoonbeamV3SerializerCompanion()];
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
100
108
|
MoonbeamModule.prototype.createProtocol = function (identifier, network) {
|
|
101
109
|
switch (identifier) {
|
|
102
110
|
case coinlib_core_1.MainProtocolSymbols.MOONBEAM:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoonbeamModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonbeamModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"MoonbeamModule.js","sourceRoot":"","sources":["../../../src/v1/module/MoonbeamModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAO2B;AAI3B,+EAAgI;AAChI,iEAAwG;AACxG,mEAA2G;AAC3G,8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AAkC,GAAE,EAAA;oBAC7C,KAAK,kCAAmB,CAAC,SAAS;wBAChC,sBAAO,IAAA,0DAAmC,GAAE,EAAA;oBAC9C;wBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,+BAA4B,CAAC,CAAA;iBAC1G;;;;KACF;IAEY,oDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,oDAA6B,EAAE,EAAA;;;KAC3C;IAEO,uCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE;YAClB,KAAK,kCAAmB,CAAC,QAAQ;gBAC/B,OAAO,IAAA,yCAAsB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC5C,KAAK,kCAAmB,CAAC,SAAS;gBAChC,OAAO,IAAA,2CAAuB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC7C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,+BAA4B,CAAC,CAAA;SAC1G;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAtDD,IAsDC;AAtDY,wCAAc"}
|
|
@@ -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 MoonbeamV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
+
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
+
private readonly moonbeamTransactionValidator;
|
|
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.MoonbeamV3SerializerCompanion = 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 moonbeamTransactionSignRequest = require('./schemas/generated/transaction-sign-request-moonbeam.json');
|
|
48
|
+
var moonbeamTransactionSignResponse = require('./schemas/generated/transaction-sign-response-moonbeam.json');
|
|
49
|
+
var MoonbeamV3SerializerCompanion = /** @class */ (function () {
|
|
50
|
+
function MoonbeamV3SerializerCompanion() {
|
|
51
|
+
this.schemas = [
|
|
52
|
+
{
|
|
53
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
54
|
+
schema: { schema: moonbeamTransactionSignRequest },
|
|
55
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.MOONBEAM
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
59
|
+
schema: { schema: moonbeamTransactionSignResponse },
|
|
60
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.MOONBEAM
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
64
|
+
schema: { schema: moonbeamTransactionSignRequest },
|
|
65
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.MOONRIVER
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
69
|
+
schema: { schema: moonbeamTransactionSignResponse },
|
|
70
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.MOONRIVER
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
this.moonbeamTransactionValidator = new transaction_validator_1.MoonbeamTransactionValidator();
|
|
74
|
+
Object.keys(validators_1.moonbeamValidators).forEach(function (key) {
|
|
75
|
+
validate_1.validators[key] = validators_1.moonbeamValidators[key];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
MoonbeamV3SerializerCompanion.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.MOONBEAM:
|
|
83
|
+
case coinlib_core_1.MainProtocolSymbols.MOONRIVER:
|
|
84
|
+
return [2 /*return*/, (0, transaction_converter_1.moonbeamUnsignedTransactionToRequest)(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
|
+
MoonbeamV3SerializerCompanion.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.MOONBEAM:
|
|
97
|
+
case coinlib_core_1.MainProtocolSymbols.MOONRIVER:
|
|
98
|
+
return [2 /*return*/, (0, transaction_converter_1.moonbeamTransactionSignRequestToUnsigned)(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
|
+
MoonbeamV3SerializerCompanion.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.MOONBEAM: return [3 /*break*/, 1];
|
|
115
|
+
case coinlib_core_1.MainProtocolSymbols.MOONRIVER: 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.moonbeamTransactionValidator.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
|
+
MoonbeamV3SerializerCompanion.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.MOONBEAM:
|
|
137
|
+
case coinlib_core_1.MainProtocolSymbols.MOONRIVER:
|
|
138
|
+
return [2 /*return*/, (0, transaction_converter_1.moonbeamSignedTransactionToResponse)(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
|
+
MoonbeamV3SerializerCompanion.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.MOONBEAM:
|
|
151
|
+
case coinlib_core_1.MainProtocolSymbols.MOONRIVER:
|
|
152
|
+
return [2 /*return*/, (0, transaction_converter_1.moonbeamTransactionSignResponseToSigned)(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
|
+
MoonbeamV3SerializerCompanion.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.MOONBEAM: return [3 /*break*/, 1];
|
|
169
|
+
case coinlib_core_1.MainProtocolSymbols.MOONRIVER: 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.moonbeamTransactionValidator.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 MoonbeamV3SerializerCompanion;
|
|
187
|
+
}());
|
|
188
|
+
exports.MoonbeamV3SerializerCompanion = MoonbeamV3SerializerCompanion;
|
|
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,4EAAiF;AACjF,sDAA4D;AAE5D,IAAM,8BAA8B,GAAe,OAAO,CAAC,4DAA4D,CAAC,CAAA;AACxH,IAAM,+BAA+B,GAAe,OAAO,CAAC,6DAA6D,CAAC,CAAA;AAE1H;IA0BE;QAzBgB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE;gBAClD,kBAAkB,EAAE,kCAAmB,CAAC,QAAQ;aACjD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE;gBACnD,kBAAkB,EAAE,kCAAmB,CAAC,QAAQ;aACjD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE;gBAClD,kBAAkB,EAAE,kCAAmB,CAAC,SAAS;aAClD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE;gBACnD,kBAAkB,EAAE,kCAAmB,CAAC,SAAS;aAClD;SACF,CAAA;QAEgB,iCAA4B,GAAiC,IAAI,oDAA4B,EAAE,CAAA;QAG9G,MAAM,CAAC,IAAI,CAAC,+BAAkB,CAAC,CAAC,OAAO,CAAC,UAAC,GAAW;YAClD,qBAAU,CAAC,GAAG,CAAC,GAAG,+BAAkB,CAAC,GAAsC,CAAC,CAAA;QAC9E,CAAC,CAAC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zB,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,QAAQ,CAAC;oBAClC,KAAK,kCAAmB,CAAC,SAAS;wBAChC,sBAAO,IAAA,2DAAmC,EAAC,iBAA+C,EAAE,iBAAiB,CAAC,EAAA;oBAChH;wBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;iBACvF;;;;KACF;IAEY,mEAA2B,GAAxC,UACE,UAAkB,EAClB,uBAAgD;;;gBAEhD,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,QAAQ,CAAC;oBAClC,KAAK,kCAAmB,CAAC,SAAS;wBAChC,sBAAO,IAAA,+DAAuC,EAAC,uBAAuB,CAAC,EAAA;oBACzE;wBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;iBACvF;;;;KACF;IAEY,uEAA+B,GAA5C,UAA6C,UAAkB,EAAE,uBAAgD;;;;;;wBACvG,KAAA,UAAU,CAAA;;iCACX,kCAAmB,CAAC,QAAQ,CAAC,CAA7B,wBAA4B;iCAC5B,kCAAmB,CAAC,SAAS,CAAC,CAA9B,wBAA6B;;;;;wBAE9B,qBAAM,IAAI,CAAC,4BAA4B,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,EAAA;;wBAA1F,SAA0F,CAAA;wBAE1F,sBAAO,IAAI,EAAA;;;wBAEX,sBAAO,KAAK,EAAA;4BAGd,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;;KAEzF;IACH,oCAAC;AAAD,CAAC,AAtHD,IAsHC;AAtHY,sEAA6B"}
|
|
@@ -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 MoonbeamTransactionValidator extends SubstrateTransactionValidator implements TransactionValidator {
|
|
4
4
|
}
|
|
5
|
-
export declare class MoonbeamTransactionValidatorFactory implements TransactionValidatorFactory<MoonbeamTransactionValidator> {
|
|
6
|
-
create(): MoonbeamTransactionValidator;
|
|
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.MoonbeamTransactionValidator = void 0;
|
|
19
19
|
var v1_1 = require("@airgap/substrate/v1");
|
|
20
20
|
var MoonbeamTransactionValidator = /** @class */ (function (_super) {
|
|
21
21
|
__extends(MoonbeamTransactionValidator, _super);
|
|
@@ -25,13 +25,4 @@ var MoonbeamTransactionValidator = /** @class */ (function (_super) {
|
|
|
25
25
|
return MoonbeamTransactionValidator;
|
|
26
26
|
}(v1_1.SubstrateTransactionValidator));
|
|
27
27
|
exports.MoonbeamTransactionValidator = MoonbeamTransactionValidator;
|
|
28
|
-
var MoonbeamTransactionValidatorFactory = /** @class */ (function () {
|
|
29
|
-
function MoonbeamTransactionValidatorFactory() {
|
|
30
|
-
}
|
|
31
|
-
MoonbeamTransactionValidatorFactory.prototype.create = function () {
|
|
32
|
-
return new MoonbeamTransactionValidator();
|
|
33
|
-
};
|
|
34
|
-
return MoonbeamTransactionValidatorFactory;
|
|
35
|
-
}());
|
|
36
|
-
exports.MoonbeamTransactionValidatorFactory = MoonbeamTransactionValidatorFactory;
|
|
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;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"}
|