@airgap/ethereum 0.13.14-beta.1 → 0.13.14-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -79,12 +79,11 @@ var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
|
79
79
|
EthereumV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
80
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
81
81
|
return __generator(this, function (_a) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
82
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ETH || identifier.startsWith(coinlib_core_1.SubProtocolSymbols.ETH_ERC20)) {
|
|
83
|
+
return [2 /*return*/, (0, transaction_converter_1.ethereumUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
88
87
|
}
|
|
89
88
|
return [2 /*return*/];
|
|
90
89
|
});
|
|
@@ -93,12 +92,11 @@ var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
|
93
92
|
EthereumV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
94
93
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
94
|
return __generator(this, function (_a) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
95
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ETH || identifier.startsWith(coinlib_core_1.SubProtocolSymbols.ETH_ERC20)) {
|
|
96
|
+
return [2 /*return*/, (0, transaction_converter_1.ethereumTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
102
100
|
}
|
|
103
101
|
return [2 /*return*/];
|
|
104
102
|
});
|
|
@@ -106,26 +104,24 @@ var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
|
106
104
|
};
|
|
107
105
|
EthereumV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
108
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
var _a
|
|
110
|
-
return __generator(this, function (
|
|
111
|
-
switch (
|
|
107
|
+
var _a;
|
|
108
|
+
return __generator(this, function (_b) {
|
|
109
|
+
switch (_b.label) {
|
|
112
110
|
case 0:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
case coinlib_core_1.MainProtocolSymbols.ETH: return [3 /*break*/, 1];
|
|
116
|
-
case coinlib_core_1.SubProtocolSymbols.ETH_ERC20: return [3 /*break*/, 1];
|
|
117
|
-
}
|
|
118
|
-
return [3 /*break*/, 4];
|
|
111
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.ETH || identifier.startsWith(coinlib_core_1.SubProtocolSymbols.ETH_ERC20))) return [3 /*break*/, 5];
|
|
112
|
+
_b.label = 1;
|
|
119
113
|
case 1:
|
|
120
|
-
|
|
114
|
+
_b.trys.push([1, 3, , 4]);
|
|
121
115
|
return [4 /*yield*/, this.ethereumTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
122
116
|
case 2:
|
|
123
|
-
|
|
117
|
+
_b.sent();
|
|
124
118
|
return [2 /*return*/, true];
|
|
125
119
|
case 3:
|
|
126
|
-
|
|
120
|
+
_a = _b.sent();
|
|
127
121
|
return [2 /*return*/, false];
|
|
128
|
-
case 4:
|
|
122
|
+
case 4: return [3 /*break*/, 6];
|
|
123
|
+
case 5: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
124
|
+
case 6: return [2 /*return*/];
|
|
129
125
|
}
|
|
130
126
|
});
|
|
131
127
|
});
|
|
@@ -133,12 +129,11 @@ var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
|
133
129
|
EthereumV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
134
130
|
return __awaiter(this, void 0, void 0, function () {
|
|
135
131
|
return __generator(this, function (_a) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
132
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ETH || identifier.startsWith(coinlib_core_1.SubProtocolSymbols.ETH_ERC20)) {
|
|
133
|
+
return [2 /*return*/, (0, transaction_converter_1.ethereumSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
142
137
|
}
|
|
143
138
|
return [2 /*return*/];
|
|
144
139
|
});
|
|
@@ -147,12 +142,11 @@ var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
|
147
142
|
EthereumV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
148
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
149
144
|
return __generator(this, function (_a) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
145
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ETH || identifier.startsWith(coinlib_core_1.SubProtocolSymbols.ETH_ERC20)) {
|
|
146
|
+
return [2 /*return*/, (0, transaction_converter_1.ethereumTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
156
150
|
}
|
|
157
151
|
return [2 /*return*/];
|
|
158
152
|
});
|
|
@@ -160,26 +154,24 @@ var EthereumV3SerializerCompanion = /** @class */ (function () {
|
|
|
160
154
|
};
|
|
161
155
|
EthereumV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
162
156
|
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
-
var _a
|
|
164
|
-
return __generator(this, function (
|
|
165
|
-
switch (
|
|
157
|
+
var _a;
|
|
158
|
+
return __generator(this, function (_b) {
|
|
159
|
+
switch (_b.label) {
|
|
166
160
|
case 0:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
case coinlib_core_1.MainProtocolSymbols.ETH: return [3 /*break*/, 1];
|
|
170
|
-
case coinlib_core_1.SubProtocolSymbols.ETH_ERC20: return [3 /*break*/, 1];
|
|
171
|
-
}
|
|
172
|
-
return [3 /*break*/, 4];
|
|
161
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.ETH || identifier.startsWith(coinlib_core_1.SubProtocolSymbols.ETH_ERC20))) return [3 /*break*/, 5];
|
|
162
|
+
_b.label = 1;
|
|
173
163
|
case 1:
|
|
174
|
-
|
|
164
|
+
_b.trys.push([1, 3, , 4]);
|
|
175
165
|
return [4 /*yield*/, this.ethereumTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
176
166
|
case 2:
|
|
177
|
-
|
|
167
|
+
_b.sent();
|
|
178
168
|
return [2 /*return*/, true];
|
|
179
169
|
case 3:
|
|
180
|
-
|
|
170
|
+
_a = _b.sent();
|
|
181
171
|
return [2 /*return*/, false];
|
|
182
|
-
case 4:
|
|
172
|
+
case 4: return [3 /*break*/, 6];
|
|
173
|
+
case 5: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.ETHEREUM, "Protocol ".concat(identifier, " not supported"));
|
|
174
|
+
case 6: return [2 /*return*/];
|
|
183
175
|
}
|
|
184
176
|
});
|
|
185
177
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsF;AACtF,sDAA8D;AAG9D,iDAAgH;AAIhH,mFAKkD;AAClD,4EAAiF;AAEjF,IAAM,8BAA8B,GAAe,OAAO,CAAC,4DAA4D,CAAC,CAAA;AACxH,IAAM,mCAAmC,GAAe,OAAO,CAAC,kEAAkE,CAAC,CAAA;AACnI,IAAM,+BAA+B,GAAe,OAAO,CAAC,6DAA6D,CAAC,CAAA;AAE1H;IAAA;QACkB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE;gBAClD,kBAAkB,EAAE,kCAAmB,CAAC,GAAG;aAC5C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;gBACvD,kBAAkB,EAAE,kCAAmB,CAAC,GAAG;aAC5C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE;gBACnD,kBAAkB,EAAE,kCAAmB,CAAC,GAAG;aAC5C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE;gBAClD,kBAAkB,EAAE,iCAAkB,CAAC,SAAS;aACjD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE;gBACnD,kBAAkB,EAAE,iCAAkB,CAAC,SAAS;aACjD;SACF,CAAA;QAEgB,iCAA4B,GAAiC,IAAI,oDAA4B,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsF;AACtF,sDAA8D;AAG9D,iDAAgH;AAIhH,mFAKkD;AAClD,4EAAiF;AAEjF,IAAM,8BAA8B,GAAe,OAAO,CAAC,4DAA4D,CAAC,CAAA;AACxH,IAAM,mCAAmC,GAAe,OAAO,CAAC,kEAAkE,CAAC,CAAA;AACnI,IAAM,+BAA+B,GAAe,OAAO,CAAC,6DAA6D,CAAC,CAAA;AAE1H;IAAA;QACkB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE;gBAClD,kBAAkB,EAAE,kCAAmB,CAAC,GAAG;aAC5C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;gBACvD,kBAAkB,EAAE,kCAAmB,CAAC,GAAG;aAC5C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE;gBACnD,kBAAkB,EAAE,kCAAmB,CAAC,GAAG;aAC5C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE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