Skip to content

Commit

Permalink
Fix/wpy (#1484)
Browse files Browse the repository at this point in the history
* fix: ignore network error

* feat: version

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mosshqq and mergify[bot] authored Dec 17, 2024
1 parent 1f210e5 commit 5d00f3b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .yarn/versions/9efbbea0.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions packages/conflux-tx-error/index.js
Original file line number Diff line number Diff line change
@@ -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') {
Expand Down Expand Up @@ -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}
}
5 changes: 4 additions & 1 deletion packages/conflux-tx-error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 6 additions & 0 deletions packages/ethereum-tx-error/index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}
}
5 changes: 4 additions & 1 deletion packages/ethereum-tx-error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5d00f3b

Please sign in to comment.