@txnlab/use-wallet 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3903,12 +3903,18 @@ var KibisisWallet = class _KibisisWallet extends BaseWallet {
3903
3903
  console.info(
3904
3904
  `[${_KibisisWallet.name}]#${_functionName}: initializing @agoralabs-sh/avm-web-provider...`
3905
3905
  );
3906
- this.avmWebProviderSDK = await import("@agoralabs-sh/avm-web-provider");
3906
+ const module2 = await import("@agoralabs-sh/avm-web-provider");
3907
+ this.avmWebProviderSDK = module2.default ? module2.default : module2;
3907
3908
  if (!this.avmWebProviderSDK) {
3908
3909
  throw new Error(
3909
3910
  "failed to initialize, the @agoralabs-sh/avm-web-provider sdk was not provided"
3910
3911
  );
3911
3912
  }
3913
+ if (!this.avmWebProviderSDK.AVMWebClient) {
3914
+ throw new Error(
3915
+ "failed to initialize, the @agoralabs-sh/avm-web-provider sdk was not provided. AVMWebClient missing"
3916
+ );
3917
+ }
3912
3918
  }
3913
3919
  return this.avmWebProviderSDK;
3914
3920
  }
@@ -5845,16 +5851,23 @@ var WalletManager = class {
5845
5851
  networkConfig;
5846
5852
  store;
5847
5853
  subscribe;
5848
- constructor({ wallets = [], network = "testnet" /* TESTNET */, algod = {} } = {}) {
5854
+ options;
5855
+ constructor({
5856
+ wallets = [],
5857
+ network = "testnet" /* TESTNET */,
5858
+ algod = {},
5859
+ options = {}
5860
+ } = {}) {
5849
5861
  this.networkConfig = this.initNetworkConfig(network, algod);
5862
+ this.options = { resetNetwork: options.resetNetwork || false };
5850
5863
  const persistedState = this.loadPersistedState();
5851
- const initialState = persistedState ? {
5852
- ...persistedState,
5853
- algodClient: this.createAlgodClient(this.networkConfig[persistedState.activeNetwork])
5854
- } : {
5864
+ const activeNetwork = this.options.resetNetwork ? network : persistedState?.activeNetwork || network;
5865
+ const algodClient = this.createAlgodClient(this.networkConfig[activeNetwork]);
5866
+ const initialState = {
5855
5867
  ...defaultState,
5856
- activeNetwork: network,
5857
- algodClient: this.createAlgodClient(this.networkConfig[network])
5868
+ ...persistedState,
5869
+ activeNetwork,
5870
+ algodClient
5858
5871
  };
5859
5872
  this.store = new import_store13.Store(initialState, {
5860
5873
  onUpdate: () => this.savePersistedState()