Skip to content

Commit

Permalink
Update js networks
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Sep 2, 2022
1 parent 43d5c9d commit d0bea91
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
12 changes: 6 additions & 6 deletions core/bin/zksync_eth_sender/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use zksync_eth_client::clients::mock::MockEthereum;

/// Mock database is capable of recording all the incoming requests for the further analysis.
#[derive(Debug)]
pub(in crate) struct MockDatabase {
pub(crate) struct MockDatabase {
eth_operations: RwLock<Vec<ETHOperation>>,
aggregated_operations: RwLock<Vec<(i64, AggregatedOperation)>>,
unprocessed_operations: RwLock<Vec<(i64, AggregatedOperation)>>,
Expand Down Expand Up @@ -358,7 +358,7 @@ impl DatabaseInterface for MockDatabase {
}

/// Creates a default `ETHParams` for use by mock `ETHSender` .
pub(in crate) fn default_eth_parameters() -> ETHParams {
pub(crate) fn default_eth_parameters() -> ETHParams {
ETHParams {
id: true,
nonce: 0,
Expand All @@ -372,7 +372,7 @@ pub(in crate) fn default_eth_parameters() -> ETHParams {

/// Creates a default `ETHSender` with mock Ethereum connection/database and no operations in DB.
/// Returns the `ETHSender` itself along with communication channels to interact with it.
pub(in crate) async fn default_eth_sender() -> ETHSender<MockDatabase> {
pub(crate) async fn default_eth_sender() -> ETHSender<MockDatabase> {
build_eth_sender(
1,
Vec::new(),
Expand All @@ -386,7 +386,7 @@ pub(in crate) async fn default_eth_sender() -> ETHSender<MockDatabase> {
/// Creates an `ETHSender` with mock Ethereum connection/database and no operations in DB
/// which supports multiple transactions in flight.
/// Returns the `ETHSender` itself along with communication channels to interact with it.
pub(in crate) async fn concurrent_eth_sender(max_txs_in_flight: u64) -> ETHSender<MockDatabase> {
pub(crate) async fn concurrent_eth_sender(max_txs_in_flight: u64) -> ETHSender<MockDatabase> {
build_eth_sender(
max_txs_in_flight,
Vec::new(),
Expand All @@ -399,7 +399,7 @@ pub(in crate) async fn concurrent_eth_sender(max_txs_in_flight: u64) -> ETHSende

/// Creates an `ETHSender` with mock Ethereum connection/database and restores its state "from DB".
/// Returns the `ETHSender` itself along with communication channels to interact with it.
pub(in crate) async fn restored_eth_sender(
pub(crate) async fn restored_eth_sender(
eth_operations: Vec<ETHOperation>,
aggregated_operations: Vec<(i64, AggregatedOperation)>,
unprocessed_operations: Vec<(i64, AggregatedOperation)>,
Expand Down Expand Up @@ -457,7 +457,7 @@ async fn build_eth_sender(
/// Behaves the same as `ETHSender::sign_new_tx`, but does not affect nonce.
/// This method should be used to create expected tx copies which won't affect
/// the internal `ETHSender` state.
pub(in crate) async fn create_signed_tx(
pub(crate) async fn create_signed_tx(
id: i64,
eth_sender: &ETHSender<MockDatabase>,
aggregated_operation: (i64, AggregatedOperation),
Expand Down
16 changes: 6 additions & 10 deletions sdk/zksync.js/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,18 @@ export async function getDefaultProvider(
} else if (transport === 'HTTP') {
return await Provider.newHttpProvider('http://127.0.0.1:3030', pollIntervalMilliSecs, network);
}
} else if (network === 'ropsten') {
} else if (network === 'goerli') {
if (transport === 'WS') {
return await Provider.newWebsocketProvider('wss://ropsten-api.zksync.io/jsrpc-ws', network);
return await Provider.newWebsocketProvider('wss://goerli-api.zksync.io/jsrpc-ws', network);
} else if (transport === 'HTTP') {
return await Provider.newHttpProvider(
'https://ropsten-api.zksync.io/jsrpc',
pollIntervalMilliSecs,
network
);
return await Provider.newHttpProvider('https://goerli-api.zksync.io/jsrpc', pollIntervalMilliSecs, network);
}
} else if (network === 'rinkeby') {
} else if (network === 'sepolia') {
if (transport === 'WS') {
return await Provider.newWebsocketProvider('wss://rinkeby-api.zksync.io/jsrpc-ws', network);
return await Provider.newWebsocketProvider('wss://sepolia-api.zksync.io/jsrpc-ws', network);
} else if (transport === 'HTTP') {
return await Provider.newHttpProvider(
'https://rinkeby-api.zksync.io/jsrpc',
'https://sepolia-api.zksync.io/jsrpc',
pollIntervalMilliSecs,
network
);
Expand Down
2 changes: 1 addition & 1 deletion sdk/zksync.js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type TotalFee = Map<TokenLike, BigNumber>;

export type Nonce = number | 'committed';

export type Network = 'localhost' | 'rinkeby' | 'ropsten' | 'mainnet' | 'rinkeby-beta' | 'goerli-beta';
export type Network = 'localhost' | 'sepolia' | 'goerli' | 'mainnet' | 'rinkeby-beta' | 'goerli-beta';

const MAINNET_NETWORK_CHAIN_ID = 1;
const ROPSTEN_NETWORK_CHAIN_ID = 3;
Expand Down

0 comments on commit d0bea91

Please sign in to comment.