-
-
Notifications
You must be signed in to change notification settings - Fork 35
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(network): enable runtime connection to custom Algorand nodes #339
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add `updateNetworkAlgod` method to `WalletManager` to allow updating algod configuration for any network at runtime. This enables users to connect to their own Algorand nodes by modifying the network configuration after initialization. - Add `updateNetworkAlgod` method to `WalletManager` class - Add comprehensive test suite for the new method - Handle validation of updated configurations - Automatically update active algod client when modifying active network - Preserve existing configuration when partially updating
- Move network functionality (`activeNetwork`, `algodClient`, `setActiveNetwork`, etc.) to `useNetwork` - Reorganize exports to match logical grouping (Provider, Network, Wallet) - Update tests to reflect new hook separation - Add comprehensive test coverage for `useNetwork` hook - Remove network-related properties from `useWallet` tests - Export additional network types from `use-wallet` package BREAKING CHANGE: Network-related properties and methods have been moved from `useWallet` to the new `useNetwork` hook.
- Move network functionality (`activeNetwork`, `algodClient`, `setActiveNetwork`) to `useNetwork` - Reorganize exports to match logical grouping (Provider, Network, Wallet) - Update tests to reflect new function separation - Add comprehensive test coverage for `useNetwork` - Remove network-related properties from `useWallet` tests - Export additional network types from `use-wallet` package - Improve test organization and setup BREAKING CHANGE: Network-related properties and methods have been moved from `useWallet` to the new `useNetwork` function.
Move network-related functionality from `useWallet` to `useNetwork` composable to improve code organization and separation of concerns. Update tests to reflect the new structure. - Move `algodClient` and `setAlgodClient` to `useNetwork` - Move `setActiveNetwork` and `activeNetwork` to `useNetwork` - Split network-related tests into `useNetwork.test.ts` - Update `useWallet` tests to remove network assertions - Improve test setup with better mock organization BREAKING CHANGE: Network-related properties (`algodClient`, `setAlgodClient`, `activeNetwork`, `setActiveNetwork`) have been moved from `useWallet` to a new `useNetwork` composable.
Remove `name` property from `NetworkConfig` in tests to match updated type definition. This aligns test fixtures with the core `NetworkConfig` type that no longer includes the optional name field.
Add `updateNetworkAlgod` function to Vue adapter and test coverage for both Vue and Solid adapters. This completes the network configuration functionality across all framework adapters, ensuring consistent behavior for runtime algod config updates.
Split network-related functionality from `useWallet` into separate `useNetwork` hook across all framework examples. - Move `algodClient`, `activeNetwork`, and `setActiveNetwork` to `useNetwork` - Update Next.js example to use split hooks - Update Nuxt example to use split hooks - Update React example to use split hooks - Update Solid example to use split hooks - Update Vue example to use split hooks
When updating network configuration through `updateNetworkAlgod`, ensure the `algodClient` is also updated in the store if the modified network is currently active.
Add `activeNetworkConfig` to `useNetwork` across React, Vue, and Solid implementations: - Add `activeNetworkConfig` property to `WalletManager` in core library - Expose current network configuration through `useNetwork` hook - Add tests to verify network config updates correctly - Ensure reactivity when switching networks or updating config at runtime
drichar
changed the title
refactor(*): split network functionality into useNetwork hook
feat(network): enable runtime connection to custom Algorand nodes
Jan 20, 2025
Add support for persisting user-modified network configurations while preserving developer-provided defaults. This enables users to customize network settings that persist between sessions without affecting the base configuration. - Add `customNetworkConfigs` to persisted state - Store base network config separately from runtime config - Compare against base config to identify user customizations - Update tests to verify persistence behavior
drichar
force-pushed
the
feat/runtime-algod-config-update
branch
from
January 20, 2025 23:56
b120f37
to
a5dccfa
Compare
Add `resetNetworkConfig` method to `WalletManager` and expose it through framework adapters. This allows resetting a network's configuration to its default state, removing any customizations. - Add `resetNetworkConfig` method to `WalletManager` class - Add tests for `WalletManager` `resetNetworkConfig` functionality - Expose `resetNetworkConfig` through React, Vue, and Solid adapters - Add comprehensive tests for each adapter implementation
Update the `algodClient` state when updating network configuration to ensure UI reflects the current network state. This fixes an issue where the UI would not update after resetting network configuration.
Move `algodClient` and `setAlgodClient` from `useNetwork` to `useWallet` to better align with their usage patterns. Update tests to handle shared context between hooks and fix assertions around loading states. - Remove `algodClient` and `setAlgodClient` from `useNetwork` return value - Add `algodClient` and `setAlgodClient` to `useWallet` return value - Update tests to use combined hooks when testing cross-hook interactions - Fix integration test to properly handle loading states
Move `algodClient` from `useNetwork` to `useWallet` to maintain consistency with React adapter changes. Update tests to reflect new hook structure. - Remove `algodClient` from `useNetwork` return value - Add `algodClient` to `useWallet` return value - Update test components to access `algodClient` through `useWallet`
Move `algodClient` from `useNetwork` to `useWallet` composable to better align with component responsibilities. Update tests to reflect new dependency structure and improve injection mocking setup. - Move `algodClient` computed property from `useNetwork` to `useWallet` - Update `useNetwork` tests to get `algodClient` from `useWallet` - Add `algodClient` injection handling in `useWallet` tests - Move inject mock setup into `setupMocks` for consistent dependency initialization
Add network configuration forms to React and Vue examples with styling: - Add config form component with server/port/token inputs - Add form styling for light/dark modes - Move network controls to separate component - Update imports and component structure The network configuration UI allows users to view and modify the algod node configuration for each network.
Update Next, Nuxt, and Solid example apps to reflect the movement of `algodClient` from `useNetwork` back to `useWallet`.
Move network configuration from `WalletManager` instance to store state to support runtime network configuration updates and ensure reactivity across framework adapters. This change enables the new feature that lets users modify network settings at runtime while ensuring those updates are properly tracked in the reactive store. - Adds `networkConfig` to store state - Updates all references to use `store.state.networkConfig` - Removes `networks` prop from wallet constructors - Simplifies `algodClient` creation by passing config directly
Update React and Vue adapters and examples to use `networkConfig` from store state instead of the removed `networks` property. This change follows up on moving network configuration to the reactive store. - Update `useNetwork` hook/composable to return `networkConfig` instead of `networks` - Update `NetworkControls` components in React/Vue examples - Fix affected tests in both adapter packages
Update Solid adapter to use reactive store for network configuration and add `NetworkControls` component to demonstrate runtime network configuration. This change improves reactivity in the Solid example project to match React and Vue implementations. - Add `NetworkControls` component with config form UI - Update `useNetwork` function to use store state for better reactivity - Remove network controls from `Connect` component - Add styles for network configuration UI - Update tests to reflect new network config handling
Make logging more consistent across framework adapters when creating new `algodClient` instances. This change: - Standardize log message format across React/Vue/Solid - Add missing log statements for client creation - Add clarifying comments about `algodClient` updates
Rename constant to better reflect its purpose as configuration data rather than network instances.
Rename method to better reflect its purpose of updating algod configuration rather than the entire network. - Rename `updateNetworkAlgod` to `updateAlgodConfig` in `WalletManager` - Update method name in React/Vue/Solid adapters - Update all test files to use new method name - Update example projects to use renamed method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the ability to connect to custom Algorand nodes at runtime through the new
updateAlgodConfig
method. Users can now dynamically modify network configurations to connect to their own nodes after initialization, with their customizations persisting between sessions. As part of this change, network functionality has been refactored into a dedicateduseNetwork
hook for better organization and maintainability.Details
updateAlgodConfig
andresetNetworkConfig
methods to modify network configurations at runtimeuseNetwork
hook for better organization