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

Feature/browser #1029

Merged
merged 18 commits into from
Jan 28, 2025
Merged

Feature/browser #1029

merged 18 commits into from
Jan 28, 2025

Conversation

EvgeniyJB
Copy link
Collaborator

@EvgeniyJB EvgeniyJB commented Jan 28, 2025

--add injectedJavaScript
--connect injectedJavaScript file with browser
--add logic connect airdao wallet with browser

ArturHoncharuk and others added 15 commits January 20, 2025 10:35
- Added a new `BrowserScreen` to the navigation stack for enhanced browsing capabilities.
- Updated `package.json` to include `@metamask/react-native-webview` version 14.0.4 for improved webview functionality.
- Modified `PRODUCTS` to include a new product entry for the browser feature.
- Updated type definitions to accommodate the new `BrowserScreen` in navigation and product paths.
- Updated `createAMBProvider` to accept `CHAIN_ID` for improved provider configuration.
- Enhanced `BrowserScreen` to include wallet functionality, allowing for message signing and account management.
- Implemented message handling for various Ethereum methods (e.g., `personal_sign`, `eth_requestAccounts`, `eth_chainId`, etc.) to facilitate interaction with the webview.
- Added reload and back navigation buttons for better user experience in the webview.
- Integrated `ethers` library for wallet operations, ensuring secure message signing and account retrieval.
…Provider

- Deleted the `injected.ts` file and its export, as it is no longer needed for the current implementation.
- Removed the `index.ts` file which previously exported the injected JavaScript.
- Updated `createAMBProvider` to accept an optional `networkUrl` parameter for improved flexibility in provider configuration.
- Enhanced the `BrowserScreen` to accommodate the removal of the injected JavaScript, ensuring continued functionality with the updated provider.
- Added a deprecation notice for the `networkUrl` parameter in `createAMBProvider`, recommending the use of `Config.NETWORK_URL` instead.
- Enhanced documentation for better clarity on the function's usage and future changes.
- Added support for wallet permissions management, including `wallet_requestPermissions`, `wallet_revokePermissions`, and `wallet_getPermissions` methods.
- Updated the handling of Ethereum methods to include permission-related responses and improved error handling.
- Refactored the `extractWallet` function to return the wallet instance for better integration with permission requests.
- Enhanced logging for incoming requests and responses to aid in debugging and monitoring.
- Updated the chain ID handling to use a constant for improved maintainability.
…confirmation

- Introduced a custom console implementation to log messages from the webview to the React Native environment.
- Updated the BrowserScreen to include user confirmation dialogs for signing messages and typed data, improving user experience and security.
- Refactored the handling of Ethereum methods to ensure address verification and error handling during signing processes.
- Changed the webview source URL to 'https://airquest.xyz/' for updated functionality.
- Enhanced logging for incoming webview messages to aid in debugging and monitoring.
…sions handling

- Introduced new JavaScript functions for revoking permissions and updating Ethereum state, improving interaction with the webview.
- Refactored the BrowserScreen to utilize these new functions, streamlining the process of managing Ethereum accounts and permissions.
- Updated the handling of wallet permissions to ensure proper state updates and event emissions, enhancing user experience and security.
- Improved error handling and logging for Ethereum-related actions, aiding in debugging and monitoring.
- Changed the webview source URL to 'https://metamask.github.io/test-dapp/' for testing purposes.
…e management

- Refactored the event handling system to ensure events are emitted only when state changes, reducing unnecessary calls and improving performance.
- Introduced a new state management structure to track the last emitted state for accounts, chain ID, and connection status.
- Updated the revoke permissions and update Ethereum state functions to utilize the new event system, enhancing reliability and clarity.
- Changed the webview source URL to 'https://metamask.github.io/test-dapp/' for testing purposes.
- Replaced the existing base64 encoded icon for the AMB Wallet with a new one to ensure accurate representation in the browser feature.
- Maintained the structure of the provider information while enhancing the visual aspect of the wallet integration.
…te management and user interactions

- Updated the injected provider to rename it to 'AirDAO Wallet' and improved event handling for better state management.
- Introduced a last emitted state tracking system to prevent unnecessary event emissions, enhancing performance and reliability.
- Enhanced the BrowserScreen to handle Ethereum state updates and permissions more effectively, including user confirmation dialogs for transaction signing.
- Implemented duplicate request handling and optimized state updates to prevent loops during address changes.
- Improved error handling and logging for Ethereum-related actions, aiding in debugging and user experience.
…gration

- Updated the injectable provider to generate a dynamic UUID for the provider info, improving uniqueness and security.
- Integrated EIP-6963 provider information, allowing for better compatibility with Ethereum standards.
- Refactored the revoke permissions and update Ethereum state functions to streamline state management and event emissions.
- Improved error handling and logging for better debugging and user experience during Ethereum interactions.
- Refactored the middleware to streamline event handling and state management, enhancing performance and reliability.
- Updated the injectable provider to use dynamic network version handling.
- Removed the deprecated middlewareHelpers file and improved error handling in the rpc-error-handler.
- Enhanced the BrowserScreen to utilize the new event handling structure, improving user interactions and state updates.
- Updated the import path for middleware helpers to use the correct module location.
- Updated the import statement for the injectable provider to ensure proper module resolution.
- Removed redundant import of rpcErrorHandler and requestUserApproval, streamlining the code structure.
@EvgeniyJB EvgeniyJB merged commit 87abb61 into dev Jan 28, 2025
2 checks passed
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.

2 participants