πŸ”Ή 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