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

Revert "Add ETH-wallets to react lib" #546

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

rubenmarcus
Copy link
Member

@rubenmarcus rubenmarcus commented Oct 8, 2024

User description

Reverts #544


PR Type

enhancement, dependencies


Description

  • Removed Ethereum wallet setup and related imports from bitte-wallet.ts and wallet.ts.
  • Deleted web3-modal.ts, which contained configuration for web3 modal.
  • Updated package.json to remove Ethereum-related dependencies and downgrade some NEAR wallet selector dependencies.

Changes walkthrough 📝

Relevant files
Enhancement
bitte-wallet.ts
Remove Ethereum wallet setup and related imports                 

packages/react/src/wallet/bitte-wallet.ts

  • Removed imports related to Ethereum wallets.
  • Removed setupEthereumWallets from the list of supported wallets.
  • +0/-4     
    wallet.ts
    Remove Ethereum wallet setup and related imports                 

    packages/react/src/wallet/wallet.ts

  • Removed imports related to Ethereum wallets.
  • Removed setupEthereumWallets from the list of supported wallets.
  • +1/-4     
    web3-modal.ts
    Remove web3 modal configuration file                                         

    packages/react/src/wallet/web3-modal.ts

    • Deleted the entire file responsible for web3 modal configuration.
    +0/-77   
    Dependencies
    package.json
    Update package dependencies and remove Ethereum-related packages

    packages/react/package.json

  • Removed dependencies related to Ethereum wallets and web3 modal.
  • Downgraded versions of some NEAR wallet selector dependencies.
  • +6/-14   

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @rubenmarcus rubenmarcus merged commit cd68117 into beta Oct 8, 2024
    1 of 2 checks passed
    @rubenmarcus rubenmarcus deleted the revert-544-add-eth-wallets branch October 8, 2024 16:30
    @mintbase-codium-pr-agent
    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No key issues to review

    @mintbase-codium-pr-agent
    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Align the version numbers of '@near-wallet-selector' packages for compatibility

    Consider aligning the version numbers of the '@near-wallet-selector' packages to
    ensure compatibility and prevent potential issues from version mismatches.

    packages/react/package.json [27-31]

    -"@near-wallet-selector/core": "8.9.12",
    -"@near-wallet-selector/here-wallet": "8.9.12",
    -"@near-wallet-selector/meteor-wallet": "8.9.12",
    -"@near-wallet-selector/modal-ui": "8.9.12",
    -"@near-wallet-selector/my-near-wallet": "8.9.12",
    +"@near-wallet-selector/core": "8.9.13",
    +"@near-wallet-selector/here-wallet": "8.9.13",
    +"@near-wallet-selector/meteor-wallet": "8.9.13",
    +"@near-wallet-selector/modal-ui": "8.9.13",
    +"@near-wallet-selector/my-near-wallet": "8.9.13",
     
    Suggestion importance[1-10]: 9

    Why: Ensuring consistent version numbers across related packages is crucial for compatibility and preventing potential issues. This suggestion addresses a possible oversight in the PR.

    9
    Maintainability
    Use an environment variable for the support link to enhance maintainability

    Replace the hardcoded support link with a configurable environment variable or a
    centralized configuration to facilitate easier updates and maintenance.

    packages/react/src/wallet/bitte-wallet.ts [30]

    -const SUPPORT = '- further help available on our telegram channel: https://t.me/mintdev';
    +const SUPPORT = `- further help available on our telegram channel: ${process.env.SUPPORT_CHANNEL_URL}`;
     
    Suggestion importance[1-10]: 8

    Why: Replacing the hardcoded support link with an environment variable improves maintainability and flexibility, allowing easier updates without modifying the codebase.

    8
    Enhancement
    Add error handling for wallet setup functions to improve robustness

    Consider adding error handling for the wallet setup functions to ensure robustness
    in case of failures during the wallet initialization.

    packages/react/src/wallet/bitte-wallet.ts [38-40]

    -setupMeteorWallet(),
    -setupMyNearWallet(),
    -setupHereWallet(),
    +try {
    +  setupMeteorWallet(),
    +  setupMyNearWallet(),
    +  setupHereWallet(),
    +} catch (error) {
    +  console.error("Failed to setup wallets:", error);
    +}
     
    Suggestion importance[1-10]: 7

    Why: Adding error handling for wallet setup functions is a good practice to ensure robustness and handle potential failures gracefully. However, the suggestion does not address how the error handling should be integrated into the existing code structure, which could be more detailed.

    7
    Refactor the supported wallets into a function for dynamic configuration and easier testing

    Refactor the array of supported wallets into a function that returns the array,
    allowing for dynamic changes and easier testing.

    packages/react/src/wallet/bitte-wallet.ts [37-40]

    -export const SUPPORTED_NEAR_WALLETS: Array<WalletModuleFactory> =[
    -  setupMeteorWallet(),
    -  setupMyNearWallet(),
    -  setupHereWallet(),
    -];
    +export function getSupportedNearWallets(): Array<WalletModuleFactory> {
    +  return [
    +    setupMeteorWallet(),
    +    setupMyNearWallet(),
    +    setupHereWallet(),
    +  ];
    +}
     
    Suggestion importance[1-10]: 6

    Why: Refactoring the array into a function allows for dynamic configuration and easier testing, which can improve code maintainability. However, the benefit is minor unless there is a specific need for dynamic changes.

    6

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant