Skip to content

Commit

Permalink
add methods
Browse files Browse the repository at this point in the history
  • Loading branch information
juanbono committed Jan 15, 2024
1 parent 01cae80 commit 3f5a40c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/lib/web3_decl/src/namespaces/zks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub trait ZksNamespace {
#[method(name = "getMainContract")]
async fn get_main_contract(&self) -> RpcResult<Address>;

#[method(name = "getNativeTokenAddress")]
async fn get_native_token_address(&self) -> RpcResult<Address>;

#[method(name = "getTestnetPaymaster")]
async fn get_testnet_paymaster(&self) -> RpcResult<Option<Address>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub trait ZksNamespaceT {
#[rpc(name = "zks_getMainContract")]
fn get_main_contract(&self) -> BoxFuture<Result<Address>>;

#[rpc(name = "zks_getNativeTokenAddress")]
fn get_native_token_address(&self) -> BoxFuture<Result<Address>>;

#[rpc(name = "zks_getTestnetPaymaster")]
fn get_testnet_paymaster(&self) -> BoxFuture<Result<Option<Address>>>;

Expand Down Expand Up @@ -142,6 +145,10 @@ impl<G: L1GasPriceProvider + Send + Sync + 'static> ZksNamespaceT for ZksNamespa
Box::pin(async move { Ok(self_.get_main_contract_impl()) })
}

fn get_native_token_address(&self) -> BoxFuture<Result<Address> > {
todo!()
}

fn get_miniblock_range(&self, batch: L1BatchNumber) -> BoxFuture<Result<Option<(U64, U64)>>> {
let self_ = self.clone();
Box::pin(async move {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ impl<G: L1GasPriceProvider + Send + Sync + 'static> ZksNamespaceServer for ZksNa
Ok(self.get_main_contract_impl())
}

async fn get_native_token_address(&self) -> RpcResult<Address> {
todo!()
}

async fn get_testnet_paymaster(&self) -> RpcResult<Option<Address>> {
Ok(self.get_testnet_paymaster_impl())
}
Expand Down
5 changes: 5 additions & 0 deletions core/lib/zksync_core/src/api_server/web3/namespaces/zks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ impl<G: L1GasPriceProvider> ZksNamespace<G> {
self.state.api_config.diamond_proxy_addr
}

#[tracing::instrument(skip_all)]
pub fn get_native_token_address_impl(&self) -> Address {
todo!()
}

#[tracing::instrument(skip(self))]
pub fn get_testnet_paymaster_impl(&self) -> Option<Address> {
self.state.api_config.l2_testnet_paymaster_addr
Expand Down

0 comments on commit 3f5a40c

Please sign in to comment.