diff --git a/.yarn/versions/9efbbea0.yml b/.yarn/versions/9efbbea0.yml new file mode 100644 index 000000000..d7523f8ce --- /dev/null +++ b/.yarn/versions/9efbbea0.yml @@ -0,0 +1,11 @@ +releases: + "@fluent-wallet/conflux-tx-error": major + "@fluent-wallet/ethereum-tx-error": patch + "@fluent-wallet/wallet_handle-unfinished-cfx-tx": patch + "@fluent-wallet/wallet_handle-unfinished-eth-tx": patch + browser-extension: patch + helios-background: patch + helios-popup: patch + +declined: + - helios diff --git a/packages/conflux-tx-error/index.js b/packages/conflux-tx-error/index.js index d0a33a7fd..2bcc53649 100644 --- a/packages/conflux-tx-error/index.js +++ b/packages/conflux-tx-error/index.js @@ -1,3 +1,5 @@ +import {ERROR} from '@fluent-wallet/json-rpc-error' + // shouldDiscard means should stop tracking this tx export function processError(err) { if (typeof err?.data === 'string') { @@ -32,6 +34,10 @@ export function processError(err) { if (err.data?.includes?.('Can not recover pubkey')) return {errorType: 'canNotRecoverPubKey', shouldDiscard: true} } + // network error + if (err?.code === ERROR.SERVER.code) { + return {errorType: ERROR.SERVER.name, shouldDiscard: false} + } return {errorType: 'unknownError', shouldDiscard: true} } diff --git a/packages/conflux-tx-error/package.json b/packages/conflux-tx-error/package.json index 31a480c9e..d8135d11c 100644 --- a/packages/conflux-tx-error/package.json +++ b/packages/conflux-tx-error/package.json @@ -3,5 +3,8 @@ "type": "module", "main": "index.js", "packageManager": "yarn@3.1.0", - "version": "0.0.6" + "version": "0.0.6", + "dependencies": { + "@fluent-wallet/json-rpc-error": "workspace:packages/json-rpc-error" + } } diff --git a/packages/ethereum-tx-error/index.js b/packages/ethereum-tx-error/index.js index 0de8de1ab..5271fc867 100644 --- a/packages/ethereum-tx-error/index.js +++ b/packages/ethereum-tx-error/index.js @@ -1,3 +1,5 @@ +import {ERROR} from '@fluent-wallet/json-rpc-error' + // shouldDiscard means should stop tracking this tx // error from geth txpool error // https://github.com/ethereum/go-ethereum/blob/2d20fed893faa894f50af709349b13b6ad9b45db/core/tx_pool.go#L56 @@ -67,6 +69,10 @@ export function processError(err) { if (/invalid chainid/i.test(errstr)) return {errorType: 'chainIdMismatch', shouldDiscard: true} } + // network error + if (err?.code === ERROR.SERVER.code) { + return {errorType: ERROR.SERVER.name, shouldDiscard: false} + } return {errorType: 'unknownError', shouldDiscard: true} } diff --git a/packages/ethereum-tx-error/package.json b/packages/ethereum-tx-error/package.json index e2cb7de80..cf89d2a8c 100644 --- a/packages/ethereum-tx-error/package.json +++ b/packages/ethereum-tx-error/package.json @@ -3,5 +3,8 @@ "type": "module", "main": "index.js", "packageManager": "yarn@3.1.0", - "version": "1.0.2" + "version": "1.0.2", + "dependencies": { + "@fluent-wallet/json-rpc-error": "workspace:packages/json-rpc-error" + } } diff --git a/yarn.lock b/yarn.lock index 10e892a4c..d194a4810 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4327,6 +4327,8 @@ __metadata: "@fluent-wallet/conflux-tx-error@workspace:*, @fluent-wallet/conflux-tx-error@workspace:packages/conflux-tx-error": version: 0.0.0-use.local resolution: "@fluent-wallet/conflux-tx-error@workspace:packages/conflux-tx-error" + dependencies: + "@fluent-wallet/json-rpc-error": "workspace:packages/json-rpc-error" languageName: unknown linkType: soft @@ -4726,6 +4728,8 @@ __metadata: "@fluent-wallet/ethereum-tx-error@workspace:*, @fluent-wallet/ethereum-tx-error@workspace:packages/ethereum-tx-error": version: 0.0.0-use.local resolution: "@fluent-wallet/ethereum-tx-error@workspace:packages/ethereum-tx-error" + dependencies: + "@fluent-wallet/json-rpc-error": "workspace:packages/json-rpc-error" languageName: unknown linkType: soft