From 2265b34a036ac881c5404e1780fd35975f31756a Mon Sep 17 00:00:00 2001 From: Monte Lai Date: Tue, 6 Feb 2024 22:58:10 +0800 Subject: [PATCH] fix: regex to support query parameters --- packages/snap/snap.manifest.json | 2 +- packages/snap/src/keyring.ts | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 8155ad3..c6a9649 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -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", diff --git a/packages/snap/src/keyring.ts b/packages/snap/src/keyring.ts index aa6af32..ac64a4f 100644 --- a/packages/snap/src/keyring.ts +++ b/packages/snap/src/keyring.ts @@ -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}`); }