From 2eb0e86fa32ebb0f0ae4594f46bb1121f5bb670f Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 17 Dec 2024 16:38:53 +0800 Subject: [PATCH] OK-34380: Resolve LTC tx build failure in extension (#6359) * fix: Add error log * chore: debug * fix: upgrade coinselect version * chore: open console --- packages/core/package.json | 2 +- packages/core/src/utils/coinSelectUtils.ts | 5 ++++- .../src/logger/scopes/transaction/scenes/coinselect.ts | 8 +++++++- yarn.lock | 10 +++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 00743185f03..78c21994205 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -27,7 +27,7 @@ "@onekeyfe/bitcoinforksjs-lib": "7.0.0-rc.0", "@onekeyfe/cardano-coin-selection": "1.0.0", "@onekeyfe/cardano-coin-selection-asmjs": "1.1.1", - "@onekeyfe/coinselect": "3.1.13", + "@onekeyfe/coinselect": "3.1.14", "@onekeyfe/kaspa-core-lib": "^1.0.1", "@solana/spl-token": "^0.4.8", "@solana/web3.js": "^1.87.7", diff --git a/packages/core/src/utils/coinSelectUtils.ts b/packages/core/src/utils/coinSelectUtils.ts index 72dc41f815b..04aa2c1c295 100644 --- a/packages/core/src/utils/coinSelectUtils.ts +++ b/packages/core/src/utils/coinSelectUtils.ts @@ -203,7 +203,10 @@ export function coinSelectWithWitness( try { return coinSelectWitness(coinselectParams); } catch (error) { - defaultLogger.transaction.coinSelect.coinSelectFailed(coinselectParams); + defaultLogger.transaction.coinSelect.coinSelectFailed( + coinselectParams, + error as Error, + ); return { inputs: undefined, outputs: undefined, diff --git a/packages/shared/src/logger/scopes/transaction/scenes/coinselect.ts b/packages/shared/src/logger/scopes/transaction/scenes/coinselect.ts index 589f3ca216c..91d9e4fe194 100644 --- a/packages/shared/src/logger/scopes/transaction/scenes/coinselect.ts +++ b/packages/shared/src/logger/scopes/transaction/scenes/coinselect.ts @@ -5,7 +5,7 @@ import type { ICoinSelectParams } from '@onekeyfe/coinselect/witness'; export class CoinSelectScene extends BaseScene { @LogToLocal() - public coinSelectFailed(params: ICoinSelectParams) { + public coinSelectFailed(params: ICoinSelectParams, error?: Error) { return { utxos: params.utxos, outputs: params.outputs, @@ -15,6 +15,12 @@ export class CoinSelectScene extends BaseScene { txType: params.txType, baseFee: params.baseFee, dustThreshold: params.dustThreshold, + error: error + ? { + message: error.message, + stack: error.stack, + } + : undefined, }; } } diff --git a/yarn.lock b/yarn.lock index 19659306eb1..42d3e98b8e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5975,9 +5975,9 @@ __metadata: languageName: node linkType: hard -"@onekeyfe/coinselect@npm:3.1.13": - version: 3.1.13 - resolution: "@onekeyfe/coinselect@npm:3.1.13" +"@onekeyfe/coinselect@npm:3.1.14": + version: 3.1.14 + resolution: "@onekeyfe/coinselect@npm:3.1.14" dependencies: bchaddrjs: "npm:^0.5.2" bech32: "npm:^2.0.0" @@ -5998,7 +5998,7 @@ __metadata: wif: "npm:^5.0.0" peerDependencies: tslib: ^2.6.2 - checksum: 10/88d1fc5b9390dcaa20cfc9ad4d633af2de077970a7d735b45852d5dafb17ce0d57479fb16689c0aea0e6d90d8ffe4e75177dd42c0f35cfe1a150a88bf315272d + checksum: 10/97be13c92c9dcffba99deafc78d56ae057c0495571e58582436e24d97424fca828721b7927db5edf58687b19949f1a4330ba8c0abf9a5ec15d03243a2576a517 languageName: node linkType: hard @@ -6836,7 +6836,7 @@ __metadata: "@onekeyfe/bitcoinforksjs-lib": "npm:7.0.0-rc.0" "@onekeyfe/cardano-coin-selection": "npm:1.0.0" "@onekeyfe/cardano-coin-selection-asmjs": "npm:1.1.1" - "@onekeyfe/coinselect": "npm:3.1.13" + "@onekeyfe/coinselect": "npm:3.1.14" "@onekeyfe/kaspa-core-lib": "npm:^1.0.1" "@solana/spl-token": "npm:^0.4.8" "@solana/web3.js": "npm:^1.87.7"