reown-com/reown_flutter

An error while trying to configure SIWE: Non conforming namespaces. Multi-namespace requests are not supported

Closed this issue · 8 comments

I got an error while trying to configure SIWE and One-Click Auth.

❌ [ReownAppKitModal] buildConnectionUri error: ReownSignError(code: 9, message: Non conforming namespaces. authenticate() Multi-namespace requests are not supported. Please request single namespace only., data: null)

Version: ^1.2.0-beta01

App Kit Modal declaration:

 _appKitModal = ReownAppKitModal(
      context: context,
      projectId: ReownConstants.projectId,
      enableAnalytics: true,
      logLevel: LogLevel.debug,
      siweConfig: _siweConfig,
      optionalNamespaces: {
        NetworkUtils.eip155: const RequiredNamespace(
          methods: ['personal_sign', 'eth_sendTransaction'],
          events: [],
        ),
      },
      metadata: _pairingMetadata,
    );

Don't know if revelant, but here (package's SiweService) nonEVM == null is true, since I declared optionalNamespaces, without it nonEVM == 'solana' and SIWE isn't working at all:

@override
  bool get enabled {
    // TODO check this logic
    final nonEVM = _namespaces.keys.firstWhereOrNull(
      (k) => k != NetworkUtils.eip155,
    );
    return _siweConfig?.enabled == true && nonEVM == null;
  }

Maybe somewhere optional namespaces not applied and instead of it default ones used (which is eip155 and solana), which causes the error?

Anyway: how do I solve the issue? Sorry, if it's only my mistake

More logs:

 [2024-11-20 18:50:31.741992]  SIWE getNonce
 [2024-11-20 18:50:31.747254]  SIWE getMessageParams
 [2024-11-20 18:50:31.766137]  ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 [2024-11-20 18:50:31.766522]  │ #0   _LogPrinter.log (package:reown_core/core_impl.dart:328:40)
 [2024-11-20 18:50:31.766675]  │ #1   ReownAppKitModal.buildConnectionUri (package:reown_appkit/modal/appkit_modal_impl.dart:897:31)
 [2024-11-20 18:50:31.766806]  │ #2   <asynchronous suspension>
 [2024-11-20 18:50:31.766933]  │ #3   ReownAppKitModal.connectSelectedWallet (package:reown_appkit/modal/appkit_modal_impl.dart:815:9)
 [2024-11-20 18:50:31.767050]  │ #4   <asynchronous suspension>
 [2024-11-20 18:50:31.767168]  ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
 [2024-11-20 18:50:31.767355]  │ 2024-11-20 18:50:31.765804 🐛 [ReownAppKitModal] authenticate {"chains":["eip155:1","eip155:10","eip155:56","eip155:100","eip155:137","eip155:324","eip155:1101","eip155:5000","eip155:8217","eip155:8453","eip155:42161","eip155:42220","eip155:43114","eip155:59144","eip155:7777777","eip155:1313161554","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:11155111","eip155:17000","eip155:80001","eip155:80002","eip155:97","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"],"domain":".com","nonce":"1732121431743","uri":"https://.com/","type":{"t":"eip4361"},"statement":"Please sign with your account","methods":["personal_sign","eth_sendTransaction"]}, null
 [2024-11-20 18:50:31.767540]  └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 [2024-11-20 18:50:31.783454]  ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 [2024-11-20 18:50:31.783720]  │ #0   _LogPrinter.log (package:reown_core/core_impl.dart:328:40)
 [2024-11-20 18:50:31.783830]  │ #1   ReownAppKitModal.buildConnectionUri (package:reown_appkit/modal/appkit_modal_impl.dart:918:29)
 [2024-11-20 18:50:31.783928]  │ #2   <asynchronous suspension>
 [2024-11-20 18:50:31.784026]  │ #3   ReownAppKitModal.connectSelectedWallet (package:reown_appkit/modal/appkit_modal_impl.dart:815:9)
 [2024-11-20 18:50:31.784118]  │ #4   <asynchronous suspension>
 [2024-11-20 18:50:31.784205]  ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
 [2024-11-20 18:50:31.784317]  │ 2024-11-20 18:50:31.783279 ❌ [ReownAppKitModal] buildConnectionUri error: ReownSignError(code: 9, message: Non conforming namespaces. authenticate() Multi-namespace requests are not supported. Please request single namespace only., data: null)
 [2024-11-20 18:50:31.784421]  └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 [2024-11-20 18:50:31.787973]  ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 [2024-11-20 18:50:31.788231]  │ #0   _LogPrinter.log (package:reown_core/core_impl.dart:328:40)
 [2024-11-20 18:50:31.788371]  │ #1   UriService.openRedirect (package:reown_appkit/modal/services/uri_service/url_utils.dart:87:18)
 [2024-11-20 18:50:31.788502]  │ #2   ReownAppKitModal.connectSelectedWallet (package:reown_appkit/modal/appkit_modal_impl.dart:820:29)
 [2024-11-20 18:50:31.788642]  │ #3   <asynchronous suspension>
 [2024-11-20 18:50:31.788783]  ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
 [2024-11-20 18:50:31.788967]  │ 2024-11-20 18:50:31.787825 📝 [UriService] openRedirect trust://wc?uri=
 [2024-11-20 18:50:31.789124]  └──────────────────────────────────────────────────────────────────────────────────────────

