Skip to content

Commit

Permalink
fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink committed Mar 4, 2024
1 parent ecb31ff commit 7a1103f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/sdk/src/decode/decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7a1103f

Please sign in to comment.