Skip to content

Commit 0736c54

Browse files
committed
fix(web): fix-dispute-template-presets-in-dev-ui
1 parent 6ac5035 commit 0736c54

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

web/src/pages/DisputeTemplateView/FetchDisputeRequestInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ const StyledA = styled.a`
4646
const presets = [
4747
{
4848
title: "Escrow",
49-
txnHash: "0xfa24d589a0c26c71d06f6e0a151460783f70b51c174a08c04768f458c7817cd1",
49+
txnHash: "0x85e60cb407c9a38e625263cc762ff4283d01f38201825e1d20109d8664cfa7d4",
5050
chainId: 421614,
5151
},
5252
{
5353
title: "Curated Lists",
54-
txnHash: "0xd9ab4908fc5447d532bc287f49e2f2beb754fc62024b806f05a9abf706be7c06",
54+
txnHash: "0x9da51a432a61b539e76f12e681ca6ac865090ebc024a80931c25640b970ae9a3",
5555
chainId: 421614,
5656
},
5757
{

web/src/utils/getDisputeRequestParamsFromTxn.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
1-
import { getPublicClient } from "@wagmi/core";
2-
import { GetTransactionReceiptReturnType, decodeEventLog, getEventSelector } from "viem";
1+
import { GetTransactionReceiptReturnType, createPublicClient, decodeEventLog, getEventSelector, http } from "viem";
2+
import * as chains from "viem/chains";
33

44
import { iArbitrableV2Abi } from "hooks/contracts/generated";
55
import { isUndefined } from "utils/index";
66

7+
/**
8+
* Gets the chain object for the given chain id.
9+
* @param chainId - Chain id of the target EVM chain.
10+
* @returns Viem's chain object.
11+
*/
12+
const getChain = (chainId: number) => {
13+
for (const chain of Object.values(chains)) {
14+
if ("id" in chain) {
15+
if (chain.id === chainId) {
16+
return chain;
17+
}
18+
}
19+
}
20+
21+
throw new Error(`Chain with id ${chainId} not found`);
22+
};
23+
24+
// Warning : do not import this in any pages except DisputeTemplatePreview, this has a large bundle size.
725
export const getDisputeRequestParamsFromTxn = async (hash: `0x${string}`, chainId: number) => {
826
try {
9-
const publicClient = getPublicClient({ chainId });
27+
const publicClient = createPublicClient({
28+
chain: getChain(chainId),
29+
transport: http(),
30+
});
1031

1132
const txn: GetTransactionReceiptReturnType = await publicClient.getTransactionReceipt({
1233
hash,
@@ -28,6 +49,8 @@ export const getDisputeRequestParamsFromTxn = async (hash: `0x${string}`, chainI
2849
_arbitrable: disputeRequestEvent.address,
2950
};
3051
} catch (e) {
52+
console.log("Error getting txn :", { e });
53+
3154
return undefined;
3255
}
3356
};

0 commit comments

Comments
 (0)