diff --git a/packages/app/README.md b/packages/app/README.md index 27c421eff1..0be36b6001 100644 --- a/packages/app/README.md +++ b/packages/app/README.md @@ -40,8 +40,8 @@ import type { EnvironmentConfig } from "."; const config: EnvironmentConfig = { networks: [ { - apiURLv2: "http://localhost:3020", - apiUrl: "https://zksync2-testnet-explorer.zksync.dev", + apiUrl: "http://localhost:3020", + verificationApiUrl: "https://zksync2-testnet-explorer.zksync.dev", hostnames: ["localhost"], icon: "/images/icons/zksync-arrows.svg", l1ExplorerUrl: "https://goerli.etherscan.io", @@ -55,8 +55,8 @@ const config: EnvironmentConfig = { }, // next network has been just added { - apiURLv2: "http://localhost:3030", - apiUrl: "https://zksync2-testnet-explorer.zksync.dev", + apiUrl: "http://localhost:3030", + verificationApiUrl: "https://zksync2-testnet-explorer.zksync.dev", hostnames: ["localhost"], icon: "/images/icons/zksync-arrows.svg", l1ExplorerUrl: "https://goerli.etherscan.io", diff --git a/packages/app/src/composables/useAddress.ts b/packages/app/src/composables/useAddress.ts index 4d3693d22a..fe5262362c 100644 --- a/packages/app/src/composables/useAddress.ts +++ b/packages/app/src/composables/useAddress.ts @@ -94,7 +94,7 @@ export default (context = useContext()) => { const getContractVerificationInfo = async (address: string): Promise => { try { - return await $fetch(`${context.currentNetwork.value.apiUrl}/contract_verification/info/${address}`); + return await $fetch(`${context.currentNetwork.value.verificationApiUrl}/contract_verification/info/${address}`); } catch (e) { if (!(e instanceof FetchError) || e.response?.status !== 404) { throw e; @@ -165,7 +165,7 @@ export default (context = useContext()) => { try { const response: Api.Response.Account | Api.Response.Contract = await $fetch( - `${context.currentNetwork.value.apiURLv2}/address/${address}` + `${context.currentNetwork.value.apiUrl}/address/${address}` ); if (response.type === "account") { item.value = response; diff --git a/packages/app/src/composables/useBatch.ts b/packages/app/src/composables/useBatch.ts index e634204e5b..7eeb2916ff 100644 --- a/packages/app/src/composables/useBatch.ts +++ b/packages/app/src/composables/useBatch.ts @@ -26,7 +26,7 @@ export default (context = useContext()) => { isRequestFailed.value = false; try { - const batch = await $fetch(`${context.currentNetwork.value.apiURLv2}/batches/${id}`); + const batch = await $fetch(`${context.currentNetwork.value.apiUrl}/batches/${id}`); if (batch.proveTxHash) { const proof = await getBatchNewProof(id); batch.isProvenByNewProver = !!proof; diff --git a/packages/app/src/composables/useBatches.ts b/packages/app/src/composables/useBatches.ts index a4f2672e04..fad98a3583 100644 --- a/packages/app/src/composables/useBatches.ts +++ b/packages/app/src/composables/useBatches.ts @@ -5,6 +5,6 @@ export type BatchListItem = Api.Response.BatchListItem; export default (context = useContext()) => { return useFetchCollection( - new URL(`/batches?toDate=${new Date().toISOString()}`, context.currentNetwork.value.apiURLv2) + new URL(`/batches?toDate=${new Date().toISOString()}`, context.currentNetwork.value.apiUrl) ); }; diff --git a/packages/app/src/composables/useBlock.ts b/packages/app/src/composables/useBlock.ts index d06616059c..c2002feeb5 100644 --- a/packages/app/src/composables/useBlock.ts +++ b/packages/app/src/composables/useBlock.ts @@ -56,7 +56,7 @@ export default (context = useContext()) => { isRequestFailed.value = false; try { - const data = await $fetch(`${context.currentNetwork.value.apiURLv2}/blocks/${id}`); + const data = await $fetch(`${context.currentNetwork.value.apiUrl}/blocks/${id}`); if (data.l1BatchNumber && data.proveTxHash) { const proof = await getBatchNewProof(data.l1BatchNumber); data.isProvenByNewProver = !!proof; diff --git a/packages/app/src/composables/useBlocks.ts b/packages/app/src/composables/useBlocks.ts index 093abce231..e94b88d86f 100644 --- a/packages/app/src/composables/useBlocks.ts +++ b/packages/app/src/composables/useBlocks.ts @@ -5,6 +5,6 @@ import type { BlockListItem } from "@/composables/useBlock"; export default (context = useContext()) => { return useFetchCollection( - new URL(`/blocks?toDate=${new Date().toISOString()}`, context.currentNetwork.value.apiURLv2) + new URL(`/blocks?toDate=${new Date().toISOString()}`, context.currentNetwork.value.apiUrl) ); }; diff --git a/packages/app/src/composables/useContractABI.ts b/packages/app/src/composables/useContractABI.ts index 637c8e4e6e..6299aeab39 100644 --- a/packages/app/src/composables/useContractABI.ts +++ b/packages/app/src/composables/useContractABI.ts @@ -12,7 +12,7 @@ import { checksumAddress } from "@/utils/formatters"; const retrieveAddressInfo = useMemoize( async (address: Address, context: Context = useContext()) => { - return await $fetch(`${context.currentNetwork.value.apiUrl}/contract_verification/info/${address}`); + return await $fetch(`${context.currentNetwork.value.verificationApiUrl}/contract_verification/info/${address}`); }, { getKey(address: Address, context: Context = useContext()) { diff --git a/packages/app/src/composables/useContractEvents.ts b/packages/app/src/composables/useContractEvents.ts index 3ca54cbe87..31c6a8be1c 100644 --- a/packages/app/src/composables/useContractEvents.ts +++ b/packages/app/src/composables/useContractEvents.ts @@ -41,7 +41,7 @@ export default (context = useContext()) => { isRequestFailed.value = false; try { - const url = new URL(`/address/${params.contractAddress}/logs`, context.currentNetwork.value.apiURLv2); + const url = new URL(`/address/${params.contractAddress}/logs`, context.currentNetwork.value.apiUrl); if (params.toDate && +new Date(params.toDate) > 0) { url.searchParams.set("toDate", params.toDate.toISOString()); } diff --git a/packages/app/src/composables/useContractVerification.ts b/packages/app/src/composables/useContractVerification.ts index 7da6447ccc..499b975e45 100644 --- a/packages/app/src/composables/useContractVerification.ts +++ b/packages/app/src/composables/useContractVerification.ts @@ -55,7 +55,7 @@ export default (context = useContext()) => { const response: { status: ContractVerificationStatus; error?: string; - } = await $fetch(`${context.currentNetwork.value.apiUrl}/contract_verification/${id}`); + } = await $fetch(`${context.currentNetwork.value.verificationApiUrl}/contract_verification/${id}`); if (response.error) { throw new ContractVerificationError(response.error, response); } @@ -88,7 +88,7 @@ export default (context = useContext()) => { ].includes(data.codeFormat); const { sourceCode, zkCompilerVersion, compilerVersion, ...payload } = data; - const response = await $fetch(`${context.currentNetwork.value.apiUrl}/contract_verification`, { + const response = await $fetch(`${context.currentNetwork.value.verificationApiUrl}/contract_verification`, { method: "POST", body: { ...payload, @@ -135,7 +135,9 @@ export default (context = useContext()) => { compilerVersions.value[compiler].isRequestPending = true; compilerVersions.value[compiler].isRequestFailed = false; try { - const result = await $fetch(`${context.currentNetwork.value.apiUrl}/contract_verification/${compiler}_versions`); + const result = await $fetch( + `${context.currentNetwork.value.verificationApiUrl}/contract_verification/${compiler}_versions` + ); compilerVersions.value[compiler].versions = result.sort((a: string, b: string) => { return b.localeCompare(a, undefined, { numeric: true, sensitivity: "base" }); }); diff --git a/packages/app/src/composables/useNetworkStats.ts b/packages/app/src/composables/useNetworkStats.ts index 0d0ca0455e..6e175fd8ba 100644 --- a/packages/app/src/composables/useNetworkStats.ts +++ b/packages/app/src/composables/useNetworkStats.ts @@ -10,5 +10,5 @@ export interface NetworkStats { } export default (context = useContext()) => { - return useFetch(() => new URL(`${context.currentNetwork.value.apiURLv2}/stats`)); + return useFetch(() => new URL(`${context.currentNetwork.value.apiUrl}/stats`)); }; diff --git a/packages/app/src/composables/useRuntimeConfig.ts b/packages/app/src/composables/useRuntimeConfig.ts index 8622bd74e0..d50098be55 100644 --- a/packages/app/src/composables/useRuntimeConfig.ts +++ b/packages/app/src/composables/useRuntimeConfig.ts @@ -1,8 +1,8 @@ import type { NetworkConfig } from "@/configs"; export const DEFAULT_NETWORK: NetworkConfig = { - apiURLv2: "https://block-explorer-api.testnets.zksync.dev", - apiUrl: "https://zksync2-testnet-explorer.zksync.dev", + apiUrl: "https://block-explorer-api.testnets.zksync.dev", + verificationApiUrl: "https://zksync2-testnet-explorer.zksync.dev", bridgeUrl: "https://goerli.bridge.zksync.io", hostnames: ["https://goerli.explorer.zksync.io"], icon: "/images/icons/zksync-arrows.svg", diff --git a/packages/app/src/composables/useSearch.ts b/packages/app/src/composables/useSearch.ts index 631d6f1d45..3dff3785c9 100644 --- a/packages/app/src/composables/useSearch.ts +++ b/packages/app/src/composables/useSearch.ts @@ -40,7 +40,7 @@ export default (context = useContext()) => { if (!item.isValid) { continue; } - await $fetch(`${context.currentNetwork.value.apiURLv2}/${item.apiRoute}/${param}`); + await $fetch(`${context.currentNetwork.value.apiUrl}/${item.apiRoute}/${param}`); await router.push({ name: item.routeName, params: item.routeParam }); return; diff --git a/packages/app/src/composables/useToken.ts b/packages/app/src/composables/useToken.ts index 5902006fb5..2e277a9e0c 100644 --- a/packages/app/src/composables/useToken.ts +++ b/packages/app/src/composables/useToken.ts @@ -27,7 +27,7 @@ export const retrieveToken = useMemoize( if (tokenAddress === ETH_TOKEN.l2Address) { return Promise.resolve(ETH_TOKEN); } - return $fetch(`${context.currentNetwork.value.apiURLv2}/tokens/${tokenAddress}`); + return $fetch(`${context.currentNetwork.value.apiUrl}/tokens/${tokenAddress}`); }, { getKey(tokenAddress: Hash, context: Context = useContext()) { diff --git a/packages/app/src/composables/useTransaction.ts b/packages/app/src/composables/useTransaction.ts index 078e883e08..5bf813ee78 100644 --- a/packages/app/src/composables/useTransaction.ts +++ b/packages/app/src/composables/useTransaction.ts @@ -144,11 +144,11 @@ export default (context = useContext()) => { try { const [txResponse, txTransfers, txLogs] = await Promise.all([ - $fetch(`${context.currentNetwork.value.apiURLv2}/transactions/${hash}`), + $fetch(`${context.currentNetwork.value.apiUrl}/transactions/${hash}`), all( - new URL(`${context.currentNetwork.value.apiURLv2}/transactions/${hash}/transfers?limit=100`) + new URL(`${context.currentNetwork.value.apiUrl}/transactions/${hash}/transfers?limit=100`) ), - all(new URL(`${context.currentNetwork.value.apiURLv2}/transactions/${hash}/logs?limit=100`)), + all(new URL(`${context.currentNetwork.value.apiUrl}/transactions/${hash}/logs?limit=100`)), ]); transaction.value = mapTransaction(txResponse, txTransfers, txLogs); } catch (error) { diff --git a/packages/app/src/composables/useTransactions.ts b/packages/app/src/composables/useTransactions.ts index 2505240866..8e2b5cdadf 100644 --- a/packages/app/src/composables/useTransactions.ts +++ b/packages/app/src/composables/useTransactions.ts @@ -19,6 +19,6 @@ export default (searchParams: ComputedRef, context = us .filter(([, value]) => !!value || value === 0) .map(([key, value]) => [key, value.toString()]) ); - return new URL(`/transactions?${new URLSearchParams(requestParams)}`, context.currentNetwork.value.apiURLv2); + return new URL(`/transactions?${new URLSearchParams(requestParams)}`, context.currentNetwork.value.apiUrl); }); }; diff --git a/packages/app/src/composables/useTransfers.ts b/packages/app/src/composables/useTransfers.ts index f86d46b542..d878e42acb 100644 --- a/packages/app/src/composables/useTransfers.ts +++ b/packages/app/src/composables/useTransfers.ts @@ -14,7 +14,7 @@ export default (address: ComputedRef, context = useContext()) => { () => new URL( `/address/${address.value}/transfers?toDate=${new Date().toISOString()}`, - context.currentNetwork.value.apiURLv2 + context.currentNetwork.value.apiUrl ), (transfer: Api.Response.Transfer): Transfer => ({ ...transfer, diff --git a/packages/app/src/configs/index.ts b/packages/app/src/configs/index.ts index 61f1848b2e..aaa7da16c4 100644 --- a/packages/app/src/configs/index.ts +++ b/packages/app/src/configs/index.ts @@ -1,8 +1,8 @@ export type NetworkConfig = { name: string; icon: string; + verificationApiUrl: string; apiUrl: string; - apiURLv2: string; newProverUrl: string; rpcUrl: string; bridgeUrl?: string; diff --git a/packages/app/src/configs/local.config.ts b/packages/app/src/configs/local.config.ts index 84ae463f57..3871d6586b 100644 --- a/packages/app/src/configs/local.config.ts +++ b/packages/app/src/configs/local.config.ts @@ -5,8 +5,8 @@ import type { EnvironmentConfig } from "."; const config: EnvironmentConfig = { networks: [ { - apiURLv2: "http://localhost:3020", - apiUrl: "https://zksync2-testnet-explorer.zksync.dev", + apiUrl: "http://localhost:3020", + verificationApiUrl: "https://zksync2-testnet-explorer.zksync.dev", hostnames: ["localhost"], icon: "/images/icons/zksync-arrows.svg", l1ExplorerUrl: "https://goerli.etherscan.io", diff --git a/packages/app/src/configs/production.config.ts b/packages/app/src/configs/production.config.ts index 92735f5294..68fdeccd70 100644 --- a/packages/app/src/configs/production.config.ts +++ b/packages/app/src/configs/production.config.ts @@ -3,8 +3,8 @@ import type { EnvironmentConfig } from "."; const config: EnvironmentConfig = { networks: [ { - apiURLv2: "https://block-explorer-api.testnets.zksync.dev", - apiUrl: "https://zksync2-testnet-explorer.zksync.dev", + apiUrl: "https://block-explorer-api.testnets.zksync.dev", + verificationApiUrl: "https://zksync2-testnet-explorer.zksync.dev", bridgeUrl: "https://goerli.bridge.zksync.io", hostnames: ["https://goerli.explorer.zksync.io"], icon: "/images/icons/zksync-arrows.svg", @@ -19,8 +19,8 @@ const config: EnvironmentConfig = { rpcUrl: "https://testnet.era.zksync.dev", }, { - apiURLv2: "https://block-explorer-api.mainnet.zksync.io", - apiUrl: "https://zksync2-mainnet-explorer.zksync.io", + apiUrl: "https://block-explorer-api.mainnet.zksync.io", + verificationApiUrl: "https://zksync2-mainnet-explorer.zksync.io", bridgeUrl: "https://bridge.zksync.io", hostnames: ["https://explorer.zksync.io"], icon: "/images/icons/zksync-arrows.svg", diff --git a/packages/app/src/configs/staging.config.ts b/packages/app/src/configs/staging.config.ts index 85e7df65e7..43e7577b6e 100644 --- a/packages/app/src/configs/staging.config.ts +++ b/packages/app/src/configs/staging.config.ts @@ -3,8 +3,8 @@ import type { EnvironmentConfig } from "."; const config: EnvironmentConfig = { networks: [ { - apiURLv2: "https://block-explorer-api.testnets.zksync.dev", - apiUrl: "https://zksync2-testnet-explorer.zksync.dev", + apiUrl: "https://block-explorer-api.testnets.zksync.dev", + verificationApiUrl: "https://zksync2-testnet-explorer.zksync.dev", bridgeUrl: "https://staging.goerli.bridge.zksync.dev", hostnames: ["https://goerli.staging-scan-v2.zksync.dev"], icon: "/images/icons/zksync-arrows.svg", @@ -19,8 +19,8 @@ const config: EnvironmentConfig = { rpcUrl: "https://testnet.era.zksync.dev", }, { - apiURLv2: "https://block-explorer-api.stage.zksync.dev", - apiUrl: "https://z2-dev-api-explorer.zksync.dev", + apiUrl: "https://block-explorer-api.stage.zksync.dev", + verificationApiUrl: "https://z2-dev-api-explorer.zksync.dev", hostnames: ["https://goerli-beta.staging-scan-v2.zksync.dev"], icon: "/images/icons/zksync-arrows.svg", l1ExplorerUrl: "https://goerli.etherscan.io", @@ -34,8 +34,8 @@ const config: EnvironmentConfig = { rpcUrl: "https://z2-dev-api.zksync.dev", }, { - apiURLv2: "https://block-explorer-api.mainnet.zksync.io", - apiUrl: "https://zksync2-mainnet-explorer.zksync.io", + apiUrl: "https://block-explorer-api.mainnet.zksync.io", + verificationApiUrl: "https://zksync2-mainnet-explorer.zksync.io", bridgeUrl: "https://staging.bridge.zksync.dev", hostnames: ["https://staging-scan-v2.zksync.dev"], icon: "/images/icons/zksync-arrows.svg", diff --git a/packages/app/tests/composables/useAddress.spec.ts b/packages/app/tests/composables/useAddress.spec.ts index e96afc66da..044c9f36eb 100644 --- a/packages/app/tests/composables/useAddress.spec.ts +++ b/packages/app/tests/composables/useAddress.spec.ts @@ -47,7 +47,7 @@ const mockGetStorageAt = vi.fn().mockResolvedValue("0x00000000000000000000000000 vi.mock("@/composables/useContext", () => { return { default: () => ({ - currentNetwork: computed(() => ({ apiUrl: "http://api.url", apiURLv2: "http://api2.url" })), + currentNetwork: computed(() => ({ verificationApiUrl: "http://verification.url", apiUrl: "http://api2.url" })), getL2Provider: vi.fn().mockReturnValue({ getStorageAt: (slot: string) => mockGetStorageAt(slot), }), @@ -95,10 +95,10 @@ describe("useAddresses", () => { const { item, getByAddress } = useAddress(); await getByAddress("0xc31f9d4cbf557b6cf0ad2af66d44c358f7fa7a1c"); expect($fetch).toBeCalledWith( - "http://api.url/contract_verification/info/0xc31f9d4cbf557b6cf0ad2af66d44c358f7fa7a1c" + "http://verification.url/contract_verification/info/0xc31f9d4cbf557b6cf0ad2af66d44c358f7fa7a1c" ); expect($fetch).toBeCalledWith( - "http://api.url/contract_verification/info/0xc31f9d4cbf557b6cf0ad2af66d44c358f7fa7a10" + "http://verification.url/contract_verification/info/0xc31f9d4cbf557b6cf0ad2af66d44c358f7fa7a10" ); expect(item.value).toEqual({ address: "0xc31f9d4cbf557b6cf0ad2af66d44c358f7fa7a1c", diff --git a/packages/app/tests/composables/useTransaction.spec.ts b/packages/app/tests/composables/useTransaction.spec.ts index ccb7780c2b..0c6e3de7c2 100644 --- a/packages/app/tests/composables/useTransaction.spec.ts +++ b/packages/app/tests/composables/useTransaction.spec.ts @@ -531,7 +531,7 @@ describe("useTransaction:", () => { currentNetwork: { value: { newProverUrl: "http://prover.url", - apiURLv2: "http://api.url", + apiUrl: "http://api.url", }, }, getL2Provider: vi.fn().mockReturnValue(provider), diff --git a/packages/app/tests/e2e/src/pages/base.page.ts b/packages/app/tests/e2e/src/pages/base.page.ts index f973a529be..2111d0ac2b 100644 --- a/packages/app/tests/e2e/src/pages/base.page.ts +++ b/packages/app/tests/e2e/src/pages/base.page.ts @@ -146,7 +146,7 @@ export class BasePage { //Debug on @id367 if (slug_element === "from-address" || slug_element === "to-address") { - return await this.getNetworkLayer(slug_element, "byTestID"); //changed in uexp-3170-transactions + return await this.getNetworkLayer(slug_element, "byTestID"); } else if ( //hint: for these types we should hardcoded L1 layer //Debug on @id241 diff --git a/packages/app/tests/mocks.ts b/packages/app/tests/mocks.ts index 30c0db3af3..e5c590dbb1 100644 --- a/packages/app/tests/mocks.ts +++ b/packages/app/tests/mocks.ts @@ -22,8 +22,8 @@ import type { Provider } from "zksync-web3"; export const GOERLI_NETWORK: NetworkConfig = { name: "goerli", - apiUrl: "", - apiURLv2: "https://block-explorer-api.testnets.zksync.dev", + verificationApiUrl: "", + apiUrl: "https://block-explorer-api.testnets.zksync.dev", icon: "", l2ChainId: 280, rpcUrl: "", @@ -37,8 +37,8 @@ export const GOERLI_NETWORK: NetworkConfig = { }; export const GOERLI_BETA_NETWORK: NetworkConfig = { name: "goerli-beta", - apiUrl: "", - apiURLv2: "https://block-explorer-api.mock.zksync.dev", + verificationApiUrl: "", + apiUrl: "https://block-explorer-api.mock.zksync.dev", icon: "", l2ChainId: 270, rpcUrl: "",