Skip to content

Commit 0b5367d

Browse files
authored
fix: replace sepolia with zksync os testnet (#240)
1 parent 22a275b commit 0b5367d

File tree

2 files changed

+57
-16
lines changed

2 files changed

+57
-16
lines changed

packages/auth-server-api/src/config.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import dotenv from "dotenv";
22
import { readFileSync } from "fs";
33
import { dirname, join } from "path";
44
import { fileURLToPath } from "url";
5-
import type { Chain } from "viem";
6-
import { localhost, sepolia } from "viem/chains";
5+
import { type Chain, defineChain } from "viem";
6+
import { localhost } from "viem/chains";
77
import { z } from "zod";
88

99
// Load environment variables
@@ -69,7 +69,27 @@ if (!FACTORY_ADDRESS || !EOA_VALIDATOR_ADDRESS || !WEBAUTHN_VALIDATOR_ADDRESS ||
6969
}
7070

7171
// Supported chains configuration
72-
const SUPPORTED_CHAINS: Chain[] = [localhost, sepolia];
72+
const zksyncOsTestnet = defineChain({
73+
id: 8022833,
74+
name: "ZKsyncOS Testnet",
75+
nativeCurrency: {
76+
name: "Ether",
77+
symbol: "ETH",
78+
decimals: 18,
79+
},
80+
rpcUrls: {
81+
default: {
82+
http: ["https://zksync-os-testnet-alpha.zksync.dev"],
83+
},
84+
},
85+
blockExplorers: {
86+
default: {
87+
name: "ZKsyncOS Testnet Explorer",
88+
url: "https://zksync-os-testnet-alpha.staging-scan-v2.zksync.dev",
89+
},
90+
},
91+
});
92+
const SUPPORTED_CHAINS: Chain[] = [localhost, zksyncOsTestnet];
7393

7494
function getChain(chainId: number): Chain {
7595
const chain = SUPPORTED_CHAINS.find((c) => c.id === chainId);

packages/auth-server/stores/client.ts

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
import { useAppKitProvider } from "@reown/appkit/vue";
2-
import { type Address, createPublicClient, createWalletClient, custom, type Hex, http, publicActions, walletActions } from "viem";
2+
import { type Address, createPublicClient, createWalletClient, custom, defineChain, type Hex, http, publicActions, walletActions } from "viem";
33
import { createBundlerClient } from "viem/account-abstraction";
44
import { /* generatePrivateKey, */ privateKeyToAccount } from "viem/accounts";
5-
import { localhost, sepolia } from "viem/chains";
5+
import { localhost } from "viem/chains";
66
import { createPasskeyClient } from "zksync-sso-4337/client";
77

88
// TODO: OIDC and guardian recovery are not yet available in sdk-4337
99
// import { createZkSyncOidcClient, type ZkSyncSsoClient } from "zksync-sso/client/oidc";
1010
// import { createZksyncRecoveryGuardianClient } from "zksync-sso/client/recovery";
1111
import localChainData from "./local-node.json";
1212

13-
export const supportedChains = [localhost, sepolia];
13+
const zksyncOsTestnet = defineChain({
14+
id: 8022833,
15+
name: "ZKsyncOS Testnet",
16+
nativeCurrency: {
17+
name: "Ether",
18+
symbol: "ETH",
19+
decimals: 18,
20+
},
21+
rpcUrls: {
22+
default: {
23+
http: ["https://zksync-os-testnet-alpha.zksync.dev"],
24+
},
25+
},
26+
blockExplorers: {
27+
default: {
28+
name: "ZKsyncOS Testnet Explorer",
29+
url: "https://zksync-os-testnet-alpha.staging-scan-v2.zksync.dev",
30+
},
31+
},
32+
});
33+
34+
export const supportedChains = [localhost, zksyncOsTestnet];
1435
export type SupportedChainId = (typeof supportedChains)[number]["id"];
1536
export const blockExplorerUrlByChain: Record<SupportedChainId, string> = {
1637
[localhost.id]: "http://localhost:3010",
17-
[sepolia.id]: "https://sepolia.etherscan.io",
38+
[zksyncOsTestnet.id]: "https://zksync-os-testnet-alpha.staging-scan-v2.zksync.dev",
1839
};
1940
export const blockExplorerApiByChain: Record<SupportedChainId, string> = {
2041
[localhost.id]: "http://localhost:3020",
21-
[sepolia.id]: "https://api-sepolia.etherscan.io/api",
42+
[zksyncOsTestnet.id]: "https://block-explorer-api.zksync-os-testnet-alpha.zksync.dev/api",
2243
};
2344

2445
type ChainContracts = {
@@ -32,22 +53,22 @@ type ChainContracts = {
3253

3354
export const contractsByChain: Record<SupportedChainId, ChainContracts> = {
3455
[localhost.id]: localChainData as ChainContracts,
35-
[sepolia.id]: {
36-
eoaValidator: "0x027ce1d8244318e38c3B65E3EABC2537BD712077",
37-
webauthnValidator: "0xAbcB5AB6eBb69F4F5F8cf1a493F56Ad3d28562bd",
38-
sessionValidator: "0x09fbd5b956AF5c64C7eB4fb473E7E64DAF0f79D7",
39-
factory: "0xF33128d7Cd2ab37Af12B3a22D9dA79f928c2B450",
56+
[zksyncOsTestnet.id]: {
57+
eoaValidator: "0x3497392f9662Da3de1EC2AfE8724CdBF6b884088",
58+
webauthnValidator: "0xa5C2c5C723239C0cD11a5691954CdAC4369C874b",
59+
sessionValidator: "0x2bF3B894aA2C13A1545C6982bBbee435B5168b52",
60+
factory: "0x757b5c9854d327A6B76840c996dfAac0F6b3Dc1f",
4061
bundlerUrl: "https://bundler-api.stage-sso.zksync.dev",
41-
beacon: "0xd1Ab9B640995124D3FD311d70BA4F216AD5b1aD5",
62+
beacon: "0x1D779D791B55a093dE60da664C3F301a87f96C62",
4263
},
4364
};
4465

4566
export const chainParameters: Record<SupportedChainId, { blockTime: number }> = {
4667
[localhost.id]: {
4768
blockTime: 1,
4869
},
49-
[sepolia.id]: {
50-
blockTime: 12,
70+
[zksyncOsTestnet.id]: {
71+
blockTime: 1,
5172
},
5273
};
5374

0 commit comments

Comments
 (0)