diff --git a/lib/wallet/network_info.dart b/lib/wallet/network_info.dart index dc5ec984..14fbf6f2 100644 --- a/lib/wallet/network_info.dart +++ b/lib/wallet/network_info.dart @@ -63,7 +63,7 @@ class GRPCInfo extends Equatable { return GrpcOrGrpcWebClientChannel.toSeparateEndpoints( grpcHost: host.replaceFirst(RegExp('http(s)?://'), ''), grpcPort: port, - grpcTransportSecure: credentials == ChannelCredentials.secure(), + grpcTransportSecure: credentials.isSecure, grpcWebHost: finaleWebHost.replaceFirst(RegExp('http(s)?://'), ''), grpcWebPort: webPort, grpcWebTransportSecure: webTransportSecure, diff --git a/test/types/network_info_test.dart b/test/types/network_info_test.dart index 96236a68..fe027237 100644 --- a/test/types/network_info_test.dart +++ b/test/types/network_info_test.dart @@ -6,24 +6,34 @@ void main() { group('GRPCInfo', () { group('toJson and fromJson work properly', () { test('with secure credentials', () { + final channelCredential = ChannelCredentials.secure(); final grpcInfo = GRPCInfo( host: 'localhost', port: 1111, - credentials: ChannelCredentials.secure(), + credentials: channelCredential, ); + final channel = grpcInfo.getChannel(); + + expect(channel.options.credentials.isSecure, true); + final json = grpcInfo.toJson(); final fromJson = GRPCInfo.fromJson(json); expect(fromJson, equals(grpcInfo)); }); test('with insecure credentials', () { + final channelCredential = ChannelCredentials.insecure(); final grpcInfo = GRPCInfo( host: 'localhost', port: 1111, - credentials: ChannelCredentials.insecure(), + credentials: channelCredential, ); + final channel = grpcInfo.getChannel(); + + expect(channel.options.credentials.isSecure, false); + final json = grpcInfo.toJson(); final fromJson = GRPCInfo.fromJson(json); expect(fromJson, equals(grpcInfo));