๐Ÿ”น 2. Token Balance Queries

๐Ÿ’ฌ User Command

โ€œWhatโ€™s my balance of MYT tokens?โ€

๐Ÿง  How the Bot Interprets This

  • Intent Detected: check_token_balance

  • Parameters Needed:

    • Token symbol or contract address

    • User wallet address (can be derived from wallet connection)

โš™๏ธ Execution Flow

  1. Token Identification

    • The bot uses a local or on-chain index (if available) to map token symbol (MYT) to a known contract address.

    • If itโ€™s a custom token deployed via Dialect AI, the bot already knows the contract location.

  2. Wallet Connection

    • If not already connected, the bot will prompt the user to connect their wallet.

  3. Read Token Balance

    • The bot calls the balanceOf(address) function using the contractโ€™s ABI via ethers.js.

  4. Response to User

    • The bot calculates the balance (converted from Wei to readable token units, e.g., 1.00 MYT) and replies:

      โ€œYour current balance of MYT is: 10,000.00 MYTโ€

๐Ÿง  Additional Features (Planned)

  • Batch balance queries

  • Fiat value estimates

  • Holdings across multiple wallets

Last updated