-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(network): add new network config builder (#316)
* feat(network): add network config builder for custom configurations 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. * refactor(store): rename defaultState constant to DEFAULT_STATE * fix(network): update framework adapters for new network config structure 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. * refactor(network): improve network config type safety and validation 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 * fix(network): update test cases to reflect new network config structure * fix(solid): revert to inline default state in wallet tests 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 * refactor(adapters): change setActiveNetwork to accept string network ID - Replace `NetworkId` type with string for `networkId` parameter - Add network existence validation in `setActiveNetwork` - Add tests for invalid network and custom network scenarios * chore(test): update test scripts to use vitest run - Change test script from "vitest" to "vitest run" in all packages - Ensures tests run once and exit instead of watching by default * refactor(wallets): move networkConfig getter to BaseWallet class - Move `networkConfig` getter from `WalletConnect` to `BaseWallet` - Make networks accessible for testing in all wallet implementations * fix(test): use DEFAULT_NETWORKS in CustomWallet test mocks - Replace empty networks object with `DEFAULT_NETWORKS` in Custom wallet tests - Ensure consistent network configuration across all wallet tests * style(imports): reorder imports for consistency - Move DEFAULT_NETWORKS import to top of `LuteWallet` test file - Group related imports together - Sort type imports alphabetically - Follow project import ordering conventions
- Loading branch information
Showing
51 changed files
with
899 additions
and
448 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.