From d51e3fbff43c31d88353ac71151626312d22c0b9 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Fri, 23 Jun 2023 00:04:16 -0400 Subject: [PATCH] Fixed CCIP read in contract calls (#4043). --- src.ts/providers/abstract-provider.ts | 3 ++- src.ts/providers/provider.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src.ts/providers/abstract-provider.ts b/src.ts/providers/abstract-provider.ts index 65f8cb18b7..36df994ab1 100644 --- a/src.ts/providers/abstract-provider.ts +++ b/src.ts/providers/abstract-provider.ts @@ -939,7 +939,7 @@ export class AbstractProvider implements Provider { try { return hexlify(await this._perform({ method: "call", transaction, blockTag })); - } catch (error) { + } catch (error: any) { // CCIP Read OffchainLookup if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") { const data = error.data; @@ -1007,6 +1007,7 @@ export class AbstractProvider implements Provider { tx: this._getTransactionRequest(_tx), blockTag: this._getBlockTag(_tx.blockTag) }); + return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0: -1)); } diff --git a/src.ts/providers/provider.ts b/src.ts/providers/provider.ts index 583527dc83..ee183328a2 100644 --- a/src.ts/providers/provider.ts +++ b/src.ts/providers/provider.ts @@ -351,7 +351,7 @@ export function copyRequest(req: TransactionRequest): PreparedTransactionRequest if ("blockTag" in req) { result.blockTag = req.blockTag; } if ("enableCcipRead" in req) { - result.enableCcipReadEnabled = !!req.enableCcipRead + result.enableCcipRead = !!req.enableCcipRead } if ("customData" in req) {