Skip to content

Commit

Permalink
Revert "fix: rollback to zksync-web3"
Browse files Browse the repository at this point in the history
This reverts commit 5e74427.
  • Loading branch information
JackHamer09 committed Mar 6, 2024
1 parent 1e64841 commit c9ada59
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 26 deletions.
6 changes: 3 additions & 3 deletions composables/transaction/useAllowance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BigNumber } from "ethers";
import IERC20 from "zksync-web3/abi/IERC20.json";
import IERC20 from "zksync-ethers/abi/IERC20.json";

import type { Hash } from "@/types";
import type { BigNumberish } from "ethers";
Expand All @@ -26,7 +26,7 @@ export default (
const publicClient = getPublicClient();
const allowance = (await publicClient!.readContract({
address: tokenAddress.value as Hash,
abi: IERC20.abi,
abi: IERC20,
functionName: "allowance",
args: [accountAddress.value, contractAddress],
})) as bigint;
Expand Down Expand Up @@ -68,7 +68,7 @@ export default (
setAllowanceStatus.value = "waiting-for-signature";
setAllowanceTransactionHash.value = await wallet.writeContract({
address: tokenAddress.value as Hash,
abi: IERC20.abi,
abi: IERC20,
functionName: "approve",
args: [contractAddress, approvalAmount!.toString()],
});
Expand Down
2 changes: 1 addition & 1 deletion composables/zksync/deposit/useFee.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BigNumber } from "ethers";
import { parseEther } from "ethers/lib/utils";
import { L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT } from "zksync-web3/src/utils";
import { L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT } from "zksync-ethers/src/utils";

import type { Token, TokenAmount } from "@/types";
import type { BigNumberish } from "ethers";
Expand Down
2 changes: 1 addition & 1 deletion composables/zksync/deposit/useTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DepositFeeValues } from "@/composables/zksync/deposit/useFee";
import type { BigNumberish } from "ethers";
import type { L1Signer } from "zksync-web3";
import type { L1Signer } from "zksync-ethers";

export default (getL1Signer: () => Promise<L1Signer | undefined>) => {
const status = ref<"not-started" | "processing" | "waiting-for-signature" | "done">("not-started");
Expand Down
2 changes: 1 addition & 1 deletion composables/zksync/useFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BigNumber } from "ethers";

import type { Token, TokenAmount } from "@/types";
import type { BigNumberish } from "ethers";
import type { Provider } from "zksync-web3";
import type { Provider } from "zksync-ethers";

export type FeeEstimationParams = {
type: "transfer" | "withdrawal";
Expand Down
10 changes: 5 additions & 5 deletions composables/zksync/useWithdrawalFinalization.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useMemoize } from "@vueuse/core";
import { BigNumber, type BigNumberish } from "ethers";
import { Wallet } from "zksync-web3";
import ZkSyncL1BridgeAbi from "zksync-web3/abi/IL1Bridge.json";
import ZkSyncContractAbi from "zksync-web3/abi/IZkSync.json";
import { Wallet } from "zksync-ethers";
import ZkSyncL1BridgeAbi from "zksync-ethers/abi/IL1Bridge.json";
import ZkSyncContractAbi from "zksync-ethers/abi/IZkSync.json";

import type { Hash } from "@/types";

Expand Down Expand Up @@ -71,15 +71,15 @@ export default (transactionInfo: ComputedRef<TransactionInfo>) => {
if (usingMainContract.value) {
return {
address: (await retrieveMainContractAddress()) as Hash,
abi: ZkSyncContractAbi.abi,
abi: ZkSyncContractAbi,
account: onboardStore.account.address!,
functionName: "finalizeEthWithdrawal",
args: Object.values(finalizeWithdrawalParams.value!),
};
} else {
return {
address: (await retrieveBridgeAddress()) as Hash,
abi: ZkSyncL1BridgeAbi.abi,
abi: ZkSyncL1BridgeAbi,
account: onboardStore.account.address!,
functionName: "finalizeWithdrawal",
args: Object.values(finalizeWithdrawalParams.value!),
Expand Down
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"vite": "^3.0.0",
"vue-tippy": "^6.0.0",
"web3-avatar-vue": "^1.0.0",
"zksync-web3": "^0.17.0-beta.0"
"zksync-ethers": "^5.5.0"
},
"overrides": {
"vue": "latest"
Expand Down
2 changes: 1 addition & 1 deletion store/zksync/provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider } from "zksync-web3";
import { Provider } from "zksync-ethers";

export const useZkSyncProviderStore = defineStore("zkSyncProvider", () => {
const { selectedNetwork } = storeToRefs(useNetworkStore());
Expand Down
4 changes: 2 additions & 2 deletions store/zksync/transactionStatus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useStorage } from "@vueuse/core";
import { decodeEventLog } from "viem";
import ZkSyncContractInterface from "zksync-web3/abi/IZkSync.json";
import ZkSyncContractInterface from "zksync-ethers/abi/IZkSync.json";

import type { FeeEstimationParams } from "@/composables/zksync/useFee";
import type { TokenAmount, Hash } from "@/types";
Expand Down Expand Up @@ -58,7 +58,7 @@ export const useZkSyncTransactionStatusStore = defineStore("zkSyncTransactionSta
for (const log of transaction.logs) {
try {
const { args, eventName } = decodeEventLog({
abi: ZkSyncContractInterface.abi,
abi: ZkSyncContractInterface,
data: log.data,
topics: log.topics,
});
Expand Down
11 changes: 7 additions & 4 deletions store/zksync/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BigNumber, ethers, VoidSigner } from "ethers";
import { BigNumber, ethers } from "ethers";
import { $fetch } from "ofetch";
import { L1Signer, L1VoidSigner, Web3Provider } from "zksync-web3";
import { L1Signer, L1VoidSigner, Web3Provider } from "zksync-ethers";

import type { Api, TokenAmount } from "@/types";
import type { BigNumberish } from "ethers";
Expand Down Expand Up @@ -44,8 +44,11 @@ export const useZkSyncWalletStore = defineStore("zkSyncWallet", () => {
if (!account.value.address && !anyAddress) throw new Error("Address is not available");

const web3Provider = new ethers.providers.Web3Provider(onboardStore.getPublicClient() as any, "any");
const voidSigner = new VoidSigner(account.value.address || ETH_TOKEN.address, web3Provider);
return L1VoidSigner.from(voidSigner, providerStore.requestProvider()) as unknown as L1Signer;
return new L1VoidSigner(
account.value.address || ETH_TOKEN.address,
web3Provider,
providerStore.requestProvider()
) as unknown as L1Signer;
};

const {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/src/helpers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import https from "https";
import { Status } from "@cucumber/cucumber";
import * as dotenv from "dotenv";
import { ethers } from "ethers";
import { Provider } from "zksync-web3";
import { Provider } from "zksync-ethers";

import type { Pickle } from "@cucumber/messages";
import { MainPage } from "../pages/main.page";
Expand Down

0 comments on commit c9ada59

Please sign in to comment.