Skip to content

Commit

Permalink
add missing setNetworkId to wasm Wallet()
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Oct 20, 2024
1 parent 8147bdd commit 158d4be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpc/wrpc/wasm/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ impl RpcClient {
/// Set the network id for the RPC client.
/// This setting will take effect on the next connection.
#[wasm_bindgen(js_name = setNetworkId)]
pub fn set_network_id(&self, network_id: &NetworkId) -> Result<()> {
self.inner.client.set_network_id(network_id)?;
pub fn set_network_id(&self, network_id: &NetworkIdT) -> Result<()> {
self.inner.client.set_network_id(&network_id.try_into_owned()?)?;
Ok(())
}

Expand Down
7 changes: 7 additions & 0 deletions wallet/core/src/wasm/wallet/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::storage::local::interface::LocalStore;
use crate::storage::WalletDescriptor;
use crate::wallet as native;
use crate::wasm::notify::{WalletEventTarget, WalletNotificationCallback, WalletNotificationTypeOrCallback};
use kaspa_consensus_core::network::NetworkIdT;
use kaspa_wallet_macros::declare_typescript_wasm_interface as declare;
use kaspa_wasm_core::events::{get_event_targets, Sink};
use kaspa_wrpc_wasm::{IConnectOptions, Resolver, RpcClient, RpcConfig, WrpcEncoding};
Expand Down Expand Up @@ -264,6 +265,12 @@ impl Wallet {
}
Ok(())
}

#[wasm_bindgen(js_name = "setNetworkId")]
pub fn set_network_id(&self, network_id: NetworkIdT) -> Result<()> {
self.inner.wallet.set_network_id(&network_id.try_into_owned()?)?;
Ok(())
}
}

impl Wallet {
Expand Down

0 comments on commit 158d4be

Please sign in to comment.