Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resetNetwork option to WalletManager #260

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

drichar
Copy link
Collaborator

@drichar drichar commented Sep 13, 2024

Description

This PR enhances the WalletManager by introducing an options object in its configuration. The first option implemented is resetNetwork, which allows users to reset the network to the configured value on each initialization, overriding any persisted network state.

const walletManager = new WalletManager({
  wallets: [...],
  network: NetworkId.TESTNET,
  algod: {...},
  options: {
    resetNetwork: true  // App will always start connected to TestNet
  }
})

Details

  • Added options object to WalletManagerConfig interface
  • Implemented resetNetwork as the first option in the options object
  • Updated WalletManager constructor to handle the resetNetwork option
  • Added and updated tests to cover the new resetNetwork behavior
  • Ensured backward compatibility with existing configurations

This change provides a flexible framework for adding more configuration options in the future, while addressing the immediate need for network reset functionality. The resetNetwork option, when set to true, allows applications to enforce a specific network configuration.

- Introduce `options` object in `WalletManagerConfig`
- Add `resetNetwork` as the first option
- Implement `resetNetwork` functionality in `WalletManager` constructor
- Update tests to cover `resetNetwork` behavior

This change allows users to configure additional behaviors through the `options` object. The `resetNetwork` option, when true, resets the network to the configured value on each initialization, overriding any persisted network state. (This is the first of several planned configuration options.)
@drichar drichar merged commit 70b8454 into main Sep 13, 2024
1 check passed
@drichar drichar deleted the feat/config-options-resetnetwork branch September 13, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant