Skip to content

Commit

Permalink
fix: make call more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Feb 28, 2024
1 parent 5da9a23 commit 423619a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const testnet = new DAppKit({
genesis: "test",
});

const errorSelector = keccak256("Error(string)").toString("hex").slice(0, 8);
const panicSelector = keccak256("Panic(uint256)").toString("hex").slice(0, 8);
const errorSelector = "0x" + keccak256("Error(string)").toString("hex").slice(0, 8);
const panicSelector = "0x" + keccak256("Panic(uint256)").toString("hex").slice(0, 8);

export function decodeRevertReason(data: string): string {
try {
Expand Down Expand Up @@ -74,9 +74,10 @@ function App() {
for (let i = 0; i < tx.clauses.length; i++) {
const debugged = await axios.post(url + "/debug/tracers", {
target: `${block.id}/${txIndex}/${i}`,
name: 'call',
});

const revertReason = decodeRevertReason(debugged.data.returnValue);
const revertReason = decodeRevertReason(debugged.data.output);

if (revertReason) {
setRevertReason(revertReason);
Expand Down

0 comments on commit 423619a

Please sign in to comment.