ModuleWallet

Wallet Module

Module Functionality

The Wallet Module is designed to integrate blockchain wallets into DApps, allowing users to connect to on-chain applications through various wallets. Users can select supported blockchain networks and wallet types as needed, configure the display content of the connect button, and retrieve wallet-related information.


Module Features

  1. Multi-Chain Support:

    • IC Chain: Supports Internet Identity and Plug wallets.
    • EVM-Compatible Chains: Supports Ethereum and BSC wallets, with MetaMask as the default option.
    • Includes drag-and-drop support for test chains.
  2. Flexible Wallet Options:

    • Default support for any compatible wallet.
    • Users can customize supported wallet types by enabling the Any Wallet toggle.
  3. Custom Connect Button:

    • Allows configuration of button text when connecting wallets.
    • Supports an auto-connect mode without requiring a button click.
  4. Fixed Output Parameters:

    • The Output section provides wallet connection-related information, including chain and wallet details.
    • Output parameters differ for IC and EVM chains and cannot be modified.

Module User Guide

1. Module Configuration

Adding the Module

  • Drag the Wallet Module into the workspace.

Configure Chain Type and Wallet

  • Select Chain Type:

    • Choose the desired blockchain from the left menu, including:
      • IC Chain: Supports Internet Identity and Plug wallets.
      • EVM Chains (e.g., Ethereum and BSC): Supports MetaMask wallet.
    • For test chains, drag and drop the corresponding test chain from the menu.
  • Custom Wallet Options:

    • By default, all compatible wallets are supported.
    • Enable the Any Wallet toggle to customize wallet types.

Configure Connect Button

  • Set Button Text:
    • Enter the button text to be displayed during wallet connection, such as Connect Wallet.
  • Auto-Connect Mode:
    • Disable the button toggle to switch to auto-connect mode.

2. Data Output

Output Parameters (IC Chain)

  • wallet: Wallet name, type is String.
  • owner: Account owner information, type is String.
  • account_id: Account ID, type is String.

Output Parameters (EVM Chains)

  • chain: Blockchain name, type is String.
  • chain_id: Blockchain ID, type is Integer.
  • wallet: Wallet name, type is String.
  • account: Account address, type is String.

Parameter Constraints and Rules

  1. Module Name:

    • The name at the top of the module is the wallet module’s variable name, making it easy to reference in subsequent workflows.
  2. Unmodifiable Output Parameters:

    • The output parameters are auto-generated by the module and cannot be manually modified.
  3. Multi-Wallet Support:

    • By default, all compatible wallets are supported. To limit specific wallet types, enable the Any Wallet toggle.
  4. Connect Button Modes:

    • Manual Connect: Users need to click the button to connect the wallet.
    • Auto Connect: Automatically attempts to connect the wallet when the button toggle is disabled.

Usage Examples

Example 1: IC Chain Connection

  • Settings:
    • Chain Type: IC Chain.
    • Wallet Support: Internet Identity and Plug.
    • Button Text: Connect Wallet.
  • Output:
    • wallet: Plug
    • owner: cgmku-ku5u5-au3fs-4o5xk-khh2e-xey66-zcts5-oady3-kwbff-tkk7c-eae
    • account_id: 37c8382039b39b8267e45212d0323663798f6076a0ac3c3c0662ed56fed88af1

Example 2: EVM Chain Connection

  • Settings:
    • Chain Type: Ethereum.
    • Wallet Support: MetaMask.
    • Button Text: Connect MetaMask.
  • Output:
    • chain: Ethereum
    • chain_id: 1
    • wallet: MetaMask
    • account: 0x1234abcd5678efgh

Notes

  1. Chain and Wallet Compatibility:

    • Ensure the selected chain type supports the required wallet (e.g., IC chains do not support MetaMask).
  2. Button Configuration:

    • Use clear and intuitive button text to help users understand the operation.
  3. Unique Module Name:

    • For easier referencing, the module name at the top should be unique.
  4. Auto-Connect Mode:

    • Auto-connect mode is suitable for scenarios requiring simplified user interaction but requires a stable connection environment.

Module Advantages

  • Cross-Chain Compatibility: Supports multiple blockchain types and wallets, meeting diverse DApp development needs.
  • Flexible Connection Options: Offers both button click and auto-connect modes, adapting to various user interaction scenarios.
  • Clear Output Parameters: Provides a fixed output parameter structure for seamless use in subsequent workflows.
  • User-Friendly Interface: Simplifies configuration for rapid wallet integration, reducing development complexity.