@subwallet/extension-base 1.3.42-0 → 1.3.44-0
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/background/KoniTypes.d.ts +35 -23
- package/background/errors/BitcoinProviderError.d.ts +1 -1
- package/background/errors/BitcoinProviderError.js +2 -2
- package/background/types.d.ts +1 -1
- package/cjs/background/errors/BitcoinProviderError.js +2 -2
- package/cjs/core/logic-validation/recipientAddress.js +8 -2
- package/cjs/core/logic-validation/request.js +316 -3
- package/cjs/koni/background/handlers/Extension.js +418 -90
- package/cjs/koni/background/handlers/State.js +198 -6
- package/cjs/koni/background/handlers/Tabs.js +119 -6
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/bitcoin/index.js +67 -0
- package/cjs/page/index.js +5 -0
- package/cjs/services/buy-service/index.js +17 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +27 -5
- package/cjs/services/request-service/handler/AuthRequestHandler.js +18 -0
- package/cjs/services/request-service/handler/BitcoinRequestHandler.js +48 -61
- package/cjs/services/request-service/index.js +2 -2
- package/cjs/services/transaction-service/index.js +71 -2
- package/cjs/utils/auth.js +2 -1
- package/core/logic-validation/recipientAddress.js +8 -2
- package/core/logic-validation/request.d.ts +6 -2
- package/core/logic-validation/request.js +309 -3
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +330 -6
- package/koni/background/handlers/State.d.ts +4 -1
- package/koni/background/handlers/State.js +189 -4
- package/koni/background/handlers/Tabs.d.ts +7 -2
- package/koni/background/handlers/Tabs.js +119 -9
- package/package.json +11 -6
- package/packageInfo.js +1 -1
- package/page/bitcoin/index.d.ts +17 -0
- package/page/bitcoin/index.js +60 -0
- package/page/index.d.ts +2 -1
- package/page/index.js +4 -0
- package/services/balance-service/transfer/cardano-transfer.d.ts +2 -0
- package/services/buy-service/index.js +17 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +27 -5
- package/services/request-service/handler/AuthRequestHandler.js +19 -1
- package/services/request-service/handler/BitcoinRequestHandler.d.ts +3 -4
- package/services/request-service/handler/BitcoinRequestHandler.js +48 -61
- package/services/request-service/index.d.ts +1 -2
- package/services/request-service/index.js +2 -2
- package/services/transaction-service/index.d.ts +1 -0
- package/services/transaction-service/index.js +71 -2
- package/services/transaction-service/types.d.ts +1 -0
- package/types/balance/transfer.d.ts +4 -2
- package/types/buy.d.ts +1 -1
- package/utils/auth.js +3 -2
|
@@ -8,10 +8,8 @@ exports.default = void 0;
|
|
|
8
8
|
var _BitcoinProviderError = require("@subwallet/extension-base/background/errors/BitcoinProviderError");
|
|
9
9
|
var _TransactionError = require("@subwallet/extension-base/background/errors/TransactionError");
|
|
10
10
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
11
|
-
var _bitcoinTransfer = require("@subwallet/extension-base/services/balance-service/transfer/bitcoin-transfer");
|
|
12
11
|
var _types = require("@subwallet/extension-base/types");
|
|
13
12
|
var _utils = require("@subwallet/extension-base/utils");
|
|
14
|
-
var _getId = require("@subwallet/extension-base/utils/getId");
|
|
15
13
|
var _request = require("@subwallet/extension-base/utils/request");
|
|
16
14
|
var _uiKeyring = _interopRequireDefault(require("@subwallet/ui-keyring"));
|
|
17
15
|
var bitcoin = _interopRequireWildcard(require("bitcoinjs-lib"));
|
|
@@ -27,7 +25,6 @@ class BitcoinRequestHandler {
|
|
|
27
25
|
#requestService;
|
|
28
26
|
#chainService;
|
|
29
27
|
#transactionService;
|
|
30
|
-
#feeService;
|
|
31
28
|
#logger;
|
|
32
29
|
confirmationsQueueSubjectBitcoin = new _rxjs.BehaviorSubject({
|
|
33
30
|
bitcoinSignatureRequest: {},
|
|
@@ -37,10 +34,9 @@ class BitcoinRequestHandler {
|
|
|
37
34
|
bitcoinSignPsbtRequest: {}
|
|
38
35
|
});
|
|
39
36
|
confirmationsPromiseMap = {};
|
|
40
|
-
constructor(requestService, chainService,
|
|
37
|
+
constructor(requestService, chainService, transactionService) {
|
|
41
38
|
this.#requestService = requestService;
|
|
42
39
|
this.#chainService = chainService;
|
|
43
|
-
this.#feeService = feeService;
|
|
44
40
|
this.#transactionService = transactionService;
|
|
45
41
|
this.#logger = (0, _util.logger)('BitcoinRequestHandler');
|
|
46
42
|
}
|
|
@@ -61,7 +57,7 @@ class BitcoinRequestHandler {
|
|
|
61
57
|
const confirmationType = confirmations[type];
|
|
62
58
|
const payloadJson = JSON.stringify(payload);
|
|
63
59
|
const isInternal = (0, _request.isInternalRequest)(url);
|
|
64
|
-
if (['bitcoinSignatureRequest', 'bitcoinSendTransactionRequest', 'bitcoinSendTransactionRequestAfterConfirmation'].includes(type)) {
|
|
60
|
+
if (['bitcoinSignatureRequest', 'bitcoinSendTransactionRequest', 'bitcoinSendTransactionRequestAfterConfirmation', 'bitcoinSignPsbtRequest'].includes(type)) {
|
|
65
61
|
const isAlwaysRequired = await this.#requestService.settingService.isAlwaysRequired;
|
|
66
62
|
if (isAlwaysRequired) {
|
|
67
63
|
this.#requestService.keyringService.lock();
|
|
@@ -122,10 +118,9 @@ class BitcoinRequestHandler {
|
|
|
122
118
|
}
|
|
123
119
|
signMessageBitcoin(confirmation) {
|
|
124
120
|
const {
|
|
125
|
-
|
|
121
|
+
address,
|
|
126
122
|
payload
|
|
127
123
|
} = confirmation.payload;
|
|
128
|
-
const address = account.address;
|
|
129
124
|
const pair = _uiKeyring.default.getPair(address);
|
|
130
125
|
if (pair.isLocked) {
|
|
131
126
|
_uiKeyring.default.unlockPair(pair.address);
|
|
@@ -158,10 +153,9 @@ class BitcoinRequestHandler {
|
|
|
158
153
|
signTransactionBitcoin(request) {
|
|
159
154
|
// Extract necessary information from the BitcoinSendTransactionRequest
|
|
160
155
|
const {
|
|
161
|
-
|
|
156
|
+
address,
|
|
162
157
|
hashPayload
|
|
163
158
|
} = request.payload;
|
|
164
|
-
const address = account.address;
|
|
165
159
|
const pair = _uiKeyring.default.getPair(address);
|
|
166
160
|
|
|
167
161
|
// Unlock the pair if it is locked
|
|
@@ -181,59 +175,25 @@ class BitcoinRequestHandler {
|
|
|
181
175
|
const {
|
|
182
176
|
chain,
|
|
183
177
|
emitterTransaction,
|
|
184
|
-
feeCustom,
|
|
185
|
-
feeOption,
|
|
186
178
|
id
|
|
187
179
|
} = transaction;
|
|
188
180
|
const {
|
|
189
|
-
from
|
|
190
|
-
to,
|
|
191
|
-
value
|
|
181
|
+
from
|
|
192
182
|
} = transaction.data;
|
|
183
|
+
const {
|
|
184
|
+
promise,
|
|
185
|
+
reject,
|
|
186
|
+
resolve
|
|
187
|
+
} = (0, _utils.createPromiseHandler)();
|
|
193
188
|
if (!emitterTransaction) {
|
|
194
189
|
throw new _BitcoinProviderError.BitcoinProviderError(_KoniTypes.BitcoinProviderErrorType.INTERNAL_ERROR);
|
|
195
190
|
}
|
|
196
|
-
const chainInfo = this.#chainService.getChainInfoByKey(chain);
|
|
197
|
-
const bitcoinApi = this.#chainService.getBitcoinApi(chain);
|
|
198
191
|
const eventData = {
|
|
199
192
|
id,
|
|
200
193
|
errors: [],
|
|
201
194
|
warnings: [],
|
|
202
195
|
extrinsicHash: id
|
|
203
196
|
};
|
|
204
|
-
const network = chainInfo.isTestnet ? bitcoin.networks.testnet : bitcoin.networks.bitcoin;
|
|
205
|
-
const feeInfo = await this.#feeService.subscribeChainFee((0, _getId.getId)(), chain, 'bitcoin');
|
|
206
|
-
const [psbt] = await (0, _bitcoinTransfer.createBitcoinTransaction)({
|
|
207
|
-
bitcoinApi,
|
|
208
|
-
chain,
|
|
209
|
-
from,
|
|
210
|
-
feeCustom,
|
|
211
|
-
feeOption,
|
|
212
|
-
feeInfo,
|
|
213
|
-
to,
|
|
214
|
-
transferAll: false,
|
|
215
|
-
value: value || '0',
|
|
216
|
-
network
|
|
217
|
-
});
|
|
218
|
-
const pair = _uiKeyring.default.getPair(from);
|
|
219
|
-
|
|
220
|
-
// Unlock the pair if it is locked
|
|
221
|
-
if (pair.isLocked) {
|
|
222
|
-
_uiKeyring.default.unlockPair(pair.address);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Finalize all inputs in the Psbt
|
|
226
|
-
|
|
227
|
-
// Sign the Psbt using the pair's bitcoin object
|
|
228
|
-
const signedTransaction = pair.bitcoin.signTransaction(psbt, psbt.txInputs.map((v, i) => i));
|
|
229
|
-
signedTransaction.finalizeAllInputs();
|
|
230
|
-
const signature = signedTransaction.extractTransaction().toHex();
|
|
231
|
-
this.#transactionService.emitterEventTransaction(emitterTransaction, eventData, chainInfo.slug, signature);
|
|
232
|
-
const {
|
|
233
|
-
promise,
|
|
234
|
-
reject,
|
|
235
|
-
resolve
|
|
236
|
-
} = (0, _utils.createPromiseHandler)();
|
|
237
197
|
emitterTransaction.on('extrinsicHash', data => {
|
|
238
198
|
if (!data.extrinsicHash) {
|
|
239
199
|
reject(_KoniTypes.BitcoinProviderErrorType.INTERNAL_ERROR);
|
|
@@ -244,34 +204,56 @@ class BitcoinRequestHandler {
|
|
|
244
204
|
emitterTransaction.on('error', error => {
|
|
245
205
|
reject(error);
|
|
246
206
|
});
|
|
207
|
+
try {
|
|
208
|
+
const chainInfo = this.#chainService.getChainInfoByKey(chain);
|
|
209
|
+
const psbt = transaction.transaction;
|
|
210
|
+
const pair = _uiKeyring.default.getPair(from);
|
|
211
|
+
|
|
212
|
+
// Unlock the pair if it is locked
|
|
213
|
+
if (pair.isLocked) {
|
|
214
|
+
_uiKeyring.default.unlockPair(pair.address);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Finalize all inputs in the Psbt
|
|
218
|
+
// Sign the Psbt using the pair's bitcoin object
|
|
219
|
+
const signedTransaction = pair.bitcoin.signTransaction(psbt, psbt.txInputs.map((v, i) => i));
|
|
220
|
+
signedTransaction.finalizeAllInputs();
|
|
221
|
+
const signature = signedTransaction.extractTransaction().toHex();
|
|
222
|
+
this.#transactionService.emitterEventTransaction(emitterTransaction, eventData, chainInfo.slug, signature);
|
|
223
|
+
} catch (e) {
|
|
224
|
+
emitterTransaction.emit('error', {
|
|
225
|
+
...eventData,
|
|
226
|
+
errors: [new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR, e.message)]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
247
229
|
return promise;
|
|
248
230
|
}
|
|
249
231
|
async signPsbt(request) {
|
|
250
232
|
// Extract necessary information from the BitcoinSendTransactionRequest
|
|
251
233
|
const {
|
|
252
|
-
|
|
234
|
+
address,
|
|
253
235
|
payload
|
|
254
236
|
} = request.payload;
|
|
255
237
|
const {
|
|
256
238
|
allowedSighash,
|
|
239
|
+
autoFinalized = true,
|
|
257
240
|
broadcast,
|
|
258
|
-
|
|
241
|
+
network,
|
|
242
|
+
psbt: psbtHex,
|
|
259
243
|
signAtIndex
|
|
260
244
|
} = payload;
|
|
261
245
|
const transaction = this.#transactionService.getTransaction(request.id);
|
|
246
|
+
const bitcoinNetwork = network === 'bitcoinTestnet' ? bitcoin.networks.testnet : bitcoin.networks.bitcoin;
|
|
247
|
+
const psbt = bitcoin.Psbt.fromHex(psbtHex, {
|
|
248
|
+
network: bitcoinNetwork
|
|
249
|
+
});
|
|
262
250
|
let eventData = {
|
|
263
251
|
id: request.id,
|
|
264
252
|
errors: [],
|
|
265
253
|
warnings: [],
|
|
266
254
|
extrinsicHash: request.id
|
|
267
255
|
};
|
|
268
|
-
|
|
269
|
-
// todo: validate type of the account
|
|
270
|
-
|
|
271
|
-
if (Object.keys(account).length === 0) {
|
|
272
|
-
throw new _BitcoinProviderError.BitcoinProviderError(_KoniTypes.BitcoinProviderErrorType.INVALID_PARAMS, 'Please connect to Wallet to try this request');
|
|
273
|
-
}
|
|
274
|
-
const pair = _uiKeyring.default.getPair(account.address);
|
|
256
|
+
const pair = _uiKeyring.default.getPair(address);
|
|
275
257
|
|
|
276
258
|
// Unlock the pair if it is locked
|
|
277
259
|
if (pair.isLocked) {
|
|
@@ -299,8 +281,10 @@ class BitcoinRequestHandler {
|
|
|
299
281
|
throw new Error('Unable to sign');
|
|
300
282
|
}
|
|
301
283
|
if (!broadcast) {
|
|
302
|
-
|
|
303
|
-
|
|
284
|
+
if (autoFinalized) {
|
|
285
|
+
for (const index of signAtIndexGenerate) {
|
|
286
|
+
psptSignedTransaction.finalizeInput(index);
|
|
287
|
+
}
|
|
304
288
|
}
|
|
305
289
|
return {
|
|
306
290
|
psbt: psptSignedTransaction.toHex()
|
|
@@ -325,6 +309,9 @@ class BitcoinRequestHandler {
|
|
|
325
309
|
}
|
|
326
310
|
const chainInfo = this.#chainService.getChainInfoByKey(chain);
|
|
327
311
|
try {
|
|
312
|
+
if (!autoFinalized) {
|
|
313
|
+
throw new Error('Unable to send transaction without autoFinalized');
|
|
314
|
+
}
|
|
328
315
|
psptSignedTransaction.finalizeAllInputs();
|
|
329
316
|
} catch (e) {
|
|
330
317
|
emitterTransaction.emit('error', {
|
|
@@ -27,7 +27,7 @@ class RequestService {
|
|
|
27
27
|
#notSupportWCRequestHandler;
|
|
28
28
|
|
|
29
29
|
// Common
|
|
30
|
-
constructor(chainService, settingService, keyringService,
|
|
30
|
+
constructor(chainService, settingService, keyringService, transactionService) {
|
|
31
31
|
this.#chainService = chainService;
|
|
32
32
|
this.settingService = settingService;
|
|
33
33
|
this.keyringService = keyringService;
|
|
@@ -38,7 +38,7 @@ class RequestService {
|
|
|
38
38
|
this.#evmRequestHandler = new _handler.EvmRequestHandler(this);
|
|
39
39
|
this.#tonRequestHandler = new _TonRequestHandler.default(this);
|
|
40
40
|
this.#cardanoRequestHandler = new _CardanoRequestHandler.default(this);
|
|
41
|
-
this.#bitcoinRequestHandler = new _BitcoinRequestHandler.default(this, this.#chainService,
|
|
41
|
+
this.#bitcoinRequestHandler = new _BitcoinRequestHandler.default(this, this.#chainService, transactionService);
|
|
42
42
|
this.#connectWCRequestHandler = new _handler.ConnectWCRequestHandler(this);
|
|
43
43
|
this.#notSupportWCRequestHandler = new _handler.NotSupportWCRequestHandler(this);
|
|
44
44
|
|
|
@@ -126,7 +126,9 @@ class TransactionService {
|
|
|
126
126
|
const isNonNativeTokenPayFee = tokenPayFeeSlug && !(0, _utils2._isNativeTokenBySlug)(tokenPayFeeSlug);
|
|
127
127
|
const nonNativeTokenPayFeeInfo = isNonNativeTokenPayFee ? this.state.chainService.getAssetBySlug(tokenPayFeeSlug) : undefined;
|
|
128
128
|
const priceMap = (await this.state.priceService.getPrice()).priceMap;
|
|
129
|
-
|
|
129
|
+
if (!transactionInput.skipFeeRecalculation) {
|
|
130
|
+
validationResponse.estimateFee = await (0, _transfer.estimateFeeForTransaction)(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, transactionInput.isTransferLocalTokenAndPayThatTokenAsFee);
|
|
131
|
+
}
|
|
130
132
|
const chainInfoMap = this.state.chainService.getChainInfoMap();
|
|
131
133
|
|
|
132
134
|
// Check account signing transaction
|
|
@@ -307,6 +309,73 @@ class TransactionService {
|
|
|
307
309
|
'eventsHandler' in validatedTransaction && delete validatedTransaction.eventsHandler;
|
|
308
310
|
return validatedTransaction;
|
|
309
311
|
}
|
|
312
|
+
async handleTransactionAfterConfirmation(transaction) {
|
|
313
|
+
const validatedTransaction = await this.validateTransaction(transaction);
|
|
314
|
+
const stopByErrors = validatedTransaction.errors.length > 0;
|
|
315
|
+
const stopByWarnings = validatedTransaction.warnings.length > 0 && !validatedTransaction.ignoreWarnings;
|
|
316
|
+
if (stopByErrors || stopByWarnings) {
|
|
317
|
+
// @ts-ignore
|
|
318
|
+
'transaction' in validatedTransaction && delete validatedTransaction.transaction;
|
|
319
|
+
'additionalValidator' in validatedTransaction && delete validatedTransaction.additionalValidator;
|
|
320
|
+
'eventsHandler' in validatedTransaction && delete validatedTransaction.eventsHandler;
|
|
321
|
+
return validatedTransaction;
|
|
322
|
+
}
|
|
323
|
+
validatedTransaction.warnings = [];
|
|
324
|
+
const transactionsSubject = this.transactions;
|
|
325
|
+
const emitter = new _eventemitter.default();
|
|
326
|
+
|
|
327
|
+
// Fill transaction default info
|
|
328
|
+
const transactionUpdated = this.fillTransactionDefaultInfo(validatedTransaction);
|
|
329
|
+
|
|
330
|
+
// Add Transaction
|
|
331
|
+
transactionsSubject[transactionUpdated.id] = {
|
|
332
|
+
...transactionUpdated,
|
|
333
|
+
emitterTransaction: emitter
|
|
334
|
+
};
|
|
335
|
+
this.transactionSubject.next({
|
|
336
|
+
...transactionsSubject
|
|
337
|
+
});
|
|
338
|
+
emitter.on('success', data => {
|
|
339
|
+
validatedTransaction.id = data.id;
|
|
340
|
+
validatedTransaction.extrinsicHash = data.extrinsicHash;
|
|
341
|
+
this.handlePostProcessing(data.id);
|
|
342
|
+
this.onSuccess(data);
|
|
343
|
+
});
|
|
344
|
+
emitter.on('signed', data => {
|
|
345
|
+
validatedTransaction.id = data.id;
|
|
346
|
+
validatedTransaction.extrinsicHash = data.extrinsicHash;
|
|
347
|
+
this.onSigned(data);
|
|
348
|
+
});
|
|
349
|
+
emitter.on('error', data => {
|
|
350
|
+
if (data.errors.length > 0) {
|
|
351
|
+
validatedTransaction.errors.push(...data.errors);
|
|
352
|
+
}
|
|
353
|
+
this.onFailed({
|
|
354
|
+
...data,
|
|
355
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR)]
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
emitter.on('send', data => {
|
|
359
|
+
this.onSend(data);
|
|
360
|
+
});
|
|
361
|
+
emitter.on('extrinsicHash', data => {
|
|
362
|
+
this.onHasTransactionHash(data);
|
|
363
|
+
});
|
|
364
|
+
emitter.on('timeout', data => {
|
|
365
|
+
this.onTimeOut({
|
|
366
|
+
...data,
|
|
367
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types.BasicTxErrorType.TIMEOUT)]
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// @ts-ignore
|
|
372
|
+
'transaction' in validatedTransaction && delete validatedTransaction.transaction;
|
|
373
|
+
'additionalValidator' in validatedTransaction && delete validatedTransaction.additionalValidator;
|
|
374
|
+
'eventsHandler' in validatedTransaction && delete validatedTransaction.eventsHandler;
|
|
375
|
+
return {
|
|
376
|
+
...validatedTransaction
|
|
377
|
+
};
|
|
378
|
+
}
|
|
310
379
|
async handlePermitTransaction(transaction) {
|
|
311
380
|
var _transaction$step;
|
|
312
381
|
const transactionId = (0, _helpers.getTransactionId)(transaction.chainType, transaction.chain, true);
|
|
@@ -1954,7 +2023,7 @@ class TransactionService {
|
|
|
1954
2023
|
const payload = {
|
|
1955
2024
|
payload: undefined,
|
|
1956
2025
|
payloadJson: undefined,
|
|
1957
|
-
|
|
2026
|
+
address,
|
|
1958
2027
|
canSign: true,
|
|
1959
2028
|
hashPayload: tx.toHex(),
|
|
1960
2029
|
id
|
package/cjs/utils/auth.js
CHANGED
|
@@ -15,7 +15,8 @@ const isAddressValidWithAuthType = (address, accountAuthTypes) => {
|
|
|
15
15
|
evm: _types.EthereumKeypairTypes,
|
|
16
16
|
substrate: _types.SubstrateKeypairTypes,
|
|
17
17
|
ton: _types.TonKeypairTypes,
|
|
18
|
-
cardano: _types.CardanoKeypairTypes
|
|
18
|
+
cardano: _types.CardanoKeypairTypes,
|
|
19
|
+
bitcoin: _types.BitcoinKeypairTypes
|
|
19
20
|
};
|
|
20
21
|
return !!(accountAuthTypes !== null && accountAuthTypes !== void 0 && accountAuthTypes.some(authType => {
|
|
21
22
|
var _validTypes$authType;
|
|
@@ -111,7 +111,13 @@ function runValidationFunctions(validateRecipientParams, validationFunctions) {
|
|
|
111
111
|
return Promise.resolve();
|
|
112
112
|
}
|
|
113
113
|
export function validateRecipientAddress(validateRecipientParams) {
|
|
114
|
-
|
|
114
|
+
// TODO: Temporarily disable "Advanced address conversion" to prevent invalid token transfers.
|
|
115
|
+
// Re-enable after related issues are fixed.
|
|
116
|
+
const prams = {
|
|
117
|
+
...validateRecipientParams,
|
|
118
|
+
autoFormatValue: false
|
|
119
|
+
};
|
|
120
|
+
const conditions = getConditions(prams);
|
|
115
121
|
const validationFunctions = getValidationFunctions(conditions);
|
|
116
|
-
return runValidationFunctions(
|
|
122
|
+
return runValidationFunctions(prams, validationFunctions);
|
|
117
123
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfirmationType, ConfirmationTypeCardano, ErrorValidation } from '@subwallet/extension-base/background/KoniTypes';
|
|
1
|
+
import { ConfirmationType, ConfirmationTypeBitcoin, ConfirmationTypeCardano, ErrorValidation } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
2
|
import { AccountAuthType } from '@subwallet/extension-base/background/types';
|
|
3
3
|
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
4
4
|
import { AuthUrlInfo } from '@subwallet/extension-base/services/request-service/types';
|
|
@@ -15,7 +15,7 @@ export interface PayloadValidated {
|
|
|
15
15
|
method?: string;
|
|
16
16
|
payloadAfterValidated: any;
|
|
17
17
|
errorPosition?: 'dApp' | 'ui';
|
|
18
|
-
confirmationType?: ConfirmationType | ConfirmationTypeCardano;
|
|
18
|
+
confirmationType?: ConfirmationType | ConfirmationTypeCardano | ConfirmationTypeBitcoin;
|
|
19
19
|
errors: Error[];
|
|
20
20
|
}
|
|
21
21
|
export declare type SignTypedDataMessageV3V4 = {
|
|
@@ -45,5 +45,9 @@ export declare function validationEvmSignMessageMiddleware(koni: KoniState, url:
|
|
|
45
45
|
export declare function validationAuthWCMiddleware(koni: KoniState, url: string, payload: PayloadValidated, topic?: string): Promise<PayloadValidated>;
|
|
46
46
|
export declare function validationAuthCardanoMiddleware(koni: KoniState, url: string, payload: PayloadValidated): Promise<PayloadValidated>;
|
|
47
47
|
export declare function validationCardanoSignDataMiddleware(koni: KoniState, url: string, payload_: PayloadValidated): Promise<PayloadValidated>;
|
|
48
|
+
export declare function validationBitcoinConnectMiddleware(koni: KoniState, url: string, payload: PayloadValidated): Promise<PayloadValidated>;
|
|
49
|
+
export declare function validationBitcoinSignMessageMiddleware(koni: KoniState, url: string, payload_: PayloadValidated): Promise<PayloadValidated>;
|
|
50
|
+
export declare function validationBitcoinSignPsbtMiddleware(koni: KoniState, url: string, payload_: PayloadValidated): Promise<PayloadValidated>;
|
|
51
|
+
export declare function validationBitcoinSendTransactionMiddleware(koni: KoniState, url: string, payload_: PayloadValidated): Promise<PayloadValidated>;
|
|
48
52
|
export declare function convertErrorMessage(message_: string, name?: string): string[];
|
|
49
53
|
export declare function convertErrorFormat(errors: Error[]): ErrorValidation[];
|