From 40606ba396b7d89d1f109dbf5630f18a5f384d74 Mon Sep 17 00:00:00 2001 From: Abdou <118254027+a6-dou@users.noreply.github.com> Date: Wed, 17 May 2023 12:20:40 +0400 Subject: [PATCH 1/2] fix: convert decimal gas to hex --- src/simulator/providers/nodeReal.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulator/providers/nodeReal.ts b/src/simulator/providers/nodeReal.ts index 95cf51b..b509f2e 100644 --- a/src/simulator/providers/nodeReal.ts +++ b/src/simulator/providers/nodeReal.ts @@ -7,7 +7,7 @@ type CallTracerParams = { to: string; value: string; data: string; - gas: number; + gas: string; }; const baseURLs: { [chainId: number]: string } = {}; @@ -27,7 +27,7 @@ export const nodeRealFactory = (apiKey: string, chainId: number): DebugProvider to: input.to, data: input.calldata, value: input.value || "0x0", - gas: input.gas, + gas: `0x${input.gas.toString(16)}`, }, baseURLs[chainId] ), From 557d29861f8440c0eea8282be44ec7980e2fc788 Mon Sep 17 00:00:00 2001 From: Abdou <118254027+a6-dou@users.noreply.github.com> Date: Wed, 17 May 2023 12:35:04 +0400 Subject: [PATCH 2/2] fix: cover out of gas rpc error --- src/simulator/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/simulator/index.ts b/src/simulator/index.ts index 09e4fdb..9f74db1 100644 --- a/src/simulator/index.ts +++ b/src/simulator/index.ts @@ -80,7 +80,9 @@ export default class Simulator { data?.forEach((call) => { if (call.error) { throw new WizardError( - `Transaction will fail with error: '${decodeErrorMessage(call.output)}'` + `Transaction will fail with error: '${ + call.output ? decodeErrorMessage(call.output) : call.error + }'` ); } // handle native ETH transfers