@airgap/bitcoin 0.13.45-beta.3 → 0.13.45-beta.4
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 +5 -5
- package/v0/index.js +10 -10
- package/v0/index.js.map +1 -1
- package/v0/protocol/BitcoinAddress.js +9 -8
- package/v0/protocol/BitcoinAddress.js.map +1 -1
- package/v0/protocol/BitcoinCryptoClient.js +85 -16
- package/v0/protocol/BitcoinCryptoClient.js.map +1 -1
- package/v0/protocol/BitcoinProtocol.js +987 -590
- package/v0/protocol/BitcoinProtocol.js.map +1 -1
- package/v0/protocol/BitcoinProtocolOptions.js +111 -45
- package/v0/protocol/BitcoinProtocolOptions.js.map +1 -1
- package/v0/protocol/BitcoinSegwitAddress.js +29 -12
- package/v0/protocol/BitcoinSegwitAddress.js.map +1 -1
- package/v0/protocol/BitcoinSegwitProtocol.js +483 -348
- package/v0/protocol/BitcoinSegwitProtocol.js.map +1 -1
- package/v0/protocol/BitcoinTestnetProtocol.js +36 -28
- package/v0/protocol/BitcoinTestnetProtocol.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +30 -22
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v0/serializer/validators/validators.js +23 -23
- package/v0/serializer/validators/validators.js.map +1 -1
- package/v1/block-explorer/BlockCypherBlockExplorer.js +61 -12
- package/v1/block-explorer/BlockCypherBlockExplorer.js.map +1 -1
- package/v1/data/BitcoinAddress.js +10 -9
- package/v1/data/BitcoinAddress.js.map +1 -1
- package/v1/data/BitcoinLegacyAddress.js +12 -11
- package/v1/data/BitcoinLegacyAddress.js.map +1 -1
- package/v1/data/BitcoinSegwitAddress.js +12 -11
- package/v1/data/BitcoinSegwitAddress.js.map +1 -1
- package/v1/data/BitcoinTaprootAddress.js +22 -31
- package/v1/data/BitcoinTaprootAddress.js.map +1 -1
- package/v1/index.js +11 -11
- package/v1/index.js.map +1 -1
- package/v1/module/BitcoinModule.d.ts +1 -1
- package/v1/module/BitcoinModule.js +102 -44
- package/v1/module/BitcoinModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/protocol/BitcoinCryptoClient.js +90 -22
- package/v1/protocol/BitcoinCryptoClient.js.map +1 -1
- package/v1/protocol/BitcoinLegacyProtocol.js +796 -520
- package/v1/protocol/BitcoinLegacyProtocol.js.map +1 -1
- package/v1/protocol/BitcoinProtocol.js +1169 -735
- package/v1/protocol/BitcoinProtocol.js.map +1 -1
- package/v1/protocol/BitcoinSegwitProtocol.js +796 -542
- package/v1/protocol/BitcoinSegwitProtocol.js.map +1 -1
- package/v1/protocol/BitcoinTaprootProtocol.js +1000 -688
- package/v1/protocol/BitcoinTaprootProtocol.js.map +1 -1
- package/v1/protocol/BitcoinTestnetProtocol.js +33 -14
- package/v1/protocol/BitcoinTestnetProtocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +52 -29
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +165 -98
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +16 -13
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +213 -122
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/crypto.d.ts +1 -1
- package/v1/types/key.d.ts +6 -6
- package/v1/types/protocol.d.ts +2 -2
- package/v1/types/transaction.d.ts +3 -3
- package/v1/utils/common.js +6 -4
- package/v1/utils/common.js.map +1 -1
- package/v1/utils/key.d.ts +6 -5
- package/v1/utils/key.js +39 -38
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/network.js +4 -3
- package/v1/utils/network.js.map +1 -1
- package/v1/utils/protocol.js +19 -25
- package/v1/utils/protocol.js.map +1 -1
- package/v1/utils/signature.js +5 -4
- package/v1/utils/signature.js.map +1 -1
|
@@ -1,20 +1,56 @@
|
|
|
1
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
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.BitcoinV3SerializerCompanion = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
45
|
// import { BitcoinTransactionValidator } from './validators/transaction-validator'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
46
|
+
var validators_1 = require("./validators/validators");
|
|
47
|
+
var bitcoinSegwitTransactionSignRequest = require('./schemas/generated/transaction-sign-request-bitcoin-segwit.json');
|
|
48
|
+
var bitcoinSegwitTransactionSignResponse = require('./schemas/generated/transaction-sign-response-bitcoin-segwit.json');
|
|
49
|
+
var bitcoinLegacyTransactionSignRequest = require('./schemas/generated/transaction-sign-request-bitcoin-legacy.json');
|
|
50
|
+
var bitcoinLegacyTransactionSignResponse = require('./schemas/generated/transaction-sign-response-bitcoin-legacy.json');
|
|
51
|
+
var BitcoinV3SerializerCompanion = /** @class */ (function () {
|
|
16
52
|
// private readonly bitcoinTransactionValidator: BitcoinTransactionValidator = new BitcoinTransactionValidator()
|
|
17
|
-
|
|
53
|
+
function BitcoinV3SerializerCompanion() {
|
|
18
54
|
this.schemas = [
|
|
19
55
|
{
|
|
20
56
|
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
@@ -47,94 +83,125 @@ class BitcoinV3SerializerCompanion {
|
|
|
47
83
|
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT
|
|
48
84
|
}
|
|
49
85
|
];
|
|
50
|
-
Object.keys(validators_1.bitcoinValidators).forEach((key)
|
|
86
|
+
Object.keys(validators_1.bitcoinValidators).forEach(function (key) {
|
|
51
87
|
validate_1.validators[key] = validators_1.bitcoinValidators[key];
|
|
52
88
|
});
|
|
53
89
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
90
|
+
BitcoinV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (identifier) {
|
|
94
|
+
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
95
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinLegacyUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
96
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
97
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinSegwitUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
98
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
99
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinTaprootUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
100
|
+
default:
|
|
101
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported"));
|
|
102
|
+
}
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
BitcoinV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (identifier) {
|
|
111
|
+
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
112
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinLegacyTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
113
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
114
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinSegwitTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
115
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
116
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinTaprootTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
117
|
+
default:
|
|
118
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported"));
|
|
119
|
+
}
|
|
120
|
+
return [2 /*return*/];
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
BitcoinV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (identifier) {
|
|
128
|
+
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
129
|
+
// try {
|
|
130
|
+
// await this.bitcoinTransactionValidator.validateUnsignedTransaction(transactionSignRequest)
|
|
131
|
+
// return true
|
|
132
|
+
// } catch {
|
|
133
|
+
// return false
|
|
134
|
+
// }
|
|
135
|
+
return [2 /*return*/, true];
|
|
136
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
137
|
+
return [2 /*return*/, true];
|
|
138
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
139
|
+
return [2 /*return*/, true];
|
|
140
|
+
default:
|
|
141
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported"));
|
|
142
|
+
}
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
BitcoinV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (identifier) {
|
|
151
|
+
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
152
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinLegacySignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
153
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
154
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinSegwitSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
155
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
156
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinTaprootSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
157
|
+
default:
|
|
158
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported"));
|
|
159
|
+
}
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
BitcoinV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
+
return __generator(this, function (_a) {
|
|
167
|
+
switch (identifier) {
|
|
168
|
+
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
169
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinLegacyTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
170
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
171
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinSegwitTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
172
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
173
|
+
return [2 /*return*/, (0, transaction_converter_1.bitcoinTaprootTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
174
|
+
default:
|
|
175
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported"));
|
|
176
|
+
}
|
|
177
|
+
return [2 /*return*/];
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
BitcoinV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
183
|
+
return __generator(this, function (_a) {
|
|
184
|
+
switch (identifier) {
|
|
185
|
+
case coinlib_core_1.MainProtocolSymbols.BTC:
|
|
186
|
+
// try {
|
|
187
|
+
// await this.bitcoinTransactionValidator.validateSignedTransaction(transactionSignResponse as BitcoinTransactionSignResponse)
|
|
188
|
+
// return true
|
|
189
|
+
// } catch {
|
|
190
|
+
// return false
|
|
191
|
+
// }
|
|
192
|
+
return [2 /*return*/, true];
|
|
193
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_SEGWIT:
|
|
194
|
+
return [2 /*return*/, true];
|
|
195
|
+
case coinlib_core_1.MainProtocolSymbols.BTC_TAPROOT:
|
|
196
|
+
return [2 /*return*/, true];
|
|
197
|
+
default:
|
|
198
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.BITCOIN, "Protocol ".concat(identifier, " not supported"));
|
|
199
|
+
}
|
|
200
|
+
return [2 /*return*/];
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
return BitcoinV3SerializerCompanion;
|
|
205
|
+
}());
|
|
139
206
|
exports.BitcoinV3SerializerCompanion = BitcoinV3SerializerCompanion;
|
|
140
207
|
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":"
|
|
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;AAahH,mFAiBkD;AAElD,mFAAmF;AACnF,sDAA2D;AAI3D,IAAM,mCAAmC,GAAe,OAAO,CAAC,kEAAkE,CAAC,CAAA;AACnI,IAAM,oCAAoC,GAAe,OAAO,CAAC,mEAAmE,CAAC,CAAA;AAErI,IAAM,mCAAmC,GAAe,OAAO,CAAC,kEAAkE,CAAC,CAAA;AACnI,IAAM,oCAAoC,GAAe,OAAO,CAAC,mEAAmE,CAAC,CAAA;AAErI;IAkCE,gHAAgH;IAEhH;QAnCgB,YAAO,GAA4B;YACjD;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,oCAAoC,EAAE;gBACxD,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,UAAU;aACnD;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,oCAAoC,EAAE;gBACxD,kBAAkB,EAAE,kCAAmB,CAAC,UAAU;aACnD;YACD;gB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iBACrF;;;;KACF;IAEY,kEAA2B,GAAxC,UACE,UAAkB,EAClB,uBAAgD;;;gBAEhD,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,GAAG;wBAC1B,sBAAO,IAAA,oEAA4C,EAAC,uBAA+D,CAAC,EAAA;oBACtH,KAAK,kCAAmB,CAAC,UAAU;wBACjC,sBAAO,IAAA,oEAA4C,EAAC,uBAAyD,CAAC,EAAA;oBAChH,KAAK,kCAAmB,CAAC,WAAW;wBAClC,sBAAO,IAAA,qEAA6C,EAAC,uBAAgE,CAAC,EAAA;oBAExH;wBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;iBACrF;;;;KACF;IAEY,sEAA+B,GAA5C,UAA6C,UAAkB,EAAE,uBAAgD;;;gBAC/G,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,GAAG;wBAC1B,QAAQ;wBACR,gIAAgI;wBAEhI,gBAAgB;wBAChB,YAAY;wBACZ,iBAAiB;wBACjB,IAAI;wBAEJ,sBAAO,IAAI,EAAA;oBACb,KAAK,kCAAmB,CAAC,UAAU;wBACjC,sBAAO,IAAI,EAAA;oBACb,KAAK,kCAAmB,CAAC,WAAW;wBAClC,sBAAO,IAAI,EAAA;oBACb;wBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;iBACrF;;;;KACF;IACH,mCAAC;AAAD,CAAC,AAtJD,IAsJC;AAtJY,oEAA4B"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BitcoinTransactionValidator = void 0;
|
|
4
4
|
// tslint:disable: max-classes-per-file
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
6
|
+
var serializer_1 = require("@airgap/serializer");
|
|
7
|
+
var unsignedTransactionConstraints = {
|
|
8
8
|
ins: {
|
|
9
9
|
presence: { allowEmpty: false },
|
|
10
10
|
isValidBitcoinInput: true
|
|
@@ -14,7 +14,7 @@ const unsignedTransactionConstraints = {
|
|
|
14
14
|
isValidBitcoinOutput: true
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
var signedTransactionConstraints = {
|
|
18
18
|
from: {
|
|
19
19
|
presence: { allowEmpty: false },
|
|
20
20
|
isValidBitcoinFromArray: true
|
|
@@ -37,17 +37,20 @@ const signedTransactionConstraints = {
|
|
|
37
37
|
presence: { allowEmpty: false }
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
var success = function () { return undefined; };
|
|
41
|
+
var error = function (errors) { return errors; };
|
|
42
|
+
var BitcoinTransactionValidator = /** @class */ (function () {
|
|
43
|
+
function BitcoinTransactionValidator() {
|
|
44
|
+
}
|
|
45
|
+
BitcoinTransactionValidator.prototype.validateUnsignedTransaction = function (request) {
|
|
46
|
+
var transaction = request.transaction;
|
|
45
47
|
(0, serializer_1.validateSyncScheme)({});
|
|
46
48
|
return (0, validate_1.async)(transaction, unsignedTransactionConstraints).then(success, error);
|
|
47
|
-
}
|
|
48
|
-
validateSignedTransaction(response) {
|
|
49
|
+
};
|
|
50
|
+
BitcoinTransactionValidator.prototype.validateSignedTransaction = function (response) {
|
|
49
51
|
return (0, validate_1.async)(response, signedTransactionConstraints).then(success, error);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
+
};
|
|
53
|
+
return BitcoinTransactionValidator;
|
|
54
|
+
}());
|
|
52
55
|
exports.BitcoinTransactionValidator = BitcoinTransactionValidator;
|
|
53
56
|
//# 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":";;;AAAA,uCAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,8FAAyF;AACzF,iDAA6E;AAK7E,IAAM,8BAA8B,GAAG;IACrC,GAAG,EAAE;QACH,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,mBAAmB,EAAE,IAAI;KAC1B;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,oBAAoB,EAAE,IAAI;KAC3B;CACF,CAAA;AAED,IAAM,4BAA4B,GAAG;IACnC,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,uBAAuB,EAAE,IAAI;KAC9B;IACD,MAAM,EAAE;QACN,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;KAChC;IACD,GAAG,EAAE;QACH,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;KAChC;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;KAChC;IACD,WAAW,EAAE;QACX,sBAAsB,EAAE,IAAI;QAC5B,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;KAChC;CACF,CAAA;AACD,IAAM,OAAO,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAA;AAC/B,IAAM,KAAK,GAAG,UAAC,MAAM,IAAK,OAAA,MAAM,EAAN,CAAM,CAAA;AAEhC;IAAA;IAUA,CAAC;IATQ,iEAA2B,GAAlC,UAAmC,OAAsC;QACvE,IAAM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