From b8df000c8f0ccd252b6049ac5a32a986d5a8e08d Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Sat, 17 Apr 2021 18:10:27 -0400 Subject: [PATCH] Added better error detection when pre-EIP-155 transactions are disabled. --- packages/providers/src.ts/json-rpc-provider.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/providers/src.ts/json-rpc-provider.ts b/packages/providers/src.ts/json-rpc-provider.ts index 1b801da81..b6d76955a 100644 --- a/packages/providers/src.ts/json-rpc-provider.ts +++ b/packages/providers/src.ts/json-rpc-provider.ts @@ -65,6 +65,13 @@ function checkError(method: string, error: any, params: any): any { }); } + // "replacement transaction underpriced" + if (message.match(/only replay-protected/)) { + logger.throwError("legacy pre-eip-155 transactions not supported", Logger.errors.UNSUPPORTED_OPERATION, { + error, method, transaction + }); + } + if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) { logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, { error, method, transaction