-
Notifications
You must be signed in to change notification settings - Fork 28
fix: stabilize MPB bridge transaction history reads #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
L03TJ3
merged 5 commits into
GoodDollar:copilot/fix-mpb-bridge-transaction-history
from
edehvictor:fix/finalize-mpb-history-270
Jul 14, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c95b0f3
fix: stabilize MPB bridge history reads
edehvictor 7135957
fix: finalize MPB bridge history recovery
edehvictor 948845a
fix: handle transient MPB bridge block read errors
edehvictor c893e2b
fix: polish MPB bridge transaction details
edehvictor 39b91bc
fix: address MPB bridge review feedback
edehvictor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/good-design/src/apps/bridge/mpbridge/utils/transactionHelpers.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { TransactionStatus } from "@usedapp/core"; | ||
|
|
||
| import { createTransactionDetails } from "./transactionHelpers"; | ||
|
|
||
| jest.mock("@gooddollar/web3sdk-v2", () => ({ | ||
| getSourceChainId: jest.fn(() => 42220) | ||
| })); | ||
|
|
||
| describe("createTransactionDetails", () => { | ||
| it("sets a date for the submitted transaction details", () => { | ||
| const date = new Date("2026-07-07T10:00:00.000Z"); | ||
|
|
||
| const transaction = createTransactionDetails({ | ||
| amountWei: "10000000000000000000", | ||
| sourceChain: "celo", | ||
| targetChain: "xdc", | ||
| bridgeProvider: "layerzero", | ||
| bridgeStatus: { | ||
| status: "Success", | ||
| transaction: { hash: "0xbridge" } | ||
| } as Partial<TransactionStatus>, | ||
| bridgeToTxHash: undefined, | ||
| date | ||
| }); | ||
|
|
||
| expect(transaction.date).toBe(date); | ||
| expect(transaction.transactionHash).toBe("0xbridge"); | ||
| expect(transaction.amount).toBe("10.00"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/sdk-v2/src/sdk/mpbridge/hooks/useMPBBridge.helpers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export const getTransactionErrorMessage = (error: any): string => { | ||
| return ( | ||
| error?.error?.data?.message || | ||
| error?.error?.message || | ||
| error?.reason || | ||
| error?.data?.message || | ||
| error?.message || | ||
| "Transaction failed" | ||
| ); | ||
| }; | ||
|
|
||
| export const isTransientBlockReadError = (error: any): boolean => { | ||
| const message = getTransactionErrorMessage(error).toLowerCase(); | ||
|
|
||
| return message.includes("unknown block") || message.includes("no block"); | ||
| }; |
21 changes: 21 additions & 0 deletions
21
packages/sdk-v2/src/sdk/mpbridge/hooks/useMPBBridge.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { getTransactionErrorMessage, isTransientBlockReadError } from "./useMPBBridge.helpers"; | ||
|
|
||
| describe("useMPBBridge transaction error helpers", () => { | ||
| it("detects unknown block read errors from common wallet/provider shapes", () => { | ||
| expect(isTransientBlockReadError(new Error("Unknown block"))).toBe(true); | ||
| expect(isTransientBlockReadError({ reason: "no block found" })).toBe(true); | ||
| expect(isTransientBlockReadError({ error: { data: { message: "UNKNOWN BLOCK" } } })).toBe(true); | ||
| }); | ||
|
|
||
| it("does not classify regular transaction failures as transient block reads", () => { | ||
| expect(isTransientBlockReadError(new Error("user rejected transaction"))).toBe(false); | ||
| expect(isTransientBlockReadError({ error: { message: "execution reverted" } })).toBe(false); | ||
| }); | ||
|
|
||
| it("extracts a readable transaction error message", () => { | ||
| expect(getTransactionErrorMessage({ error: { data: { message: "execution reverted" } } })).toBe( | ||
| "execution reverted" | ||
| ); | ||
| expect(getTransactionErrorMessage({ reason: "user rejected transaction" })).toBe("user rejected transaction"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.