Hello @vitalii-petrun which version of AppKit are you running?

Also can you post a fully reproducible code?

Hello @vitalii-petrun which version of AppKit are you running?

^1.2.0-beta01

Ok can't reproduce your issue. All I can say is that in most use cases you don't need to pass optionalNamespaces. If you could share some code to reproduce or explain why you need optionalNamespaces would be nice

Ok can't reproduce your issue. All I can say is that in most use cases you don't need to pass optionalNamespaces. If you could share some code to reproduce or explain why you need optionalNamespaces would be nice

If i don't pass the optionalNamespaces then internal nonEVM bool var is not null, it is == 'solana', -> SIWE is rejected to work.

I checked logs. Isn't it strange that there are solana chains?

[2024-11-20 18:50:31.767355]  │ 2024-11-20 18:50:31.765804 🐛 [ReownAppKitModal] authenticate {"chains":["eip155:1","eip155:10","eip155:56","eip155:100","eip155:137","eip155:324","eip155:1101","eip155:5000","eip155:8217","eip155:8453","eip155:42161","eip155:42220","eip155:43114","eip155:59144","eip155:7777777","eip155:1313161554","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:11155111","eip155:17000","eip155:80001","eip155:80002","eip155:97","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"],"domain":".com","nonce":"1732121431743","uri":"https://.com/","type":{"t":"eip4361"},"statement":"Please sign with your account","methods":["personal_sign","eth_sendTransaction"]}, null

How to exclude Solana from here? Maybe that's causes the error?

"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"

Thanks for your patience!

Yes, Solana is causing the issue as it's not supported by SIWE, so if you want to use SIWE (only EVM chains) you should remove solana from default chains. See here https://docs.reown.com/appkit/flutter/core/custom-chains

// Remove Solana networks (supports only EVM networks):
ReownAppKitModalNetworks.removeSupportedNetworks('solana');

SIWE docs here: https://docs.reown.com/appkit/flutter/core/siwe

If you want to support Solana then SIWE is not going to work but it shouldn't fail

Yes, Solana is causing the issue as it's not supported by SIWE, so if you want to use SIWE (only EVM chains) you should remove solana from default chains. See here https://docs.reown.com/appkit/flutter/core/custom-chains

// Remove Solana networks (supports only EVM networks):
ReownAppKitModalNetworks.removeSupportedNetworks('solana');

SIWE docs here: https://docs.reown.com/appkit/flutter/core/siwe

If you want to support Solana then SIWE is not going to work but it shouldn't fail

Perfect! Like you said, removing solana in this way fixed SIWE. Thanks!