Error Handling and Troubleshooting

Common Errors

  1. Invalid Public Token

    • Description: This error occurs if the public token provided is incorrect or not recognized by the TMAWallet service.

    • Solution: Verify that you are using the correct public token for your project. Make sure there are no typos and that the token is active.

  2. Bundle Not Found

    • Description: This error is thrown when attempting to access a wallet bundle that doesn't exist.

    • Solution: Use the createBundle() method to create a new wallet bundle before attempting to access it.

  3. Storage Access Denied

    • Description: This occurs when the SDK is unable to access Telegram cloud storage, likely due to missing permissions.

    • Solution: Ensure that the Telegram app has the necessary permissions to access cloud storage. Verify the permissions in the Telegram settings.

  4. Network Error

    • Description: A network error may occur if there is an issue with the internet connection or if the blockchain network is temporarily unavailable.

    • Solution: Check your internet connection and try again. If the issue persists, check the status of the Ethereum network.

Debugging Tips

  1. Enable Debug Logs

    • To facilitate debugging, you can enable debug logs in the SDK. This will provide detailed information about the operations being performed and any issues encountered.

    • Example:

      const tmaWallet = new TMAWalletClient('your_project_public_token', { debug: true });
  2. Check Telegram Permissions

    • Ensure that the Telegram mini-app has the necessary permissions to access user data and cloud storage. Missing permissions can result in errors when trying to read or write data.

  3. Verify Network Connectivity

    • Make sure that your application has a stable internet connection, especially when interacting with the Ethereum blockchain. Network issues can lead to failed transactions or data retrieval errors.

  4. Handle Promise Rejections

    • Always handle promise rejections to catch errors and prevent unhandled exceptions. Use try-catch blocks or .catch() to manage errors.

    • Example:

      try {
        await tmaWallet.init();
        await tmaWallet.initWallet();
      } catch (error) {
        console.error('Error initializing wallet:', error);
      }

Contact Support

If you encounter an issue that you cannot resolve using the troubleshooting steps above, consider reaching out to the TMAWallet support team. Provide as much detail as possible, including:

  • The version of the SDK you are using.

  • A description of the issue and any error messages received.

  • Steps to reproduce the issue.

Having this information will help the support team assist you more efficiently.

Last updated