Skip to content

Commit

Permalink
fix: validation for addEthereumChain (#1014)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops authored Aug 18, 2023
1 parent 428509d commit 91abd3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/extension/src/core/domains/ethereum/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const prepareTransaction = (
const testNoScriptTag = (text?: string) => !text?.toLowerCase().includes("<script")

const schemaAddEthereumRequest = yup.object().shape({
chainId: yup.string().required(),
chainId: yup.string().required().test("noScriptTag", testNoScriptTag),
chainName: yup.string().required().max(100).test("noScriptTag", testNoScriptTag),
nativeCurrency: yup
.object()
Expand All @@ -276,9 +276,9 @@ const schemaAddEthereumRequest = yup.object().shape({
decimals: yup.number().required().integer(),
})
.required(),
rpcUrls: yup.array().of(yup.string().required().url()).required(),
blockExplorerUrls: yup.array().of(yup.string().required().url()),
iconUrls: yup.array().of(yup.string()),
rpcUrls: yup.array().of(yup.string().required().test("noScriptTag", testNoScriptTag)).required(),
blockExplorerUrls: yup.array().of(yup.string().required().test("noScriptTag", testNoScriptTag)),
iconUrls: yup.array().of(yup.string().test("noScriptTag", testNoScriptTag)),
})

export const isValidAddEthereumRequestParam = (obj: unknown) =>
Expand Down

0 comments on commit 91abd3f

Please sign in to comment.