Skip to content

Commit

Permalink
fix: regex to support query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
montelaidev committed Feb 6, 2024
1 parent c7429cf commit 2265b34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "git+https://github.com/MetaMask/snap-account-abstraction-keyring.git"
},
"source": {
"shasum": "clcjsjpQoTO7v/UTi4OMTGI0p5Xs7ldIO7an0fw1sYQ=",
"shasum": "FzywCTYC6+HzujH602Q5ZKsKqB33EbhGhf7ZNq3jt20=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
14 changes: 4 additions & 10 deletions packages/snap/src/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,22 @@ export class AccountAbstractionKeyring implements Keyring {
!ethers.isAddress(config.simpleAccountFactory)
) {
throwError(
`[Snap] Invalid Simple Account Factory Address: ${
config.simpleAccountFactory as string
}`,
`[Snap] Invalid Simple Account Factory Address: ${config.simpleAccountFactory}`,
);
}
if (config.entryPoint && !ethers.isAddress(config.entryPoint)) {
throwError(
`[Snap] Invalid EntryPoint Address: ${config.entryPoint as string}`,
);
throwError(`[Snap] Invalid EntryPoint Address: ${config.entryPoint}`);
}
if (
config.customVerifyingPaymasterAddress &&
!ethers.isAddress(config.customVerifyingPaymasterAddress)
) {
throwError(
`[Snap] Invalid Verifying Paymaster Address: ${
config.customVerifyingPaymasterAddress as string
}`,
`[Snap] Invalid Verifying Paymaster Address: ${config.customVerifyingPaymasterAddress}`,
);
}
const bundlerUrlRegex =
/^(https?:\/\/)?[\w\\.-]+(:\d{2,6})?(\/[\\/\w \\.-]*)?$/u;
/^(https?:\/\/)?[\w\\.-]+(:\d{2,6})?(\/[\\/\w \\.-]*)?(\?[\\/\w .\-=]*)?$/u;
if (config.bundlerUrl && !bundlerUrlRegex.test(config.bundlerUrl)) {
throwError(`[Snap] Invalid Bundler URL: ${config.bundlerUrl}`);
}
Expand Down

0 comments on commit 2265b34

Please sign in to comment.