From 7a1103f6ec08de1029049ca2c4f87c1c952a33d2 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Mon, 4 Mar 2024 10:29:58 -0800 Subject: [PATCH] fix regex --- packages/sdk/src/decode/decode.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sdk/src/decode/decode.js b/packages/sdk/src/decode/decode.js index cc3c936b5..2adb1c39d 100644 --- a/packages/sdk/src/decode/decode.js +++ b/packages/sdk/src/decode/decode.js @@ -215,13 +215,14 @@ export const decodeResponse = async (response, customDecoders = {}) => { } else if (response.collection) { return response.collection } else if (response.networkParameters) { + const prefixRegex = /^flow-/ const rawChainId = response.networkParameters.chainId let formattedChainId if (rawChainId === "flow-emulator") { formattedChainId = "local" - } else if (/^flow-/.test(rawChainId)) { - formattedChainId = rawChainId.replace("flow-", "") + } else if (prefixRegex.test(rawChainId)) { + formattedChainId = rawChainId.replace(prefixRegex, "") } else { formattedChainId = rawChainId }