diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ddad273..ebbc9288 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.14 + +- Fixed regression of optionalNamespaces not being nullable + ## 2.0.13 - Made message in json response nullable to resolve issues with rejection messages diff --git a/lib/apis/sign_api/models/json_rpc_models.dart b/lib/apis/sign_api/models/json_rpc_models.dart index 441a0096..35babd28 100644 --- a/lib/apis/sign_api/models/json_rpc_models.dart +++ b/lib/apis/sign_api/models/json_rpc_models.dart @@ -36,7 +36,7 @@ class WcSessionProposeRequest with _$WcSessionProposeRequest { const factory WcSessionProposeRequest({ required List relays, required Map requiredNamespaces, - required Map optionalNamespaces, + Map? optionalNamespaces, Map? sessionProperties, required ConnectionMetadata proposer, }) = _WcSessionProposeRequest; diff --git a/lib/apis/sign_api/models/json_rpc_models.freezed.dart b/lib/apis/sign_api/models/json_rpc_models.freezed.dart index eaee6540..039a00e1 100644 --- a/lib/apis/sign_api/models/json_rpc_models.freezed.dart +++ b/lib/apis/sign_api/models/json_rpc_models.freezed.dart @@ -330,7 +330,7 @@ mixin _$WcSessionProposeRequest { List get relays => throw _privateConstructorUsedError; Map get requiredNamespaces => throw _privateConstructorUsedError; - Map get optionalNamespaces => + Map? get optionalNamespaces => throw _privateConstructorUsedError; Map? get sessionProperties => throw _privateConstructorUsedError; @@ -351,7 +351,7 @@ abstract class $WcSessionProposeRequestCopyWith<$Res> { $Res call( {List relays, Map requiredNamespaces, - Map optionalNamespaces, + Map? optionalNamespaces, Map? sessionProperties, ConnectionMetadata proposer}); @@ -374,7 +374,7 @@ class _$WcSessionProposeRequestCopyWithImpl<$Res, $Res call({ Object? relays = null, Object? requiredNamespaces = null, - Object? optionalNamespaces = null, + Object? optionalNamespaces = freezed, Object? sessionProperties = freezed, Object? proposer = null, }) { @@ -387,10 +387,10 @@ class _$WcSessionProposeRequestCopyWithImpl<$Res, ? _value.requiredNamespaces : requiredNamespaces // ignore: cast_nullable_to_non_nullable as Map, - optionalNamespaces: null == optionalNamespaces + optionalNamespaces: freezed == optionalNamespaces ? _value.optionalNamespaces : optionalNamespaces // ignore: cast_nullable_to_non_nullable - as Map, + as Map?, sessionProperties: freezed == sessionProperties ? _value.sessionProperties : sessionProperties // ignore: cast_nullable_to_non_nullable @@ -422,7 +422,7 @@ abstract class _$$_WcSessionProposeRequestCopyWith<$Res> $Res call( {List relays, Map requiredNamespaces, - Map optionalNamespaces, + Map? optionalNamespaces, Map? sessionProperties, ConnectionMetadata proposer}); @@ -444,7 +444,7 @@ class __$$_WcSessionProposeRequestCopyWithImpl<$Res> $Res call({ Object? relays = null, Object? requiredNamespaces = null, - Object? optionalNamespaces = null, + Object? optionalNamespaces = freezed, Object? sessionProperties = freezed, Object? proposer = null, }) { @@ -457,10 +457,10 @@ class __$$_WcSessionProposeRequestCopyWithImpl<$Res> ? _value._requiredNamespaces : requiredNamespaces // ignore: cast_nullable_to_non_nullable as Map, - optionalNamespaces: null == optionalNamespaces + optionalNamespaces: freezed == optionalNamespaces ? _value._optionalNamespaces : optionalNamespaces // ignore: cast_nullable_to_non_nullable - as Map, + as Map?, sessionProperties: freezed == sessionProperties ? _value._sessionProperties : sessionProperties // ignore: cast_nullable_to_non_nullable @@ -480,7 +480,7 @@ class _$_WcSessionProposeRequest implements _WcSessionProposeRequest { const _$_WcSessionProposeRequest( {required final List relays, required final Map requiredNamespaces, - required final Map optionalNamespaces, + final Map? optionalNamespaces, final Map? sessionProperties, required this.proposer}) : _relays = relays, @@ -508,13 +508,15 @@ class _$_WcSessionProposeRequest implements _WcSessionProposeRequest { return EqualUnmodifiableMapView(_requiredNamespaces); } - final Map _optionalNamespaces; + final Map? _optionalNamespaces; @override - Map get optionalNamespaces { + Map? get optionalNamespaces { + final value = _optionalNamespaces; + if (value == null) return null; if (_optionalNamespaces is EqualUnmodifiableMapView) return _optionalNamespaces; // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_optionalNamespaces); + return EqualUnmodifiableMapView(value); } final Map? _sessionProperties; @@ -582,7 +584,7 @@ abstract class _WcSessionProposeRequest implements WcSessionProposeRequest { const factory _WcSessionProposeRequest( {required final List relays, required final Map requiredNamespaces, - required final Map optionalNamespaces, + final Map? optionalNamespaces, final Map? sessionProperties, required final ConnectionMetadata proposer}) = _$_WcSessionProposeRequest; @@ -594,7 +596,7 @@ abstract class _WcSessionProposeRequest implements WcSessionProposeRequest { @override Map get requiredNamespaces; @override - Map get optionalNamespaces; + Map? get optionalNamespaces; @override Map? get sessionProperties; @override diff --git a/lib/apis/sign_api/models/json_rpc_models.g.dart b/lib/apis/sign_api/models/json_rpc_models.g.dart index c1c690ac..0a891e6a 100644 --- a/lib/apis/sign_api/models/json_rpc_models.g.dart +++ b/lib/apis/sign_api/models/json_rpc_models.g.dart @@ -44,7 +44,7 @@ _$_WcSessionProposeRequest _$$_WcSessionProposeRequestFromJson( MapEntry(k, RequiredNamespace.fromJson(e as Map)), ), optionalNamespaces: - (json['optionalNamespaces'] as Map).map( + (json['optionalNamespaces'] as Map?)?.map( (k, e) => MapEntry(k, RequiredNamespace.fromJson(e as Map)), ), @@ -62,8 +62,6 @@ Map _$$_WcSessionProposeRequestToJson( 'relays': instance.relays.map((e) => e.toJson()).toList(), 'requiredNamespaces': instance.requiredNamespaces.map((k, e) => MapEntry(k, e.toJson())), - 'optionalNamespaces': - instance.optionalNamespaces.map((k, e) => MapEntry(k, e.toJson())), }; void writeNotNull(String key, dynamic value) { @@ -72,6 +70,8 @@ Map _$$_WcSessionProposeRequestToJson( } } + writeNotNull('optionalNamespaces', + instance.optionalNamespaces?.map((k, e) => MapEntry(k, e.toJson()))); writeNotNull('sessionProperties', instance.sessionProperties); val['proposer'] = instance.proposer.toJson(); return val; diff --git a/lib/apis/sign_api/sign_engine.dart b/lib/apis/sign_api/sign_engine.dart index fab114fb..7f62554f 100644 --- a/lib/apis/sign_api/sign_engine.dart +++ b/lib/apis/sign_api/sign_engine.dart @@ -159,7 +159,7 @@ class SignEngine implements ISignEngine { relays: request.relays, proposer: request.proposer, requiredNamespaces: request.requiredNamespaces, - optionalNamespaces: request.optionalNamespaces, + optionalNamespaces: request.optionalNamespaces ?? {}, sessionProperties: request.sessionProperties, pairingTopic: pTopic, ); @@ -176,7 +176,7 @@ class SignEngine implements ISignEngine { selfPublicKey: publicKey, pairingTopic: pTopic, requiredNamespaces: request.requiredNamespaces, - optionalNamespaces: request.optionalNamespaces, + optionalNamespaces: request.optionalNamespaces ?? {}, sessionProperties: request.sessionProperties, completer: completer, ), @@ -935,7 +935,7 @@ class SignEngine implements ISignEngine { relays: proposeRequest.relays, proposer: proposeRequest.proposer, requiredNamespaces: proposeRequest.requiredNamespaces, - optionalNamespaces: proposeRequest.optionalNamespaces, + optionalNamespaces: proposeRequest.optionalNamespaces ?? {}, sessionProperties: proposeRequest.sessionProperties, pairingTopic: topic, generatedNamespaces: namespaces, diff --git a/lib/apis/utils/constants.dart b/lib/apis/utils/constants.dart index 25d46f6d..bd31b216 100644 --- a/lib/apis/utils/constants.dart +++ b/lib/apis/utils/constants.dart @@ -1,5 +1,5 @@ class WalletConnectConstants { - static const SDK_VERSION = '2.0.12'; + static const SDK_VERSION = '2.0.14'; static const CORE_PROTOCOL = 'wc'; static const CORE_VERSION = 2; diff --git a/lib/src/version.dart b/lib/src/version.dart index f1e9c830..80cdf523 100644 --- a/lib/src/version.dart +++ b/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '2.0.12'; +const packageVersion = '2.0.13'; diff --git a/pubspec.yaml b/pubspec.yaml index 917b93f2..e369995b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: walletconnect_flutter_v2 description: WalletConnect v2 client made in dart for flutter. -version: 2.0.13 +version: 2.0.14 repository: https://github.com/WalletConnect/WalletConnectFlutterV2 environment: