diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 207904c8c3..da3621acb3 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -125,10 +125,13 @@ type Web3React = { active: boolean } -const wrapProvider = (provider: Web3Provider, blackjackData: BlackjackCheck): Web3Provider => +const wrapProvider = (provider: Web3Provider, blackjackData: BlackjackCheck | undefined): Web3Provider => new Proxy(provider, { get(target, prop) { - if (prop === 'send' && blackjackData.blacklisted) throw new Error('There was an error with your transaction') + if (prop === 'send') { + if (!blackjackData) throw new Error('There was an error with your transaction') + if (blackjackData.blacklisted) throw new Error('There was an error with your transaction.') + } return target[prop as keyof Web3Provider] }, }) diff --git a/src/utils/sendTransaction.ts b/src/utils/sendTransaction.ts index df864c118b..dd4d8a9a6d 100644 --- a/src/utils/sendTransaction.ts +++ b/src/utils/sendTransaction.ts @@ -33,7 +33,7 @@ export async function sendEVMTransaction({ } chainId?: ChainId }): Promise { - if (!account || !library) return + if (!account || !library) throw new Error('Invalid transaction') const estimateGasOption = { from: account,