From 50745b316c7b98cfec240ffdd291afc1cc783dcc Mon Sep 17 00:00:00 2001 From: Robert Sun Date: Tue, 18 Jan 2022 14:51:26 -0800 Subject: [PATCH] Fix detection for `provider.send(payload,cb)` to use replaceAll instead of replace --- utils/src/provider_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/src/provider_utils.ts b/utils/src/provider_utils.ts index a2d81bb848..388bf7af1b 100644 --- a/utils/src/provider_utils.ts +++ b/utils/src/provider_utils.ts @@ -74,7 +74,7 @@ export const providerUtils = { } else if ((supportedProvider as any).send !== undefined) { // HACK(fabio): Detect if the `send` method has the old interface `send(payload, cb)` such // as in versions < Web3.js@1.0.0-beta.37. If so, do a simple re-mapping - if (_.includes((supportedProvider as any).send.toString().replace(' ', ''), 'function(payload,callback)')) { + if (_.includes((supportedProvider as any).send.toString().replaceAll(' ', ''), 'function(payload,callback)')) { provider.sendAsync = (supportedProvider as any).send.bind(supportedProvider); return provider; } else {