From aa3fe85c8fd8f3ef13a1315295af663876f81b77 Mon Sep 17 00:00:00 2001 From: jinoosss Date: Thu, 12 Oct 2023 16:24:29 +0900 Subject: [PATCH] [GSW-323] fix: Fix ABCI Response Parser --- packages/web/src/utils/rpc-utils.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/web/src/utils/rpc-utils.ts b/packages/web/src/utils/rpc-utils.ts index 5f639ad8e..f04044afb 100644 --- a/packages/web/src/utils/rpc-utils.ts +++ b/packages/web/src/utils/rpc-utils.ts @@ -2,14 +2,14 @@ import BigNumber from "bignumber.js"; export function evaluateExpressionToNumber(evaluateExpression: string) { try { - const regexp = /(.*?)/; - const result = Array.from( - evaluateExpression.matchAll(regexp), - match => `${match[0]}`, - ); - if (result.length > 0) { - return BigNumber(result[0]).toNumber(); + const regexp = /\((.*)\)/; + const result = evaluateExpression.match(regexp); + if (result === null || result.length < 1) { + return 0; } + + const parsedValue = result[1].split(" ")[0]; + return BigNumber(parsedValue).toNumber(); } catch { console.log("Parse Error: " + evaluateExpression); }