From cfcd9dbb9c6437cf9707f6ea793a6cf13e402a07 Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Fri, 1 Dec 2023 09:45:00 +0100 Subject: [PATCH] fix: add support for `Sepolia` testnet --- src/provider.ts | 6 ++++-- src/types.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/provider.ts b/src/provider.ts index 17e9aff..38e6ff2 100644 --- a/src/provider.ts +++ b/src/provider.ts @@ -105,7 +105,7 @@ export function JsonRpcApiProvider { while (true) { const receipt = (await super.getTransactionReceipt(txHash)) as TransactionReceipt; - if (receipt.blockNumber) { + if (receipt && receipt.blockNumber) { return receipt; } await sleep(500); @@ -600,8 +600,10 @@ export class Provider extends JsonRpcApiProvider(ethers.JsonRpcProvider) { return new Provider("http://localhost:3050"); case ZkSyncNetwork.Goerli: return new Provider("https://zksync2-testnet.zksync.dev"); + case ZkSyncNetwork.Sepolia: + return new Provider("https://sepolia.era.zksync.dev"); case ZkSyncNetwork.Mainnet: - return new Provider("https://zksync2-mainnet.zksync.io/"); + return new Provider("https://mainnet.era.zksync.io"); } } } diff --git a/src/types.ts b/src/types.ts index e9fa2cb..fbcb1c6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,6 +21,7 @@ export enum Network { Ropsten = 3, Rinkeby = 4, Goerli = 5, + Sepolia = 6, Localhost = 9, } @@ -99,7 +100,7 @@ export class TransactionResponse extends ethers.TransactionResponse { override async wait(confirmations?: number): Promise { while (true) { const receipt = (await super.wait(confirmations)) as TransactionReceipt; - if (receipt.blockNumber) { + if (receipt && receipt.blockNumber) { return receipt; } await sleep(500);