-
Notifications
You must be signed in to change notification settings - Fork 36
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
refactor: metamask handling #402
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
This component is no longer in use and has been fully removed. Key changes include: - Deleted `src/sections/finance/components/finance-change-wallet.tsx`. The removal helps in cleaning up obsolete code and improving maintainability.
- Updated `src/clients/viem/walletClient.ts` to remove the use of `infuraAPIKey` from the MetaMaskSDK configuration. - This change simplifies the wallet client setup by eliminating unnecessary dependency on `GLOBAL_CONSTANTS`. - Ensures a cleaner and more maintainable code structure for wallet integration.
- **finance-withdraw.tsx**: Removed `autoFocus` prop from the "Amount to withdraw" `TextField`. - **finance-deposit.tsx**: - Removed unused `enqueueSnackbar` import. - Removed `enqueueSnackbar` call for error logging. - Removed `autoFocus` prop from the "Amount to deposit" `TextField`. These changes simplify the components by removing redundant props and unused imports, improving code clarity and maintainability.
- src/hooks/use-deposit.ts: Added detailed error logs using `console.error`. - src/hooks/use-transfer.ts, src/hooks/use-authorize-policy.ts: Introduced `console.log` for easier error debugging. - src/hooks/use-deposit-metamask.ts: Replaced `enqueueSnackbar` with `console.log` for error messages, removing extra dependency. - src/utils/metamask.ts: Removed unused `GLOBAL_CONSTANTS`, refined MetaMask redirection logic, and ensured better compatibility across platforms.
- **finance-withdraw.tsx**: - Updated `amount` state to accept `number | string` to fix type mismatch issues. - Ensured `amount` is converted to `Number` before validations, operations, and API calls. - Adjusted `amount` value used in the display to handle proper type casting. - **finance-deposit.tsx**: - Similar changes as withdraw: updated `amount` state to `number | string`. - Converted `amount` to `Number` for validations, operations, and API calls. - Refactored type handling for better consistency across inputs.
…unt' into app/refactor/quick-trasnsfer-amount
- Introduced `FinanceMetamaskHelper` to guide users without MetaMask. - Updated `finance-withdraw-from-metamask.tsx` to render helper alongside the button. - Updated `finance-deposit-from-metamask.tsx` similarly to include the helper. - Adjusted margin styling in `FinanceMetamaskButton` for consistency.
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
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.
This pull request includes significant changes to integrate MetaMask SDK into the application and refactor the wallet connection logic. The most important changes include adding the
MetaMaskProvider
inApp.tsx
, refactoring the wallet connection logic to use the MetaMask SDK, and updating several hooks to align with the new MetaMask integration.Integration of MetaMask SDK:
src/App.tsx
: AddedMetaMaskProvider
to wrap the application and configured it with necessary options for MetaMask integration. [1] [2] [3]Refactoring wallet connection logic:
src/clients/viem/walletClient.ts
: Removed the custom wallet client connection logic as it is now handled by the MetaMask SDK.src/hooks/use-metamask.ts
: Refactored theuseMetaMask
hook to utilize the MetaMask SDK for connecting and managing the wallet state.Updating hooks for MetaMask integration:
src/hooks/use-deposit-metamask.ts
: Updated theuseDepositMetamask
hook to use the newuseMetaMask
hook for wallet connection and transaction signing. [1] [2] [3]src/hooks/use-withdraw-metamask.ts
: Updated theuseWithdrawMetamask
hook to use the newuseMetaMask
hook for wallet connection and transaction signing. [1] [2] [3] [4] [5]Additional changes:
src/sections/finance/components/finance-deposit.tsx
: Updated the deposit logic to handle the amount as a string and ensure proper validation and conversion. [1] [2] [3]src/sections/finance/components/finance-deposit-from-metamask.tsx
: AddedFinanceMetamaskHelper
component to provide additional guidance for MetaMask users. [1] [2]