-
-
Notifications
You must be signed in to change notification settings - Fork 34
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): add new network config builder #316
Merged
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
Introduce `NetworkConfigBuilder` to enable customizable network configurations and support for custom networks. This change provides a more flexible way to configure network settings, including CAIP-2 chain IDs, and allows applications to define their own networks beyond the default mainnet/testnet options. - Add `NetworkConfigBuilder` for creating and customizing network configurations - Update all wallet implementations to use new network config system - Add support for CAIP-2 chain IDs in network configurations - Add `isTestnet` flag to network configurations - Update all tests to use string literals for network names - Add `network` property to wallet provider constructor calls - Update `WalletManager` tests to use new network configuration approach - Add support for custom networks via `NetworkConfigBuilder` - Update network-related test assertions - Add proper genesis hash/ID handling from network configs - Maintain `NetworkId` enum for defaultNetwork configuration - Rename config property `network` to `defaultNetwork` - Rename config property `algod` to `networks` BREAKING CHANGE: Network configuration now requires using `NetworkConfigBuilder` instead of the `NetworkId`-keyed mapped object from v3. While `NetworkId` is still exported for use with the `defaultNetwork` property, network configurations must be created using the new builder pattern.
Update framework adapters to handle the new nested algod configuration structure and `defaultNetwork` property name change. This includes: - Fix destructuring of algod config in React, Vue, and Solid adapters - Update all example apps to use `defaultNetwork` instead of network - Update test files to include networks in wallet constructor params - Export `DEFAULT_NETWORKS` from core package - Fix `NetworkId` type in `setActiveNetwork` method signatures BREAKING CHANGE: The `network` property in `WalletManagerConfig` has been renamed to `defaultNetwork` to better reflect its purpose.
Enhance the `NetworkConfigBuilder` and network config validation: - Update builder methods to accept full network config instead of just algod config - Add `DefaultNetworkConfig` type for partial network configs - Add robust token validation for all possible algosdk token types - Improve type guard to validate all network config properties - Allow full network config customization for localnet
drichar
force-pushed
the
feat/new-custom-network-config
branch
from
November 24, 2024 09:08
09f7284
to
b9f7209
Compare
Replace imported `DEFAULT_STATE` with inline state definition to prevent test state pollution. This reverts a change made in 2bb91e4. - Remove `DEFAULT_STATE` import - Define default state directly in `beforeEach` block - Ensure clean store initialization between tests - Fix regression in 'updates wallets when store state changes' test
- Replace `NetworkId` type with string for `networkId` parameter - Add network existence validation in `setActiveNetwork` - Add tests for invalid network and custom network scenarios
- Change test script from "vitest" to "vitest run" in all packages - Ensures tests run once and exit instead of watching by default
- Move `networkConfig` getter from `WalletConnect` to `BaseWallet` - Make networks accessible for testing in all wallet implementations
- Replace empty networks object with `DEFAULT_NETWORKS` in Custom wallet tests - Ensure consistent network configuration across all wallet tests
- Move DEFAULT_NETWORKS import to top of `LuteWallet` test file - Group related imports together - Sort type imports alphabetically - Follow project import ordering conventions
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 introduces the
NetworkConfigBuilder
to enable customizable network configurations and support for custom networks. It provides a more flexible way to configure network settings, including CAIP-2 chain IDs, and allows applications to define their own networks beyond the default options:Examples
Using default network configurations
Adding a custom configuration
Adding a custom network
NetworkConfigBuilder
instead of theNetworkId
-keyed mapped object from v3. WhileNetworkId
is still exported for use with thedefaultNetwork
property, network configurations must be created using the new builder pattern.Details
NetworkConfigBuilder
for creating and customizing network configurationsisTestnet
flag to network configurationsnetwork
property to wallet constructor callsNetworkConfigBuilder
NetworkId
enum fordefaultNetwork
configurationnetwork
todefaultNetwork
algod
tonetworks
Closes #214