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

Connect metamask failed(sometimes) #65

Open
codepgq opened this issue Dec 22, 2024 · 2 comments
Open

Connect metamask failed(sometimes) #65

codepgq opened this issue Dec 22, 2024 · 2 comments
Labels
appkit AppKit related issue awaiting customer Further information has been requested

Comments

@codepgq
Copy link

codepgq commented Dec 22, 2024

SDK Affected

AppKit

Describe the bug

On the simulator, calling the openModalView() method sometimes catches an unhandled exception
Linking metamask by scanning a QR code

To Reproduce

Steps to reproduce the behavior:

  1. init
Future<void> init(
    BuildContext context, {
    required String projectId,
    PairingMetadata? metadata,
  }) async {
    if (_appKit != null) return;
    final appKit = await ReownAppKit.createInstance(
      projectId: projectId,
      metadata: metadata ?? defaultMetadata,
    );

    _appKit = appKit;

    if (context.mounted) {
      _appKitModal = ReownAppKitModal(
        context: context,
        appKit: appKit,
      );

      await _appKitModal?.init();

      _listenSession();
      _listenModal();
      _listenRelayClient();
      debugPrint('default wallet connect init');
    } else {
      throw Exception('Context is not mounted');
    }
  }
  1. calling the openModalView()
  @override
  Future<void> connect() async {
    // With no options will open default screen depending on the connection status
    _appKitModal?.openModalView();
  }
  1. Sometimes connect failed and show errors
flutter: onRelayClientMessage MessageEvent({"topic":"d4689aec4997d3704df131261e292531b244ed12945d397dd7994cb320a1617b","message":"AMuQCbSgaPUB1Kx0rCx92f0m993w5UgLQdiw/Et38dvMrXctPPjMZcZFeNyzoQMl2DE8emPIboZqLoCBemRWsXzDJ9R+SJjJVzGih3rXW7zspo62tw22e+Q4pc8M9Y1RyXeqSkiNNGhdjFxUfmJK/wXpHvGx3sDL3pkOExXCEdOy/O+TSGl77/N9YXLfnZ1TURo/9W6Q","publishedAt":1734876615026,"transportType":"relay"})
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: ReownCoreError(code: 2, message: No matching key. pairing topic doesn't exist: d4689aec4997d3704df131261e292531b244ed12945d397dd7994cb320a1617b, data: null)
#0      Pairing.isValidPairingTopic (package:reown_core/pairing/pairing.dart:384:7)
pairing.dart:384
#1      Pairing._isValidDisconnect (package:reown_core/pairing/pairing.dart:869:11)
pairing.dart:869
#2      Pairing._onPairingDeleteRequest (package:reown_core/pairing/pairing.dart:782:13)
pairing.dart:782
#3      Pairing._onMessageEvent (package:reown_core/pairing/pairing.dart:713:51)
pairing.dart:713
<asynchronous suspension>

Expected behavior

Connected metamask

Smartphone (please complete the following information):

  • Device: simulator(iPhone 16Plus)
  • OS: 18.1
  • Browser [e.g. stock browser, safari]
  • Version: reown_appkit: ^1.2.0
  • Flutter version: 3.27.1
Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 17025dd882 (6 days ago) • 2024-12-17 03:23:09 +0900
Engine • revision cb4b5fff73
Tools • Dart 3.6.0 • DevTools 2.40.2
Copy link

linear bot commented Dec 22, 2024

@linear linear bot added the bug Something isn't working label Dec 27, 2024
@quetool quetool added the appkit AppKit related issue label Dec 30, 2024
@quetool
Copy link
Member

quetool commented Dec 30, 2024

Can you share a complete reproducible code? I have the feeling you are recreating AppKit instance more times than needed.

@quetool quetool added awaiting customer Further information has been requested and removed bug Something isn't working labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appkit AppKit related issue awaiting customer Further information has been requested
Projects
None yet
Development

No branches or pull requests

2 participants