Skip to content

ReownSignError in approveSession #167

@a-kirzner

Description

@a-kirzner

SDK Affected

WalletKit

Describe the bug

Hello! Sometimes I get this error ReownSignError(code: 5102, message: Unsupported events. approve() namespaces events don't satisfy requiredNamespaces events for eip155. Requested: [chainChanged, accountsChanged, message, disconnect, connect], Supported: [accountsChanged, chainChanged], data: null) when I'm trying to approve session.

Reproducible code

the part of my code:

 final sessionProposals = web3wallet.getPendingSessionProposals();
    final sessionProposal = sessionProposals[pairingId.toString()];

    if (sessionProposal == null) return status;

    final namespaces = {
      ...sessionProposal.requiredNamespaces,
      ...sessionProposal.optionalNamespaces,
    };

    final namespaceAccountsMap = <String, List<String>>{};

    for (final account in accounts) {
      final protocol = account.protocol.name;
      final namespace = namespaces[protocol];

      if (namespace == null) continue;

      final chainId = account.chainId;
      final address = account.coinInfo.coin.address;
      final walletAccount = '$protocol:$chainId:$address';

      namespaceAccountsMap[protocol] ??= [];
      namespaceAccountsMap[protocol]!.add(walletAccount);
    }

    final walletNamespaces = <String, Namespace>{};

    for (final namespaceAccountEntry in namespaceAccountsMap.entries) {
      final protocol = namespaceAccountEntry.key;
      final namespace = namespaces[protocol];

      if (namespace == null) continue;

      walletNamespaces[protocol] = Namespace(
        accounts: namespaceAccountEntry.value,
        methods: namespace.methods,
        events: namespace.events,
      );
    }

    ApproveResponse approveResponse;

    approveResponse = await web3wallet.approveSession(
        id: pairingId,
        namespaces: walletNamespaces,
    );
  • Flutter 3.29.1
  • Dart 3.7.0

Could you please tell me what can be wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting customerFurther information has been requestedhelp wantedExtra attention is neededwalletkitWalletKit related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions