diff --git a/extension/package.json b/extension/package.json index ed9d31bf..2f7a00a4 100644 --- a/extension/package.json +++ b/extension/package.json @@ -87,4 +87,4 @@ "typescript-plugin-css-modules": "^3.4.0" }, "packageManager": "yarn@3.7.0" -} +} \ No newline at end of file diff --git a/extension/src/bridge/SafeAppBridge.ts b/extension/src/bridge/SafeAppBridge.ts index 3698fc84..cfbc4668 100644 --- a/extension/src/bridge/SafeAppBridge.ts +++ b/extension/src/bridge/SafeAppBridge.ts @@ -95,10 +95,10 @@ export default class SafeAppBridge { console.debug('SAFE_APP_MESSAGE', msg.data) try { const response = await handler(msg.data.params, msg.data.id, msg.data.env) - console.log({ response }) - // TODO can this happen? (If response is not returned, it means the response will be sent somewhere else) if (typeof response !== 'undefined') { this.postResponse(msg.source, response, msg.data.id) + } else { + throw new Error('No response returned from handler') } } catch (e) { console.error('Error handling message via SafeAppCommunicator', e) diff --git a/extension/src/providers/readOnlyProvider.ts b/extension/src/providers/readOnlyProvider.ts index 3df7523b..055e5d29 100644 --- a/extension/src/providers/readOnlyProvider.ts +++ b/extension/src/providers/readOnlyProvider.ts @@ -1,22 +1,24 @@ import EventEmitter from 'events' import { hexValue } from 'ethers/lib/utils' import { - JsonRpcBatchProvider, + StaticJsonRpcProvider, TransactionRequest, } from '@ethersproject/providers' import { ChainId, RPC } from '../chains' -const readOnlyProviderCache = new Map() +const readOnlyProviderCache = new Map() const eip1193ProviderCache = new Map() const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' -export const getReadOnlyProvider = (chainId: ChainId): JsonRpcBatchProvider => { +export const getReadOnlyProvider = ( + chainId: ChainId +): StaticJsonRpcProvider => { if (readOnlyProviderCache.has(chainId)) { return readOnlyProviderCache.get(chainId)! } - const provider = new JsonRpcBatchProvider(RPC[chainId], chainId) + const provider = new StaticJsonRpcProvider(RPC[chainId], chainId) readOnlyProviderCache.set(chainId, provider) return provider } @@ -41,7 +43,7 @@ export const getEip1193ReadOnlyProvider = ( } const hexlifyTransaction = (transaction: TransactionRequest) => - JsonRpcBatchProvider.hexlifyTransaction(transaction, { + StaticJsonRpcProvider.hexlifyTransaction(transaction, { from: true, customData: true, ccipReadEnabled: true, @@ -52,7 +54,7 @@ const hexlifyTransaction = (transaction: TransactionRequest) => * Copyright (c) 2019 Richard Moore, released under MIT license. */ export class Eip1193JsonRpcProvider extends EventEmitter { - readonly provider: JsonRpcBatchProvider + readonly provider: StaticJsonRpcProvider readonly chainId: ChainId readonly address: string