diff --git a/clients/js/src/provider.ts b/clients/js/src/provider.ts index 2b7dbe0c..d9b3091b 100644 --- a/clients/js/src/provider.ts +++ b/clients/js/src/provider.ts @@ -208,7 +208,16 @@ export function makeTaggedProxyObject( if (prop === propname) return options; if (hooks && prop in hooks) return Reflect.get(hooks, prop); const value = Reflect.get(upstream, prop); - return typeof value === 'function' ? value.bind(upstream) : value; + // Brave wallet web3provider properties are read only and throw typeerror + // https://github.com/brave/brave-core/blob/74bf470a0291ea3719f1a75af066ee10b7057dbd/components/brave_wallet/resources/ethereum_provider.js#L13-L27 + // https://github.com/wevm/wagmi/blob/86c42248c2f34260a52ee85183c607315ae63ce8/packages/core/src/connectors/injected.ts#L327-L335 + if ( + typeof value === 'function' && + Object.getOwnPropertyDescriptor(upstream, prop)?.writable + ) { + return value.bind(upstream); + } + return value; }, }); }