diff --git a/example/wallet/lib/dependencies/web3wallet_service.dart b/example/wallet/lib/dependencies/web3wallet_service.dart index bb6f6e7..f3f186a 100644 --- a/example/wallet/lib/dependencies/web3wallet_service.dart +++ b/example/wallet/lib/dependencies/web3wallet_service.dart @@ -175,7 +175,9 @@ class Web3WalletService extends IWeb3WalletService { // so if you want to handle requests using onSessionRequest event then you would need to manually add that method in the approved namespaces await _web3Wallet!.approveSession( id: args.id, - namespaces: args.params.generatedNamespaces!, + namespaces: NamespaceUtils.regenerateNamespacesWithChains( + args.params.generatedNamespaces!, + ), sessionProperties: args.params.sessionProperties, ); } else { diff --git a/lib/apis/sign_api/models/session_models.dart b/lib/apis/sign_api/models/session_models.dart index 41f1d15..77d0f17 100644 --- a/lib/apis/sign_api/models/session_models.dart +++ b/lib/apis/sign_api/models/session_models.dart @@ -36,7 +36,7 @@ class SessionProposalCompleter { @freezed class Namespace with _$Namespace { - @JsonSerializable() + @JsonSerializable(includeIfNull: false) const factory Namespace({ List? chains, required List accounts, diff --git a/lib/apis/sign_api/models/session_models.freezed.dart b/lib/apis/sign_api/models/session_models.freezed.dart index f458fe9..e0f9169 100644 --- a/lib/apis/sign_api/models/session_models.freezed.dart +++ b/lib/apis/sign_api/models/session_models.freezed.dart @@ -136,7 +136,7 @@ class __$$NamespaceImplCopyWithImpl<$Res> /// @nodoc -@JsonSerializable() +@JsonSerializable(includeIfNull: false) class _$NamespaceImpl implements _Namespace { const _$NamespaceImpl( {final List? chains, diff --git a/lib/apis/sign_api/models/session_models.g.dart b/lib/apis/sign_api/models/session_models.g.dart index 259dfcf..40c5558 100644 --- a/lib/apis/sign_api/models/session_models.g.dart +++ b/lib/apis/sign_api/models/session_models.g.dart @@ -18,13 +18,21 @@ _$NamespaceImpl _$$NamespaceImplFromJson(Map json) => (json['events'] as List).map((e) => e as String).toList(), ); -Map _$$NamespaceImplToJson(_$NamespaceImpl instance) => - { - 'chains': instance.chains, - 'accounts': instance.accounts, - 'methods': instance.methods, - 'events': instance.events, - }; +Map _$$NamespaceImplToJson(_$NamespaceImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('chains', instance.chains); + val['accounts'] = instance.accounts; + val['methods'] = instance.methods; + val['events'] = instance.events; + return val; +} _$SessionDataImpl _$$SessionDataImplFromJson(Map json) => _$SessionDataImpl(