Skip to content

Commit

Permalink
Fixed CCIP read in contract calls (#4043).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jun 23, 2023
1 parent 5210b68 commit d51e3fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src.ts/providers/abstract-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion src.ts/providers/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d51e3fb

Please sign in to comment.