From fcadff4030391c1bcaf8f6999c46ec6511be5f14 Mon Sep 17 00:00:00 2001 From: Sterling Long Date: Tue, 11 Jul 2023 17:01:08 -0600 Subject: [PATCH] Added freezed, changelog, etc. --- CHANGELOG.md | 5 + README.md | 2 + build.yaml | 7 + .../models/eth/ethereum_transaction.g.dart | 44 - .../solana/solana_sign_transaction.g.dart | 55 - example/wallet/android/app/build.gradle | 2 +- .../kotlin/com/example/wallet/MainActivity.kt | 2 +- example/wallet/android/build.gradle | 2 +- .../models/eth/ethereum_transaction.g.dart | 44 - .../solana/solana_sign_transaction.g.dart | 55 - lib/apis/auth_api/auth_engine.dart | 2 +- .../auth_api/models/auth_client_models.dart | 270 +- .../models/auth_client_models.freezed.dart | 2245 ++++++++++++++++ .../auth_api/models/auth_client_models.g.dart | 82 +- lib/apis/auth_api/models/json_rpc_models.dart | 36 +- .../models/json_rpc_models.freezed.dart | 351 +++ .../auth_api/models/json_rpc_models.g.dart | 17 +- .../core/echo/models/echo_response.g.dart | 4 +- lib/apis/core/pairing/json_rpc_history.dart | 7 +- lib/apis/core/pairing/pairing.dart | 1 + lib/apis/core/pairing/pairing_store.dart | 20 +- .../core/pairing/utils/pairing_models.dart | 179 +- .../pairing/utils/pairing_models.freezed.dart | 1099 ++++++++ .../core/pairing/utils/pairing_models.g.dart | 57 +- .../core/relay_client/i_relay_client.dart | 3 + lib/apis/core/relay_client/relay_client.dart | 15 +- lib/apis/models/basic_models.dart | 105 +- lib/apis/models/basic_models.freezed.dart | 512 ++++ lib/apis/models/basic_models.g.dart | 35 +- lib/apis/models/json_rpc_error.dart | 23 +- lib/apis/models/json_rpc_error.freezed.dart | 169 ++ lib/apis/models/json_rpc_error.g.dart | 24 +- lib/apis/models/json_rpc_request.dart | 29 +- lib/apis/models/json_rpc_request.freezed.dart | 210 ++ lib/apis/models/json_rpc_request.g.dart | 6 +- lib/apis/models/json_rpc_response.dart | 30 +- .../models/json_rpc_response.freezed.dart | 226 ++ lib/apis/models/json_rpc_response.g.dart | 8 +- lib/apis/sign_api/models/json_rpc_models.dart | 251 +- .../models/json_rpc_models.freezed.dart | 2390 +++++++++++++++++ .../sign_api/models/json_rpc_models.g.dart | 114 +- lib/apis/sign_api/models/proposal_models.dart | 113 +- .../models/proposal_models.freezed.dart | 761 ++++++ .../sign_api/models/proposal_models.g.dart | 20 +- lib/apis/sign_api/models/session_models.dart | 152 +- .../models/session_models.freezed.dart | 871 ++++++ .../sign_api/models/session_models.g.dart | 16 +- lib/apis/sign_api/sessions.dart | 4 +- lib/apis/sign_api/sign_engine.dart | 4 +- lib/apis/utils/method_constants.dart | 144 +- lib/src/version.dart | 2 + pubspec.yaml | 4 +- test/auth_api/auth_client_test.dart | 2 +- test/shared/shared_test_utils.mocks.dart | 241 +- .../tests/sign_request_and_handler.dart | 2 +- test/sign_api/validation_test.dart | 6 +- 56 files changed, 9740 insertions(+), 1340 deletions(-) delete mode 100644 example/dapp/lib/models/eth/ethereum_transaction.g.dart delete mode 100644 example/dapp/lib/models/solana/solana_sign_transaction.g.dart delete mode 100644 example/wallet/lib/models/eth/ethereum_transaction.g.dart delete mode 100644 example/wallet/lib/models/solana/solana_sign_transaction.g.dart create mode 100644 lib/apis/auth_api/models/auth_client_models.freezed.dart create mode 100644 lib/apis/auth_api/models/json_rpc_models.freezed.dart create mode 100644 lib/apis/core/pairing/utils/pairing_models.freezed.dart create mode 100644 lib/apis/models/basic_models.freezed.dart create mode 100644 lib/apis/models/json_rpc_error.freezed.dart create mode 100644 lib/apis/models/json_rpc_request.freezed.dart create mode 100644 lib/apis/models/json_rpc_response.freezed.dart create mode 100644 lib/apis/sign_api/models/json_rpc_models.freezed.dart create mode 100644 lib/apis/sign_api/models/proposal_models.freezed.dart create mode 100644 lib/apis/sign_api/models/session_models.freezed.dart create mode 100644 lib/src/version.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7ce7a6..fed53ee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.13 + +- Made message in json response nullable to resolve issues with rejection messages + + ## 2.0.12 - Fixed regression with default relay URL, added tests to ensure it doesn't happen again diff --git a/README.md b/README.md index 9d6e070f..c450ff34 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,12 @@ ConnectResponse resp = await wcClient.connect( 'eip155': RequiredNamespace( chains: ['eip155:1'], // Ethereum chain methods: ['eth_signTransaction'], // Requestable Methods + events: ['eth_sendTransaction'], // Requestable Events ), 'kadena': RequiredNamespace( chains: ['kadena:mainnet01'], // Kadena chain methods: ['kadena_quicksign_v1'], // Requestable Methods + events: ['kadena_transaction_updated'], // Requestable Events ), } ); diff --git a/build.yaml b/build.yaml index 7cb5117d..767155db 100644 --- a/build.yaml +++ b/build.yaml @@ -1,6 +1,13 @@ targets: $default: builders: + freezed: + generate_for: + - lib/**.dart + - test/shared/shared_test_utils.dart json_serializable: options: explicit_to_json: true + generate_for: + - lib/**.dart + - test/shared/shared_test_utils.dart diff --git a/example/dapp/lib/models/eth/ethereum_transaction.g.dart b/example/dapp/lib/models/eth/ethereum_transaction.g.dart deleted file mode 100644 index bcf198d0..00000000 --- a/example/dapp/lib/models/eth/ethereum_transaction.g.dart +++ /dev/null @@ -1,44 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'ethereum_transaction.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -EthereumTransaction _$EthereumTransactionFromJson(Map json) => - EthereumTransaction( - from: json['from'] as String, - to: json['to'] as String, - value: json['value'] as String, - nonce: json['nonce'] as String?, - gasPrice: json['gasPrice'] as String?, - maxFeePerGas: json['maxFeePerGas'] as String?, - maxPriorityFeePerGas: json['maxPriorityFeePerGas'] as String?, - gas: json['gas'] as String?, - gasLimit: json['gasLimit'] as String?, - data: json['data'] as String?, - ); - -Map _$EthereumTransactionToJson(EthereumTransaction instance) { - final val = { - 'from': instance.from, - 'to': instance.to, - 'value': instance.value, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('nonce', instance.nonce); - writeNotNull('gasPrice', instance.gasPrice); - writeNotNull('maxFeePerGas', instance.maxFeePerGas); - writeNotNull('maxPriorityFeePerGas', instance.maxPriorityFeePerGas); - writeNotNull('gas', instance.gas); - writeNotNull('gasLimit', instance.gasLimit); - writeNotNull('data', instance.data); - return val; -} diff --git a/example/dapp/lib/models/solana/solana_sign_transaction.g.dart b/example/dapp/lib/models/solana/solana_sign_transaction.g.dart deleted file mode 100644 index 40077529..00000000 --- a/example/dapp/lib/models/solana/solana_sign_transaction.g.dart +++ /dev/null @@ -1,55 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'solana_sign_transaction.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -SolanaSignTransaction _$SolanaSignTransactionFromJson( - Map json) => - SolanaSignTransaction( - feePayer: json['feePayer'] as String, - recentBlockhash: json['recentBlockhash'] as String, - instructions: (json['instructions'] as List) - .map((e) => SolanaInstruction.fromJson(e as Map)) - .toList(), - ); - -Map _$SolanaSignTransactionToJson( - SolanaSignTransaction instance) => - { - 'feePayer': instance.feePayer, - 'recentBlockhash': instance.recentBlockhash, - 'instructions': instance.instructions.map((e) => e.toJson()).toList(), - }; - -SolanaInstruction _$SolanaInstructionFromJson(Map json) => - SolanaInstruction( - programId: json['programId'] as String, - keys: (json['keys'] as List) - .map((e) => SolanaKeyMetadata.fromJson(e as Map)) - .toList(), - data: json['data'] as String, - ); - -Map _$SolanaInstructionToJson(SolanaInstruction instance) => - { - 'programId': instance.programId, - 'keys': instance.keys.map((e) => e.toJson()).toList(), - 'data': instance.data, - }; - -SolanaKeyMetadata _$SolanaKeyMetadataFromJson(Map json) => - SolanaKeyMetadata( - pubkey: json['pubkey'] as String, - isSigner: json['isSigner'] as bool, - isWritable: json['isWritable'] as bool, - ); - -Map _$SolanaKeyMetadataToJson(SolanaKeyMetadata instance) => - { - 'pubkey': instance.pubkey, - 'isSigner': instance.isSigner, - 'isWritable': instance.isWritable, - }; diff --git a/example/wallet/android/app/build.gradle b/example/wallet/android/app/build.gradle index 8a6c49e9..f4ffa57b 100644 --- a/example/wallet/android/app/build.gradle +++ b/example/wallet/android/app/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "xyz.luzzotica.example_wallet" + applicationId "com.walletconnect.flutter_wallet" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. minSdkVersion 21 diff --git a/example/wallet/android/app/src/main/kotlin/com/example/wallet/MainActivity.kt b/example/wallet/android/app/src/main/kotlin/com/example/wallet/MainActivity.kt index 8951a809..8b95884e 100644 --- a/example/wallet/android/app/src/main/kotlin/com/example/wallet/MainActivity.kt +++ b/example/wallet/android/app/src/main/kotlin/com/example/wallet/MainActivity.kt @@ -1,4 +1,4 @@ -package com.example.wallet +package com.walletconnect.flutter_wallet import io.flutter.embedding.android.FlutterActivity diff --git a/example/wallet/android/build.gradle b/example/wallet/android/build.gradle index 83ae2200..3cdaac95 100644 --- a/example/wallet/android/build.gradle +++ b/example/wallet/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/wallet/lib/models/eth/ethereum_transaction.g.dart b/example/wallet/lib/models/eth/ethereum_transaction.g.dart deleted file mode 100644 index bcf198d0..00000000 --- a/example/wallet/lib/models/eth/ethereum_transaction.g.dart +++ /dev/null @@ -1,44 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'ethereum_transaction.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -EthereumTransaction _$EthereumTransactionFromJson(Map json) => - EthereumTransaction( - from: json['from'] as String, - to: json['to'] as String, - value: json['value'] as String, - nonce: json['nonce'] as String?, - gasPrice: json['gasPrice'] as String?, - maxFeePerGas: json['maxFeePerGas'] as String?, - maxPriorityFeePerGas: json['maxPriorityFeePerGas'] as String?, - gas: json['gas'] as String?, - gasLimit: json['gasLimit'] as String?, - data: json['data'] as String?, - ); - -Map _$EthereumTransactionToJson(EthereumTransaction instance) { - final val = { - 'from': instance.from, - 'to': instance.to, - 'value': instance.value, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('nonce', instance.nonce); - writeNotNull('gasPrice', instance.gasPrice); - writeNotNull('maxFeePerGas', instance.maxFeePerGas); - writeNotNull('maxPriorityFeePerGas', instance.maxPriorityFeePerGas); - writeNotNull('gas', instance.gas); - writeNotNull('gasLimit', instance.gasLimit); - writeNotNull('data', instance.data); - return val; -} diff --git a/example/wallet/lib/models/solana/solana_sign_transaction.g.dart b/example/wallet/lib/models/solana/solana_sign_transaction.g.dart deleted file mode 100644 index 40077529..00000000 --- a/example/wallet/lib/models/solana/solana_sign_transaction.g.dart +++ /dev/null @@ -1,55 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'solana_sign_transaction.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -SolanaSignTransaction _$SolanaSignTransactionFromJson( - Map json) => - SolanaSignTransaction( - feePayer: json['feePayer'] as String, - recentBlockhash: json['recentBlockhash'] as String, - instructions: (json['instructions'] as List) - .map((e) => SolanaInstruction.fromJson(e as Map)) - .toList(), - ); - -Map _$SolanaSignTransactionToJson( - SolanaSignTransaction instance) => - { - 'feePayer': instance.feePayer, - 'recentBlockhash': instance.recentBlockhash, - 'instructions': instance.instructions.map((e) => e.toJson()).toList(), - }; - -SolanaInstruction _$SolanaInstructionFromJson(Map json) => - SolanaInstruction( - programId: json['programId'] as String, - keys: (json['keys'] as List) - .map((e) => SolanaKeyMetadata.fromJson(e as Map)) - .toList(), - data: json['data'] as String, - ); - -Map _$SolanaInstructionToJson(SolanaInstruction instance) => - { - 'programId': instance.programId, - 'keys': instance.keys.map((e) => e.toJson()).toList(), - 'data': instance.data, - }; - -SolanaKeyMetadata _$SolanaKeyMetadataFromJson(Map json) => - SolanaKeyMetadata( - pubkey: json['pubkey'] as String, - isSigner: json['isSigner'] as bool, - isWritable: json['isWritable'] as bool, - ); - -Map _$SolanaKeyMetadataToJson(SolanaKeyMetadata instance) => - { - 'pubkey': instance.pubkey, - 'isSigner': instance.isSigner, - 'isWritable': instance.isWritable, - }; diff --git a/lib/apis/auth_api/auth_engine.dart b/lib/apis/auth_api/auth_engine.dart index e2f67575..05a5f2dd 100644 --- a/lib/apis/auth_api/auth_engine.dart +++ b/lib/apis/auth_api/auth_engine.dart @@ -200,7 +200,7 @@ class AuthEngine implements IAuthEngine { final String reconstructed = formatAuthMessage( iss: payload.iss, - cacaoPayload: payload, + cacaoPayload: CacaoRequestPayload.fromCacaoPayload(payload), ); final String walletAddress = AddressUtils.getDidAddress(payload.iss); diff --git a/lib/apis/auth_api/models/auth_client_models.dart b/lib/apis/auth_api/models/auth_client_models.dart index d2ab3175..20fc75e1 100644 --- a/lib/apis/auth_api/models/auth_client_models.dart +++ b/lib/apis/auth_api/models/auth_client_models.dart @@ -1,11 +1,12 @@ import 'dart:async'; -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/auth_api/models/auth_client_events.dart'; import 'package:walletconnect_flutter_v2/apis/auth_api/utils/auth_utils.dart'; import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart'; part 'auth_client_models.g.dart'; +part 'auth_client_models.freezed.dart'; class AuthRequestResponse { final int id; @@ -21,18 +22,15 @@ class AuthRequestResponse { }); } -@JsonSerializable(includeIfNull: false) -class AuthPublicKey { - final String publicKey; - - AuthPublicKey({ - required this.publicKey, - }); +@freezed +class AuthPublicKey with _$AuthPublicKey { + @JsonSerializable(includeIfNull: false) + const factory AuthPublicKey({ + required String publicKey, + }) = _AuthPublicKey; factory AuthPublicKey.fromJson(Map json) => _$AuthPublicKeyFromJson(json); - - Map toJson() => _$AuthPublicKeyToJson(this); } class AuthRequestParams { @@ -72,35 +70,23 @@ class AuthRequestParams { }) : nonce = nonce ?? AuthUtils.generateNonce(); } -@JsonSerializable(includeIfNull: false) -class AuthPayloadParams { - final String type; - final String chainId; - final String domain; - final String aud; - final String version; - final String nonce; - final String iat; - final String? nbf; - final String? exp; - final String? statement; - final String? requestId; - final List? resources; - - const AuthPayloadParams({ - required this.type, - required this.chainId, - required this.domain, - required this.aud, - required this.version, - required this.nonce, - required this.iat, - this.nbf, - this.exp, - this.statement, - this.requestId, - this.resources, - }); +@freezed +class AuthPayloadParams with _$AuthPayloadParams { + @JsonSerializable(includeIfNull: false) + const factory AuthPayloadParams({ + required String type, + required String chainId, + required String domain, + required String aud, + required String version, + required String nonce, + required String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources, + }) = _AuthPayloadParams; factory AuthPayloadParams.fromRequestParams(AuthRequestParams params) { return AuthPayloadParams( @@ -121,35 +107,23 @@ class AuthPayloadParams { factory AuthPayloadParams.fromJson(Map json) => _$AuthPayloadParamsFromJson(json); - - Map toJson() => _$AuthPayloadParamsToJson(this); } -@JsonSerializable(includeIfNull: false) -class CacaoRequestPayload { - final String domain; - final String aud; - final String version; - final String nonce; - final String iat; - final String? nbf; - final String? exp; - final String? statement; - final String? requestId; - final List? resources; - - const CacaoRequestPayload({ - required this.domain, - required this.aud, - required this.version, - required this.nonce, - required this.iat, - this.nbf, - this.exp, - this.statement, - this.requestId, - this.resources, - }); +@freezed +class CacaoRequestPayload with _$CacaoRequestPayload { + @JsonSerializable(includeIfNull: false) + const factory CacaoRequestPayload({ + required String domain, + required String aud, + required String version, + required String nonce, + required String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources, + }) = _CacaoRequestPayload; factory CacaoRequestPayload.fromPayloadParams(AuthPayloadParams params) { return CacaoRequestPayload( @@ -166,40 +140,41 @@ class CacaoRequestPayload { ); } + factory CacaoRequestPayload.fromCacaoPayload(CacaoPayload payload) { + return CacaoRequestPayload( + domain: payload.domain, + aud: payload.aud, + version: payload.version, + nonce: payload.nonce, + iat: payload.iat, + nbf: payload.nbf, + exp: payload.exp, + statement: payload.statement, + requestId: payload.requestId, + resources: payload.resources, + ); + } + factory CacaoRequestPayload.fromJson(Map json) => _$CacaoRequestPayloadFromJson(json); - - Map toJson() => _$CacaoRequestPayloadToJson(this); } -@JsonSerializable(includeIfNull: false) -class CacaoPayload extends CacaoRequestPayload { - final String iss; - - const CacaoPayload({ - required this.iss, - required domain, - required aud, - required version, - required nonce, - required iat, - nbf, - exp, - statement, - requestId, - resources, - }) : super( - domain: domain, - aud: aud, - version: version, - nonce: nonce, - iat: iat, - nbf: nbf, - exp: exp, - statement: statement, - requestId: requestId, - resources: resources, - ); +@freezed +class CacaoPayload with _$CacaoPayload { + @JsonSerializable(includeIfNull: false) + const factory CacaoPayload({ + required String iss, + required String domain, + required String aud, + required String version, + required String nonce, + required String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources, + }) = _CacaoPayload; factory CacaoPayload.fromRequestPayload({ required String issuer, @@ -222,77 +197,59 @@ class CacaoPayload extends CacaoRequestPayload { factory CacaoPayload.fromJson(Map json) => _$CacaoPayloadFromJson(json); - - @override - Map toJson() => _$CacaoPayloadToJson(this); } -@JsonSerializable(includeIfNull: false) -class CacaoHeader { +@freezed +class CacaoHeader with _$CacaoHeader { static const EIP4361 = 'eip4361'; - final String t; - - CacaoHeader({ - this.t = 'eip4361', - }); + @JsonSerializable(includeIfNull: false) + const factory CacaoHeader({ + @Default('eip4361') String t, + }) = _CacaoHeader; factory CacaoHeader.fromJson(Map json) => _$CacaoHeaderFromJson(json); - - Map toJson() => _$CacaoHeaderToJson(this); } -@JsonSerializable(includeIfNull: false) -class CacaoSignature { +@freezed +class CacaoSignature with _$CacaoSignature { static const EIP191 = 'eip191'; static const EIP1271 = 'eip1271'; - final String t; - final String s; - final String? m; - - const CacaoSignature({ - required this.t, - required this.s, - this.m, - }); + @JsonSerializable(includeIfNull: false) + const factory CacaoSignature({ + required String t, + required String s, + String? m, + }) = _CacaoSignature; factory CacaoSignature.fromJson(Map json) => _$CacaoSignatureFromJson(json); - - Map toJson() => _$CacaoSignatureToJson(this); } -@JsonSerializable(includeIfNull: false) -class Cacao { - CacaoHeader h; - CacaoPayload p; - CacaoSignature s; - - Cacao({ - required this.h, - required this.p, - required this.s, - }); +@freezed +class Cacao with _$Cacao { + @JsonSerializable(includeIfNull: false) + const factory Cacao({ + required CacaoHeader h, + required CacaoPayload p, + required CacaoSignature s, + }) = _Cacao; factory Cacao.fromJson(Map json) => _$CacaoFromJson(json); - - Map toJson() => _$CacaoToJson(this); } -@JsonSerializable(includeIfNull: false) -class StoredCacao extends Cacao { - final int id; - final String pairingTopic; - - StoredCacao({ - required this.id, - required this.pairingTopic, +@freezed +class StoredCacao with _$StoredCacao { + @JsonSerializable(includeIfNull: false) + const factory StoredCacao({ + required int id, + required String pairingTopic, required CacaoHeader h, required CacaoPayload p, required CacaoSignature s, - }) : super(h: h, p: p, s: s); + }) = _StoredCacao; factory StoredCacao.fromCacao({ required int id, @@ -310,29 +267,20 @@ class StoredCacao extends Cacao { factory StoredCacao.fromJson(Map json) => _$StoredCacaoFromJson(json); - - @override - Map toJson() => _$StoredCacaoToJson(this); } -@JsonSerializable(includeIfNull: false) -class PendingAuthRequest { - final int id; - final String pairingTopic; - final ConnectionMetadata metadata; - final CacaoRequestPayload cacaoPayload; - - PendingAuthRequest({ - required this.id, - required this.pairingTopic, - required this.metadata, - required this.cacaoPayload, - }); +@freezed +class PendingAuthRequest with _$PendingAuthRequest { + @JsonSerializable(includeIfNull: false) + const factory PendingAuthRequest({ + required int id, + required String pairingTopic, + required ConnectionMetadata metadata, + required CacaoRequestPayload cacaoPayload, + }) = _PendingAuthRequest; factory PendingAuthRequest.fromJson(Map json) => _$PendingAuthRequestFromJson(json); - - Map toJson() => _$PendingAuthRequestToJson(this); } class AuthRequestCompleter { diff --git a/lib/apis/auth_api/models/auth_client_models.freezed.dart b/lib/apis/auth_api/models/auth_client_models.freezed.dart new file mode 100644 index 00000000..a13387df --- /dev/null +++ b/lib/apis/auth_api/models/auth_client_models.freezed.dart @@ -0,0 +1,2245 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'auth_client_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +AuthPublicKey _$AuthPublicKeyFromJson(Map json) { + return _AuthPublicKey.fromJson(json); +} + +/// @nodoc +mixin _$AuthPublicKey { + String get publicKey => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AuthPublicKeyCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthPublicKeyCopyWith<$Res> { + factory $AuthPublicKeyCopyWith( + AuthPublicKey value, $Res Function(AuthPublicKey) then) = + _$AuthPublicKeyCopyWithImpl<$Res, AuthPublicKey>; + @useResult + $Res call({String publicKey}); +} + +/// @nodoc +class _$AuthPublicKeyCopyWithImpl<$Res, $Val extends AuthPublicKey> + implements $AuthPublicKeyCopyWith<$Res> { + _$AuthPublicKeyCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? publicKey = null, + }) { + return _then(_value.copyWith( + publicKey: null == publicKey + ? _value.publicKey + : publicKey // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_AuthPublicKeyCopyWith<$Res> + implements $AuthPublicKeyCopyWith<$Res> { + factory _$$_AuthPublicKeyCopyWith( + _$_AuthPublicKey value, $Res Function(_$_AuthPublicKey) then) = + __$$_AuthPublicKeyCopyWithImpl<$Res>; + @override + @useResult + $Res call({String publicKey}); +} + +/// @nodoc +class __$$_AuthPublicKeyCopyWithImpl<$Res> + extends _$AuthPublicKeyCopyWithImpl<$Res, _$_AuthPublicKey> + implements _$$_AuthPublicKeyCopyWith<$Res> { + __$$_AuthPublicKeyCopyWithImpl( + _$_AuthPublicKey _value, $Res Function(_$_AuthPublicKey) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? publicKey = null, + }) { + return _then(_$_AuthPublicKey( + publicKey: null == publicKey + ? _value.publicKey + : publicKey // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_AuthPublicKey implements _AuthPublicKey { + const _$_AuthPublicKey({required this.publicKey}); + + factory _$_AuthPublicKey.fromJson(Map json) => + _$$_AuthPublicKeyFromJson(json); + + @override + final String publicKey; + + @override + String toString() { + return 'AuthPublicKey(publicKey: $publicKey)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_AuthPublicKey && + (identical(other.publicKey, publicKey) || + other.publicKey == publicKey)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, publicKey); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_AuthPublicKeyCopyWith<_$_AuthPublicKey> get copyWith => + __$$_AuthPublicKeyCopyWithImpl<_$_AuthPublicKey>(this, _$identity); + + @override + Map toJson() { + return _$$_AuthPublicKeyToJson( + this, + ); + } +} + +abstract class _AuthPublicKey implements AuthPublicKey { + const factory _AuthPublicKey({required final String publicKey}) = + _$_AuthPublicKey; + + factory _AuthPublicKey.fromJson(Map json) = + _$_AuthPublicKey.fromJson; + + @override + String get publicKey; + @override + @JsonKey(ignore: true) + _$$_AuthPublicKeyCopyWith<_$_AuthPublicKey> get copyWith => + throw _privateConstructorUsedError; +} + +AuthPayloadParams _$AuthPayloadParamsFromJson(Map json) { + return _AuthPayloadParams.fromJson(json); +} + +/// @nodoc +mixin _$AuthPayloadParams { + String get type => throw _privateConstructorUsedError; + String get chainId => throw _privateConstructorUsedError; + String get domain => throw _privateConstructorUsedError; + String get aud => throw _privateConstructorUsedError; + String get version => throw _privateConstructorUsedError; + String get nonce => throw _privateConstructorUsedError; + String get iat => throw _privateConstructorUsedError; + String? get nbf => throw _privateConstructorUsedError; + String? get exp => throw _privateConstructorUsedError; + String? get statement => throw _privateConstructorUsedError; + String? get requestId => throw _privateConstructorUsedError; + List? get resources => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AuthPayloadParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthPayloadParamsCopyWith<$Res> { + factory $AuthPayloadParamsCopyWith( + AuthPayloadParams value, $Res Function(AuthPayloadParams) then) = + _$AuthPayloadParamsCopyWithImpl<$Res, AuthPayloadParams>; + @useResult + $Res call( + {String type, + String chainId, + String domain, + String aud, + String version, + String nonce, + String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources}); +} + +/// @nodoc +class _$AuthPayloadParamsCopyWithImpl<$Res, $Val extends AuthPayloadParams> + implements $AuthPayloadParamsCopyWith<$Res> { + _$AuthPayloadParamsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? chainId = null, + Object? domain = null, + Object? aud = null, + Object? version = null, + Object? nonce = null, + Object? iat = null, + Object? nbf = freezed, + Object? exp = freezed, + Object? statement = freezed, + Object? requestId = freezed, + Object? resources = freezed, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + domain: null == domain + ? _value.domain + : domain // ignore: cast_nullable_to_non_nullable + as String, + aud: null == aud + ? _value.aud + : aud // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + nonce: null == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String, + iat: null == iat + ? _value.iat + : iat // ignore: cast_nullable_to_non_nullable + as String, + nbf: freezed == nbf + ? _value.nbf + : nbf // ignore: cast_nullable_to_non_nullable + as String?, + exp: freezed == exp + ? _value.exp + : exp // ignore: cast_nullable_to_non_nullable + as String?, + statement: freezed == statement + ? _value.statement + : statement // ignore: cast_nullable_to_non_nullable + as String?, + requestId: freezed == requestId + ? _value.requestId + : requestId // ignore: cast_nullable_to_non_nullable + as String?, + resources: freezed == resources + ? _value.resources + : resources // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_AuthPayloadParamsCopyWith<$Res> + implements $AuthPayloadParamsCopyWith<$Res> { + factory _$$_AuthPayloadParamsCopyWith(_$_AuthPayloadParams value, + $Res Function(_$_AuthPayloadParams) then) = + __$$_AuthPayloadParamsCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String type, + String chainId, + String domain, + String aud, + String version, + String nonce, + String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources}); +} + +/// @nodoc +class __$$_AuthPayloadParamsCopyWithImpl<$Res> + extends _$AuthPayloadParamsCopyWithImpl<$Res, _$_AuthPayloadParams> + implements _$$_AuthPayloadParamsCopyWith<$Res> { + __$$_AuthPayloadParamsCopyWithImpl( + _$_AuthPayloadParams _value, $Res Function(_$_AuthPayloadParams) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? chainId = null, + Object? domain = null, + Object? aud = null, + Object? version = null, + Object? nonce = null, + Object? iat = null, + Object? nbf = freezed, + Object? exp = freezed, + Object? statement = freezed, + Object? requestId = freezed, + Object? resources = freezed, + }) { + return _then(_$_AuthPayloadParams( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + domain: null == domain + ? _value.domain + : domain // ignore: cast_nullable_to_non_nullable + as String, + aud: null == aud + ? _value.aud + : aud // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + nonce: null == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String, + iat: null == iat + ? _value.iat + : iat // ignore: cast_nullable_to_non_nullable + as String, + nbf: freezed == nbf + ? _value.nbf + : nbf // ignore: cast_nullable_to_non_nullable + as String?, + exp: freezed == exp + ? _value.exp + : exp // ignore: cast_nullable_to_non_nullable + as String?, + statement: freezed == statement + ? _value.statement + : statement // ignore: cast_nullable_to_non_nullable + as String?, + requestId: freezed == requestId + ? _value.requestId + : requestId // ignore: cast_nullable_to_non_nullable + as String?, + resources: freezed == resources + ? _value._resources + : resources // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_AuthPayloadParams implements _AuthPayloadParams { + const _$_AuthPayloadParams( + {required this.type, + required this.chainId, + required this.domain, + required this.aud, + required this.version, + required this.nonce, + required this.iat, + this.nbf, + this.exp, + this.statement, + this.requestId, + final List? resources}) + : _resources = resources; + + factory _$_AuthPayloadParams.fromJson(Map json) => + _$$_AuthPayloadParamsFromJson(json); + + @override + final String type; + @override + final String chainId; + @override + final String domain; + @override + final String aud; + @override + final String version; + @override + final String nonce; + @override + final String iat; + @override + final String? nbf; + @override + final String? exp; + @override + final String? statement; + @override + final String? requestId; + final List? _resources; + @override + List? get resources { + final value = _resources; + if (value == null) return null; + if (_resources is EqualUnmodifiableListView) return _resources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'AuthPayloadParams(type: $type, chainId: $chainId, domain: $domain, aud: $aud, version: $version, nonce: $nonce, iat: $iat, nbf: $nbf, exp: $exp, statement: $statement, requestId: $requestId, resources: $resources)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_AuthPayloadParams && + (identical(other.type, type) || other.type == type) && + (identical(other.chainId, chainId) || other.chainId == chainId) && + (identical(other.domain, domain) || other.domain == domain) && + (identical(other.aud, aud) || other.aud == aud) && + (identical(other.version, version) || other.version == version) && + (identical(other.nonce, nonce) || other.nonce == nonce) && + (identical(other.iat, iat) || other.iat == iat) && + (identical(other.nbf, nbf) || other.nbf == nbf) && + (identical(other.exp, exp) || other.exp == exp) && + (identical(other.statement, statement) || + other.statement == statement) && + (identical(other.requestId, requestId) || + other.requestId == requestId) && + const DeepCollectionEquality() + .equals(other._resources, _resources)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + type, + chainId, + domain, + aud, + version, + nonce, + iat, + nbf, + exp, + statement, + requestId, + const DeepCollectionEquality().hash(_resources)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_AuthPayloadParamsCopyWith<_$_AuthPayloadParams> get copyWith => + __$$_AuthPayloadParamsCopyWithImpl<_$_AuthPayloadParams>( + this, _$identity); + + @override + Map toJson() { + return _$$_AuthPayloadParamsToJson( + this, + ); + } +} + +abstract class _AuthPayloadParams implements AuthPayloadParams { + const factory _AuthPayloadParams( + {required final String type, + required final String chainId, + required final String domain, + required final String aud, + required final String version, + required final String nonce, + required final String iat, + final String? nbf, + final String? exp, + final String? statement, + final String? requestId, + final List? resources}) = _$_AuthPayloadParams; + + factory _AuthPayloadParams.fromJson(Map json) = + _$_AuthPayloadParams.fromJson; + + @override + String get type; + @override + String get chainId; + @override + String get domain; + @override + String get aud; + @override + String get version; + @override + String get nonce; + @override + String get iat; + @override + String? get nbf; + @override + String? get exp; + @override + String? get statement; + @override + String? get requestId; + @override + List? get resources; + @override + @JsonKey(ignore: true) + _$$_AuthPayloadParamsCopyWith<_$_AuthPayloadParams> get copyWith => + throw _privateConstructorUsedError; +} + +CacaoRequestPayload _$CacaoRequestPayloadFromJson(Map json) { + return _CacaoRequestPayload.fromJson(json); +} + +/// @nodoc +mixin _$CacaoRequestPayload { + String get domain => throw _privateConstructorUsedError; + String get aud => throw _privateConstructorUsedError; + String get version => throw _privateConstructorUsedError; + String get nonce => throw _privateConstructorUsedError; + String get iat => throw _privateConstructorUsedError; + String? get nbf => throw _privateConstructorUsedError; + String? get exp => throw _privateConstructorUsedError; + String? get statement => throw _privateConstructorUsedError; + String? get requestId => throw _privateConstructorUsedError; + List? get resources => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CacaoRequestPayloadCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CacaoRequestPayloadCopyWith<$Res> { + factory $CacaoRequestPayloadCopyWith( + CacaoRequestPayload value, $Res Function(CacaoRequestPayload) then) = + _$CacaoRequestPayloadCopyWithImpl<$Res, CacaoRequestPayload>; + @useResult + $Res call( + {String domain, + String aud, + String version, + String nonce, + String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources}); +} + +/// @nodoc +class _$CacaoRequestPayloadCopyWithImpl<$Res, $Val extends CacaoRequestPayload> + implements $CacaoRequestPayloadCopyWith<$Res> { + _$CacaoRequestPayloadCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? domain = null, + Object? aud = null, + Object? version = null, + Object? nonce = null, + Object? iat = null, + Object? nbf = freezed, + Object? exp = freezed, + Object? statement = freezed, + Object? requestId = freezed, + Object? resources = freezed, + }) { + return _then(_value.copyWith( + domain: null == domain + ? _value.domain + : domain // ignore: cast_nullable_to_non_nullable + as String, + aud: null == aud + ? _value.aud + : aud // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + nonce: null == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String, + iat: null == iat + ? _value.iat + : iat // ignore: cast_nullable_to_non_nullable + as String, + nbf: freezed == nbf + ? _value.nbf + : nbf // ignore: cast_nullable_to_non_nullable + as String?, + exp: freezed == exp + ? _value.exp + : exp // ignore: cast_nullable_to_non_nullable + as String?, + statement: freezed == statement + ? _value.statement + : statement // ignore: cast_nullable_to_non_nullable + as String?, + requestId: freezed == requestId + ? _value.requestId + : requestId // ignore: cast_nullable_to_non_nullable + as String?, + resources: freezed == resources + ? _value.resources + : resources // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_CacaoRequestPayloadCopyWith<$Res> + implements $CacaoRequestPayloadCopyWith<$Res> { + factory _$$_CacaoRequestPayloadCopyWith(_$_CacaoRequestPayload value, + $Res Function(_$_CacaoRequestPayload) then) = + __$$_CacaoRequestPayloadCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String domain, + String aud, + String version, + String nonce, + String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources}); +} + +/// @nodoc +class __$$_CacaoRequestPayloadCopyWithImpl<$Res> + extends _$CacaoRequestPayloadCopyWithImpl<$Res, _$_CacaoRequestPayload> + implements _$$_CacaoRequestPayloadCopyWith<$Res> { + __$$_CacaoRequestPayloadCopyWithImpl(_$_CacaoRequestPayload _value, + $Res Function(_$_CacaoRequestPayload) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? domain = null, + Object? aud = null, + Object? version = null, + Object? nonce = null, + Object? iat = null, + Object? nbf = freezed, + Object? exp = freezed, + Object? statement = freezed, + Object? requestId = freezed, + Object? resources = freezed, + }) { + return _then(_$_CacaoRequestPayload( + domain: null == domain + ? _value.domain + : domain // ignore: cast_nullable_to_non_nullable + as String, + aud: null == aud + ? _value.aud + : aud // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + nonce: null == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String, + iat: null == iat + ? _value.iat + : iat // ignore: cast_nullable_to_non_nullable + as String, + nbf: freezed == nbf + ? _value.nbf + : nbf // ignore: cast_nullable_to_non_nullable + as String?, + exp: freezed == exp + ? _value.exp + : exp // ignore: cast_nullable_to_non_nullable + as String?, + statement: freezed == statement + ? _value.statement + : statement // ignore: cast_nullable_to_non_nullable + as String?, + requestId: freezed == requestId + ? _value.requestId + : requestId // ignore: cast_nullable_to_non_nullable + as String?, + resources: freezed == resources + ? _value._resources + : resources // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_CacaoRequestPayload implements _CacaoRequestPayload { + const _$_CacaoRequestPayload( + {required this.domain, + required this.aud, + required this.version, + required this.nonce, + required this.iat, + this.nbf, + this.exp, + this.statement, + this.requestId, + final List? resources}) + : _resources = resources; + + factory _$_CacaoRequestPayload.fromJson(Map json) => + _$$_CacaoRequestPayloadFromJson(json); + + @override + final String domain; + @override + final String aud; + @override + final String version; + @override + final String nonce; + @override + final String iat; + @override + final String? nbf; + @override + final String? exp; + @override + final String? statement; + @override + final String? requestId; + final List? _resources; + @override + List? get resources { + final value = _resources; + if (value == null) return null; + if (_resources is EqualUnmodifiableListView) return _resources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'CacaoRequestPayload(domain: $domain, aud: $aud, version: $version, nonce: $nonce, iat: $iat, nbf: $nbf, exp: $exp, statement: $statement, requestId: $requestId, resources: $resources)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_CacaoRequestPayload && + (identical(other.domain, domain) || other.domain == domain) && + (identical(other.aud, aud) || other.aud == aud) && + (identical(other.version, version) || other.version == version) && + (identical(other.nonce, nonce) || other.nonce == nonce) && + (identical(other.iat, iat) || other.iat == iat) && + (identical(other.nbf, nbf) || other.nbf == nbf) && + (identical(other.exp, exp) || other.exp == exp) && + (identical(other.statement, statement) || + other.statement == statement) && + (identical(other.requestId, requestId) || + other.requestId == requestId) && + const DeepCollectionEquality() + .equals(other._resources, _resources)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + domain, + aud, + version, + nonce, + iat, + nbf, + exp, + statement, + requestId, + const DeepCollectionEquality().hash(_resources)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_CacaoRequestPayloadCopyWith<_$_CacaoRequestPayload> get copyWith => + __$$_CacaoRequestPayloadCopyWithImpl<_$_CacaoRequestPayload>( + this, _$identity); + + @override + Map toJson() { + return _$$_CacaoRequestPayloadToJson( + this, + ); + } +} + +abstract class _CacaoRequestPayload implements CacaoRequestPayload { + const factory _CacaoRequestPayload( + {required final String domain, + required final String aud, + required final String version, + required final String nonce, + required final String iat, + final String? nbf, + final String? exp, + final String? statement, + final String? requestId, + final List? resources}) = _$_CacaoRequestPayload; + + factory _CacaoRequestPayload.fromJson(Map json) = + _$_CacaoRequestPayload.fromJson; + + @override + String get domain; + @override + String get aud; + @override + String get version; + @override + String get nonce; + @override + String get iat; + @override + String? get nbf; + @override + String? get exp; + @override + String? get statement; + @override + String? get requestId; + @override + List? get resources; + @override + @JsonKey(ignore: true) + _$$_CacaoRequestPayloadCopyWith<_$_CacaoRequestPayload> get copyWith => + throw _privateConstructorUsedError; +} + +CacaoPayload _$CacaoPayloadFromJson(Map json) { + return _CacaoPayload.fromJson(json); +} + +/// @nodoc +mixin _$CacaoPayload { + String get iss => throw _privateConstructorUsedError; + String get domain => throw _privateConstructorUsedError; + String get aud => throw _privateConstructorUsedError; + String get version => throw _privateConstructorUsedError; + String get nonce => throw _privateConstructorUsedError; + String get iat => throw _privateConstructorUsedError; + String? get nbf => throw _privateConstructorUsedError; + String? get exp => throw _privateConstructorUsedError; + String? get statement => throw _privateConstructorUsedError; + String? get requestId => throw _privateConstructorUsedError; + List? get resources => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CacaoPayloadCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CacaoPayloadCopyWith<$Res> { + factory $CacaoPayloadCopyWith( + CacaoPayload value, $Res Function(CacaoPayload) then) = + _$CacaoPayloadCopyWithImpl<$Res, CacaoPayload>; + @useResult + $Res call( + {String iss, + String domain, + String aud, + String version, + String nonce, + String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources}); +} + +/// @nodoc +class _$CacaoPayloadCopyWithImpl<$Res, $Val extends CacaoPayload> + implements $CacaoPayloadCopyWith<$Res> { + _$CacaoPayloadCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? iss = null, + Object? domain = null, + Object? aud = null, + Object? version = null, + Object? nonce = null, + Object? iat = null, + Object? nbf = freezed, + Object? exp = freezed, + Object? statement = freezed, + Object? requestId = freezed, + Object? resources = freezed, + }) { + return _then(_value.copyWith( + iss: null == iss + ? _value.iss + : iss // ignore: cast_nullable_to_non_nullable + as String, + domain: null == domain + ? _value.domain + : domain // ignore: cast_nullable_to_non_nullable + as String, + aud: null == aud + ? _value.aud + : aud // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + nonce: null == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String, + iat: null == iat + ? _value.iat + : iat // ignore: cast_nullable_to_non_nullable + as String, + nbf: freezed == nbf + ? _value.nbf + : nbf // ignore: cast_nullable_to_non_nullable + as String?, + exp: freezed == exp + ? _value.exp + : exp // ignore: cast_nullable_to_non_nullable + as String?, + statement: freezed == statement + ? _value.statement + : statement // ignore: cast_nullable_to_non_nullable + as String?, + requestId: freezed == requestId + ? _value.requestId + : requestId // ignore: cast_nullable_to_non_nullable + as String?, + resources: freezed == resources + ? _value.resources + : resources // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_CacaoPayloadCopyWith<$Res> + implements $CacaoPayloadCopyWith<$Res> { + factory _$$_CacaoPayloadCopyWith( + _$_CacaoPayload value, $Res Function(_$_CacaoPayload) then) = + __$$_CacaoPayloadCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String iss, + String domain, + String aud, + String version, + String nonce, + String iat, + String? nbf, + String? exp, + String? statement, + String? requestId, + List? resources}); +} + +/// @nodoc +class __$$_CacaoPayloadCopyWithImpl<$Res> + extends _$CacaoPayloadCopyWithImpl<$Res, _$_CacaoPayload> + implements _$$_CacaoPayloadCopyWith<$Res> { + __$$_CacaoPayloadCopyWithImpl( + _$_CacaoPayload _value, $Res Function(_$_CacaoPayload) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? iss = null, + Object? domain = null, + Object? aud = null, + Object? version = null, + Object? nonce = null, + Object? iat = null, + Object? nbf = freezed, + Object? exp = freezed, + Object? statement = freezed, + Object? requestId = freezed, + Object? resources = freezed, + }) { + return _then(_$_CacaoPayload( + iss: null == iss + ? _value.iss + : iss // ignore: cast_nullable_to_non_nullable + as String, + domain: null == domain + ? _value.domain + : domain // ignore: cast_nullable_to_non_nullable + as String, + aud: null == aud + ? _value.aud + : aud // ignore: cast_nullable_to_non_nullable + as String, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + nonce: null == nonce + ? _value.nonce + : nonce // ignore: cast_nullable_to_non_nullable + as String, + iat: null == iat + ? _value.iat + : iat // ignore: cast_nullable_to_non_nullable + as String, + nbf: freezed == nbf + ? _value.nbf + : nbf // ignore: cast_nullable_to_non_nullable + as String?, + exp: freezed == exp + ? _value.exp + : exp // ignore: cast_nullable_to_non_nullable + as String?, + statement: freezed == statement + ? _value.statement + : statement // ignore: cast_nullable_to_non_nullable + as String?, + requestId: freezed == requestId + ? _value.requestId + : requestId // ignore: cast_nullable_to_non_nullable + as String?, + resources: freezed == resources + ? _value._resources + : resources // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_CacaoPayload implements _CacaoPayload { + const _$_CacaoPayload( + {required this.iss, + required this.domain, + required this.aud, + required this.version, + required this.nonce, + required this.iat, + this.nbf, + this.exp, + this.statement, + this.requestId, + final List? resources}) + : _resources = resources; + + factory _$_CacaoPayload.fromJson(Map json) => + _$$_CacaoPayloadFromJson(json); + + @override + final String iss; + @override + final String domain; + @override + final String aud; + @override + final String version; + @override + final String nonce; + @override + final String iat; + @override + final String? nbf; + @override + final String? exp; + @override + final String? statement; + @override + final String? requestId; + final List? _resources; + @override + List? get resources { + final value = _resources; + if (value == null) return null; + if (_resources is EqualUnmodifiableListView) return _resources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'CacaoPayload(iss: $iss, domain: $domain, aud: $aud, version: $version, nonce: $nonce, iat: $iat, nbf: $nbf, exp: $exp, statement: $statement, requestId: $requestId, resources: $resources)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_CacaoPayload && + (identical(other.iss, iss) || other.iss == iss) && + (identical(other.domain, domain) || other.domain == domain) && + (identical(other.aud, aud) || other.aud == aud) && + (identical(other.version, version) || other.version == version) && + (identical(other.nonce, nonce) || other.nonce == nonce) && + (identical(other.iat, iat) || other.iat == iat) && + (identical(other.nbf, nbf) || other.nbf == nbf) && + (identical(other.exp, exp) || other.exp == exp) && + (identical(other.statement, statement) || + other.statement == statement) && + (identical(other.requestId, requestId) || + other.requestId == requestId) && + const DeepCollectionEquality() + .equals(other._resources, _resources)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + iss, + domain, + aud, + version, + nonce, + iat, + nbf, + exp, + statement, + requestId, + const DeepCollectionEquality().hash(_resources)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_CacaoPayloadCopyWith<_$_CacaoPayload> get copyWith => + __$$_CacaoPayloadCopyWithImpl<_$_CacaoPayload>(this, _$identity); + + @override + Map toJson() { + return _$$_CacaoPayloadToJson( + this, + ); + } +} + +abstract class _CacaoPayload implements CacaoPayload { + const factory _CacaoPayload( + {required final String iss, + required final String domain, + required final String aud, + required final String version, + required final String nonce, + required final String iat, + final String? nbf, + final String? exp, + final String? statement, + final String? requestId, + final List? resources}) = _$_CacaoPayload; + + factory _CacaoPayload.fromJson(Map json) = + _$_CacaoPayload.fromJson; + + @override + String get iss; + @override + String get domain; + @override + String get aud; + @override + String get version; + @override + String get nonce; + @override + String get iat; + @override + String? get nbf; + @override + String? get exp; + @override + String? get statement; + @override + String? get requestId; + @override + List? get resources; + @override + @JsonKey(ignore: true) + _$$_CacaoPayloadCopyWith<_$_CacaoPayload> get copyWith => + throw _privateConstructorUsedError; +} + +CacaoHeader _$CacaoHeaderFromJson(Map json) { + return _CacaoHeader.fromJson(json); +} + +/// @nodoc +mixin _$CacaoHeader { + String get t => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CacaoHeaderCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CacaoHeaderCopyWith<$Res> { + factory $CacaoHeaderCopyWith( + CacaoHeader value, $Res Function(CacaoHeader) then) = + _$CacaoHeaderCopyWithImpl<$Res, CacaoHeader>; + @useResult + $Res call({String t}); +} + +/// @nodoc +class _$CacaoHeaderCopyWithImpl<$Res, $Val extends CacaoHeader> + implements $CacaoHeaderCopyWith<$Res> { + _$CacaoHeaderCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? t = null, + }) { + return _then(_value.copyWith( + t: null == t + ? _value.t + : t // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_CacaoHeaderCopyWith<$Res> + implements $CacaoHeaderCopyWith<$Res> { + factory _$$_CacaoHeaderCopyWith( + _$_CacaoHeader value, $Res Function(_$_CacaoHeader) then) = + __$$_CacaoHeaderCopyWithImpl<$Res>; + @override + @useResult + $Res call({String t}); +} + +/// @nodoc +class __$$_CacaoHeaderCopyWithImpl<$Res> + extends _$CacaoHeaderCopyWithImpl<$Res, _$_CacaoHeader> + implements _$$_CacaoHeaderCopyWith<$Res> { + __$$_CacaoHeaderCopyWithImpl( + _$_CacaoHeader _value, $Res Function(_$_CacaoHeader) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? t = null, + }) { + return _then(_$_CacaoHeader( + t: null == t + ? _value.t + : t // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_CacaoHeader implements _CacaoHeader { + const _$_CacaoHeader({this.t = 'eip4361'}); + + factory _$_CacaoHeader.fromJson(Map json) => + _$$_CacaoHeaderFromJson(json); + + @override + @JsonKey() + final String t; + + @override + String toString() { + return 'CacaoHeader(t: $t)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_CacaoHeader && + (identical(other.t, t) || other.t == t)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, t); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_CacaoHeaderCopyWith<_$_CacaoHeader> get copyWith => + __$$_CacaoHeaderCopyWithImpl<_$_CacaoHeader>(this, _$identity); + + @override + Map toJson() { + return _$$_CacaoHeaderToJson( + this, + ); + } +} + +abstract class _CacaoHeader implements CacaoHeader { + const factory _CacaoHeader({final String t}) = _$_CacaoHeader; + + factory _CacaoHeader.fromJson(Map json) = + _$_CacaoHeader.fromJson; + + @override + String get t; + @override + @JsonKey(ignore: true) + _$$_CacaoHeaderCopyWith<_$_CacaoHeader> get copyWith => + throw _privateConstructorUsedError; +} + +CacaoSignature _$CacaoSignatureFromJson(Map json) { + return _CacaoSignature.fromJson(json); +} + +/// @nodoc +mixin _$CacaoSignature { + String get t => throw _privateConstructorUsedError; + String get s => throw _privateConstructorUsedError; + String? get m => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CacaoSignatureCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CacaoSignatureCopyWith<$Res> { + factory $CacaoSignatureCopyWith( + CacaoSignature value, $Res Function(CacaoSignature) then) = + _$CacaoSignatureCopyWithImpl<$Res, CacaoSignature>; + @useResult + $Res call({String t, String s, String? m}); +} + +/// @nodoc +class _$CacaoSignatureCopyWithImpl<$Res, $Val extends CacaoSignature> + implements $CacaoSignatureCopyWith<$Res> { + _$CacaoSignatureCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? t = null, + Object? s = null, + Object? m = freezed, + }) { + return _then(_value.copyWith( + t: null == t + ? _value.t + : t // ignore: cast_nullable_to_non_nullable + as String, + s: null == s + ? _value.s + : s // ignore: cast_nullable_to_non_nullable + as String, + m: freezed == m + ? _value.m + : m // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_CacaoSignatureCopyWith<$Res> + implements $CacaoSignatureCopyWith<$Res> { + factory _$$_CacaoSignatureCopyWith( + _$_CacaoSignature value, $Res Function(_$_CacaoSignature) then) = + __$$_CacaoSignatureCopyWithImpl<$Res>; + @override + @useResult + $Res call({String t, String s, String? m}); +} + +/// @nodoc +class __$$_CacaoSignatureCopyWithImpl<$Res> + extends _$CacaoSignatureCopyWithImpl<$Res, _$_CacaoSignature> + implements _$$_CacaoSignatureCopyWith<$Res> { + __$$_CacaoSignatureCopyWithImpl( + _$_CacaoSignature _value, $Res Function(_$_CacaoSignature) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? t = null, + Object? s = null, + Object? m = freezed, + }) { + return _then(_$_CacaoSignature( + t: null == t + ? _value.t + : t // ignore: cast_nullable_to_non_nullable + as String, + s: null == s + ? _value.s + : s // ignore: cast_nullable_to_non_nullable + as String, + m: freezed == m + ? _value.m + : m // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_CacaoSignature implements _CacaoSignature { + const _$_CacaoSignature({required this.t, required this.s, this.m}); + + factory _$_CacaoSignature.fromJson(Map json) => + _$$_CacaoSignatureFromJson(json); + + @override + final String t; + @override + final String s; + @override + final String? m; + + @override + String toString() { + return 'CacaoSignature(t: $t, s: $s, m: $m)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_CacaoSignature && + (identical(other.t, t) || other.t == t) && + (identical(other.s, s) || other.s == s) && + (identical(other.m, m) || other.m == m)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, t, s, m); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_CacaoSignatureCopyWith<_$_CacaoSignature> get copyWith => + __$$_CacaoSignatureCopyWithImpl<_$_CacaoSignature>(this, _$identity); + + @override + Map toJson() { + return _$$_CacaoSignatureToJson( + this, + ); + } +} + +abstract class _CacaoSignature implements CacaoSignature { + const factory _CacaoSignature( + {required final String t, + required final String s, + final String? m}) = _$_CacaoSignature; + + factory _CacaoSignature.fromJson(Map json) = + _$_CacaoSignature.fromJson; + + @override + String get t; + @override + String get s; + @override + String? get m; + @override + @JsonKey(ignore: true) + _$$_CacaoSignatureCopyWith<_$_CacaoSignature> get copyWith => + throw _privateConstructorUsedError; +} + +Cacao _$CacaoFromJson(Map json) { + return _Cacao.fromJson(json); +} + +/// @nodoc +mixin _$Cacao { + CacaoHeader get h => throw _privateConstructorUsedError; + CacaoPayload get p => throw _privateConstructorUsedError; + CacaoSignature get s => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CacaoCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CacaoCopyWith<$Res> { + factory $CacaoCopyWith(Cacao value, $Res Function(Cacao) then) = + _$CacaoCopyWithImpl<$Res, Cacao>; + @useResult + $Res call({CacaoHeader h, CacaoPayload p, CacaoSignature s}); + + $CacaoHeaderCopyWith<$Res> get h; + $CacaoPayloadCopyWith<$Res> get p; + $CacaoSignatureCopyWith<$Res> get s; +} + +/// @nodoc +class _$CacaoCopyWithImpl<$Res, $Val extends Cacao> + implements $CacaoCopyWith<$Res> { + _$CacaoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? h = null, + Object? p = null, + Object? s = null, + }) { + return _then(_value.copyWith( + h: null == h + ? _value.h + : h // ignore: cast_nullable_to_non_nullable + as CacaoHeader, + p: null == p + ? _value.p + : p // ignore: cast_nullable_to_non_nullable + as CacaoPayload, + s: null == s + ? _value.s + : s // ignore: cast_nullable_to_non_nullable + as CacaoSignature, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $CacaoHeaderCopyWith<$Res> get h { + return $CacaoHeaderCopyWith<$Res>(_value.h, (value) { + return _then(_value.copyWith(h: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $CacaoPayloadCopyWith<$Res> get p { + return $CacaoPayloadCopyWith<$Res>(_value.p, (value) { + return _then(_value.copyWith(p: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $CacaoSignatureCopyWith<$Res> get s { + return $CacaoSignatureCopyWith<$Res>(_value.s, (value) { + return _then(_value.copyWith(s: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_CacaoCopyWith<$Res> implements $CacaoCopyWith<$Res> { + factory _$$_CacaoCopyWith(_$_Cacao value, $Res Function(_$_Cacao) then) = + __$$_CacaoCopyWithImpl<$Res>; + @override + @useResult + $Res call({CacaoHeader h, CacaoPayload p, CacaoSignature s}); + + @override + $CacaoHeaderCopyWith<$Res> get h; + @override + $CacaoPayloadCopyWith<$Res> get p; + @override + $CacaoSignatureCopyWith<$Res> get s; +} + +/// @nodoc +class __$$_CacaoCopyWithImpl<$Res> extends _$CacaoCopyWithImpl<$Res, _$_Cacao> + implements _$$_CacaoCopyWith<$Res> { + __$$_CacaoCopyWithImpl(_$_Cacao _value, $Res Function(_$_Cacao) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? h = null, + Object? p = null, + Object? s = null, + }) { + return _then(_$_Cacao( + h: null == h + ? _value.h + : h // ignore: cast_nullable_to_non_nullable + as CacaoHeader, + p: null == p + ? _value.p + : p // ignore: cast_nullable_to_non_nullable + as CacaoPayload, + s: null == s + ? _value.s + : s // ignore: cast_nullable_to_non_nullable + as CacaoSignature, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_Cacao implements _Cacao { + const _$_Cacao({required this.h, required this.p, required this.s}); + + factory _$_Cacao.fromJson(Map json) => + _$$_CacaoFromJson(json); + + @override + final CacaoHeader h; + @override + final CacaoPayload p; + @override + final CacaoSignature s; + + @override + String toString() { + return 'Cacao(h: $h, p: $p, s: $s)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_Cacao && + (identical(other.h, h) || other.h == h) && + (identical(other.p, p) || other.p == p) && + (identical(other.s, s) || other.s == s)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, h, p, s); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_CacaoCopyWith<_$_Cacao> get copyWith => + __$$_CacaoCopyWithImpl<_$_Cacao>(this, _$identity); + + @override + Map toJson() { + return _$$_CacaoToJson( + this, + ); + } +} + +abstract class _Cacao implements Cacao { + const factory _Cacao( + {required final CacaoHeader h, + required final CacaoPayload p, + required final CacaoSignature s}) = _$_Cacao; + + factory _Cacao.fromJson(Map json) = _$_Cacao.fromJson; + + @override + CacaoHeader get h; + @override + CacaoPayload get p; + @override + CacaoSignature get s; + @override + @JsonKey(ignore: true) + _$$_CacaoCopyWith<_$_Cacao> get copyWith => + throw _privateConstructorUsedError; +} + +StoredCacao _$StoredCacaoFromJson(Map json) { + return _StoredCacao.fromJson(json); +} + +/// @nodoc +mixin _$StoredCacao { + int get id => throw _privateConstructorUsedError; + String get pairingTopic => throw _privateConstructorUsedError; + CacaoHeader get h => throw _privateConstructorUsedError; + CacaoPayload get p => throw _privateConstructorUsedError; + CacaoSignature get s => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $StoredCacaoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $StoredCacaoCopyWith<$Res> { + factory $StoredCacaoCopyWith( + StoredCacao value, $Res Function(StoredCacao) then) = + _$StoredCacaoCopyWithImpl<$Res, StoredCacao>; + @useResult + $Res call( + {int id, + String pairingTopic, + CacaoHeader h, + CacaoPayload p, + CacaoSignature s}); + + $CacaoHeaderCopyWith<$Res> get h; + $CacaoPayloadCopyWith<$Res> get p; + $CacaoSignatureCopyWith<$Res> get s; +} + +/// @nodoc +class _$StoredCacaoCopyWithImpl<$Res, $Val extends StoredCacao> + implements $StoredCacaoCopyWith<$Res> { + _$StoredCacaoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? pairingTopic = null, + Object? h = null, + Object? p = null, + Object? s = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + h: null == h + ? _value.h + : h // ignore: cast_nullable_to_non_nullable + as CacaoHeader, + p: null == p + ? _value.p + : p // ignore: cast_nullable_to_non_nullable + as CacaoPayload, + s: null == s + ? _value.s + : s // ignore: cast_nullable_to_non_nullable + as CacaoSignature, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $CacaoHeaderCopyWith<$Res> get h { + return $CacaoHeaderCopyWith<$Res>(_value.h, (value) { + return _then(_value.copyWith(h: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $CacaoPayloadCopyWith<$Res> get p { + return $CacaoPayloadCopyWith<$Res>(_value.p, (value) { + return _then(_value.copyWith(p: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $CacaoSignatureCopyWith<$Res> get s { + return $CacaoSignatureCopyWith<$Res>(_value.s, (value) { + return _then(_value.copyWith(s: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_StoredCacaoCopyWith<$Res> + implements $StoredCacaoCopyWith<$Res> { + factory _$$_StoredCacaoCopyWith( + _$_StoredCacao value, $Res Function(_$_StoredCacao) then) = + __$$_StoredCacaoCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + String pairingTopic, + CacaoHeader h, + CacaoPayload p, + CacaoSignature s}); + + @override + $CacaoHeaderCopyWith<$Res> get h; + @override + $CacaoPayloadCopyWith<$Res> get p; + @override + $CacaoSignatureCopyWith<$Res> get s; +} + +/// @nodoc +class __$$_StoredCacaoCopyWithImpl<$Res> + extends _$StoredCacaoCopyWithImpl<$Res, _$_StoredCacao> + implements _$$_StoredCacaoCopyWith<$Res> { + __$$_StoredCacaoCopyWithImpl( + _$_StoredCacao _value, $Res Function(_$_StoredCacao) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? pairingTopic = null, + Object? h = null, + Object? p = null, + Object? s = null, + }) { + return _then(_$_StoredCacao( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + h: null == h + ? _value.h + : h // ignore: cast_nullable_to_non_nullable + as CacaoHeader, + p: null == p + ? _value.p + : p // ignore: cast_nullable_to_non_nullable + as CacaoPayload, + s: null == s + ? _value.s + : s // ignore: cast_nullable_to_non_nullable + as CacaoSignature, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_StoredCacao implements _StoredCacao { + const _$_StoredCacao( + {required this.id, + required this.pairingTopic, + required this.h, + required this.p, + required this.s}); + + factory _$_StoredCacao.fromJson(Map json) => + _$$_StoredCacaoFromJson(json); + + @override + final int id; + @override + final String pairingTopic; + @override + final CacaoHeader h; + @override + final CacaoPayload p; + @override + final CacaoSignature s; + + @override + String toString() { + return 'StoredCacao(id: $id, pairingTopic: $pairingTopic, h: $h, p: $p, s: $s)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_StoredCacao && + (identical(other.id, id) || other.id == id) && + (identical(other.pairingTopic, pairingTopic) || + other.pairingTopic == pairingTopic) && + (identical(other.h, h) || other.h == h) && + (identical(other.p, p) || other.p == p) && + (identical(other.s, s) || other.s == s)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, pairingTopic, h, p, s); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_StoredCacaoCopyWith<_$_StoredCacao> get copyWith => + __$$_StoredCacaoCopyWithImpl<_$_StoredCacao>(this, _$identity); + + @override + Map toJson() { + return _$$_StoredCacaoToJson( + this, + ); + } +} + +abstract class _StoredCacao implements StoredCacao { + const factory _StoredCacao( + {required final int id, + required final String pairingTopic, + required final CacaoHeader h, + required final CacaoPayload p, + required final CacaoSignature s}) = _$_StoredCacao; + + factory _StoredCacao.fromJson(Map json) = + _$_StoredCacao.fromJson; + + @override + int get id; + @override + String get pairingTopic; + @override + CacaoHeader get h; + @override + CacaoPayload get p; + @override + CacaoSignature get s; + @override + @JsonKey(ignore: true) + _$$_StoredCacaoCopyWith<_$_StoredCacao> get copyWith => + throw _privateConstructorUsedError; +} + +PendingAuthRequest _$PendingAuthRequestFromJson(Map json) { + return _PendingAuthRequest.fromJson(json); +} + +/// @nodoc +mixin _$PendingAuthRequest { + int get id => throw _privateConstructorUsedError; + String get pairingTopic => throw _privateConstructorUsedError; + ConnectionMetadata get metadata => throw _privateConstructorUsedError; + CacaoRequestPayload get cacaoPayload => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PendingAuthRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PendingAuthRequestCopyWith<$Res> { + factory $PendingAuthRequestCopyWith( + PendingAuthRequest value, $Res Function(PendingAuthRequest) then) = + _$PendingAuthRequestCopyWithImpl<$Res, PendingAuthRequest>; + @useResult + $Res call( + {int id, + String pairingTopic, + ConnectionMetadata metadata, + CacaoRequestPayload cacaoPayload}); + + $ConnectionMetadataCopyWith<$Res> get metadata; + $CacaoRequestPayloadCopyWith<$Res> get cacaoPayload; +} + +/// @nodoc +class _$PendingAuthRequestCopyWithImpl<$Res, $Val extends PendingAuthRequest> + implements $PendingAuthRequestCopyWith<$Res> { + _$PendingAuthRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? pairingTopic = null, + Object? metadata = null, + Object? cacaoPayload = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + metadata: null == metadata + ? _value.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + cacaoPayload: null == cacaoPayload + ? _value.cacaoPayload + : cacaoPayload // ignore: cast_nullable_to_non_nullable + as CacaoRequestPayload, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get metadata { + return $ConnectionMetadataCopyWith<$Res>(_value.metadata, (value) { + return _then(_value.copyWith(metadata: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $CacaoRequestPayloadCopyWith<$Res> get cacaoPayload { + return $CacaoRequestPayloadCopyWith<$Res>(_value.cacaoPayload, (value) { + return _then(_value.copyWith(cacaoPayload: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_PendingAuthRequestCopyWith<$Res> + implements $PendingAuthRequestCopyWith<$Res> { + factory _$$_PendingAuthRequestCopyWith(_$_PendingAuthRequest value, + $Res Function(_$_PendingAuthRequest) then) = + __$$_PendingAuthRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + String pairingTopic, + ConnectionMetadata metadata, + CacaoRequestPayload cacaoPayload}); + + @override + $ConnectionMetadataCopyWith<$Res> get metadata; + @override + $CacaoRequestPayloadCopyWith<$Res> get cacaoPayload; +} + +/// @nodoc +class __$$_PendingAuthRequestCopyWithImpl<$Res> + extends _$PendingAuthRequestCopyWithImpl<$Res, _$_PendingAuthRequest> + implements _$$_PendingAuthRequestCopyWith<$Res> { + __$$_PendingAuthRequestCopyWithImpl( + _$_PendingAuthRequest _value, $Res Function(_$_PendingAuthRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? pairingTopic = null, + Object? metadata = null, + Object? cacaoPayload = null, + }) { + return _then(_$_PendingAuthRequest( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + metadata: null == metadata + ? _value.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + cacaoPayload: null == cacaoPayload + ? _value.cacaoPayload + : cacaoPayload // ignore: cast_nullable_to_non_nullable + as CacaoRequestPayload, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_PendingAuthRequest implements _PendingAuthRequest { + const _$_PendingAuthRequest( + {required this.id, + required this.pairingTopic, + required this.metadata, + required this.cacaoPayload}); + + factory _$_PendingAuthRequest.fromJson(Map json) => + _$$_PendingAuthRequestFromJson(json); + + @override + final int id; + @override + final String pairingTopic; + @override + final ConnectionMetadata metadata; + @override + final CacaoRequestPayload cacaoPayload; + + @override + String toString() { + return 'PendingAuthRequest(id: $id, pairingTopic: $pairingTopic, metadata: $metadata, cacaoPayload: $cacaoPayload)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_PendingAuthRequest && + (identical(other.id, id) || other.id == id) && + (identical(other.pairingTopic, pairingTopic) || + other.pairingTopic == pairingTopic) && + (identical(other.metadata, metadata) || + other.metadata == metadata) && + (identical(other.cacaoPayload, cacaoPayload) || + other.cacaoPayload == cacaoPayload)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, id, pairingTopic, metadata, cacaoPayload); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_PendingAuthRequestCopyWith<_$_PendingAuthRequest> get copyWith => + __$$_PendingAuthRequestCopyWithImpl<_$_PendingAuthRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_PendingAuthRequestToJson( + this, + ); + } +} + +abstract class _PendingAuthRequest implements PendingAuthRequest { + const factory _PendingAuthRequest( + {required final int id, + required final String pairingTopic, + required final ConnectionMetadata metadata, + required final CacaoRequestPayload cacaoPayload}) = _$_PendingAuthRequest; + + factory _PendingAuthRequest.fromJson(Map json) = + _$_PendingAuthRequest.fromJson; + + @override + int get id; + @override + String get pairingTopic; + @override + ConnectionMetadata get metadata; + @override + CacaoRequestPayload get cacaoPayload; + @override + @JsonKey(ignore: true) + _$$_PendingAuthRequestCopyWith<_$_PendingAuthRequest> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/auth_api/models/auth_client_models.g.dart b/lib/apis/auth_api/models/auth_client_models.g.dart index 4c1bcc5e..b823ba9f 100644 --- a/lib/apis/auth_api/models/auth_client_models.g.dart +++ b/lib/apis/auth_api/models/auth_client_models.g.dart @@ -6,18 +6,18 @@ part of 'auth_client_models.dart'; // JsonSerializableGenerator // ************************************************************************** -AuthPublicKey _$AuthPublicKeyFromJson(Map json) => - AuthPublicKey( +_$_AuthPublicKey _$$_AuthPublicKeyFromJson(Map json) => + _$_AuthPublicKey( publicKey: json['publicKey'] as String, ); -Map _$AuthPublicKeyToJson(AuthPublicKey instance) => +Map _$$_AuthPublicKeyToJson(_$_AuthPublicKey instance) => { 'publicKey': instance.publicKey, }; -AuthPayloadParams _$AuthPayloadParamsFromJson(Map json) => - AuthPayloadParams( +_$_AuthPayloadParams _$$_AuthPayloadParamsFromJson(Map json) => + _$_AuthPayloadParams( type: json['type'] as String, chainId: json['chainId'] as String, domain: json['domain'] as String, @@ -34,7 +34,8 @@ AuthPayloadParams _$AuthPayloadParamsFromJson(Map json) => .toList(), ); -Map _$AuthPayloadParamsToJson(AuthPayloadParams instance) { +Map _$$_AuthPayloadParamsToJson( + _$_AuthPayloadParams instance) { final val = { 'type': instance.type, 'chainId': instance.chainId, @@ -59,8 +60,9 @@ Map _$AuthPayloadParamsToJson(AuthPayloadParams instance) { return val; } -CacaoRequestPayload _$CacaoRequestPayloadFromJson(Map json) => - CacaoRequestPayload( +_$_CacaoRequestPayload _$$_CacaoRequestPayloadFromJson( + Map json) => + _$_CacaoRequestPayload( domain: json['domain'] as String, aud: json['aud'] as String, version: json['version'] as String, @@ -75,7 +77,8 @@ CacaoRequestPayload _$CacaoRequestPayloadFromJson(Map json) => .toList(), ); -Map _$CacaoRequestPayloadToJson(CacaoRequestPayload instance) { +Map _$$_CacaoRequestPayloadToJson( + _$_CacaoRequestPayload instance) { final val = { 'domain': instance.domain, 'aud': instance.aud, @@ -98,22 +101,26 @@ Map _$CacaoRequestPayloadToJson(CacaoRequestPayload instance) { return val; } -CacaoPayload _$CacaoPayloadFromJson(Map json) => CacaoPayload( +_$_CacaoPayload _$$_CacaoPayloadFromJson(Map json) => + _$_CacaoPayload( iss: json['iss'] as String, - domain: json['domain'], - aud: json['aud'], - version: json['version'], - nonce: json['nonce'], - iat: json['iat'], - nbf: json['nbf'], - exp: json['exp'], - statement: json['statement'], - requestId: json['requestId'], - resources: json['resources'], + domain: json['domain'] as String, + aud: json['aud'] as String, + version: json['version'] as String, + nonce: json['nonce'] as String, + iat: json['iat'] as String, + nbf: json['nbf'] as String?, + exp: json['exp'] as String?, + statement: json['statement'] as String?, + requestId: json['requestId'] as String?, + resources: (json['resources'] as List?) + ?.map((e) => e as String) + .toList(), ); -Map _$CacaoPayloadToJson(CacaoPayload instance) { +Map _$$_CacaoPayloadToJson(_$_CacaoPayload instance) { final val = { + 'iss': instance.iss, 'domain': instance.domain, 'aud': instance.aud, 'version': instance.version, @@ -132,27 +139,27 @@ Map _$CacaoPayloadToJson(CacaoPayload instance) { writeNotNull('statement', instance.statement); writeNotNull('requestId', instance.requestId); writeNotNull('resources', instance.resources); - val['iss'] = instance.iss; return val; } -CacaoHeader _$CacaoHeaderFromJson(Map json) => CacaoHeader( +_$_CacaoHeader _$$_CacaoHeaderFromJson(Map json) => + _$_CacaoHeader( t: json['t'] as String? ?? 'eip4361', ); -Map _$CacaoHeaderToJson(CacaoHeader instance) => +Map _$$_CacaoHeaderToJson(_$_CacaoHeader instance) => { 't': instance.t, }; -CacaoSignature _$CacaoSignatureFromJson(Map json) => - CacaoSignature( +_$_CacaoSignature _$$_CacaoSignatureFromJson(Map json) => + _$_CacaoSignature( t: json['t'] as String, s: json['s'] as String, m: json['m'] as String?, ); -Map _$CacaoSignatureToJson(CacaoSignature instance) { +Map _$$_CacaoSignatureToJson(_$_CacaoSignature instance) { final val = { 't': instance.t, 's': instance.s, @@ -168,19 +175,20 @@ Map _$CacaoSignatureToJson(CacaoSignature instance) { return val; } -Cacao _$CacaoFromJson(Map json) => Cacao( +_$_Cacao _$$_CacaoFromJson(Map json) => _$_Cacao( h: CacaoHeader.fromJson(json['h'] as Map), p: CacaoPayload.fromJson(json['p'] as Map), s: CacaoSignature.fromJson(json['s'] as Map), ); -Map _$CacaoToJson(Cacao instance) => { +Map _$$_CacaoToJson(_$_Cacao instance) => { 'h': instance.h.toJson(), 'p': instance.p.toJson(), 's': instance.s.toJson(), }; -StoredCacao _$StoredCacaoFromJson(Map json) => StoredCacao( +_$_StoredCacao _$$_StoredCacaoFromJson(Map json) => + _$_StoredCacao( id: json['id'] as int, pairingTopic: json['pairingTopic'] as String, h: CacaoHeader.fromJson(json['h'] as Map), @@ -188,17 +196,18 @@ StoredCacao _$StoredCacaoFromJson(Map json) => StoredCacao( s: CacaoSignature.fromJson(json['s'] as Map), ); -Map _$StoredCacaoToJson(StoredCacao instance) => +Map _$$_StoredCacaoToJson(_$_StoredCacao instance) => { + 'id': instance.id, + 'pairingTopic': instance.pairingTopic, 'h': instance.h.toJson(), 'p': instance.p.toJson(), 's': instance.s.toJson(), - 'id': instance.id, - 'pairingTopic': instance.pairingTopic, }; -PendingAuthRequest _$PendingAuthRequestFromJson(Map json) => - PendingAuthRequest( +_$_PendingAuthRequest _$$_PendingAuthRequestFromJson( + Map json) => + _$_PendingAuthRequest( id: json['id'] as int, pairingTopic: json['pairingTopic'] as String, metadata: @@ -207,7 +216,8 @@ PendingAuthRequest _$PendingAuthRequestFromJson(Map json) => json['cacaoPayload'] as Map), ); -Map _$PendingAuthRequestToJson(PendingAuthRequest instance) => +Map _$$_PendingAuthRequestToJson( + _$_PendingAuthRequest instance) => { 'id': instance.id, 'pairingTopic': instance.pairingTopic, diff --git a/lib/apis/auth_api/models/json_rpc_models.dart b/lib/apis/auth_api/models/json_rpc_models.dart index 7073c21e..4ca5e008 100644 --- a/lib/apis/auth_api/models/json_rpc_models.dart +++ b/lib/apis/auth_api/models/json_rpc_models.dart @@ -1,35 +1,29 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/auth_api/models/auth_client_models.dart'; import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart'; part 'json_rpc_models.g.dart'; +part 'json_rpc_models.freezed.dart'; -@JsonSerializable() -class WcAuthRequestRequest { - final AuthPayloadParams payloadParams; - final ConnectionMetadata requester; - - WcAuthRequestRequest({ - required this.payloadParams, - required this.requester, - }); +@freezed +class WcAuthRequestRequest with _$WcAuthRequestRequest { + @JsonSerializable() + const factory WcAuthRequestRequest({ + required AuthPayloadParams payloadParams, + required ConnectionMetadata requester, + }) = _WcAuthRequestRequest; factory WcAuthRequestRequest.fromJson(Map json) => _$WcAuthRequestRequestFromJson(json); - - Map toJson() => _$WcAuthRequestRequestToJson(this); } -@JsonSerializable() -class WcAuthRequestResult { - final Cacao cacao; - - WcAuthRequestResult({ - required this.cacao, - }); +@freezed +class WcAuthRequestResult with _$WcAuthRequestResult { + @JsonSerializable() + const factory WcAuthRequestResult({ + required Cacao cacao, + }) = _WcAuthRequestResult; factory WcAuthRequestResult.fromJson(Map json) => _$WcAuthRequestResultFromJson(json); - - Map toJson() => _$WcAuthRequestResultToJson(this); } diff --git a/lib/apis/auth_api/models/json_rpc_models.freezed.dart b/lib/apis/auth_api/models/json_rpc_models.freezed.dart new file mode 100644 index 00000000..ec9e04a9 --- /dev/null +++ b/lib/apis/auth_api/models/json_rpc_models.freezed.dart @@ -0,0 +1,351 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'json_rpc_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +WcAuthRequestRequest _$WcAuthRequestRequestFromJson(Map json) { + return _WcAuthRequestRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcAuthRequestRequest { + AuthPayloadParams get payloadParams => throw _privateConstructorUsedError; + ConnectionMetadata get requester => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcAuthRequestRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcAuthRequestRequestCopyWith<$Res> { + factory $WcAuthRequestRequestCopyWith(WcAuthRequestRequest value, + $Res Function(WcAuthRequestRequest) then) = + _$WcAuthRequestRequestCopyWithImpl<$Res, WcAuthRequestRequest>; + @useResult + $Res call({AuthPayloadParams payloadParams, ConnectionMetadata requester}); + + $AuthPayloadParamsCopyWith<$Res> get payloadParams; + $ConnectionMetadataCopyWith<$Res> get requester; +} + +/// @nodoc +class _$WcAuthRequestRequestCopyWithImpl<$Res, + $Val extends WcAuthRequestRequest> + implements $WcAuthRequestRequestCopyWith<$Res> { + _$WcAuthRequestRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? payloadParams = null, + Object? requester = null, + }) { + return _then(_value.copyWith( + payloadParams: null == payloadParams + ? _value.payloadParams + : payloadParams // ignore: cast_nullable_to_non_nullable + as AuthPayloadParams, + requester: null == requester + ? _value.requester + : requester // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $AuthPayloadParamsCopyWith<$Res> get payloadParams { + return $AuthPayloadParamsCopyWith<$Res>(_value.payloadParams, (value) { + return _then(_value.copyWith(payloadParams: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get requester { + return $ConnectionMetadataCopyWith<$Res>(_value.requester, (value) { + return _then(_value.copyWith(requester: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_WcAuthRequestRequestCopyWith<$Res> + implements $WcAuthRequestRequestCopyWith<$Res> { + factory _$$_WcAuthRequestRequestCopyWith(_$_WcAuthRequestRequest value, + $Res Function(_$_WcAuthRequestRequest) then) = + __$$_WcAuthRequestRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({AuthPayloadParams payloadParams, ConnectionMetadata requester}); + + @override + $AuthPayloadParamsCopyWith<$Res> get payloadParams; + @override + $ConnectionMetadataCopyWith<$Res> get requester; +} + +/// @nodoc +class __$$_WcAuthRequestRequestCopyWithImpl<$Res> + extends _$WcAuthRequestRequestCopyWithImpl<$Res, _$_WcAuthRequestRequest> + implements _$$_WcAuthRequestRequestCopyWith<$Res> { + __$$_WcAuthRequestRequestCopyWithImpl(_$_WcAuthRequestRequest _value, + $Res Function(_$_WcAuthRequestRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? payloadParams = null, + Object? requester = null, + }) { + return _then(_$_WcAuthRequestRequest( + payloadParams: null == payloadParams + ? _value.payloadParams + : payloadParams // ignore: cast_nullable_to_non_nullable + as AuthPayloadParams, + requester: null == requester + ? _value.requester + : requester // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcAuthRequestRequest implements _WcAuthRequestRequest { + const _$_WcAuthRequestRequest( + {required this.payloadParams, required this.requester}); + + factory _$_WcAuthRequestRequest.fromJson(Map json) => + _$$_WcAuthRequestRequestFromJson(json); + + @override + final AuthPayloadParams payloadParams; + @override + final ConnectionMetadata requester; + + @override + String toString() { + return 'WcAuthRequestRequest(payloadParams: $payloadParams, requester: $requester)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcAuthRequestRequest && + (identical(other.payloadParams, payloadParams) || + other.payloadParams == payloadParams) && + (identical(other.requester, requester) || + other.requester == requester)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, payloadParams, requester); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcAuthRequestRequestCopyWith<_$_WcAuthRequestRequest> get copyWith => + __$$_WcAuthRequestRequestCopyWithImpl<_$_WcAuthRequestRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcAuthRequestRequestToJson( + this, + ); + } +} + +abstract class _WcAuthRequestRequest implements WcAuthRequestRequest { + const factory _WcAuthRequestRequest( + {required final AuthPayloadParams payloadParams, + required final ConnectionMetadata requester}) = _$_WcAuthRequestRequest; + + factory _WcAuthRequestRequest.fromJson(Map json) = + _$_WcAuthRequestRequest.fromJson; + + @override + AuthPayloadParams get payloadParams; + @override + ConnectionMetadata get requester; + @override + @JsonKey(ignore: true) + _$$_WcAuthRequestRequestCopyWith<_$_WcAuthRequestRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcAuthRequestResult _$WcAuthRequestResultFromJson(Map json) { + return _WcAuthRequestResult.fromJson(json); +} + +/// @nodoc +mixin _$WcAuthRequestResult { + Cacao get cacao => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcAuthRequestResultCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcAuthRequestResultCopyWith<$Res> { + factory $WcAuthRequestResultCopyWith( + WcAuthRequestResult value, $Res Function(WcAuthRequestResult) then) = + _$WcAuthRequestResultCopyWithImpl<$Res, WcAuthRequestResult>; + @useResult + $Res call({Cacao cacao}); + + $CacaoCopyWith<$Res> get cacao; +} + +/// @nodoc +class _$WcAuthRequestResultCopyWithImpl<$Res, $Val extends WcAuthRequestResult> + implements $WcAuthRequestResultCopyWith<$Res> { + _$WcAuthRequestResultCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cacao = null, + }) { + return _then(_value.copyWith( + cacao: null == cacao + ? _value.cacao + : cacao // ignore: cast_nullable_to_non_nullable + as Cacao, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $CacaoCopyWith<$Res> get cacao { + return $CacaoCopyWith<$Res>(_value.cacao, (value) { + return _then(_value.copyWith(cacao: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_WcAuthRequestResultCopyWith<$Res> + implements $WcAuthRequestResultCopyWith<$Res> { + factory _$$_WcAuthRequestResultCopyWith(_$_WcAuthRequestResult value, + $Res Function(_$_WcAuthRequestResult) then) = + __$$_WcAuthRequestResultCopyWithImpl<$Res>; + @override + @useResult + $Res call({Cacao cacao}); + + @override + $CacaoCopyWith<$Res> get cacao; +} + +/// @nodoc +class __$$_WcAuthRequestResultCopyWithImpl<$Res> + extends _$WcAuthRequestResultCopyWithImpl<$Res, _$_WcAuthRequestResult> + implements _$$_WcAuthRequestResultCopyWith<$Res> { + __$$_WcAuthRequestResultCopyWithImpl(_$_WcAuthRequestResult _value, + $Res Function(_$_WcAuthRequestResult) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cacao = null, + }) { + return _then(_$_WcAuthRequestResult( + cacao: null == cacao + ? _value.cacao + : cacao // ignore: cast_nullable_to_non_nullable + as Cacao, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcAuthRequestResult implements _WcAuthRequestResult { + const _$_WcAuthRequestResult({required this.cacao}); + + factory _$_WcAuthRequestResult.fromJson(Map json) => + _$$_WcAuthRequestResultFromJson(json); + + @override + final Cacao cacao; + + @override + String toString() { + return 'WcAuthRequestResult(cacao: $cacao)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcAuthRequestResult && + (identical(other.cacao, cacao) || other.cacao == cacao)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, cacao); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcAuthRequestResultCopyWith<_$_WcAuthRequestResult> get copyWith => + __$$_WcAuthRequestResultCopyWithImpl<_$_WcAuthRequestResult>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcAuthRequestResultToJson( + this, + ); + } +} + +abstract class _WcAuthRequestResult implements WcAuthRequestResult { + const factory _WcAuthRequestResult({required final Cacao cacao}) = + _$_WcAuthRequestResult; + + factory _WcAuthRequestResult.fromJson(Map json) = + _$_WcAuthRequestResult.fromJson; + + @override + Cacao get cacao; + @override + @JsonKey(ignore: true) + _$$_WcAuthRequestResultCopyWith<_$_WcAuthRequestResult> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/auth_api/models/json_rpc_models.g.dart b/lib/apis/auth_api/models/json_rpc_models.g.dart index 007f3acd..a1638027 100644 --- a/lib/apis/auth_api/models/json_rpc_models.g.dart +++ b/lib/apis/auth_api/models/json_rpc_models.g.dart @@ -6,29 +6,30 @@ part of 'json_rpc_models.dart'; // JsonSerializableGenerator // ************************************************************************** -WcAuthRequestRequest _$WcAuthRequestRequestFromJson( +_$_WcAuthRequestRequest _$$_WcAuthRequestRequestFromJson( Map json) => - WcAuthRequestRequest( + _$_WcAuthRequestRequest( payloadParams: AuthPayloadParams.fromJson( json['payloadParams'] as Map), requester: ConnectionMetadata.fromJson( json['requester'] as Map), ); -Map _$WcAuthRequestRequestToJson( - WcAuthRequestRequest instance) => +Map _$$_WcAuthRequestRequestToJson( + _$_WcAuthRequestRequest instance) => { 'payloadParams': instance.payloadParams.toJson(), 'requester': instance.requester.toJson(), }; -WcAuthRequestResult _$WcAuthRequestResultFromJson(Map json) => - WcAuthRequestResult( +_$_WcAuthRequestResult _$$_WcAuthRequestResultFromJson( + Map json) => + _$_WcAuthRequestResult( cacao: Cacao.fromJson(json['cacao'] as Map), ); -Map _$WcAuthRequestResultToJson( - WcAuthRequestResult instance) => +Map _$$_WcAuthRequestResultToJson( + _$_WcAuthRequestResult instance) => { 'cacao': instance.cacao.toJson(), }; diff --git a/lib/apis/core/echo/models/echo_response.g.dart b/lib/apis/core/echo/models/echo_response.g.dart index aae0c23f..d5ba1692 100644 --- a/lib/apis/core/echo/models/echo_response.g.dart +++ b/lib/apis/core/echo/models/echo_response.g.dart @@ -18,8 +18,8 @@ EchoResponse _$EchoResponseFromJson(Map json) => EchoResponse( Map _$EchoResponseToJson(EchoResponse instance) => { - 'errors': instance.errors, - 'fields': instance.fields, + 'errors': instance.errors?.map((e) => e.toJson()).toList(), + 'fields': instance.fields?.map((e) => e.toJson()).toList(), 'status': instance.status, }; diff --git a/lib/apis/core/pairing/json_rpc_history.dart b/lib/apis/core/pairing/json_rpc_history.dart index fbd46d89..0544a8b5 100644 --- a/lib/apis/core/pairing/json_rpc_history.dart +++ b/lib/apis/core/pairing/json_rpc_history.dart @@ -28,8 +28,11 @@ class JsonRpcHistory extends GenericStore return; } - record.response = - response.containsKey('result') ? response['result'] : response['error']; + record = record.copyWith( + response: response.containsKey('result') + ? response['result'] + : response['error'], + ); await set(sId, record); } } diff --git a/lib/apis/core/pairing/pairing.dart b/lib/apis/core/pairing/pairing.dart index 5e434263..21c0e6c9 100644 --- a/lib/apis/core/pairing/pairing.dart +++ b/lib/apis/core/pairing/pairing.dart @@ -639,6 +639,7 @@ class Pairing implements IPairing { // print(payloadString); Map data = jsonDecode(payloadString); + core.logger.i('Pairing _onMessageEvent, Received data: $data'); // If it's an rpc request, handle it // print('Pairing: Received data: $data'); diff --git a/lib/apis/core/pairing/pairing_store.dart b/lib/apis/core/pairing/pairing_store.dart index 8c850266..f288d609 100644 --- a/lib/apis/core/pairing/pairing_store.dart +++ b/lib/apis/core/pairing/pairing_store.dart @@ -23,31 +23,17 @@ class PairingStore extends GenericStore implements IPairingStore { if (info == null) { return; } - // int prevExpiry = info.expiry; - // bool wasActive = info.active; if (expiry != null) { - info.expiry = expiry; + info = info.copyWith(expiry: expiry); } if (active != null) { - info.active = active; + info = info.copyWith(active: active); } if (metadata != null) { - info.peerMetadata = metadata; + info = info.copyWith(peerMetadata: metadata); } - // onUpdate.broadcast( - // StoreUpdateEvent( - // topic, - // info, - // ), - // ); - - // print('Previous expiry: $prevExpiry, new expiry: ${info.expiry}'); - // print('Previous active: $wasActive, new active: ${info.active}'); await set(topic, info); - - // print('Saved PairingInfo'); - // print(get(topic)); } } diff --git a/lib/apis/core/pairing/utils/pairing_models.dart b/lib/apis/core/pairing/utils/pairing_models.dart index 79ab3ba4..64cc019d 100644 --- a/lib/apis/core/pairing/utils/pairing_models.dart +++ b/lib/apis/core/pairing/utils/pairing_models.dart @@ -1,10 +1,12 @@ import 'package:event/event.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client_models.dart'; import 'package:walletconnect_flutter_v2/apis/models/json_rpc_error.dart'; import 'package:walletconnect_flutter_v2/apis/models/json_rpc_request.dart'; part 'pairing_models.g.dart'; +part 'pairing_models.freezed.dart'; enum ProtocolType { pair, @@ -12,49 +14,31 @@ enum ProtocolType { auth, } -@JsonSerializable() -class PairingInfo { - String topic; - // Value in seconds - int expiry; - Relay relay; - bool active; - PairingMetadata? peerMetadata; - - PairingInfo({ - required this.topic, - required this.expiry, - required this.relay, - required this.active, - this.peerMetadata, - }); +@freezed +class PairingInfo with _$PairingInfo { + @JsonSerializable() + const factory PairingInfo({ + required String topic, + required int expiry, + required Relay relay, + required bool active, + PairingMetadata? peerMetadata, + }) = _PairingInfo; factory PairingInfo.fromJson(Map json) => _$PairingInfoFromJson(json); - - Map toJson() => _$PairingInfoToJson(this); - - @override - String toString() { - return 'PairingInfo(topic: $topic, expiry: $expiry, relay: $relay, active: $active, peerMetadata: $peerMetadata)'; - } } -@JsonSerializable() -class PairingMetadata { - final String name; - final String description; - final String url; - final List icons; - final Redirect? redirect; - - const PairingMetadata({ - required this.name, - required this.description, - required this.url, - required this.icons, - this.redirect, - }); +@freezed +class PairingMetadata with _$PairingMetadata { + @JsonSerializable(includeIfNull: false) + const factory PairingMetadata({ + required String name, + required String description, + required String url, + required List icons, + Redirect? redirect, + }) = _PairingMetadata; factory PairingMetadata.empty() => const PairingMetadata( name: '', @@ -65,60 +49,18 @@ class PairingMetadata { factory PairingMetadata.fromJson(Map json) => _$PairingMetadataFromJson(json); - - Map toJson() => _$PairingMetadataToJson(this); - - @override - String toString() { - return 'PairingMetadata(name: $name, description: $description, url: $url, icons: $icons, redirect: $redirect)'; - } - - @override - bool operator ==(Object other) { - return other is PairingMetadata && hashCode == other.hashCode; - } - - @override - int get hashCode => - name.hashCode + - description.hashCode + - url.hashCode + - icons.fold( - 0, - (prevValue, element) => prevValue + element.hashCode, - ) + - (redirect == null ? 1 : redirect.hashCode); } -@JsonSerializable() -class Redirect { - final String? native; - final String? universal; - - Redirect({ - this.native, - this.universal, - }); +@freezed +class Redirect with _$Redirect { + @JsonSerializable() + const factory Redirect({ + String? native, + String? universal, + }) = _Redirect; factory Redirect.fromJson(Map json) => _$RedirectFromJson(json); - - Map toJson() => _$RedirectToJson(this); - - @override - String toString() { - return 'Redirect(native: $native, universal: $universal)'; - } - - @override - bool operator ==(Object other) { - return other is Redirect && hashCode == other.hashCode; - } - - @override - int get hashCode => - (native == null ? 1 : native!.hashCode) + - (universal == null ? 1 : universal!.hashCode); } class CreateResponse { @@ -209,57 +151,34 @@ class PairingActivateEvent extends EventArgs { } } -@JsonSerializable(includeIfNull: false) -class JsonRpcRecord { - int id; - String topic; - String method; - dynamic params; - dynamic response; - String? chainId; - int? expiry; - - JsonRpcRecord({ - required this.id, - required this.topic, - required this.method, - required this.params, - this.chainId, - this.expiry, - }); +@freezed +class JsonRpcRecord with _$JsonRpcRecord { + @JsonSerializable(includeIfNull: false) + const factory JsonRpcRecord({ + required int id, + required String topic, + required String method, + required dynamic params, + String? chainId, + int? expiry, + dynamic response, + }) = _JsonRpcRecord; factory JsonRpcRecord.fromJson(Map json) => _$JsonRpcRecordFromJson(json); - - Map toJson() => _$JsonRpcRecordToJson(this); - - @override - String toString() { - return 'JsonRpcRecord(id: $id, topic: $topic, method: $method, params: $params, response: $response, chainId: $chainId, expiry: $expiry)'; - } } -@JsonSerializable(includeIfNull: false) -class ReceiverPublicKey { - String topic; - String publicKey; - int expiry; - - ReceiverPublicKey({ - required this.topic, - required this.publicKey, - required this.expiry, - }); +@freezed +class ReceiverPublicKey with _$ReceiverPublicKey { + @JsonSerializable(includeIfNull: false) + const factory ReceiverPublicKey({ + required String topic, + required String publicKey, + required int expiry, + }) = _ReceiverPublicKey; factory ReceiverPublicKey.fromJson(Map json) => _$ReceiverPublicKeyFromJson(json); - - Map toJson() => _$ReceiverPublicKeyToJson(this); - - @override - String toString() { - return 'Receiver(topic: $topic, publicKey: $publicKey, expiry: $expiry)'; - } } class RegisteredFunction { diff --git a/lib/apis/core/pairing/utils/pairing_models.freezed.dart b/lib/apis/core/pairing/utils/pairing_models.freezed.dart new file mode 100644 index 00000000..4a9e590b --- /dev/null +++ b/lib/apis/core/pairing/utils/pairing_models.freezed.dart @@ -0,0 +1,1099 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'pairing_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +PairingInfo _$PairingInfoFromJson(Map json) { + return _PairingInfo.fromJson(json); +} + +/// @nodoc +mixin _$PairingInfo { + String get topic => throw _privateConstructorUsedError; + int get expiry => throw _privateConstructorUsedError; + Relay get relay => throw _privateConstructorUsedError; + bool get active => throw _privateConstructorUsedError; + PairingMetadata? get peerMetadata => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PairingInfoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PairingInfoCopyWith<$Res> { + factory $PairingInfoCopyWith( + PairingInfo value, $Res Function(PairingInfo) then) = + _$PairingInfoCopyWithImpl<$Res, PairingInfo>; + @useResult + $Res call( + {String topic, + int expiry, + Relay relay, + bool active, + PairingMetadata? peerMetadata}); + + $PairingMetadataCopyWith<$Res>? get peerMetadata; +} + +/// @nodoc +class _$PairingInfoCopyWithImpl<$Res, $Val extends PairingInfo> + implements $PairingInfoCopyWith<$Res> { + _$PairingInfoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topic = null, + Object? expiry = null, + Object? relay = null, + Object? active = null, + Object? peerMetadata = freezed, + }) { + return _then(_value.copyWith( + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + active: null == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool, + peerMetadata: freezed == peerMetadata + ? _value.peerMetadata + : peerMetadata // ignore: cast_nullable_to_non_nullable + as PairingMetadata?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PairingMetadataCopyWith<$Res>? get peerMetadata { + if (_value.peerMetadata == null) { + return null; + } + + return $PairingMetadataCopyWith<$Res>(_value.peerMetadata!, (value) { + return _then(_value.copyWith(peerMetadata: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_PairingInfoCopyWith<$Res> + implements $PairingInfoCopyWith<$Res> { + factory _$$_PairingInfoCopyWith( + _$_PairingInfo value, $Res Function(_$_PairingInfo) then) = + __$$_PairingInfoCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String topic, + int expiry, + Relay relay, + bool active, + PairingMetadata? peerMetadata}); + + @override + $PairingMetadataCopyWith<$Res>? get peerMetadata; +} + +/// @nodoc +class __$$_PairingInfoCopyWithImpl<$Res> + extends _$PairingInfoCopyWithImpl<$Res, _$_PairingInfo> + implements _$$_PairingInfoCopyWith<$Res> { + __$$_PairingInfoCopyWithImpl( + _$_PairingInfo _value, $Res Function(_$_PairingInfo) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topic = null, + Object? expiry = null, + Object? relay = null, + Object? active = null, + Object? peerMetadata = freezed, + }) { + return _then(_$_PairingInfo( + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + active: null == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool, + peerMetadata: freezed == peerMetadata + ? _value.peerMetadata + : peerMetadata // ignore: cast_nullable_to_non_nullable + as PairingMetadata?, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_PairingInfo implements _PairingInfo { + const _$_PairingInfo( + {required this.topic, + required this.expiry, + required this.relay, + required this.active, + this.peerMetadata}); + + factory _$_PairingInfo.fromJson(Map json) => + _$$_PairingInfoFromJson(json); + + @override + final String topic; + @override + final int expiry; + @override + final Relay relay; + @override + final bool active; + @override + final PairingMetadata? peerMetadata; + + @override + String toString() { + return 'PairingInfo(topic: $topic, expiry: $expiry, relay: $relay, active: $active, peerMetadata: $peerMetadata)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_PairingInfo && + (identical(other.topic, topic) || other.topic == topic) && + (identical(other.expiry, expiry) || other.expiry == expiry) && + (identical(other.relay, relay) || other.relay == relay) && + (identical(other.active, active) || other.active == active) && + (identical(other.peerMetadata, peerMetadata) || + other.peerMetadata == peerMetadata)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, topic, expiry, relay, active, peerMetadata); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_PairingInfoCopyWith<_$_PairingInfo> get copyWith => + __$$_PairingInfoCopyWithImpl<_$_PairingInfo>(this, _$identity); + + @override + Map toJson() { + return _$$_PairingInfoToJson( + this, + ); + } +} + +abstract class _PairingInfo implements PairingInfo { + const factory _PairingInfo( + {required final String topic, + required final int expiry, + required final Relay relay, + required final bool active, + final PairingMetadata? peerMetadata}) = _$_PairingInfo; + + factory _PairingInfo.fromJson(Map json) = + _$_PairingInfo.fromJson; + + @override + String get topic; + @override + int get expiry; + @override + Relay get relay; + @override + bool get active; + @override + PairingMetadata? get peerMetadata; + @override + @JsonKey(ignore: true) + _$$_PairingInfoCopyWith<_$_PairingInfo> get copyWith => + throw _privateConstructorUsedError; +} + +PairingMetadata _$PairingMetadataFromJson(Map json) { + return _PairingMetadata.fromJson(json); +} + +/// @nodoc +mixin _$PairingMetadata { + String get name => throw _privateConstructorUsedError; + String get description => throw _privateConstructorUsedError; + String get url => throw _privateConstructorUsedError; + List get icons => throw _privateConstructorUsedError; + Redirect? get redirect => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PairingMetadataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PairingMetadataCopyWith<$Res> { + factory $PairingMetadataCopyWith( + PairingMetadata value, $Res Function(PairingMetadata) then) = + _$PairingMetadataCopyWithImpl<$Res, PairingMetadata>; + @useResult + $Res call( + {String name, + String description, + String url, + List icons, + Redirect? redirect}); + + $RedirectCopyWith<$Res>? get redirect; +} + +/// @nodoc +class _$PairingMetadataCopyWithImpl<$Res, $Val extends PairingMetadata> + implements $PairingMetadataCopyWith<$Res> { + _$PairingMetadataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? description = null, + Object? url = null, + Object? icons = null, + Object? redirect = freezed, + }) { + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + url: null == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String, + icons: null == icons + ? _value.icons + : icons // ignore: cast_nullable_to_non_nullable + as List, + redirect: freezed == redirect + ? _value.redirect + : redirect // ignore: cast_nullable_to_non_nullable + as Redirect?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $RedirectCopyWith<$Res>? get redirect { + if (_value.redirect == null) { + return null; + } + + return $RedirectCopyWith<$Res>(_value.redirect!, (value) { + return _then(_value.copyWith(redirect: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_PairingMetadataCopyWith<$Res> + implements $PairingMetadataCopyWith<$Res> { + factory _$$_PairingMetadataCopyWith( + _$_PairingMetadata value, $Res Function(_$_PairingMetadata) then) = + __$$_PairingMetadataCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String name, + String description, + String url, + List icons, + Redirect? redirect}); + + @override + $RedirectCopyWith<$Res>? get redirect; +} + +/// @nodoc +class __$$_PairingMetadataCopyWithImpl<$Res> + extends _$PairingMetadataCopyWithImpl<$Res, _$_PairingMetadata> + implements _$$_PairingMetadataCopyWith<$Res> { + __$$_PairingMetadataCopyWithImpl( + _$_PairingMetadata _value, $Res Function(_$_PairingMetadata) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? description = null, + Object? url = null, + Object? icons = null, + Object? redirect = freezed, + }) { + return _then(_$_PairingMetadata( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + url: null == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String, + icons: null == icons + ? _value._icons + : icons // ignore: cast_nullable_to_non_nullable + as List, + redirect: freezed == redirect + ? _value.redirect + : redirect // ignore: cast_nullable_to_non_nullable + as Redirect?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_PairingMetadata implements _PairingMetadata { + const _$_PairingMetadata( + {required this.name, + required this.description, + required this.url, + required final List icons, + this.redirect}) + : _icons = icons; + + factory _$_PairingMetadata.fromJson(Map json) => + _$$_PairingMetadataFromJson(json); + + @override + final String name; + @override + final String description; + @override + final String url; + final List _icons; + @override + List get icons { + if (_icons is EqualUnmodifiableListView) return _icons; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_icons); + } + + @override + final Redirect? redirect; + + @override + String toString() { + return 'PairingMetadata(name: $name, description: $description, url: $url, icons: $icons, redirect: $redirect)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_PairingMetadata && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.url, url) || other.url == url) && + const DeepCollectionEquality().equals(other._icons, _icons) && + (identical(other.redirect, redirect) || + other.redirect == redirect)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, name, description, url, + const DeepCollectionEquality().hash(_icons), redirect); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_PairingMetadataCopyWith<_$_PairingMetadata> get copyWith => + __$$_PairingMetadataCopyWithImpl<_$_PairingMetadata>(this, _$identity); + + @override + Map toJson() { + return _$$_PairingMetadataToJson( + this, + ); + } +} + +abstract class _PairingMetadata implements PairingMetadata { + const factory _PairingMetadata( + {required final String name, + required final String description, + required final String url, + required final List icons, + final Redirect? redirect}) = _$_PairingMetadata; + + factory _PairingMetadata.fromJson(Map json) = + _$_PairingMetadata.fromJson; + + @override + String get name; + @override + String get description; + @override + String get url; + @override + List get icons; + @override + Redirect? get redirect; + @override + @JsonKey(ignore: true) + _$$_PairingMetadataCopyWith<_$_PairingMetadata> get copyWith => + throw _privateConstructorUsedError; +} + +Redirect _$RedirectFromJson(Map json) { + return _Redirect.fromJson(json); +} + +/// @nodoc +mixin _$Redirect { + String? get native => throw _privateConstructorUsedError; + String? get universal => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $RedirectCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RedirectCopyWith<$Res> { + factory $RedirectCopyWith(Redirect value, $Res Function(Redirect) then) = + _$RedirectCopyWithImpl<$Res, Redirect>; + @useResult + $Res call({String? native, String? universal}); +} + +/// @nodoc +class _$RedirectCopyWithImpl<$Res, $Val extends Redirect> + implements $RedirectCopyWith<$Res> { + _$RedirectCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? native = freezed, + Object? universal = freezed, + }) { + return _then(_value.copyWith( + native: freezed == native + ? _value.native + : native // ignore: cast_nullable_to_non_nullable + as String?, + universal: freezed == universal + ? _value.universal + : universal // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_RedirectCopyWith<$Res> implements $RedirectCopyWith<$Res> { + factory _$$_RedirectCopyWith( + _$_Redirect value, $Res Function(_$_Redirect) then) = + __$$_RedirectCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? native, String? universal}); +} + +/// @nodoc +class __$$_RedirectCopyWithImpl<$Res> + extends _$RedirectCopyWithImpl<$Res, _$_Redirect> + implements _$$_RedirectCopyWith<$Res> { + __$$_RedirectCopyWithImpl( + _$_Redirect _value, $Res Function(_$_Redirect) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? native = freezed, + Object? universal = freezed, + }) { + return _then(_$_Redirect( + native: freezed == native + ? _value.native + : native // ignore: cast_nullable_to_non_nullable + as String?, + universal: freezed == universal + ? _value.universal + : universal // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_Redirect implements _Redirect { + const _$_Redirect({this.native, this.universal}); + + factory _$_Redirect.fromJson(Map json) => + _$$_RedirectFromJson(json); + + @override + final String? native; + @override + final String? universal; + + @override + String toString() { + return 'Redirect(native: $native, universal: $universal)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_Redirect && + (identical(other.native, native) || other.native == native) && + (identical(other.universal, universal) || + other.universal == universal)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, native, universal); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_RedirectCopyWith<_$_Redirect> get copyWith => + __$$_RedirectCopyWithImpl<_$_Redirect>(this, _$identity); + + @override + Map toJson() { + return _$$_RedirectToJson( + this, + ); + } +} + +abstract class _Redirect implements Redirect { + const factory _Redirect({final String? native, final String? universal}) = + _$_Redirect; + + factory _Redirect.fromJson(Map json) = _$_Redirect.fromJson; + + @override + String? get native; + @override + String? get universal; + @override + @JsonKey(ignore: true) + _$$_RedirectCopyWith<_$_Redirect> get copyWith => + throw _privateConstructorUsedError; +} + +JsonRpcRecord _$JsonRpcRecordFromJson(Map json) { + return _JsonRpcRecord.fromJson(json); +} + +/// @nodoc +mixin _$JsonRpcRecord { + int get id => throw _privateConstructorUsedError; + String get topic => throw _privateConstructorUsedError; + String get method => throw _privateConstructorUsedError; + dynamic get params => throw _privateConstructorUsedError; + String? get chainId => throw _privateConstructorUsedError; + int? get expiry => throw _privateConstructorUsedError; + dynamic get response => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $JsonRpcRecordCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $JsonRpcRecordCopyWith<$Res> { + factory $JsonRpcRecordCopyWith( + JsonRpcRecord value, $Res Function(JsonRpcRecord) then) = + _$JsonRpcRecordCopyWithImpl<$Res, JsonRpcRecord>; + @useResult + $Res call( + {int id, + String topic, + String method, + dynamic params, + String? chainId, + int? expiry, + dynamic response}); +} + +/// @nodoc +class _$JsonRpcRecordCopyWithImpl<$Res, $Val extends JsonRpcRecord> + implements $JsonRpcRecordCopyWith<$Res> { + _$JsonRpcRecordCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? topic = null, + Object? method = null, + Object? params = freezed, + Object? chainId = freezed, + Object? expiry = freezed, + Object? response = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + chainId: freezed == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String?, + expiry: freezed == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int?, + response: freezed == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_JsonRpcRecordCopyWith<$Res> + implements $JsonRpcRecordCopyWith<$Res> { + factory _$$_JsonRpcRecordCopyWith( + _$_JsonRpcRecord value, $Res Function(_$_JsonRpcRecord) then) = + __$$_JsonRpcRecordCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + String topic, + String method, + dynamic params, + String? chainId, + int? expiry, + dynamic response}); +} + +/// @nodoc +class __$$_JsonRpcRecordCopyWithImpl<$Res> + extends _$JsonRpcRecordCopyWithImpl<$Res, _$_JsonRpcRecord> + implements _$$_JsonRpcRecordCopyWith<$Res> { + __$$_JsonRpcRecordCopyWithImpl( + _$_JsonRpcRecord _value, $Res Function(_$_JsonRpcRecord) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? topic = null, + Object? method = null, + Object? params = freezed, + Object? chainId = freezed, + Object? expiry = freezed, + Object? response = freezed, + }) { + return _then(_$_JsonRpcRecord( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + chainId: freezed == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String?, + expiry: freezed == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int?, + response: freezed == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as dynamic, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_JsonRpcRecord implements _JsonRpcRecord { + const _$_JsonRpcRecord( + {required this.id, + required this.topic, + required this.method, + required this.params, + this.chainId, + this.expiry, + this.response}); + + factory _$_JsonRpcRecord.fromJson(Map json) => + _$$_JsonRpcRecordFromJson(json); + + @override + final int id; + @override + final String topic; + @override + final String method; + @override + final dynamic params; + @override + final String? chainId; + @override + final int? expiry; + @override + final dynamic response; + + @override + String toString() { + return 'JsonRpcRecord(id: $id, topic: $topic, method: $method, params: $params, chainId: $chainId, expiry: $expiry, response: $response)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_JsonRpcRecord && + (identical(other.id, id) || other.id == id) && + (identical(other.topic, topic) || other.topic == topic) && + (identical(other.method, method) || other.method == method) && + const DeepCollectionEquality().equals(other.params, params) && + (identical(other.chainId, chainId) || other.chainId == chainId) && + (identical(other.expiry, expiry) || other.expiry == expiry) && + const DeepCollectionEquality().equals(other.response, response)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + id, + topic, + method, + const DeepCollectionEquality().hash(params), + chainId, + expiry, + const DeepCollectionEquality().hash(response)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_JsonRpcRecordCopyWith<_$_JsonRpcRecord> get copyWith => + __$$_JsonRpcRecordCopyWithImpl<_$_JsonRpcRecord>(this, _$identity); + + @override + Map toJson() { + return _$$_JsonRpcRecordToJson( + this, + ); + } +} + +abstract class _JsonRpcRecord implements JsonRpcRecord { + const factory _JsonRpcRecord( + {required final int id, + required final String topic, + required final String method, + required final dynamic params, + final String? chainId, + final int? expiry, + final dynamic response}) = _$_JsonRpcRecord; + + factory _JsonRpcRecord.fromJson(Map json) = + _$_JsonRpcRecord.fromJson; + + @override + int get id; + @override + String get topic; + @override + String get method; + @override + dynamic get params; + @override + String? get chainId; + @override + int? get expiry; + @override + dynamic get response; + @override + @JsonKey(ignore: true) + _$$_JsonRpcRecordCopyWith<_$_JsonRpcRecord> get copyWith => + throw _privateConstructorUsedError; +} + +ReceiverPublicKey _$ReceiverPublicKeyFromJson(Map json) { + return _ReceiverPublicKey.fromJson(json); +} + +/// @nodoc +mixin _$ReceiverPublicKey { + String get topic => throw _privateConstructorUsedError; + String get publicKey => throw _privateConstructorUsedError; + int get expiry => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ReceiverPublicKeyCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ReceiverPublicKeyCopyWith<$Res> { + factory $ReceiverPublicKeyCopyWith( + ReceiverPublicKey value, $Res Function(ReceiverPublicKey) then) = + _$ReceiverPublicKeyCopyWithImpl<$Res, ReceiverPublicKey>; + @useResult + $Res call({String topic, String publicKey, int expiry}); +} + +/// @nodoc +class _$ReceiverPublicKeyCopyWithImpl<$Res, $Val extends ReceiverPublicKey> + implements $ReceiverPublicKeyCopyWith<$Res> { + _$ReceiverPublicKeyCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topic = null, + Object? publicKey = null, + Object? expiry = null, + }) { + return _then(_value.copyWith( + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + publicKey: null == publicKey + ? _value.publicKey + : publicKey // ignore: cast_nullable_to_non_nullable + as String, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_ReceiverPublicKeyCopyWith<$Res> + implements $ReceiverPublicKeyCopyWith<$Res> { + factory _$$_ReceiverPublicKeyCopyWith(_$_ReceiverPublicKey value, + $Res Function(_$_ReceiverPublicKey) then) = + __$$_ReceiverPublicKeyCopyWithImpl<$Res>; + @override + @useResult + $Res call({String topic, String publicKey, int expiry}); +} + +/// @nodoc +class __$$_ReceiverPublicKeyCopyWithImpl<$Res> + extends _$ReceiverPublicKeyCopyWithImpl<$Res, _$_ReceiverPublicKey> + implements _$$_ReceiverPublicKeyCopyWith<$Res> { + __$$_ReceiverPublicKeyCopyWithImpl( + _$_ReceiverPublicKey _value, $Res Function(_$_ReceiverPublicKey) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topic = null, + Object? publicKey = null, + Object? expiry = null, + }) { + return _then(_$_ReceiverPublicKey( + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + publicKey: null == publicKey + ? _value.publicKey + : publicKey // ignore: cast_nullable_to_non_nullable + as String, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_ReceiverPublicKey implements _ReceiverPublicKey { + const _$_ReceiverPublicKey( + {required this.topic, required this.publicKey, required this.expiry}); + + factory _$_ReceiverPublicKey.fromJson(Map json) => + _$$_ReceiverPublicKeyFromJson(json); + + @override + final String topic; + @override + final String publicKey; + @override + final int expiry; + + @override + String toString() { + return 'ReceiverPublicKey(topic: $topic, publicKey: $publicKey, expiry: $expiry)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_ReceiverPublicKey && + (identical(other.topic, topic) || other.topic == topic) && + (identical(other.publicKey, publicKey) || + other.publicKey == publicKey) && + (identical(other.expiry, expiry) || other.expiry == expiry)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, topic, publicKey, expiry); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_ReceiverPublicKeyCopyWith<_$_ReceiverPublicKey> get copyWith => + __$$_ReceiverPublicKeyCopyWithImpl<_$_ReceiverPublicKey>( + this, _$identity); + + @override + Map toJson() { + return _$$_ReceiverPublicKeyToJson( + this, + ); + } +} + +abstract class _ReceiverPublicKey implements ReceiverPublicKey { + const factory _ReceiverPublicKey( + {required final String topic, + required final String publicKey, + required final int expiry}) = _$_ReceiverPublicKey; + + factory _ReceiverPublicKey.fromJson(Map json) = + _$_ReceiverPublicKey.fromJson; + + @override + String get topic; + @override + String get publicKey; + @override + int get expiry; + @override + @JsonKey(ignore: true) + _$$_ReceiverPublicKeyCopyWith<_$_ReceiverPublicKey> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/core/pairing/utils/pairing_models.g.dart b/lib/apis/core/pairing/utils/pairing_models.g.dart index 15a0c9f0..faeb9314 100644 --- a/lib/apis/core/pairing/utils/pairing_models.g.dart +++ b/lib/apis/core/pairing/utils/pairing_models.g.dart @@ -6,7 +6,8 @@ part of 'pairing_models.dart'; // JsonSerializableGenerator // ************************************************************************** -PairingInfo _$PairingInfoFromJson(Map json) => PairingInfo( +_$_PairingInfo _$$_PairingInfoFromJson(Map json) => + _$_PairingInfo( topic: json['topic'] as String, expiry: json['expiry'] as int, relay: Relay.fromJson(json['relay'] as Map), @@ -17,7 +18,7 @@ PairingInfo _$PairingInfoFromJson(Map json) => PairingInfo( json['peerMetadata'] as Map), ); -Map _$PairingInfoToJson(PairingInfo instance) => +Map _$$_PairingInfoToJson(_$_PairingInfo instance) => { 'topic': instance.topic, 'expiry': instance.expiry, @@ -26,8 +27,8 @@ Map _$PairingInfoToJson(PairingInfo instance) => 'peerMetadata': instance.peerMetadata?.toJson(), }; -PairingMetadata _$PairingMetadataFromJson(Map json) => - PairingMetadata( +_$_PairingMetadata _$$_PairingMetadataFromJson(Map json) => + _$_PairingMetadata( name: json['name'] as String, description: json['description'] as String, url: json['url'] as String, @@ -37,36 +38,47 @@ PairingMetadata _$PairingMetadataFromJson(Map json) => : Redirect.fromJson(json['redirect'] as Map), ); -Map _$PairingMetadataToJson(PairingMetadata instance) => - { - 'name': instance.name, - 'description': instance.description, - 'url': instance.url, - 'icons': instance.icons, - 'redirect': instance.redirect?.toJson(), - }; +Map _$$_PairingMetadataToJson(_$_PairingMetadata instance) { + final val = { + 'name': instance.name, + 'description': instance.description, + 'url': instance.url, + 'icons': instance.icons, + }; -Redirect _$RedirectFromJson(Map json) => Redirect( + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('redirect', instance.redirect?.toJson()); + return val; +} + +_$_Redirect _$$_RedirectFromJson(Map json) => _$_Redirect( native: json['native'] as String?, universal: json['universal'] as String?, ); -Map _$RedirectToJson(Redirect instance) => { +Map _$$_RedirectToJson(_$_Redirect instance) => + { 'native': instance.native, 'universal': instance.universal, }; -JsonRpcRecord _$JsonRpcRecordFromJson(Map json) => - JsonRpcRecord( +_$_JsonRpcRecord _$$_JsonRpcRecordFromJson(Map json) => + _$_JsonRpcRecord( id: json['id'] as int, topic: json['topic'] as String, method: json['method'] as String, params: json['params'], chainId: json['chainId'] as String?, expiry: json['expiry'] as int?, - )..response = json['response']; + response: json['response'], + ); -Map _$JsonRpcRecordToJson(JsonRpcRecord instance) { +Map _$$_JsonRpcRecordToJson(_$_JsonRpcRecord instance) { final val = { 'id': instance.id, 'topic': instance.topic, @@ -80,20 +92,21 @@ Map _$JsonRpcRecordToJson(JsonRpcRecord instance) { } writeNotNull('params', instance.params); - writeNotNull('response', instance.response); writeNotNull('chainId', instance.chainId); writeNotNull('expiry', instance.expiry); + writeNotNull('response', instance.response); return val; } -ReceiverPublicKey _$ReceiverPublicKeyFromJson(Map json) => - ReceiverPublicKey( +_$_ReceiverPublicKey _$$_ReceiverPublicKeyFromJson(Map json) => + _$_ReceiverPublicKey( topic: json['topic'] as String, publicKey: json['publicKey'] as String, expiry: json['expiry'] as int, ); -Map _$ReceiverPublicKeyToJson(ReceiverPublicKey instance) => +Map _$$_ReceiverPublicKeyToJson( + _$_ReceiverPublicKey instance) => { 'topic': instance.topic, 'publicKey': instance.publicKey, diff --git a/lib/apis/core/relay_client/i_relay_client.dart b/lib/apis/core/relay_client/i_relay_client.dart index 0b43a38d..a7c38e5b 100644 --- a/lib/apis/core/relay_client/i_relay_client.dart +++ b/lib/apis/core/relay_client/i_relay_client.dart @@ -31,6 +31,9 @@ abstract class IRelayClient { abstract final Event onSubscriptionSync; abstract final Event onSubscriptionResubscribed; + /// Returns true if the client is connected to a relay server + bool get isConnected; + Future init(); Future publish({ required String topic, diff --git a/lib/apis/core/relay_client/relay_client.dart b/lib/apis/core/relay_client/relay_client.dart index 820ef72e..cada9d8c 100644 --- a/lib/apis/core/relay_client/relay_client.dart +++ b/lib/apis/core/relay_client/relay_client.dart @@ -54,6 +54,9 @@ class RelayClient implements IRelayClient { @override final Event onSubscriptionSync = Event(); + @override + bool get isConnected => jsonRPC != null && !jsonRPC!.isClosed; + bool _initialized = false; bool _active = true; bool _handledClose = false; @@ -169,7 +172,7 @@ class RelayClient implements IRelayClient { Future connect({String? relayUrl}) async { _checkInitialized(); - if (jsonRPC != null && !jsonRPC!.isClosed) { + if (isConnected) { return; } // print('connecting to relay server'); @@ -187,7 +190,9 @@ class RelayClient implements IRelayClient { Future disconnect() async { _checkInitialized(); - core.logger.v('Disconnecting from relay server'); + core.logger.v('RelayClient: Disconnecting from relay'); + + _active = false; await jsonRPC?.close(); jsonRPC = null; @@ -197,8 +202,6 @@ class RelayClient implements IRelayClient { _heartbeatTimer = null; onRelayClientDisconnect.broadcast(); - - _active = false; } /// PRIVATE FUNCTIONS /// @@ -314,10 +317,6 @@ class RelayClient implements IRelayClient { } } - Future _reconnect(EventArgs? args) async { - if (_initialized) {} - } - void _startHeartbeat() { _heartbeatTimer = Timer.periodic( Duration(seconds: heartbeatPeriod), diff --git a/lib/apis/models/basic_models.dart b/lib/apis/models/basic_models.dart index 347d7d79..59226eea 100644 --- a/lib/apis/models/basic_models.dart +++ b/lib/apis/models/basic_models.dart @@ -1,101 +1,44 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/core/pairing/utils/pairing_models.dart'; part 'basic_models.g.dart'; +part 'basic_models.freezed.dart'; /// ERRORS class WalletConnectErrorSilent {} -@JsonSerializable(includeIfNull: false) -class WalletConnectError { - int code; - String message; - String? data; - - WalletConnectError({ - required this.code, - required this.message, - this.data, - }); - - WalletConnectError copyWith({ - int? code, - String? message, +@freezed +class WalletConnectError with _$WalletConnectError { + // @JsonSerializable(includeIfNull: false) + const factory WalletConnectError({ + required int code, + required String message, String? data, - }) { - return WalletConnectError( - code: code ?? this.code, - message: message ?? this.message, - data: data ?? this.data, - ); - } + }) = _WalletConnectError; factory WalletConnectError.fromJson(Map json) => _$WalletConnectErrorFromJson(json); - - Map toJson() => _$WalletConnectErrorToJson(this); - - @override - String toString() { - return 'WalletConnectError(code: $code, message: $message, data: $data)'; - } } -class RpcOptions { - final int ttl; - final bool prompt; - final int tag; - - const RpcOptions( - this.ttl, - this.prompt, - this.tag, - ); - - RpcOptions copyWith({ - int? ttl, - bool? prompt, - int? tag, - }) { - return RpcOptions( - ttl ?? this.ttl, - prompt ?? this.prompt, - tag ?? this.tag, - ); - } - - @override - String toString() { - return 'RpcOptions(ttl: $ttl, prompt: $prompt, tag: $tag)'; - } +@freezed +class RpcOptions with _$RpcOptions { + // @JsonSerializable() + const factory RpcOptions({ + required int ttl, + required bool prompt, + required int tag, + }) = _RpcOptions; } -@JsonSerializable() -class ConnectionMetadata { - final String publicKey; - final PairingMetadata metadata; - - const ConnectionMetadata({ - required this.publicKey, - required this.metadata, - }); +@freezed +class ConnectionMetadata with _$ConnectionMetadata { + // @JsonSerializable() + const factory ConnectionMetadata({ + required String publicKey, + required PairingMetadata metadata, + }) = _ConnectionMetadata; factory ConnectionMetadata.fromJson(Map json) => _$ConnectionMetadataFromJson(json); - - Map toJson() => _$ConnectionMetadataToJson(this); - - @override - bool operator ==(Object other) { - return other is ConnectionMetadata && hashCode == other.hashCode; - } - - @override - int get hashCode => publicKey.hashCode + metadata.hashCode; - - @override - String toString() { - return 'ConnectionMetadata(publicKey: $publicKey, metadata: $metadata)'; - } } diff --git a/lib/apis/models/basic_models.freezed.dart b/lib/apis/models/basic_models.freezed.dart new file mode 100644 index 00000000..c845dea2 --- /dev/null +++ b/lib/apis/models/basic_models.freezed.dart @@ -0,0 +1,512 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'basic_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +WalletConnectError _$WalletConnectErrorFromJson(Map json) { + return _WalletConnectError.fromJson(json); +} + +/// @nodoc +mixin _$WalletConnectError { + int get code => throw _privateConstructorUsedError; + String get message => throw _privateConstructorUsedError; + String? get data => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WalletConnectErrorCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WalletConnectErrorCopyWith<$Res> { + factory $WalletConnectErrorCopyWith( + WalletConnectError value, $Res Function(WalletConnectError) then) = + _$WalletConnectErrorCopyWithImpl<$Res, WalletConnectError>; + @useResult + $Res call({int code, String message, String? data}); +} + +/// @nodoc +class _$WalletConnectErrorCopyWithImpl<$Res, $Val extends WalletConnectError> + implements $WalletConnectErrorCopyWith<$Res> { + _$WalletConnectErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = null, + Object? data = freezed, + }) { + return _then(_value.copyWith( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WalletConnectErrorCopyWith<$Res> + implements $WalletConnectErrorCopyWith<$Res> { + factory _$$_WalletConnectErrorCopyWith(_$_WalletConnectError value, + $Res Function(_$_WalletConnectError) then) = + __$$_WalletConnectErrorCopyWithImpl<$Res>; + @override + @useResult + $Res call({int code, String message, String? data}); +} + +/// @nodoc +class __$$_WalletConnectErrorCopyWithImpl<$Res> + extends _$WalletConnectErrorCopyWithImpl<$Res, _$_WalletConnectError> + implements _$$_WalletConnectErrorCopyWith<$Res> { + __$$_WalletConnectErrorCopyWithImpl( + _$_WalletConnectError _value, $Res Function(_$_WalletConnectError) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = null, + Object? data = freezed, + }) { + return _then(_$_WalletConnectError( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_WalletConnectError implements _WalletConnectError { + const _$_WalletConnectError( + {required this.code, required this.message, this.data}); + + factory _$_WalletConnectError.fromJson(Map json) => + _$$_WalletConnectErrorFromJson(json); + + @override + final int code; + @override + final String message; + @override + final String? data; + + @override + String toString() { + return 'WalletConnectError(code: $code, message: $message, data: $data)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WalletConnectError && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message) && + (identical(other.data, data) || other.data == data)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, code, message, data); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WalletConnectErrorCopyWith<_$_WalletConnectError> get copyWith => + __$$_WalletConnectErrorCopyWithImpl<_$_WalletConnectError>( + this, _$identity); + + @override + Map toJson() { + return _$$_WalletConnectErrorToJson( + this, + ); + } +} + +abstract class _WalletConnectError implements WalletConnectError { + const factory _WalletConnectError( + {required final int code, + required final String message, + final String? data}) = _$_WalletConnectError; + + factory _WalletConnectError.fromJson(Map json) = + _$_WalletConnectError.fromJson; + + @override + int get code; + @override + String get message; + @override + String? get data; + @override + @JsonKey(ignore: true) + _$$_WalletConnectErrorCopyWith<_$_WalletConnectError> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$RpcOptions { + int get ttl => throw _privateConstructorUsedError; + bool get prompt => throw _privateConstructorUsedError; + int get tag => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $RpcOptionsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RpcOptionsCopyWith<$Res> { + factory $RpcOptionsCopyWith( + RpcOptions value, $Res Function(RpcOptions) then) = + _$RpcOptionsCopyWithImpl<$Res, RpcOptions>; + @useResult + $Res call({int ttl, bool prompt, int tag}); +} + +/// @nodoc +class _$RpcOptionsCopyWithImpl<$Res, $Val extends RpcOptions> + implements $RpcOptionsCopyWith<$Res> { + _$RpcOptionsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? ttl = null, + Object? prompt = null, + Object? tag = null, + }) { + return _then(_value.copyWith( + ttl: null == ttl + ? _value.ttl + : ttl // ignore: cast_nullable_to_non_nullable + as int, + prompt: null == prompt + ? _value.prompt + : prompt // ignore: cast_nullable_to_non_nullable + as bool, + tag: null == tag + ? _value.tag + : tag // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_RpcOptionsCopyWith<$Res> + implements $RpcOptionsCopyWith<$Res> { + factory _$$_RpcOptionsCopyWith( + _$_RpcOptions value, $Res Function(_$_RpcOptions) then) = + __$$_RpcOptionsCopyWithImpl<$Res>; + @override + @useResult + $Res call({int ttl, bool prompt, int tag}); +} + +/// @nodoc +class __$$_RpcOptionsCopyWithImpl<$Res> + extends _$RpcOptionsCopyWithImpl<$Res, _$_RpcOptions> + implements _$$_RpcOptionsCopyWith<$Res> { + __$$_RpcOptionsCopyWithImpl( + _$_RpcOptions _value, $Res Function(_$_RpcOptions) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? ttl = null, + Object? prompt = null, + Object? tag = null, + }) { + return _then(_$_RpcOptions( + ttl: null == ttl + ? _value.ttl + : ttl // ignore: cast_nullable_to_non_nullable + as int, + prompt: null == prompt + ? _value.prompt + : prompt // ignore: cast_nullable_to_non_nullable + as bool, + tag: null == tag + ? _value.tag + : tag // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$_RpcOptions implements _RpcOptions { + const _$_RpcOptions( + {required this.ttl, required this.prompt, required this.tag}); + + @override + final int ttl; + @override + final bool prompt; + @override + final int tag; + + @override + String toString() { + return 'RpcOptions(ttl: $ttl, prompt: $prompt, tag: $tag)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_RpcOptions && + (identical(other.ttl, ttl) || other.ttl == ttl) && + (identical(other.prompt, prompt) || other.prompt == prompt) && + (identical(other.tag, tag) || other.tag == tag)); + } + + @override + int get hashCode => Object.hash(runtimeType, ttl, prompt, tag); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_RpcOptionsCopyWith<_$_RpcOptions> get copyWith => + __$$_RpcOptionsCopyWithImpl<_$_RpcOptions>(this, _$identity); +} + +abstract class _RpcOptions implements RpcOptions { + const factory _RpcOptions( + {required final int ttl, + required final bool prompt, + required final int tag}) = _$_RpcOptions; + + @override + int get ttl; + @override + bool get prompt; + @override + int get tag; + @override + @JsonKey(ignore: true) + _$$_RpcOptionsCopyWith<_$_RpcOptions> get copyWith => + throw _privateConstructorUsedError; +} + +ConnectionMetadata _$ConnectionMetadataFromJson(Map json) { + return _ConnectionMetadata.fromJson(json); +} + +/// @nodoc +mixin _$ConnectionMetadata { + String get publicKey => throw _privateConstructorUsedError; + PairingMetadata get metadata => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ConnectionMetadataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ConnectionMetadataCopyWith<$Res> { + factory $ConnectionMetadataCopyWith( + ConnectionMetadata value, $Res Function(ConnectionMetadata) then) = + _$ConnectionMetadataCopyWithImpl<$Res, ConnectionMetadata>; + @useResult + $Res call({String publicKey, PairingMetadata metadata}); + + $PairingMetadataCopyWith<$Res> get metadata; +} + +/// @nodoc +class _$ConnectionMetadataCopyWithImpl<$Res, $Val extends ConnectionMetadata> + implements $ConnectionMetadataCopyWith<$Res> { + _$ConnectionMetadataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? publicKey = null, + Object? metadata = null, + }) { + return _then(_value.copyWith( + publicKey: null == publicKey + ? _value.publicKey + : publicKey // ignore: cast_nullable_to_non_nullable + as String, + metadata: null == metadata + ? _value.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as PairingMetadata, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PairingMetadataCopyWith<$Res> get metadata { + return $PairingMetadataCopyWith<$Res>(_value.metadata, (value) { + return _then(_value.copyWith(metadata: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_ConnectionMetadataCopyWith<$Res> + implements $ConnectionMetadataCopyWith<$Res> { + factory _$$_ConnectionMetadataCopyWith(_$_ConnectionMetadata value, + $Res Function(_$_ConnectionMetadata) then) = + __$$_ConnectionMetadataCopyWithImpl<$Res>; + @override + @useResult + $Res call({String publicKey, PairingMetadata metadata}); + + @override + $PairingMetadataCopyWith<$Res> get metadata; +} + +/// @nodoc +class __$$_ConnectionMetadataCopyWithImpl<$Res> + extends _$ConnectionMetadataCopyWithImpl<$Res, _$_ConnectionMetadata> + implements _$$_ConnectionMetadataCopyWith<$Res> { + __$$_ConnectionMetadataCopyWithImpl( + _$_ConnectionMetadata _value, $Res Function(_$_ConnectionMetadata) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? publicKey = null, + Object? metadata = null, + }) { + return _then(_$_ConnectionMetadata( + publicKey: null == publicKey + ? _value.publicKey + : publicKey // ignore: cast_nullable_to_non_nullable + as String, + metadata: null == metadata + ? _value.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as PairingMetadata, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_ConnectionMetadata implements _ConnectionMetadata { + const _$_ConnectionMetadata( + {required this.publicKey, required this.metadata}); + + factory _$_ConnectionMetadata.fromJson(Map json) => + _$$_ConnectionMetadataFromJson(json); + + @override + final String publicKey; + @override + final PairingMetadata metadata; + + @override + String toString() { + return 'ConnectionMetadata(publicKey: $publicKey, metadata: $metadata)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_ConnectionMetadata && + (identical(other.publicKey, publicKey) || + other.publicKey == publicKey) && + (identical(other.metadata, metadata) || + other.metadata == metadata)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, publicKey, metadata); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_ConnectionMetadataCopyWith<_$_ConnectionMetadata> get copyWith => + __$$_ConnectionMetadataCopyWithImpl<_$_ConnectionMetadata>( + this, _$identity); + + @override + Map toJson() { + return _$$_ConnectionMetadataToJson( + this, + ); + } +} + +abstract class _ConnectionMetadata implements ConnectionMetadata { + const factory _ConnectionMetadata( + {required final String publicKey, + required final PairingMetadata metadata}) = _$_ConnectionMetadata; + + factory _ConnectionMetadata.fromJson(Map json) = + _$_ConnectionMetadata.fromJson; + + @override + String get publicKey; + @override + PairingMetadata get metadata; + @override + @JsonKey(ignore: true) + _$$_ConnectionMetadataCopyWith<_$_ConnectionMetadata> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/models/basic_models.g.dart b/lib/apis/models/basic_models.g.dart index 56448e82..4d8caf4e 100644 --- a/lib/apis/models/basic_models.g.dart +++ b/lib/apis/models/basic_models.g.dart @@ -6,37 +6,32 @@ part of 'basic_models.dart'; // JsonSerializableGenerator // ************************************************************************** -WalletConnectError _$WalletConnectErrorFromJson(Map json) => - WalletConnectError( +_$_WalletConnectError _$$_WalletConnectErrorFromJson( + Map json) => + _$_WalletConnectError( code: json['code'] as int, message: json['message'] as String, data: json['data'] as String?, ); -Map _$WalletConnectErrorToJson(WalletConnectError instance) { - final val = { - 'code': instance.code, - 'message': instance.message, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('data', instance.data); - return val; -} +Map _$$_WalletConnectErrorToJson( + _$_WalletConnectError instance) => + { + 'code': instance.code, + 'message': instance.message, + 'data': instance.data, + }; -ConnectionMetadata _$ConnectionMetadataFromJson(Map json) => - ConnectionMetadata( +_$_ConnectionMetadata _$$_ConnectionMetadataFromJson( + Map json) => + _$_ConnectionMetadata( publicKey: json['publicKey'] as String, metadata: PairingMetadata.fromJson(json['metadata'] as Map), ); -Map _$ConnectionMetadataToJson(ConnectionMetadata instance) => +Map _$$_ConnectionMetadataToJson( + _$_ConnectionMetadata instance) => { 'publicKey': instance.publicKey, 'metadata': instance.metadata.toJson(), diff --git a/lib/apis/models/json_rpc_error.dart b/lib/apis/models/json_rpc_error.dart index 08cbb70b..df98fc5a 100644 --- a/lib/apis/models/json_rpc_error.dart +++ b/lib/apis/models/json_rpc_error.dart @@ -1,16 +1,15 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; part 'json_rpc_error.g.dart'; +part 'json_rpc_error.freezed.dart'; -@JsonSerializable() -class JsonRpcError { - final int code; - final String message; - - JsonRpcError({ - required this.code, - required this.message, - }); +@freezed +class JsonRpcError with _$JsonRpcError { + @JsonSerializable(includeIfNull: false) + const factory JsonRpcError({ + required int code, + String? message, + }) = _JsonRpcError; factory JsonRpcError.serverError(String message) => JsonRpcError(code: -32000, message: message); @@ -25,8 +24,4 @@ class JsonRpcError { factory JsonRpcError.fromJson(Map json) => _$JsonRpcErrorFromJson(json); - Map toJson() => _$JsonRpcErrorToJson(this); - - @override - String toString() => 'JsonRpcError(code: $code, message: $message)'; } diff --git a/lib/apis/models/json_rpc_error.freezed.dart b/lib/apis/models/json_rpc_error.freezed.dart new file mode 100644 index 00000000..101dc78e --- /dev/null +++ b/lib/apis/models/json_rpc_error.freezed.dart @@ -0,0 +1,169 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'json_rpc_error.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +JsonRpcError _$JsonRpcErrorFromJson(Map json) { + return _JsonRpcError.fromJson(json); +} + +/// @nodoc +mixin _$JsonRpcError { + int get code => throw _privateConstructorUsedError; + String? get message => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $JsonRpcErrorCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $JsonRpcErrorCopyWith<$Res> { + factory $JsonRpcErrorCopyWith( + JsonRpcError value, $Res Function(JsonRpcError) then) = + _$JsonRpcErrorCopyWithImpl<$Res, JsonRpcError>; + @useResult + $Res call({int code, String? message}); +} + +/// @nodoc +class _$JsonRpcErrorCopyWithImpl<$Res, $Val extends JsonRpcError> + implements $JsonRpcErrorCopyWith<$Res> { + _$JsonRpcErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = freezed, + }) { + return _then(_value.copyWith( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_JsonRpcErrorCopyWith<$Res> + implements $JsonRpcErrorCopyWith<$Res> { + factory _$$_JsonRpcErrorCopyWith( + _$_JsonRpcError value, $Res Function(_$_JsonRpcError) then) = + __$$_JsonRpcErrorCopyWithImpl<$Res>; + @override + @useResult + $Res call({int code, String? message}); +} + +/// @nodoc +class __$$_JsonRpcErrorCopyWithImpl<$Res> + extends _$JsonRpcErrorCopyWithImpl<$Res, _$_JsonRpcError> + implements _$$_JsonRpcErrorCopyWith<$Res> { + __$$_JsonRpcErrorCopyWithImpl( + _$_JsonRpcError _value, $Res Function(_$_JsonRpcError) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = freezed, + }) { + return _then(_$_JsonRpcError( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_JsonRpcError implements _JsonRpcError { + const _$_JsonRpcError({required this.code, this.message}); + + factory _$_JsonRpcError.fromJson(Map json) => + _$$_JsonRpcErrorFromJson(json); + + @override + final int code; + @override + final String? message; + + @override + String toString() { + return 'JsonRpcError(code: $code, message: $message)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_JsonRpcError && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, code, message); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_JsonRpcErrorCopyWith<_$_JsonRpcError> get copyWith => + __$$_JsonRpcErrorCopyWithImpl<_$_JsonRpcError>(this, _$identity); + + @override + Map toJson() { + return _$$_JsonRpcErrorToJson( + this, + ); + } +} + +abstract class _JsonRpcError implements JsonRpcError { + const factory _JsonRpcError( + {required final int code, final String? message}) = _$_JsonRpcError; + + factory _JsonRpcError.fromJson(Map json) = + _$_JsonRpcError.fromJson; + + @override + int get code; + @override + String? get message; + @override + @JsonKey(ignore: true) + _$$_JsonRpcErrorCopyWith<_$_JsonRpcError> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/models/json_rpc_error.g.dart b/lib/apis/models/json_rpc_error.g.dart index d5198bef..41ea545d 100644 --- a/lib/apis/models/json_rpc_error.g.dart +++ b/lib/apis/models/json_rpc_error.g.dart @@ -6,13 +6,23 @@ part of 'json_rpc_error.dart'; // JsonSerializableGenerator // ************************************************************************** -JsonRpcError _$JsonRpcErrorFromJson(Map json) => JsonRpcError( +_$_JsonRpcError _$$_JsonRpcErrorFromJson(Map json) => + _$_JsonRpcError( code: json['code'] as int, - message: json['message'] as String, + message: json['message'] as String?, ); -Map _$JsonRpcErrorToJson(JsonRpcError instance) => - { - 'code': instance.code, - 'message': instance.message, - }; +Map _$$_JsonRpcErrorToJson(_$_JsonRpcError instance) { + final val = { + 'code': instance.code, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('message', instance.message); + return val; +} diff --git a/lib/apis/models/json_rpc_request.dart b/lib/apis/models/json_rpc_request.dart index ad58c741..3c54d97f 100644 --- a/lib/apis/models/json_rpc_request.dart +++ b/lib/apis/models/json_rpc_request.dart @@ -1,26 +1,19 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; part 'json_rpc_request.g.dart'; +part 'json_rpc_request.freezed.dart'; -@JsonSerializable() -class JsonRpcRequest { - final int id; - final String jsonrpc; - final String method; - final dynamic params; - - JsonRpcRequest({ - required this.id, - this.jsonrpc = '2.0', - required this.method, - this.params, - }); +@freezed +class JsonRpcRequest with _$JsonRpcRequest { + @JsonSerializable() + const factory JsonRpcRequest({ + required int id, + @Default('2.0') String jsonrpc, + required String method, + dynamic params, + }) = _JsonRpcRequest; factory JsonRpcRequest.fromJson(Map json) => _$JsonRpcRequestFromJson(json); - Map toJson() => _$JsonRpcRequestToJson(this); - - @override - String toString() => - 'JsonRpcRequest(id: $id, jsonrpc: $jsonrpc, method: $method, params: $params)'; } diff --git a/lib/apis/models/json_rpc_request.freezed.dart b/lib/apis/models/json_rpc_request.freezed.dart new file mode 100644 index 00000000..65f68d93 --- /dev/null +++ b/lib/apis/models/json_rpc_request.freezed.dart @@ -0,0 +1,210 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'json_rpc_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +JsonRpcRequest _$JsonRpcRequestFromJson(Map json) { + return _JsonRpcRequest.fromJson(json); +} + +/// @nodoc +mixin _$JsonRpcRequest { + int get id => throw _privateConstructorUsedError; + String get jsonrpc => throw _privateConstructorUsedError; + String get method => throw _privateConstructorUsedError; + dynamic get params => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $JsonRpcRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $JsonRpcRequestCopyWith<$Res> { + factory $JsonRpcRequestCopyWith( + JsonRpcRequest value, $Res Function(JsonRpcRequest) then) = + _$JsonRpcRequestCopyWithImpl<$Res, JsonRpcRequest>; + @useResult + $Res call({int id, String jsonrpc, String method, dynamic params}); +} + +/// @nodoc +class _$JsonRpcRequestCopyWithImpl<$Res, $Val extends JsonRpcRequest> + implements $JsonRpcRequestCopyWith<$Res> { + _$JsonRpcRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? jsonrpc = null, + Object? method = null, + Object? params = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + jsonrpc: null == jsonrpc + ? _value.jsonrpc + : jsonrpc // ignore: cast_nullable_to_non_nullable + as String, + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_JsonRpcRequestCopyWith<$Res> + implements $JsonRpcRequestCopyWith<$Res> { + factory _$$_JsonRpcRequestCopyWith( + _$_JsonRpcRequest value, $Res Function(_$_JsonRpcRequest) then) = + __$$_JsonRpcRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({int id, String jsonrpc, String method, dynamic params}); +} + +/// @nodoc +class __$$_JsonRpcRequestCopyWithImpl<$Res> + extends _$JsonRpcRequestCopyWithImpl<$Res, _$_JsonRpcRequest> + implements _$$_JsonRpcRequestCopyWith<$Res> { + __$$_JsonRpcRequestCopyWithImpl( + _$_JsonRpcRequest _value, $Res Function(_$_JsonRpcRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? jsonrpc = null, + Object? method = null, + Object? params = freezed, + }) { + return _then(_$_JsonRpcRequest( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + jsonrpc: null == jsonrpc + ? _value.jsonrpc + : jsonrpc // ignore: cast_nullable_to_non_nullable + as String, + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_JsonRpcRequest implements _JsonRpcRequest { + const _$_JsonRpcRequest( + {required this.id, + this.jsonrpc = '2.0', + required this.method, + this.params}); + + factory _$_JsonRpcRequest.fromJson(Map json) => + _$$_JsonRpcRequestFromJson(json); + + @override + final int id; + @override + @JsonKey() + final String jsonrpc; + @override + final String method; + @override + final dynamic params; + + @override + String toString() { + return 'JsonRpcRequest(id: $id, jsonrpc: $jsonrpc, method: $method, params: $params)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_JsonRpcRequest && + (identical(other.id, id) || other.id == id) && + (identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc) && + (identical(other.method, method) || other.method == method) && + const DeepCollectionEquality().equals(other.params, params)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, jsonrpc, method, + const DeepCollectionEquality().hash(params)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_JsonRpcRequestCopyWith<_$_JsonRpcRequest> get copyWith => + __$$_JsonRpcRequestCopyWithImpl<_$_JsonRpcRequest>(this, _$identity); + + @override + Map toJson() { + return _$$_JsonRpcRequestToJson( + this, + ); + } +} + +abstract class _JsonRpcRequest implements JsonRpcRequest { + const factory _JsonRpcRequest( + {required final int id, + final String jsonrpc, + required final String method, + final dynamic params}) = _$_JsonRpcRequest; + + factory _JsonRpcRequest.fromJson(Map json) = + _$_JsonRpcRequest.fromJson; + + @override + int get id; + @override + String get jsonrpc; + @override + String get method; + @override + dynamic get params; + @override + @JsonKey(ignore: true) + _$$_JsonRpcRequestCopyWith<_$_JsonRpcRequest> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/models/json_rpc_request.g.dart b/lib/apis/models/json_rpc_request.g.dart index 342b7337..4e6e6997 100644 --- a/lib/apis/models/json_rpc_request.g.dart +++ b/lib/apis/models/json_rpc_request.g.dart @@ -6,15 +6,15 @@ part of 'json_rpc_request.dart'; // JsonSerializableGenerator // ************************************************************************** -JsonRpcRequest _$JsonRpcRequestFromJson(Map json) => - JsonRpcRequest( +_$_JsonRpcRequest _$$_JsonRpcRequestFromJson(Map json) => + _$_JsonRpcRequest( id: json['id'] as int, jsonrpc: json['jsonrpc'] as String? ?? '2.0', method: json['method'] as String, params: json['params'], ); -Map _$JsonRpcRequestToJson(JsonRpcRequest instance) => +Map _$$_JsonRpcRequestToJson(_$_JsonRpcRequest instance) => { 'id': instance.id, 'jsonrpc': instance.jsonrpc, diff --git a/lib/apis/models/json_rpc_response.dart b/lib/apis/models/json_rpc_response.dart index 807463c3..2b14c61c 100644 --- a/lib/apis/models/json_rpc_response.dart +++ b/lib/apis/models/json_rpc_response.dart @@ -1,27 +1,19 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/models/json_rpc_error.dart'; part 'json_rpc_response.g.dart'; +part 'json_rpc_response.freezed.dart'; -@JsonSerializable(genericArgumentFactories: true) -class JsonRpcResponse { - final int id; - final String jsonrpc; - final JsonRpcError? error; - final T? result; - - JsonRpcResponse({ - required this.id, - this.jsonrpc = '2.0', - this.error, - this.result, - }); +@Freezed(genericArgumentFactories: true) +class JsonRpcResponse with _$JsonRpcResponse { + // @JsonSerializable(genericArgumentFactories: true) + const factory JsonRpcResponse({ + required int id, + @Default('2.0') String jsonrpc, + JsonRpcError? error, + T? result, + }) = _JsonRpcResponse; factory JsonRpcResponse.fromJson(Map json) => _$JsonRpcResponseFromJson(json, (object) => object as T); - Map toJson() => _$JsonRpcResponseToJson(this, (t) => t); - - @override - String toString() => - 'JsonRpcResponse(id: $id, jsonrpc: $jsonrpc, result: $result, error: $error)'; } diff --git a/lib/apis/models/json_rpc_response.freezed.dart b/lib/apis/models/json_rpc_response.freezed.dart new file mode 100644 index 00000000..c62cb82f --- /dev/null +++ b/lib/apis/models/json_rpc_response.freezed.dart @@ -0,0 +1,226 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'json_rpc_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +JsonRpcResponse _$JsonRpcResponseFromJson( + Map json, T Function(Object?) fromJsonT) { + return _JsonRpcResponse.fromJson(json, fromJsonT); +} + +/// @nodoc +mixin _$JsonRpcResponse { + int get id => throw _privateConstructorUsedError; + String get jsonrpc => throw _privateConstructorUsedError; + JsonRpcError? get error => throw _privateConstructorUsedError; + T? get result => throw _privateConstructorUsedError; + + Map toJson(Object? Function(T) toJsonT) => + throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $JsonRpcResponseCopyWith> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $JsonRpcResponseCopyWith { + factory $JsonRpcResponseCopyWith( + JsonRpcResponse value, $Res Function(JsonRpcResponse) then) = + _$JsonRpcResponseCopyWithImpl>; + @useResult + $Res call({int id, String jsonrpc, JsonRpcError? error, T? result}); + + $JsonRpcErrorCopyWith<$Res>? get error; +} + +/// @nodoc +class _$JsonRpcResponseCopyWithImpl> + implements $JsonRpcResponseCopyWith { + _$JsonRpcResponseCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? jsonrpc = null, + Object? error = freezed, + Object? result = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + jsonrpc: null == jsonrpc + ? _value.jsonrpc + : jsonrpc // ignore: cast_nullable_to_non_nullable + as String, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as JsonRpcError?, + result: freezed == result + ? _value.result + : result // ignore: cast_nullable_to_non_nullable + as T?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $JsonRpcErrorCopyWith<$Res>? get error { + if (_value.error == null) { + return null; + } + + return $JsonRpcErrorCopyWith<$Res>(_value.error!, (value) { + return _then(_value.copyWith(error: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_JsonRpcResponseCopyWith + implements $JsonRpcResponseCopyWith { + factory _$$_JsonRpcResponseCopyWith(_$_JsonRpcResponse value, + $Res Function(_$_JsonRpcResponse) then) = + __$$_JsonRpcResponseCopyWithImpl; + @override + @useResult + $Res call({int id, String jsonrpc, JsonRpcError? error, T? result}); + + @override + $JsonRpcErrorCopyWith<$Res>? get error; +} + +/// @nodoc +class __$$_JsonRpcResponseCopyWithImpl + extends _$JsonRpcResponseCopyWithImpl> + implements _$$_JsonRpcResponseCopyWith { + __$$_JsonRpcResponseCopyWithImpl( + _$_JsonRpcResponse _value, $Res Function(_$_JsonRpcResponse) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? jsonrpc = null, + Object? error = freezed, + Object? result = freezed, + }) { + return _then(_$_JsonRpcResponse( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + jsonrpc: null == jsonrpc + ? _value.jsonrpc + : jsonrpc // ignore: cast_nullable_to_non_nullable + as String, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as JsonRpcError?, + result: freezed == result + ? _value.result + : result // ignore: cast_nullable_to_non_nullable + as T?, + )); + } +} + +/// @nodoc +@JsonSerializable(genericArgumentFactories: true) +class _$_JsonRpcResponse implements _JsonRpcResponse { + const _$_JsonRpcResponse( + {required this.id, this.jsonrpc = '2.0', this.error, this.result}); + + factory _$_JsonRpcResponse.fromJson( + Map json, T Function(Object?) fromJsonT) => + _$$_JsonRpcResponseFromJson(json, fromJsonT); + + @override + final int id; + @override + @JsonKey() + final String jsonrpc; + @override + final JsonRpcError? error; + @override + final T? result; + + @override + String toString() { + return 'JsonRpcResponse<$T>(id: $id, jsonrpc: $jsonrpc, error: $error, result: $result)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_JsonRpcResponse && + (identical(other.id, id) || other.id == id) && + (identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc) && + (identical(other.error, error) || other.error == error) && + const DeepCollectionEquality().equals(other.result, result)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, jsonrpc, error, + const DeepCollectionEquality().hash(result)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_JsonRpcResponseCopyWith> get copyWith => + __$$_JsonRpcResponseCopyWithImpl>( + this, _$identity); + + @override + Map toJson(Object? Function(T) toJsonT) { + return _$$_JsonRpcResponseToJson(this, toJsonT); + } +} + +abstract class _JsonRpcResponse implements JsonRpcResponse { + const factory _JsonRpcResponse( + {required final int id, + final String jsonrpc, + final JsonRpcError? error, + final T? result}) = _$_JsonRpcResponse; + + factory _JsonRpcResponse.fromJson( + Map json, T Function(Object?) fromJsonT) = + _$_JsonRpcResponse.fromJson; + + @override + int get id; + @override + String get jsonrpc; + @override + JsonRpcError? get error; + @override + T? get result; + @override + @JsonKey(ignore: true) + _$$_JsonRpcResponseCopyWith> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/models/json_rpc_response.g.dart b/lib/apis/models/json_rpc_response.g.dart index 7793d55d..fa21ff97 100644 --- a/lib/apis/models/json_rpc_response.g.dart +++ b/lib/apis/models/json_rpc_response.g.dart @@ -6,11 +6,11 @@ part of 'json_rpc_response.dart'; // JsonSerializableGenerator // ************************************************************************** -JsonRpcResponse _$JsonRpcResponseFromJson( +_$_JsonRpcResponse _$$_JsonRpcResponseFromJson( Map json, T Function(Object? json) fromJsonT, ) => - JsonRpcResponse( + _$_JsonRpcResponse( id: json['id'] as int, jsonrpc: json['jsonrpc'] as String? ?? '2.0', error: json['error'] == null @@ -19,8 +19,8 @@ JsonRpcResponse _$JsonRpcResponseFromJson( result: _$nullableGenericFromJson(json['result'], fromJsonT), ); -Map _$JsonRpcResponseToJson( - JsonRpcResponse instance, +Map _$$_JsonRpcResponseToJson( + _$_JsonRpcResponse instance, Object? Function(T value) toJsonT, ) => { diff --git a/lib/apis/sign_api/models/json_rpc_models.dart b/lib/apis/sign_api/models/json_rpc_models.dart index 54f02f8f..441a0096 100644 --- a/lib/apis/sign_api/models/json_rpc_models.dart +++ b/lib/apis/sign_api/models/json_rpc_models.dart @@ -1,224 +1,169 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client_models.dart'; import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart'; import 'package:walletconnect_flutter_v2/apis/sign_api/models/proposal_models.dart'; import 'package:walletconnect_flutter_v2/apis/sign_api/models/session_models.dart'; part 'json_rpc_models.g.dart'; +part 'json_rpc_models.freezed.dart'; -@JsonSerializable() -class WcPairingDeleteRequest { - final int code; - final String message; - - WcPairingDeleteRequest({required this.code, required this.message}); +@freezed +class WcPairingDeleteRequest with _$WcPairingDeleteRequest { + @JsonSerializable() + const factory WcPairingDeleteRequest({ + required int code, + required String message, + }) = _WcPairingDeleteRequest; factory WcPairingDeleteRequest.fromJson(Map json) => _$WcPairingDeleteRequestFromJson(json); - - Map toJson() => _$WcPairingDeleteRequestToJson(this); } -@JsonSerializable() -class WcPairingPingRequest { - final Map data; - - WcPairingPingRequest({required this.data}); +@freezed +class WcPairingPingRequest with _$WcPairingPingRequest { + @JsonSerializable() + const factory WcPairingPingRequest({ + required Map data, + }) = _WcPairingPingRequest; factory WcPairingPingRequest.fromJson(Map json) => _$WcPairingPingRequestFromJson(json); - - Map toJson() => _$WcPairingPingRequestToJson(this); } -@JsonSerializable(includeIfNull: false) -class WcSessionProposeRequest { - final List relays; - final Map requiredNamespaces; - final Map? optionalNamespaces; - final Map? sessionProperties; - final ConnectionMetadata proposer; - - WcSessionProposeRequest({ - required this.relays, - required this.requiredNamespaces, - required this.optionalNamespaces, - required this.proposer, - this.sessionProperties, - }); +@freezed +class WcSessionProposeRequest with _$WcSessionProposeRequest { + @JsonSerializable(includeIfNull: false) + const factory WcSessionProposeRequest({ + required List relays, + required Map requiredNamespaces, + required Map optionalNamespaces, + Map? sessionProperties, + required ConnectionMetadata proposer, + }) = _WcSessionProposeRequest; factory WcSessionProposeRequest.fromJson(Map json) => _$WcSessionProposeRequestFromJson(json); - - Map toJson() => _$WcSessionProposeRequestToJson(this); } -@JsonSerializable() -class WcSessionProposeResponse { - Relay relay; - String responderPublicKey; - - WcSessionProposeResponse({ - required this.relay, - required this.responderPublicKey, - }); +@freezed +class WcSessionProposeResponse with _$WcSessionProposeResponse { + @JsonSerializable() + const factory WcSessionProposeResponse({ + required Relay relay, + required String responderPublicKey, + }) = _WcSessionProposeResponse; factory WcSessionProposeResponse.fromJson(Map json) => _$WcSessionProposeResponseFromJson(json); - - Map toJson() => _$WcSessionProposeResponseToJson(this); - - @override - String toString() { - return 'WcSessionProposeResponse(relay: $relay, responderPublicKey: $responderPublicKey)'; - } } -@JsonSerializable(includeIfNull: false) -class WcSessionSettleRequest { - final Relay relay; - final Map namespaces; - final Map? requiredNamespaces; - final Map? optionalNamespaces; - final Map? sessionProperties; - final int expiry; - final ConnectionMetadata controller; - - WcSessionSettleRequest({ - required this.relay, - required this.namespaces, - required this.requiredNamespaces, - required this.optionalNamespaces, - this.sessionProperties, - required this.expiry, - required this.controller, - }); +@freezed +class WcSessionSettleRequest with _$WcSessionSettleRequest { + @JsonSerializable(includeIfNull: false) + const factory WcSessionSettleRequest({ + required Relay relay, + required Map namespaces, + Map? requiredNamespaces, + Map? optionalNamespaces, + Map? sessionProperties, + required int expiry, + required ConnectionMetadata controller, + }) = _WcSessionSettleRequest; factory WcSessionSettleRequest.fromJson(Map json) => _$WcSessionSettleRequestFromJson(json); - - Map toJson() => _$WcSessionSettleRequestToJson(this); - - @override - String toString() { - return 'WcSessionSettleRequest(relay: $relay, namespaces: $namespaces, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, sessionProperties: $sessionProperties, expiry: $expiry, controller: $controller)'; - } } -@JsonSerializable() -class WcSessionUpdateRequest { - final Map namespaces; - - WcSessionUpdateRequest({required this.namespaces}); +@freezed +class WcSessionUpdateRequest with _$WcSessionUpdateRequest { + @JsonSerializable() + const factory WcSessionUpdateRequest({ + required Map namespaces, + }) = _WcSessionUpdateRequest; factory WcSessionUpdateRequest.fromJson(Map json) => _$WcSessionUpdateRequestFromJson(json); - - Map toJson() => _$WcSessionUpdateRequestToJson(this); } -@JsonSerializable(includeIfNull: false) -class WcSessionExtendRequest { - final Map? data; - - WcSessionExtendRequest({this.data}); +@freezed +class WcSessionExtendRequest with _$WcSessionExtendRequest { + @JsonSerializable(includeIfNull: false) + const factory WcSessionExtendRequest({ + Map? data, + }) = _WcSessionExtendRequest; factory WcSessionExtendRequest.fromJson(Map json) => _$WcSessionExtendRequestFromJson(json); - - Map toJson() => _$WcSessionExtendRequestToJson(this); } -@JsonSerializable(includeIfNull: false) -class WcSessionDeleteRequest { - final int code; - final String message; - final String? data; - - WcSessionDeleteRequest({ - required this.code, - required this.message, - this.data, - }); +@freezed +class WcSessionDeleteRequest with _$WcSessionDeleteRequest { + @JsonSerializable(includeIfNull: false) + const factory WcSessionDeleteRequest({ + required int code, + required String message, + String? data, + }) = _WcSessionDeleteRequest; factory WcSessionDeleteRequest.fromJson(Map json) => _$WcSessionDeleteRequestFromJson(json); - - Map toJson() => _$WcSessionDeleteRequestToJson(this); } -@JsonSerializable(includeIfNull: false) -class WcSessionPingRequest { - final Map? data; - - WcSessionPingRequest({required this.data}); +@freezed +class WcSessionPingRequest with _$WcSessionPingRequest { + @JsonSerializable(includeIfNull: false) + const factory WcSessionPingRequest({ + Map? data, + }) = _WcSessionPingRequest; factory WcSessionPingRequest.fromJson(Map json) => _$WcSessionPingRequestFromJson(json); - - Map toJson() => _$WcSessionPingRequestToJson(this); } -@JsonSerializable() -class WcSessionRequestRequest { - final String chainId; - final SessionRequestParams request; - - WcSessionRequestRequest({ - required this.chainId, - required this.request, - }); +@freezed +class WcSessionRequestRequest with _$WcSessionRequestRequest { + @JsonSerializable() + const factory WcSessionRequestRequest({ + required String chainId, + required SessionRequestParams request, + }) = _WcSessionRequestRequest; factory WcSessionRequestRequest.fromJson(Map json) => _$WcSessionRequestRequestFromJson(json); - - Map toJson() => _$WcSessionRequestRequestToJson(this); } -@JsonSerializable() -class SessionRequestParams { - final String method; - final dynamic params; - - SessionRequestParams({ - required this.method, - required this.params, - }); +@freezed +class SessionRequestParams with _$SessionRequestParams { + @JsonSerializable() + const factory SessionRequestParams({ + required String method, + required dynamic params, + }) = _SessionRequestParams; factory SessionRequestParams.fromJson(Map json) => _$SessionRequestParamsFromJson(json); - - Map toJson() => _$SessionRequestParamsToJson(this); } -@JsonSerializable() -class WcSessionEventRequest { - final String chainId; - final SessionEventParams event; - - WcSessionEventRequest({ - required this.chainId, - required this.event, - }); +@freezed +class WcSessionEventRequest with _$WcSessionEventRequest { + @JsonSerializable() + const factory WcSessionEventRequest({ + required String chainId, + required SessionEventParams event, + }) = _WcSessionEventRequest; factory WcSessionEventRequest.fromJson(Map json) => _$WcSessionEventRequestFromJson(json); - - Map toJson() => _$WcSessionEventRequestToJson(this); } -@JsonSerializable() -class SessionEventParams { - final String name; - final dynamic data; - - SessionEventParams({ - required this.name, - required this.data, - }); +@freezed +class SessionEventParams with _$SessionEventParams { + @JsonSerializable() + const factory SessionEventParams({ + required String name, + required dynamic data, + }) = _SessionEventParams; factory SessionEventParams.fromJson(Map json) => _$SessionEventParamsFromJson(json); - - Map toJson() => _$SessionEventParamsToJson(this); } diff --git a/lib/apis/sign_api/models/json_rpc_models.freezed.dart b/lib/apis/sign_api/models/json_rpc_models.freezed.dart new file mode 100644 index 00000000..eaee6540 --- /dev/null +++ b/lib/apis/sign_api/models/json_rpc_models.freezed.dart @@ -0,0 +1,2390 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'json_rpc_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +WcPairingDeleteRequest _$WcPairingDeleteRequestFromJson( + Map json) { + return _WcPairingDeleteRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcPairingDeleteRequest { + int get code => throw _privateConstructorUsedError; + String get message => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcPairingDeleteRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcPairingDeleteRequestCopyWith<$Res> { + factory $WcPairingDeleteRequestCopyWith(WcPairingDeleteRequest value, + $Res Function(WcPairingDeleteRequest) then) = + _$WcPairingDeleteRequestCopyWithImpl<$Res, WcPairingDeleteRequest>; + @useResult + $Res call({int code, String message}); +} + +/// @nodoc +class _$WcPairingDeleteRequestCopyWithImpl<$Res, + $Val extends WcPairingDeleteRequest> + implements $WcPairingDeleteRequestCopyWith<$Res> { + _$WcPairingDeleteRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = null, + }) { + return _then(_value.copyWith( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcPairingDeleteRequestCopyWith<$Res> + implements $WcPairingDeleteRequestCopyWith<$Res> { + factory _$$_WcPairingDeleteRequestCopyWith(_$_WcPairingDeleteRequest value, + $Res Function(_$_WcPairingDeleteRequest) then) = + __$$_WcPairingDeleteRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({int code, String message}); +} + +/// @nodoc +class __$$_WcPairingDeleteRequestCopyWithImpl<$Res> + extends _$WcPairingDeleteRequestCopyWithImpl<$Res, + _$_WcPairingDeleteRequest> + implements _$$_WcPairingDeleteRequestCopyWith<$Res> { + __$$_WcPairingDeleteRequestCopyWithImpl(_$_WcPairingDeleteRequest _value, + $Res Function(_$_WcPairingDeleteRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = null, + }) { + return _then(_$_WcPairingDeleteRequest( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcPairingDeleteRequest implements _WcPairingDeleteRequest { + const _$_WcPairingDeleteRequest({required this.code, required this.message}); + + factory _$_WcPairingDeleteRequest.fromJson(Map json) => + _$$_WcPairingDeleteRequestFromJson(json); + + @override + final int code; + @override + final String message; + + @override + String toString() { + return 'WcPairingDeleteRequest(code: $code, message: $message)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcPairingDeleteRequest && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, code, message); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcPairingDeleteRequestCopyWith<_$_WcPairingDeleteRequest> get copyWith => + __$$_WcPairingDeleteRequestCopyWithImpl<_$_WcPairingDeleteRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcPairingDeleteRequestToJson( + this, + ); + } +} + +abstract class _WcPairingDeleteRequest implements WcPairingDeleteRequest { + const factory _WcPairingDeleteRequest( + {required final int code, + required final String message}) = _$_WcPairingDeleteRequest; + + factory _WcPairingDeleteRequest.fromJson(Map json) = + _$_WcPairingDeleteRequest.fromJson; + + @override + int get code; + @override + String get message; + @override + @JsonKey(ignore: true) + _$$_WcPairingDeleteRequestCopyWith<_$_WcPairingDeleteRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcPairingPingRequest _$WcPairingPingRequestFromJson(Map json) { + return _WcPairingPingRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcPairingPingRequest { + Map get data => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcPairingPingRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcPairingPingRequestCopyWith<$Res> { + factory $WcPairingPingRequestCopyWith(WcPairingPingRequest value, + $Res Function(WcPairingPingRequest) then) = + _$WcPairingPingRequestCopyWithImpl<$Res, WcPairingPingRequest>; + @useResult + $Res call({Map data}); +} + +/// @nodoc +class _$WcPairingPingRequestCopyWithImpl<$Res, + $Val extends WcPairingPingRequest> + implements $WcPairingPingRequestCopyWith<$Res> { + _$WcPairingPingRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as Map, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcPairingPingRequestCopyWith<$Res> + implements $WcPairingPingRequestCopyWith<$Res> { + factory _$$_WcPairingPingRequestCopyWith(_$_WcPairingPingRequest value, + $Res Function(_$_WcPairingPingRequest) then) = + __$$_WcPairingPingRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({Map data}); +} + +/// @nodoc +class __$$_WcPairingPingRequestCopyWithImpl<$Res> + extends _$WcPairingPingRequestCopyWithImpl<$Res, _$_WcPairingPingRequest> + implements _$$_WcPairingPingRequestCopyWith<$Res> { + __$$_WcPairingPingRequestCopyWithImpl(_$_WcPairingPingRequest _value, + $Res Function(_$_WcPairingPingRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = null, + }) { + return _then(_$_WcPairingPingRequest( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as Map, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcPairingPingRequest implements _WcPairingPingRequest { + const _$_WcPairingPingRequest({required final Map data}) + : _data = data; + + factory _$_WcPairingPingRequest.fromJson(Map json) => + _$$_WcPairingPingRequestFromJson(json); + + final Map _data; + @override + Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); + } + + @override + String toString() { + return 'WcPairingPingRequest(data: $data)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcPairingPingRequest && + const DeepCollectionEquality().equals(other._data, _data)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_data)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcPairingPingRequestCopyWith<_$_WcPairingPingRequest> get copyWith => + __$$_WcPairingPingRequestCopyWithImpl<_$_WcPairingPingRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcPairingPingRequestToJson( + this, + ); + } +} + +abstract class _WcPairingPingRequest implements WcPairingPingRequest { + const factory _WcPairingPingRequest( + {required final Map data}) = _$_WcPairingPingRequest; + + factory _WcPairingPingRequest.fromJson(Map json) = + _$_WcPairingPingRequest.fromJson; + + @override + Map get data; + @override + @JsonKey(ignore: true) + _$$_WcPairingPingRequestCopyWith<_$_WcPairingPingRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionProposeRequest _$WcSessionProposeRequestFromJson( + Map json) { + return _WcSessionProposeRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionProposeRequest { + List get relays => throw _privateConstructorUsedError; + Map get requiredNamespaces => + throw _privateConstructorUsedError; + Map get optionalNamespaces => + throw _privateConstructorUsedError; + Map? get sessionProperties => + throw _privateConstructorUsedError; + ConnectionMetadata get proposer => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionProposeRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionProposeRequestCopyWith<$Res> { + factory $WcSessionProposeRequestCopyWith(WcSessionProposeRequest value, + $Res Function(WcSessionProposeRequest) then) = + _$WcSessionProposeRequestCopyWithImpl<$Res, WcSessionProposeRequest>; + @useResult + $Res call( + {List relays, + Map requiredNamespaces, + Map optionalNamespaces, + Map? sessionProperties, + ConnectionMetadata proposer}); + + $ConnectionMetadataCopyWith<$Res> get proposer; +} + +/// @nodoc +class _$WcSessionProposeRequestCopyWithImpl<$Res, + $Val extends WcSessionProposeRequest> + implements $WcSessionProposeRequestCopyWith<$Res> { + _$WcSessionProposeRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? relays = null, + Object? requiredNamespaces = null, + Object? optionalNamespaces = null, + Object? sessionProperties = freezed, + Object? proposer = null, + }) { + return _then(_value.copyWith( + relays: null == relays + ? _value.relays + : relays // ignore: cast_nullable_to_non_nullable + as List, + requiredNamespaces: null == requiredNamespaces + ? _value.requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + optionalNamespaces: null == optionalNamespaces + ? _value.optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + sessionProperties: freezed == sessionProperties + ? _value.sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + proposer: null == proposer + ? _value.proposer + : proposer // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get proposer { + return $ConnectionMetadataCopyWith<$Res>(_value.proposer, (value) { + return _then(_value.copyWith(proposer: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_WcSessionProposeRequestCopyWith<$Res> + implements $WcSessionProposeRequestCopyWith<$Res> { + factory _$$_WcSessionProposeRequestCopyWith(_$_WcSessionProposeRequest value, + $Res Function(_$_WcSessionProposeRequest) then) = + __$$_WcSessionProposeRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {List relays, + Map requiredNamespaces, + Map optionalNamespaces, + Map? sessionProperties, + ConnectionMetadata proposer}); + + @override + $ConnectionMetadataCopyWith<$Res> get proposer; +} + +/// @nodoc +class __$$_WcSessionProposeRequestCopyWithImpl<$Res> + extends _$WcSessionProposeRequestCopyWithImpl<$Res, + _$_WcSessionProposeRequest> + implements _$$_WcSessionProposeRequestCopyWith<$Res> { + __$$_WcSessionProposeRequestCopyWithImpl(_$_WcSessionProposeRequest _value, + $Res Function(_$_WcSessionProposeRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? relays = null, + Object? requiredNamespaces = null, + Object? optionalNamespaces = null, + Object? sessionProperties = freezed, + Object? proposer = null, + }) { + return _then(_$_WcSessionProposeRequest( + relays: null == relays + ? _value._relays + : relays // ignore: cast_nullable_to_non_nullable + as List, + requiredNamespaces: null == requiredNamespaces + ? _value._requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + optionalNamespaces: null == optionalNamespaces + ? _value._optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + sessionProperties: freezed == sessionProperties + ? _value._sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + proposer: null == proposer + ? _value.proposer + : proposer // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_WcSessionProposeRequest implements _WcSessionProposeRequest { + const _$_WcSessionProposeRequest( + {required final List relays, + required final Map requiredNamespaces, + required final Map optionalNamespaces, + final Map? sessionProperties, + required this.proposer}) + : _relays = relays, + _requiredNamespaces = requiredNamespaces, + _optionalNamespaces = optionalNamespaces, + _sessionProperties = sessionProperties; + + factory _$_WcSessionProposeRequest.fromJson(Map json) => + _$$_WcSessionProposeRequestFromJson(json); + + final List _relays; + @override + List get relays { + if (_relays is EqualUnmodifiableListView) return _relays; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_relays); + } + + final Map _requiredNamespaces; + @override + Map get requiredNamespaces { + if (_requiredNamespaces is EqualUnmodifiableMapView) + return _requiredNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_requiredNamespaces); + } + + final Map _optionalNamespaces; + @override + Map get optionalNamespaces { + if (_optionalNamespaces is EqualUnmodifiableMapView) + return _optionalNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_optionalNamespaces); + } + + final Map? _sessionProperties; + @override + Map? get sessionProperties { + final value = _sessionProperties; + if (value == null) return null; + if (_sessionProperties is EqualUnmodifiableMapView) + return _sessionProperties; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final ConnectionMetadata proposer; + + @override + String toString() { + return 'WcSessionProposeRequest(relays: $relays, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, sessionProperties: $sessionProperties, proposer: $proposer)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionProposeRequest && + const DeepCollectionEquality().equals(other._relays, _relays) && + const DeepCollectionEquality() + .equals(other._requiredNamespaces, _requiredNamespaces) && + const DeepCollectionEquality() + .equals(other._optionalNamespaces, _optionalNamespaces) && + const DeepCollectionEquality() + .equals(other._sessionProperties, _sessionProperties) && + (identical(other.proposer, proposer) || + other.proposer == proposer)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_relays), + const DeepCollectionEquality().hash(_requiredNamespaces), + const DeepCollectionEquality().hash(_optionalNamespaces), + const DeepCollectionEquality().hash(_sessionProperties), + proposer); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionProposeRequestCopyWith<_$_WcSessionProposeRequest> + get copyWith => + __$$_WcSessionProposeRequestCopyWithImpl<_$_WcSessionProposeRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionProposeRequestToJson( + this, + ); + } +} + +abstract class _WcSessionProposeRequest implements WcSessionProposeRequest { + const factory _WcSessionProposeRequest( + {required final List relays, + required final Map requiredNamespaces, + required final Map optionalNamespaces, + final Map? sessionProperties, + required final ConnectionMetadata proposer}) = _$_WcSessionProposeRequest; + + factory _WcSessionProposeRequest.fromJson(Map json) = + _$_WcSessionProposeRequest.fromJson; + + @override + List get relays; + @override + Map get requiredNamespaces; + @override + Map get optionalNamespaces; + @override + Map? get sessionProperties; + @override + ConnectionMetadata get proposer; + @override + @JsonKey(ignore: true) + _$$_WcSessionProposeRequestCopyWith<_$_WcSessionProposeRequest> + get copyWith => throw _privateConstructorUsedError; +} + +WcSessionProposeResponse _$WcSessionProposeResponseFromJson( + Map json) { + return _WcSessionProposeResponse.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionProposeResponse { + Relay get relay => throw _privateConstructorUsedError; + String get responderPublicKey => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionProposeResponseCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionProposeResponseCopyWith<$Res> { + factory $WcSessionProposeResponseCopyWith(WcSessionProposeResponse value, + $Res Function(WcSessionProposeResponse) then) = + _$WcSessionProposeResponseCopyWithImpl<$Res, WcSessionProposeResponse>; + @useResult + $Res call({Relay relay, String responderPublicKey}); +} + +/// @nodoc +class _$WcSessionProposeResponseCopyWithImpl<$Res, + $Val extends WcSessionProposeResponse> + implements $WcSessionProposeResponseCopyWith<$Res> { + _$WcSessionProposeResponseCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? relay = null, + Object? responderPublicKey = null, + }) { + return _then(_value.copyWith( + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + responderPublicKey: null == responderPublicKey + ? _value.responderPublicKey + : responderPublicKey // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcSessionProposeResponseCopyWith<$Res> + implements $WcSessionProposeResponseCopyWith<$Res> { + factory _$$_WcSessionProposeResponseCopyWith( + _$_WcSessionProposeResponse value, + $Res Function(_$_WcSessionProposeResponse) then) = + __$$_WcSessionProposeResponseCopyWithImpl<$Res>; + @override + @useResult + $Res call({Relay relay, String responderPublicKey}); +} + +/// @nodoc +class __$$_WcSessionProposeResponseCopyWithImpl<$Res> + extends _$WcSessionProposeResponseCopyWithImpl<$Res, + _$_WcSessionProposeResponse> + implements _$$_WcSessionProposeResponseCopyWith<$Res> { + __$$_WcSessionProposeResponseCopyWithImpl(_$_WcSessionProposeResponse _value, + $Res Function(_$_WcSessionProposeResponse) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? relay = null, + Object? responderPublicKey = null, + }) { + return _then(_$_WcSessionProposeResponse( + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + responderPublicKey: null == responderPublicKey + ? _value.responderPublicKey + : responderPublicKey // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcSessionProposeResponse implements _WcSessionProposeResponse { + const _$_WcSessionProposeResponse( + {required this.relay, required this.responderPublicKey}); + + factory _$_WcSessionProposeResponse.fromJson(Map json) => + _$$_WcSessionProposeResponseFromJson(json); + + @override + final Relay relay; + @override + final String responderPublicKey; + + @override + String toString() { + return 'WcSessionProposeResponse(relay: $relay, responderPublicKey: $responderPublicKey)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionProposeResponse && + (identical(other.relay, relay) || other.relay == relay) && + (identical(other.responderPublicKey, responderPublicKey) || + other.responderPublicKey == responderPublicKey)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, relay, responderPublicKey); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionProposeResponseCopyWith<_$_WcSessionProposeResponse> + get copyWith => __$$_WcSessionProposeResponseCopyWithImpl< + _$_WcSessionProposeResponse>(this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionProposeResponseToJson( + this, + ); + } +} + +abstract class _WcSessionProposeResponse implements WcSessionProposeResponse { + const factory _WcSessionProposeResponse( + {required final Relay relay, + required final String responderPublicKey}) = _$_WcSessionProposeResponse; + + factory _WcSessionProposeResponse.fromJson(Map json) = + _$_WcSessionProposeResponse.fromJson; + + @override + Relay get relay; + @override + String get responderPublicKey; + @override + @JsonKey(ignore: true) + _$$_WcSessionProposeResponseCopyWith<_$_WcSessionProposeResponse> + get copyWith => throw _privateConstructorUsedError; +} + +WcSessionSettleRequest _$WcSessionSettleRequestFromJson( + Map json) { + return _WcSessionSettleRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionSettleRequest { + Relay get relay => throw _privateConstructorUsedError; + Map get namespaces => throw _privateConstructorUsedError; + Map? get requiredNamespaces => + throw _privateConstructorUsedError; + Map? get optionalNamespaces => + throw _privateConstructorUsedError; + Map? get sessionProperties => + throw _privateConstructorUsedError; + int get expiry => throw _privateConstructorUsedError; + ConnectionMetadata get controller => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionSettleRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionSettleRequestCopyWith<$Res> { + factory $WcSessionSettleRequestCopyWith(WcSessionSettleRequest value, + $Res Function(WcSessionSettleRequest) then) = + _$WcSessionSettleRequestCopyWithImpl<$Res, WcSessionSettleRequest>; + @useResult + $Res call( + {Relay relay, + Map namespaces, + Map? requiredNamespaces, + Map? optionalNamespaces, + Map? sessionProperties, + int expiry, + ConnectionMetadata controller}); + + $ConnectionMetadataCopyWith<$Res> get controller; +} + +/// @nodoc +class _$WcSessionSettleRequestCopyWithImpl<$Res, + $Val extends WcSessionSettleRequest> + implements $WcSessionSettleRequestCopyWith<$Res> { + _$WcSessionSettleRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? relay = null, + Object? namespaces = null, + Object? requiredNamespaces = freezed, + Object? optionalNamespaces = freezed, + Object? sessionProperties = freezed, + Object? expiry = null, + Object? controller = null, + }) { + return _then(_value.copyWith( + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + namespaces: null == namespaces + ? _value.namespaces + : namespaces // ignore: cast_nullable_to_non_nullable + as Map, + requiredNamespaces: freezed == requiredNamespaces + ? _value.requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + optionalNamespaces: freezed == optionalNamespaces + ? _value.optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + sessionProperties: freezed == sessionProperties + ? _value.sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + controller: null == controller + ? _value.controller + : controller // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get controller { + return $ConnectionMetadataCopyWith<$Res>(_value.controller, (value) { + return _then(_value.copyWith(controller: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_WcSessionSettleRequestCopyWith<$Res> + implements $WcSessionSettleRequestCopyWith<$Res> { + factory _$$_WcSessionSettleRequestCopyWith(_$_WcSessionSettleRequest value, + $Res Function(_$_WcSessionSettleRequest) then) = + __$$_WcSessionSettleRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {Relay relay, + Map namespaces, + Map? requiredNamespaces, + Map? optionalNamespaces, + Map? sessionProperties, + int expiry, + ConnectionMetadata controller}); + + @override + $ConnectionMetadataCopyWith<$Res> get controller; +} + +/// @nodoc +class __$$_WcSessionSettleRequestCopyWithImpl<$Res> + extends _$WcSessionSettleRequestCopyWithImpl<$Res, + _$_WcSessionSettleRequest> + implements _$$_WcSessionSettleRequestCopyWith<$Res> { + __$$_WcSessionSettleRequestCopyWithImpl(_$_WcSessionSettleRequest _value, + $Res Function(_$_WcSessionSettleRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? relay = null, + Object? namespaces = null, + Object? requiredNamespaces = freezed, + Object? optionalNamespaces = freezed, + Object? sessionProperties = freezed, + Object? expiry = null, + Object? controller = null, + }) { + return _then(_$_WcSessionSettleRequest( + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + namespaces: null == namespaces + ? _value._namespaces + : namespaces // ignore: cast_nullable_to_non_nullable + as Map, + requiredNamespaces: freezed == requiredNamespaces + ? _value._requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + optionalNamespaces: freezed == optionalNamespaces + ? _value._optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + sessionProperties: freezed == sessionProperties + ? _value._sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + controller: null == controller + ? _value.controller + : controller // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_WcSessionSettleRequest implements _WcSessionSettleRequest { + const _$_WcSessionSettleRequest( + {required this.relay, + required final Map namespaces, + final Map? requiredNamespaces, + final Map? optionalNamespaces, + final Map? sessionProperties, + required this.expiry, + required this.controller}) + : _namespaces = namespaces, + _requiredNamespaces = requiredNamespaces, + _optionalNamespaces = optionalNamespaces, + _sessionProperties = sessionProperties; + + factory _$_WcSessionSettleRequest.fromJson(Map json) => + _$$_WcSessionSettleRequestFromJson(json); + + @override + final Relay relay; + final Map _namespaces; + @override + Map get namespaces { + if (_namespaces is EqualUnmodifiableMapView) return _namespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_namespaces); + } + + final Map? _requiredNamespaces; + @override + Map? get requiredNamespaces { + final value = _requiredNamespaces; + if (value == null) return null; + if (_requiredNamespaces is EqualUnmodifiableMapView) + return _requiredNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _optionalNamespaces; + @override + Map? get optionalNamespaces { + final value = _optionalNamespaces; + if (value == null) return null; + if (_optionalNamespaces is EqualUnmodifiableMapView) + return _optionalNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _sessionProperties; + @override + Map? get sessionProperties { + final value = _sessionProperties; + if (value == null) return null; + if (_sessionProperties is EqualUnmodifiableMapView) + return _sessionProperties; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final int expiry; + @override + final ConnectionMetadata controller; + + @override + String toString() { + return 'WcSessionSettleRequest(relay: $relay, namespaces: $namespaces, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, sessionProperties: $sessionProperties, expiry: $expiry, controller: $controller)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionSettleRequest && + (identical(other.relay, relay) || other.relay == relay) && + const DeepCollectionEquality() + .equals(other._namespaces, _namespaces) && + const DeepCollectionEquality() + .equals(other._requiredNamespaces, _requiredNamespaces) && + const DeepCollectionEquality() + .equals(other._optionalNamespaces, _optionalNamespaces) && + const DeepCollectionEquality() + .equals(other._sessionProperties, _sessionProperties) && + (identical(other.expiry, expiry) || other.expiry == expiry) && + (identical(other.controller, controller) || + other.controller == controller)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + relay, + const DeepCollectionEquality().hash(_namespaces), + const DeepCollectionEquality().hash(_requiredNamespaces), + const DeepCollectionEquality().hash(_optionalNamespaces), + const DeepCollectionEquality().hash(_sessionProperties), + expiry, + controller); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionSettleRequestCopyWith<_$_WcSessionSettleRequest> get copyWith => + __$$_WcSessionSettleRequestCopyWithImpl<_$_WcSessionSettleRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionSettleRequestToJson( + this, + ); + } +} + +abstract class _WcSessionSettleRequest implements WcSessionSettleRequest { + const factory _WcSessionSettleRequest( + {required final Relay relay, + required final Map namespaces, + final Map? requiredNamespaces, + final Map? optionalNamespaces, + final Map? sessionProperties, + required final int expiry, + required final ConnectionMetadata controller}) = + _$_WcSessionSettleRequest; + + factory _WcSessionSettleRequest.fromJson(Map json) = + _$_WcSessionSettleRequest.fromJson; + + @override + Relay get relay; + @override + Map get namespaces; + @override + Map? get requiredNamespaces; + @override + Map? get optionalNamespaces; + @override + Map? get sessionProperties; + @override + int get expiry; + @override + ConnectionMetadata get controller; + @override + @JsonKey(ignore: true) + _$$_WcSessionSettleRequestCopyWith<_$_WcSessionSettleRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionUpdateRequest _$WcSessionUpdateRequestFromJson( + Map json) { + return _WcSessionUpdateRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionUpdateRequest { + Map get namespaces => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionUpdateRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionUpdateRequestCopyWith<$Res> { + factory $WcSessionUpdateRequestCopyWith(WcSessionUpdateRequest value, + $Res Function(WcSessionUpdateRequest) then) = + _$WcSessionUpdateRequestCopyWithImpl<$Res, WcSessionUpdateRequest>; + @useResult + $Res call({Map namespaces}); +} + +/// @nodoc +class _$WcSessionUpdateRequestCopyWithImpl<$Res, + $Val extends WcSessionUpdateRequest> + implements $WcSessionUpdateRequestCopyWith<$Res> { + _$WcSessionUpdateRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? namespaces = null, + }) { + return _then(_value.copyWith( + namespaces: null == namespaces + ? _value.namespaces + : namespaces // ignore: cast_nullable_to_non_nullable + as Map, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcSessionUpdateRequestCopyWith<$Res> + implements $WcSessionUpdateRequestCopyWith<$Res> { + factory _$$_WcSessionUpdateRequestCopyWith(_$_WcSessionUpdateRequest value, + $Res Function(_$_WcSessionUpdateRequest) then) = + __$$_WcSessionUpdateRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({Map namespaces}); +} + +/// @nodoc +class __$$_WcSessionUpdateRequestCopyWithImpl<$Res> + extends _$WcSessionUpdateRequestCopyWithImpl<$Res, + _$_WcSessionUpdateRequest> + implements _$$_WcSessionUpdateRequestCopyWith<$Res> { + __$$_WcSessionUpdateRequestCopyWithImpl(_$_WcSessionUpdateRequest _value, + $Res Function(_$_WcSessionUpdateRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? namespaces = null, + }) { + return _then(_$_WcSessionUpdateRequest( + namespaces: null == namespaces + ? _value._namespaces + : namespaces // ignore: cast_nullable_to_non_nullable + as Map, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcSessionUpdateRequest implements _WcSessionUpdateRequest { + const _$_WcSessionUpdateRequest( + {required final Map namespaces}) + : _namespaces = namespaces; + + factory _$_WcSessionUpdateRequest.fromJson(Map json) => + _$$_WcSessionUpdateRequestFromJson(json); + + final Map _namespaces; + @override + Map get namespaces { + if (_namespaces is EqualUnmodifiableMapView) return _namespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_namespaces); + } + + @override + String toString() { + return 'WcSessionUpdateRequest(namespaces: $namespaces)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionUpdateRequest && + const DeepCollectionEquality() + .equals(other._namespaces, _namespaces)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_namespaces)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionUpdateRequestCopyWith<_$_WcSessionUpdateRequest> get copyWith => + __$$_WcSessionUpdateRequestCopyWithImpl<_$_WcSessionUpdateRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionUpdateRequestToJson( + this, + ); + } +} + +abstract class _WcSessionUpdateRequest implements WcSessionUpdateRequest { + const factory _WcSessionUpdateRequest( + {required final Map namespaces}) = + _$_WcSessionUpdateRequest; + + factory _WcSessionUpdateRequest.fromJson(Map json) = + _$_WcSessionUpdateRequest.fromJson; + + @override + Map get namespaces; + @override + @JsonKey(ignore: true) + _$$_WcSessionUpdateRequestCopyWith<_$_WcSessionUpdateRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionExtendRequest _$WcSessionExtendRequestFromJson( + Map json) { + return _WcSessionExtendRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionExtendRequest { + Map? get data => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionExtendRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionExtendRequestCopyWith<$Res> { + factory $WcSessionExtendRequestCopyWith(WcSessionExtendRequest value, + $Res Function(WcSessionExtendRequest) then) = + _$WcSessionExtendRequestCopyWithImpl<$Res, WcSessionExtendRequest>; + @useResult + $Res call({Map? data}); +} + +/// @nodoc +class _$WcSessionExtendRequestCopyWithImpl<$Res, + $Val extends WcSessionExtendRequest> + implements $WcSessionExtendRequestCopyWith<$Res> { + _$WcSessionExtendRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = freezed, + }) { + return _then(_value.copyWith( + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcSessionExtendRequestCopyWith<$Res> + implements $WcSessionExtendRequestCopyWith<$Res> { + factory _$$_WcSessionExtendRequestCopyWith(_$_WcSessionExtendRequest value, + $Res Function(_$_WcSessionExtendRequest) then) = + __$$_WcSessionExtendRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({Map? data}); +} + +/// @nodoc +class __$$_WcSessionExtendRequestCopyWithImpl<$Res> + extends _$WcSessionExtendRequestCopyWithImpl<$Res, + _$_WcSessionExtendRequest> + implements _$$_WcSessionExtendRequestCopyWith<$Res> { + __$$_WcSessionExtendRequestCopyWithImpl(_$_WcSessionExtendRequest _value, + $Res Function(_$_WcSessionExtendRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = freezed, + }) { + return _then(_$_WcSessionExtendRequest( + data: freezed == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_WcSessionExtendRequest implements _WcSessionExtendRequest { + const _$_WcSessionExtendRequest({final Map? data}) + : _data = data; + + factory _$_WcSessionExtendRequest.fromJson(Map json) => + _$$_WcSessionExtendRequestFromJson(json); + + final Map? _data; + @override + Map? get data { + final value = _data; + if (value == null) return null; + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + String toString() { + return 'WcSessionExtendRequest(data: $data)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionExtendRequest && + const DeepCollectionEquality().equals(other._data, _data)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_data)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionExtendRequestCopyWith<_$_WcSessionExtendRequest> get copyWith => + __$$_WcSessionExtendRequestCopyWithImpl<_$_WcSessionExtendRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionExtendRequestToJson( + this, + ); + } +} + +abstract class _WcSessionExtendRequest implements WcSessionExtendRequest { + const factory _WcSessionExtendRequest({final Map? data}) = + _$_WcSessionExtendRequest; + + factory _WcSessionExtendRequest.fromJson(Map json) = + _$_WcSessionExtendRequest.fromJson; + + @override + Map? get data; + @override + @JsonKey(ignore: true) + _$$_WcSessionExtendRequestCopyWith<_$_WcSessionExtendRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionDeleteRequest _$WcSessionDeleteRequestFromJson( + Map json) { + return _WcSessionDeleteRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionDeleteRequest { + int get code => throw _privateConstructorUsedError; + String get message => throw _privateConstructorUsedError; + String? get data => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionDeleteRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionDeleteRequestCopyWith<$Res> { + factory $WcSessionDeleteRequestCopyWith(WcSessionDeleteRequest value, + $Res Function(WcSessionDeleteRequest) then) = + _$WcSessionDeleteRequestCopyWithImpl<$Res, WcSessionDeleteRequest>; + @useResult + $Res call({int code, String message, String? data}); +} + +/// @nodoc +class _$WcSessionDeleteRequestCopyWithImpl<$Res, + $Val extends WcSessionDeleteRequest> + implements $WcSessionDeleteRequestCopyWith<$Res> { + _$WcSessionDeleteRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = null, + Object? data = freezed, + }) { + return _then(_value.copyWith( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcSessionDeleteRequestCopyWith<$Res> + implements $WcSessionDeleteRequestCopyWith<$Res> { + factory _$$_WcSessionDeleteRequestCopyWith(_$_WcSessionDeleteRequest value, + $Res Function(_$_WcSessionDeleteRequest) then) = + __$$_WcSessionDeleteRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({int code, String message, String? data}); +} + +/// @nodoc +class __$$_WcSessionDeleteRequestCopyWithImpl<$Res> + extends _$WcSessionDeleteRequestCopyWithImpl<$Res, + _$_WcSessionDeleteRequest> + implements _$$_WcSessionDeleteRequestCopyWith<$Res> { + __$$_WcSessionDeleteRequestCopyWithImpl(_$_WcSessionDeleteRequest _value, + $Res Function(_$_WcSessionDeleteRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? code = null, + Object? message = null, + Object? data = freezed, + }) { + return _then(_$_WcSessionDeleteRequest( + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_WcSessionDeleteRequest implements _WcSessionDeleteRequest { + const _$_WcSessionDeleteRequest( + {required this.code, required this.message, this.data}); + + factory _$_WcSessionDeleteRequest.fromJson(Map json) => + _$$_WcSessionDeleteRequestFromJson(json); + + @override + final int code; + @override + final String message; + @override + final String? data; + + @override + String toString() { + return 'WcSessionDeleteRequest(code: $code, message: $message, data: $data)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionDeleteRequest && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message) && + (identical(other.data, data) || other.data == data)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, code, message, data); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionDeleteRequestCopyWith<_$_WcSessionDeleteRequest> get copyWith => + __$$_WcSessionDeleteRequestCopyWithImpl<_$_WcSessionDeleteRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionDeleteRequestToJson( + this, + ); + } +} + +abstract class _WcSessionDeleteRequest implements WcSessionDeleteRequest { + const factory _WcSessionDeleteRequest( + {required final int code, + required final String message, + final String? data}) = _$_WcSessionDeleteRequest; + + factory _WcSessionDeleteRequest.fromJson(Map json) = + _$_WcSessionDeleteRequest.fromJson; + + @override + int get code; + @override + String get message; + @override + String? get data; + @override + @JsonKey(ignore: true) + _$$_WcSessionDeleteRequestCopyWith<_$_WcSessionDeleteRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionPingRequest _$WcSessionPingRequestFromJson(Map json) { + return _WcSessionPingRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionPingRequest { + Map? get data => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionPingRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionPingRequestCopyWith<$Res> { + factory $WcSessionPingRequestCopyWith(WcSessionPingRequest value, + $Res Function(WcSessionPingRequest) then) = + _$WcSessionPingRequestCopyWithImpl<$Res, WcSessionPingRequest>; + @useResult + $Res call({Map? data}); +} + +/// @nodoc +class _$WcSessionPingRequestCopyWithImpl<$Res, + $Val extends WcSessionPingRequest> + implements $WcSessionPingRequestCopyWith<$Res> { + _$WcSessionPingRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = freezed, + }) { + return _then(_value.copyWith( + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_WcSessionPingRequestCopyWith<$Res> + implements $WcSessionPingRequestCopyWith<$Res> { + factory _$$_WcSessionPingRequestCopyWith(_$_WcSessionPingRequest value, + $Res Function(_$_WcSessionPingRequest) then) = + __$$_WcSessionPingRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({Map? data}); +} + +/// @nodoc +class __$$_WcSessionPingRequestCopyWithImpl<$Res> + extends _$WcSessionPingRequestCopyWithImpl<$Res, _$_WcSessionPingRequest> + implements _$$_WcSessionPingRequestCopyWith<$Res> { + __$$_WcSessionPingRequestCopyWithImpl(_$_WcSessionPingRequest _value, + $Res Function(_$_WcSessionPingRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = freezed, + }) { + return _then(_$_WcSessionPingRequest( + data: freezed == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_WcSessionPingRequest implements _WcSessionPingRequest { + const _$_WcSessionPingRequest({final Map? data}) + : _data = data; + + factory _$_WcSessionPingRequest.fromJson(Map json) => + _$$_WcSessionPingRequestFromJson(json); + + final Map? _data; + @override + Map? get data { + final value = _data; + if (value == null) return null; + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + String toString() { + return 'WcSessionPingRequest(data: $data)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionPingRequest && + const DeepCollectionEquality().equals(other._data, _data)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_data)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionPingRequestCopyWith<_$_WcSessionPingRequest> get copyWith => + __$$_WcSessionPingRequestCopyWithImpl<_$_WcSessionPingRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionPingRequestToJson( + this, + ); + } +} + +abstract class _WcSessionPingRequest implements WcSessionPingRequest { + const factory _WcSessionPingRequest({final Map? data}) = + _$_WcSessionPingRequest; + + factory _WcSessionPingRequest.fromJson(Map json) = + _$_WcSessionPingRequest.fromJson; + + @override + Map? get data; + @override + @JsonKey(ignore: true) + _$$_WcSessionPingRequestCopyWith<_$_WcSessionPingRequest> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionRequestRequest _$WcSessionRequestRequestFromJson( + Map json) { + return _WcSessionRequestRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionRequestRequest { + String get chainId => throw _privateConstructorUsedError; + SessionRequestParams get request => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionRequestRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionRequestRequestCopyWith<$Res> { + factory $WcSessionRequestRequestCopyWith(WcSessionRequestRequest value, + $Res Function(WcSessionRequestRequest) then) = + _$WcSessionRequestRequestCopyWithImpl<$Res, WcSessionRequestRequest>; + @useResult + $Res call({String chainId, SessionRequestParams request}); + + $SessionRequestParamsCopyWith<$Res> get request; +} + +/// @nodoc +class _$WcSessionRequestRequestCopyWithImpl<$Res, + $Val extends WcSessionRequestRequest> + implements $WcSessionRequestRequestCopyWith<$Res> { + _$WcSessionRequestRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chainId = null, + Object? request = null, + }) { + return _then(_value.copyWith( + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + request: null == request + ? _value.request + : request // ignore: cast_nullable_to_non_nullable + as SessionRequestParams, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $SessionRequestParamsCopyWith<$Res> get request { + return $SessionRequestParamsCopyWith<$Res>(_value.request, (value) { + return _then(_value.copyWith(request: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_WcSessionRequestRequestCopyWith<$Res> + implements $WcSessionRequestRequestCopyWith<$Res> { + factory _$$_WcSessionRequestRequestCopyWith(_$_WcSessionRequestRequest value, + $Res Function(_$_WcSessionRequestRequest) then) = + __$$_WcSessionRequestRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({String chainId, SessionRequestParams request}); + + @override + $SessionRequestParamsCopyWith<$Res> get request; +} + +/// @nodoc +class __$$_WcSessionRequestRequestCopyWithImpl<$Res> + extends _$WcSessionRequestRequestCopyWithImpl<$Res, + _$_WcSessionRequestRequest> + implements _$$_WcSessionRequestRequestCopyWith<$Res> { + __$$_WcSessionRequestRequestCopyWithImpl(_$_WcSessionRequestRequest _value, + $Res Function(_$_WcSessionRequestRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chainId = null, + Object? request = null, + }) { + return _then(_$_WcSessionRequestRequest( + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + request: null == request + ? _value.request + : request // ignore: cast_nullable_to_non_nullable + as SessionRequestParams, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcSessionRequestRequest implements _WcSessionRequestRequest { + const _$_WcSessionRequestRequest( + {required this.chainId, required this.request}); + + factory _$_WcSessionRequestRequest.fromJson(Map json) => + _$$_WcSessionRequestRequestFromJson(json); + + @override + final String chainId; + @override + final SessionRequestParams request; + + @override + String toString() { + return 'WcSessionRequestRequest(chainId: $chainId, request: $request)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionRequestRequest && + (identical(other.chainId, chainId) || other.chainId == chainId) && + (identical(other.request, request) || other.request == request)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, chainId, request); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionRequestRequestCopyWith<_$_WcSessionRequestRequest> + get copyWith => + __$$_WcSessionRequestRequestCopyWithImpl<_$_WcSessionRequestRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionRequestRequestToJson( + this, + ); + } +} + +abstract class _WcSessionRequestRequest implements WcSessionRequestRequest { + const factory _WcSessionRequestRequest( + {required final String chainId, + required final SessionRequestParams request}) = + _$_WcSessionRequestRequest; + + factory _WcSessionRequestRequest.fromJson(Map json) = + _$_WcSessionRequestRequest.fromJson; + + @override + String get chainId; + @override + SessionRequestParams get request; + @override + @JsonKey(ignore: true) + _$$_WcSessionRequestRequestCopyWith<_$_WcSessionRequestRequest> + get copyWith => throw _privateConstructorUsedError; +} + +SessionRequestParams _$SessionRequestParamsFromJson(Map json) { + return _SessionRequestParams.fromJson(json); +} + +/// @nodoc +mixin _$SessionRequestParams { + String get method => throw _privateConstructorUsedError; + dynamic get params => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SessionRequestParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionRequestParamsCopyWith<$Res> { + factory $SessionRequestParamsCopyWith(SessionRequestParams value, + $Res Function(SessionRequestParams) then) = + _$SessionRequestParamsCopyWithImpl<$Res, SessionRequestParams>; + @useResult + $Res call({String method, dynamic params}); +} + +/// @nodoc +class _$SessionRequestParamsCopyWithImpl<$Res, + $Val extends SessionRequestParams> + implements $SessionRequestParamsCopyWith<$Res> { + _$SessionRequestParamsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? method = null, + Object? params = freezed, + }) { + return _then(_value.copyWith( + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_SessionRequestParamsCopyWith<$Res> + implements $SessionRequestParamsCopyWith<$Res> { + factory _$$_SessionRequestParamsCopyWith(_$_SessionRequestParams value, + $Res Function(_$_SessionRequestParams) then) = + __$$_SessionRequestParamsCopyWithImpl<$Res>; + @override + @useResult + $Res call({String method, dynamic params}); +} + +/// @nodoc +class __$$_SessionRequestParamsCopyWithImpl<$Res> + extends _$SessionRequestParamsCopyWithImpl<$Res, _$_SessionRequestParams> + implements _$$_SessionRequestParamsCopyWith<$Res> { + __$$_SessionRequestParamsCopyWithImpl(_$_SessionRequestParams _value, + $Res Function(_$_SessionRequestParams) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? method = null, + Object? params = freezed, + }) { + return _then(_$_SessionRequestParams( + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_SessionRequestParams implements _SessionRequestParams { + const _$_SessionRequestParams({required this.method, required this.params}); + + factory _$_SessionRequestParams.fromJson(Map json) => + _$$_SessionRequestParamsFromJson(json); + + @override + final String method; + @override + final dynamic params; + + @override + String toString() { + return 'SessionRequestParams(method: $method, params: $params)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_SessionRequestParams && + (identical(other.method, method) || other.method == method) && + const DeepCollectionEquality().equals(other.params, params)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, method, const DeepCollectionEquality().hash(params)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_SessionRequestParamsCopyWith<_$_SessionRequestParams> get copyWith => + __$$_SessionRequestParamsCopyWithImpl<_$_SessionRequestParams>( + this, _$identity); + + @override + Map toJson() { + return _$$_SessionRequestParamsToJson( + this, + ); + } +} + +abstract class _SessionRequestParams implements SessionRequestParams { + const factory _SessionRequestParams( + {required final String method, + required final dynamic params}) = _$_SessionRequestParams; + + factory _SessionRequestParams.fromJson(Map json) = + _$_SessionRequestParams.fromJson; + + @override + String get method; + @override + dynamic get params; + @override + @JsonKey(ignore: true) + _$$_SessionRequestParamsCopyWith<_$_SessionRequestParams> get copyWith => + throw _privateConstructorUsedError; +} + +WcSessionEventRequest _$WcSessionEventRequestFromJson( + Map json) { + return _WcSessionEventRequest.fromJson(json); +} + +/// @nodoc +mixin _$WcSessionEventRequest { + String get chainId => throw _privateConstructorUsedError; + SessionEventParams get event => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $WcSessionEventRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $WcSessionEventRequestCopyWith<$Res> { + factory $WcSessionEventRequestCopyWith(WcSessionEventRequest value, + $Res Function(WcSessionEventRequest) then) = + _$WcSessionEventRequestCopyWithImpl<$Res, WcSessionEventRequest>; + @useResult + $Res call({String chainId, SessionEventParams event}); + + $SessionEventParamsCopyWith<$Res> get event; +} + +/// @nodoc +class _$WcSessionEventRequestCopyWithImpl<$Res, + $Val extends WcSessionEventRequest> + implements $WcSessionEventRequestCopyWith<$Res> { + _$WcSessionEventRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chainId = null, + Object? event = null, + }) { + return _then(_value.copyWith( + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + event: null == event + ? _value.event + : event // ignore: cast_nullable_to_non_nullable + as SessionEventParams, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $SessionEventParamsCopyWith<$Res> get event { + return $SessionEventParamsCopyWith<$Res>(_value.event, (value) { + return _then(_value.copyWith(event: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_WcSessionEventRequestCopyWith<$Res> + implements $WcSessionEventRequestCopyWith<$Res> { + factory _$$_WcSessionEventRequestCopyWith(_$_WcSessionEventRequest value, + $Res Function(_$_WcSessionEventRequest) then) = + __$$_WcSessionEventRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call({String chainId, SessionEventParams event}); + + @override + $SessionEventParamsCopyWith<$Res> get event; +} + +/// @nodoc +class __$$_WcSessionEventRequestCopyWithImpl<$Res> + extends _$WcSessionEventRequestCopyWithImpl<$Res, _$_WcSessionEventRequest> + implements _$$_WcSessionEventRequestCopyWith<$Res> { + __$$_WcSessionEventRequestCopyWithImpl(_$_WcSessionEventRequest _value, + $Res Function(_$_WcSessionEventRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chainId = null, + Object? event = null, + }) { + return _then(_$_WcSessionEventRequest( + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + event: null == event + ? _value.event + : event // ignore: cast_nullable_to_non_nullable + as SessionEventParams, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_WcSessionEventRequest implements _WcSessionEventRequest { + const _$_WcSessionEventRequest({required this.chainId, required this.event}); + + factory _$_WcSessionEventRequest.fromJson(Map json) => + _$$_WcSessionEventRequestFromJson(json); + + @override + final String chainId; + @override + final SessionEventParams event; + + @override + String toString() { + return 'WcSessionEventRequest(chainId: $chainId, event: $event)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_WcSessionEventRequest && + (identical(other.chainId, chainId) || other.chainId == chainId) && + (identical(other.event, event) || other.event == event)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, chainId, event); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_WcSessionEventRequestCopyWith<_$_WcSessionEventRequest> get copyWith => + __$$_WcSessionEventRequestCopyWithImpl<_$_WcSessionEventRequest>( + this, _$identity); + + @override + Map toJson() { + return _$$_WcSessionEventRequestToJson( + this, + ); + } +} + +abstract class _WcSessionEventRequest implements WcSessionEventRequest { + const factory _WcSessionEventRequest( + {required final String chainId, + required final SessionEventParams event}) = _$_WcSessionEventRequest; + + factory _WcSessionEventRequest.fromJson(Map json) = + _$_WcSessionEventRequest.fromJson; + + @override + String get chainId; + @override + SessionEventParams get event; + @override + @JsonKey(ignore: true) + _$$_WcSessionEventRequestCopyWith<_$_WcSessionEventRequest> get copyWith => + throw _privateConstructorUsedError; +} + +SessionEventParams _$SessionEventParamsFromJson(Map json) { + return _SessionEventParams.fromJson(json); +} + +/// @nodoc +mixin _$SessionEventParams { + String get name => throw _privateConstructorUsedError; + dynamic get data => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SessionEventParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionEventParamsCopyWith<$Res> { + factory $SessionEventParamsCopyWith( + SessionEventParams value, $Res Function(SessionEventParams) then) = + _$SessionEventParamsCopyWithImpl<$Res, SessionEventParams>; + @useResult + $Res call({String name, dynamic data}); +} + +/// @nodoc +class _$SessionEventParamsCopyWithImpl<$Res, $Val extends SessionEventParams> + implements $SessionEventParamsCopyWith<$Res> { + _$SessionEventParamsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? data = freezed, + }) { + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_SessionEventParamsCopyWith<$Res> + implements $SessionEventParamsCopyWith<$Res> { + factory _$$_SessionEventParamsCopyWith(_$_SessionEventParams value, + $Res Function(_$_SessionEventParams) then) = + __$$_SessionEventParamsCopyWithImpl<$Res>; + @override + @useResult + $Res call({String name, dynamic data}); +} + +/// @nodoc +class __$$_SessionEventParamsCopyWithImpl<$Res> + extends _$SessionEventParamsCopyWithImpl<$Res, _$_SessionEventParams> + implements _$$_SessionEventParamsCopyWith<$Res> { + __$$_SessionEventParamsCopyWithImpl( + _$_SessionEventParams _value, $Res Function(_$_SessionEventParams) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? data = freezed, + }) { + return _then(_$_SessionEventParams( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as dynamic, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_SessionEventParams implements _SessionEventParams { + const _$_SessionEventParams({required this.name, required this.data}); + + factory _$_SessionEventParams.fromJson(Map json) => + _$$_SessionEventParamsFromJson(json); + + @override + final String name; + @override + final dynamic data; + + @override + String toString() { + return 'SessionEventParams(name: $name, data: $data)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_SessionEventParams && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.data, data)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, name, const DeepCollectionEquality().hash(data)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_SessionEventParamsCopyWith<_$_SessionEventParams> get copyWith => + __$$_SessionEventParamsCopyWithImpl<_$_SessionEventParams>( + this, _$identity); + + @override + Map toJson() { + return _$$_SessionEventParamsToJson( + this, + ); + } +} + +abstract class _SessionEventParams implements SessionEventParams { + const factory _SessionEventParams( + {required final String name, + required final dynamic data}) = _$_SessionEventParams; + + factory _SessionEventParams.fromJson(Map json) = + _$_SessionEventParams.fromJson; + + @override + String get name; + @override + dynamic get data; + @override + @JsonKey(ignore: true) + _$$_SessionEventParamsCopyWith<_$_SessionEventParams> get copyWith => + throw _privateConstructorUsedError; +} 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 e68c98f3..c1c690ac 100644 --- a/lib/apis/sign_api/models/json_rpc_models.g.dart +++ b/lib/apis/sign_api/models/json_rpc_models.g.dart @@ -6,35 +6,35 @@ part of 'json_rpc_models.dart'; // JsonSerializableGenerator // ************************************************************************** -WcPairingDeleteRequest _$WcPairingDeleteRequestFromJson( +_$_WcPairingDeleteRequest _$$_WcPairingDeleteRequestFromJson( Map json) => - WcPairingDeleteRequest( + _$_WcPairingDeleteRequest( code: json['code'] as int, message: json['message'] as String, ); -Map _$WcPairingDeleteRequestToJson( - WcPairingDeleteRequest instance) => +Map _$$_WcPairingDeleteRequestToJson( + _$_WcPairingDeleteRequest instance) => { 'code': instance.code, 'message': instance.message, }; -WcPairingPingRequest _$WcPairingPingRequestFromJson( +_$_WcPairingPingRequest _$$_WcPairingPingRequestFromJson( Map json) => - WcPairingPingRequest( + _$_WcPairingPingRequest( data: json['data'] as Map, ); -Map _$WcPairingPingRequestToJson( - WcPairingPingRequest instance) => +Map _$$_WcPairingPingRequestToJson( + _$_WcPairingPingRequest instance) => { 'data': instance.data, }; -WcSessionProposeRequest _$WcSessionProposeRequestFromJson( +_$_WcSessionProposeRequest _$$_WcSessionProposeRequestFromJson( Map json) => - WcSessionProposeRequest( + _$_WcSessionProposeRequest( relays: (json['relays'] as List) .map((e) => Relay.fromJson(e as Map)) .toList(), @@ -44,24 +44,26 @@ 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)), ), - proposer: - ConnectionMetadata.fromJson(json['proposer'] as Map), sessionProperties: (json['sessionProperties'] as Map?)?.map( (k, e) => MapEntry(k, e as String), ), + proposer: + ConnectionMetadata.fromJson(json['proposer'] as Map), ); -Map _$WcSessionProposeRequestToJson( - WcSessionProposeRequest instance) { +Map _$$_WcSessionProposeRequestToJson( + _$_WcSessionProposeRequest instance) { final val = { '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) { @@ -70,30 +72,28 @@ Map _$WcSessionProposeRequestToJson( } } - writeNotNull('optionalNamespaces', - instance.optionalNamespaces?.map((k, e) => MapEntry(k, e.toJson()))); writeNotNull('sessionProperties', instance.sessionProperties); val['proposer'] = instance.proposer.toJson(); return val; } -WcSessionProposeResponse _$WcSessionProposeResponseFromJson( +_$_WcSessionProposeResponse _$$_WcSessionProposeResponseFromJson( Map json) => - WcSessionProposeResponse( + _$_WcSessionProposeResponse( relay: Relay.fromJson(json['relay'] as Map), responderPublicKey: json['responderPublicKey'] as String, ); -Map _$WcSessionProposeResponseToJson( - WcSessionProposeResponse instance) => +Map _$$_WcSessionProposeResponseToJson( + _$_WcSessionProposeResponse instance) => { 'relay': instance.relay.toJson(), 'responderPublicKey': instance.responderPublicKey, }; -WcSessionSettleRequest _$WcSessionSettleRequestFromJson( +_$_WcSessionSettleRequest _$$_WcSessionSettleRequestFromJson( Map json) => - WcSessionSettleRequest( + _$_WcSessionSettleRequest( relay: Relay.fromJson(json['relay'] as Map), namespaces: (json['namespaces'] as Map).map( (k, e) => MapEntry(k, Namespace.fromJson(e as Map)), @@ -117,8 +117,8 @@ WcSessionSettleRequest _$WcSessionSettleRequestFromJson( json['controller'] as Map), ); -Map _$WcSessionSettleRequestToJson( - WcSessionSettleRequest instance) { +Map _$$_WcSessionSettleRequestToJson( + _$_WcSessionSettleRequest instance) { final val = { 'relay': instance.relay.toJson(), 'namespaces': instance.namespaces.map((k, e) => MapEntry(k, e.toJson())), @@ -140,28 +140,28 @@ Map _$WcSessionSettleRequestToJson( return val; } -WcSessionUpdateRequest _$WcSessionUpdateRequestFromJson( +_$_WcSessionUpdateRequest _$$_WcSessionUpdateRequestFromJson( Map json) => - WcSessionUpdateRequest( + _$_WcSessionUpdateRequest( namespaces: (json['namespaces'] as Map).map( (k, e) => MapEntry(k, Namespace.fromJson(e as Map)), ), ); -Map _$WcSessionUpdateRequestToJson( - WcSessionUpdateRequest instance) => +Map _$$_WcSessionUpdateRequestToJson( + _$_WcSessionUpdateRequest instance) => { 'namespaces': instance.namespaces.map((k, e) => MapEntry(k, e.toJson())), }; -WcSessionExtendRequest _$WcSessionExtendRequestFromJson( +_$_WcSessionExtendRequest _$$_WcSessionExtendRequestFromJson( Map json) => - WcSessionExtendRequest( + _$_WcSessionExtendRequest( data: json['data'] as Map?, ); -Map _$WcSessionExtendRequestToJson( - WcSessionExtendRequest instance) { +Map _$$_WcSessionExtendRequestToJson( + _$_WcSessionExtendRequest instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -174,16 +174,16 @@ Map _$WcSessionExtendRequestToJson( return val; } -WcSessionDeleteRequest _$WcSessionDeleteRequestFromJson( +_$_WcSessionDeleteRequest _$$_WcSessionDeleteRequestFromJson( Map json) => - WcSessionDeleteRequest( + _$_WcSessionDeleteRequest( code: json['code'] as int, message: json['message'] as String, data: json['data'] as String?, ); -Map _$WcSessionDeleteRequestToJson( - WcSessionDeleteRequest instance) { +Map _$$_WcSessionDeleteRequestToJson( + _$_WcSessionDeleteRequest instance) { final val = { 'code': instance.code, 'message': instance.message, @@ -199,14 +199,14 @@ Map _$WcSessionDeleteRequestToJson( return val; } -WcSessionPingRequest _$WcSessionPingRequestFromJson( +_$_WcSessionPingRequest _$$_WcSessionPingRequestFromJson( Map json) => - WcSessionPingRequest( + _$_WcSessionPingRequest( data: json['data'] as Map?, ); -Map _$WcSessionPingRequestToJson( - WcSessionPingRequest instance) { +Map _$$_WcSessionPingRequestToJson( + _$_WcSessionPingRequest instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -219,56 +219,58 @@ Map _$WcSessionPingRequestToJson( return val; } -WcSessionRequestRequest _$WcSessionRequestRequestFromJson( +_$_WcSessionRequestRequest _$$_WcSessionRequestRequestFromJson( Map json) => - WcSessionRequestRequest( + _$_WcSessionRequestRequest( chainId: json['chainId'] as String, request: SessionRequestParams.fromJson( json['request'] as Map), ); -Map _$WcSessionRequestRequestToJson( - WcSessionRequestRequest instance) => +Map _$$_WcSessionRequestRequestToJson( + _$_WcSessionRequestRequest instance) => { 'chainId': instance.chainId, 'request': instance.request.toJson(), }; -SessionRequestParams _$SessionRequestParamsFromJson( +_$_SessionRequestParams _$$_SessionRequestParamsFromJson( Map json) => - SessionRequestParams( + _$_SessionRequestParams( method: json['method'] as String, params: json['params'], ); -Map _$SessionRequestParamsToJson( - SessionRequestParams instance) => +Map _$$_SessionRequestParamsToJson( + _$_SessionRequestParams instance) => { 'method': instance.method, 'params': instance.params, }; -WcSessionEventRequest _$WcSessionEventRequestFromJson( +_$_WcSessionEventRequest _$$_WcSessionEventRequestFromJson( Map json) => - WcSessionEventRequest( + _$_WcSessionEventRequest( chainId: json['chainId'] as String, event: SessionEventParams.fromJson(json['event'] as Map), ); -Map _$WcSessionEventRequestToJson( - WcSessionEventRequest instance) => +Map _$$_WcSessionEventRequestToJson( + _$_WcSessionEventRequest instance) => { 'chainId': instance.chainId, 'event': instance.event.toJson(), }; -SessionEventParams _$SessionEventParamsFromJson(Map json) => - SessionEventParams( +_$_SessionEventParams _$$_SessionEventParamsFromJson( + Map json) => + _$_SessionEventParams( name: json['name'] as String, data: json['data'], ); -Map _$SessionEventParamsToJson(SessionEventParams instance) => +Map _$$_SessionEventParamsToJson( + _$_SessionEventParams instance) => { 'name': instance.name, 'data': instance.data, diff --git a/lib/apis/sign_api/models/proposal_models.dart b/lib/apis/sign_api/models/proposal_models.dart index 790ee459..3f891d0e 100644 --- a/lib/apis/sign_api/models/proposal_models.dart +++ b/lib/apis/sign_api/models/proposal_models.dart @@ -1,102 +1,51 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client_models.dart'; import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart'; import 'package:walletconnect_flutter_v2/apis/sign_api/models/session_models.dart'; part 'proposal_models.g.dart'; +part 'proposal_models.freezed.dart'; -@JsonSerializable(includeIfNull: false) -class RequiredNamespace { - final List? chains; - final List methods; - final List events; - - const RequiredNamespace({ - this.chains, - required this.methods, - required this.events, - }); +@freezed +class RequiredNamespace with _$RequiredNamespace { + @JsonSerializable(includeIfNull: false) + const factory RequiredNamespace({ + List? chains, + required List methods, + required List events, + }) = _RequiredNamespace; factory RequiredNamespace.fromJson(Map json) => _$RequiredNamespaceFromJson(json); - - Map toJson() => _$RequiredNamespaceToJson(this); - - @override - String toString() { - return 'RequiredNamespace(chains: $chains, methods: $methods, events: $events)'; - } - - @override - bool operator ==(Object other) { - return other is RequiredNamespace && hashCode == other.hashCode; - } - - @override - int get hashCode => - (chains == null - ? 0 - : chains!.fold( - 0, - (previousValue, element) => previousValue + element.hashCode, - )) + - methods.fold( - 0, - (prevValue, element) => prevValue + element.hashCode, - ) + - events.fold( - 0, - (prevValue, element) => prevValue + element.hashCode, - ); } -@JsonSerializable() -class SessionProposal { - final int id; - final ProposalData params; - - SessionProposal({ - required this.id, - required this.params, - }); +@freezed +class SessionProposal with _$SessionProposal { + @JsonSerializable() + const factory SessionProposal({ + required int id, + required ProposalData params, + }) = _SessionProposal; factory SessionProposal.fromJson(Map json) => _$SessionProposalFromJson(json); - - Map toJson() => _$SessionProposalToJson(this); } -@JsonSerializable(includeIfNull: false) -class ProposalData { - final int id; - final int expiry; - final List relays; - final ConnectionMetadata proposer; - final Map requiredNamespaces; - final Map optionalNamespaces; - final Map? sessionProperties; - final String pairingTopic; - final Map? generatedNamespaces; - - const ProposalData({ - required this.id, - required this.expiry, - required this.relays, - required this.proposer, - required this.requiredNamespaces, - required this.optionalNamespaces, - required this.pairingTopic, - this.sessionProperties, - this.generatedNamespaces, - }); +@freezed +class ProposalData with _$ProposalData { + @JsonSerializable(includeIfNull: false) + const factory ProposalData({ + required int id, + required int expiry, + required List relays, + required ConnectionMetadata proposer, + required Map requiredNamespaces, + required Map optionalNamespaces, + required String pairingTopic, + Map? sessionProperties, + Map? generatedNamespaces, + }) = _ProposalData; factory ProposalData.fromJson(Map json) => _$ProposalDataFromJson(json); - - Map toJson() => _$ProposalDataToJson(this); - - @override - String toString() { - return 'ProposalData(id: $id, expiry: $expiry, relays: $relays, proposer: $proposer, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, sessionProperties: $sessionProperties, pairingTopic: $pairingTopic, generatedNamespaces: $generatedNamespaces)'; - } } diff --git a/lib/apis/sign_api/models/proposal_models.freezed.dart b/lib/apis/sign_api/models/proposal_models.freezed.dart new file mode 100644 index 00000000..ce8252e9 --- /dev/null +++ b/lib/apis/sign_api/models/proposal_models.freezed.dart @@ -0,0 +1,761 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'proposal_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +RequiredNamespace _$RequiredNamespaceFromJson(Map json) { + return _RequiredNamespace.fromJson(json); +} + +/// @nodoc +mixin _$RequiredNamespace { + List? get chains => throw _privateConstructorUsedError; + List get methods => throw _privateConstructorUsedError; + List get events => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $RequiredNamespaceCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RequiredNamespaceCopyWith<$Res> { + factory $RequiredNamespaceCopyWith( + RequiredNamespace value, $Res Function(RequiredNamespace) then) = + _$RequiredNamespaceCopyWithImpl<$Res, RequiredNamespace>; + @useResult + $Res call({List? chains, List methods, List events}); +} + +/// @nodoc +class _$RequiredNamespaceCopyWithImpl<$Res, $Val extends RequiredNamespace> + implements $RequiredNamespaceCopyWith<$Res> { + _$RequiredNamespaceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chains = freezed, + Object? methods = null, + Object? events = null, + }) { + return _then(_value.copyWith( + chains: freezed == chains + ? _value.chains + : chains // ignore: cast_nullable_to_non_nullable + as List?, + methods: null == methods + ? _value.methods + : methods // ignore: cast_nullable_to_non_nullable + as List, + events: null == events + ? _value.events + : events // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_RequiredNamespaceCopyWith<$Res> + implements $RequiredNamespaceCopyWith<$Res> { + factory _$$_RequiredNamespaceCopyWith(_$_RequiredNamespace value, + $Res Function(_$_RequiredNamespace) then) = + __$$_RequiredNamespaceCopyWithImpl<$Res>; + @override + @useResult + $Res call({List? chains, List methods, List events}); +} + +/// @nodoc +class __$$_RequiredNamespaceCopyWithImpl<$Res> + extends _$RequiredNamespaceCopyWithImpl<$Res, _$_RequiredNamespace> + implements _$$_RequiredNamespaceCopyWith<$Res> { + __$$_RequiredNamespaceCopyWithImpl( + _$_RequiredNamespace _value, $Res Function(_$_RequiredNamespace) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chains = freezed, + Object? methods = null, + Object? events = null, + }) { + return _then(_$_RequiredNamespace( + chains: freezed == chains + ? _value._chains + : chains // ignore: cast_nullable_to_non_nullable + as List?, + methods: null == methods + ? _value._methods + : methods // ignore: cast_nullable_to_non_nullable + as List, + events: null == events + ? _value._events + : events // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_RequiredNamespace implements _RequiredNamespace { + const _$_RequiredNamespace( + {final List? chains, + required final List methods, + required final List events}) + : _chains = chains, + _methods = methods, + _events = events; + + factory _$_RequiredNamespace.fromJson(Map json) => + _$$_RequiredNamespaceFromJson(json); + + final List? _chains; + @override + List? get chains { + final value = _chains; + if (value == null) return null; + if (_chains is EqualUnmodifiableListView) return _chains; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List _methods; + @override + List get methods { + if (_methods is EqualUnmodifiableListView) return _methods; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_methods); + } + + final List _events; + @override + List get events { + if (_events is EqualUnmodifiableListView) return _events; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_events); + } + + @override + String toString() { + return 'RequiredNamespace(chains: $chains, methods: $methods, events: $events)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_RequiredNamespace && + const DeepCollectionEquality().equals(other._chains, _chains) && + const DeepCollectionEquality().equals(other._methods, _methods) && + const DeepCollectionEquality().equals(other._events, _events)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_chains), + const DeepCollectionEquality().hash(_methods), + const DeepCollectionEquality().hash(_events)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_RequiredNamespaceCopyWith<_$_RequiredNamespace> get copyWith => + __$$_RequiredNamespaceCopyWithImpl<_$_RequiredNamespace>( + this, _$identity); + + @override + Map toJson() { + return _$$_RequiredNamespaceToJson( + this, + ); + } +} + +abstract class _RequiredNamespace implements RequiredNamespace { + const factory _RequiredNamespace( + {final List? chains, + required final List methods, + required final List events}) = _$_RequiredNamespace; + + factory _RequiredNamespace.fromJson(Map json) = + _$_RequiredNamespace.fromJson; + + @override + List? get chains; + @override + List get methods; + @override + List get events; + @override + @JsonKey(ignore: true) + _$$_RequiredNamespaceCopyWith<_$_RequiredNamespace> get copyWith => + throw _privateConstructorUsedError; +} + +SessionProposal _$SessionProposalFromJson(Map json) { + return _SessionProposal.fromJson(json); +} + +/// @nodoc +mixin _$SessionProposal { + int get id => throw _privateConstructorUsedError; + ProposalData get params => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SessionProposalCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionProposalCopyWith<$Res> { + factory $SessionProposalCopyWith( + SessionProposal value, $Res Function(SessionProposal) then) = + _$SessionProposalCopyWithImpl<$Res, SessionProposal>; + @useResult + $Res call({int id, ProposalData params}); + + $ProposalDataCopyWith<$Res> get params; +} + +/// @nodoc +class _$SessionProposalCopyWithImpl<$Res, $Val extends SessionProposal> + implements $SessionProposalCopyWith<$Res> { + _$SessionProposalCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? params = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + params: null == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as ProposalData, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ProposalDataCopyWith<$Res> get params { + return $ProposalDataCopyWith<$Res>(_value.params, (value) { + return _then(_value.copyWith(params: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_SessionProposalCopyWith<$Res> + implements $SessionProposalCopyWith<$Res> { + factory _$$_SessionProposalCopyWith( + _$_SessionProposal value, $Res Function(_$_SessionProposal) then) = + __$$_SessionProposalCopyWithImpl<$Res>; + @override + @useResult + $Res call({int id, ProposalData params}); + + @override + $ProposalDataCopyWith<$Res> get params; +} + +/// @nodoc +class __$$_SessionProposalCopyWithImpl<$Res> + extends _$SessionProposalCopyWithImpl<$Res, _$_SessionProposal> + implements _$$_SessionProposalCopyWith<$Res> { + __$$_SessionProposalCopyWithImpl( + _$_SessionProposal _value, $Res Function(_$_SessionProposal) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? params = null, + }) { + return _then(_$_SessionProposal( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + params: null == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as ProposalData, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_SessionProposal implements _SessionProposal { + const _$_SessionProposal({required this.id, required this.params}); + + factory _$_SessionProposal.fromJson(Map json) => + _$$_SessionProposalFromJson(json); + + @override + final int id; + @override + final ProposalData params; + + @override + String toString() { + return 'SessionProposal(id: $id, params: $params)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_SessionProposal && + (identical(other.id, id) || other.id == id) && + (identical(other.params, params) || other.params == params)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, params); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_SessionProposalCopyWith<_$_SessionProposal> get copyWith => + __$$_SessionProposalCopyWithImpl<_$_SessionProposal>(this, _$identity); + + @override + Map toJson() { + return _$$_SessionProposalToJson( + this, + ); + } +} + +abstract class _SessionProposal implements SessionProposal { + const factory _SessionProposal( + {required final int id, + required final ProposalData params}) = _$_SessionProposal; + + factory _SessionProposal.fromJson(Map json) = + _$_SessionProposal.fromJson; + + @override + int get id; + @override + ProposalData get params; + @override + @JsonKey(ignore: true) + _$$_SessionProposalCopyWith<_$_SessionProposal> get copyWith => + throw _privateConstructorUsedError; +} + +ProposalData _$ProposalDataFromJson(Map json) { + return _ProposalData.fromJson(json); +} + +/// @nodoc +mixin _$ProposalData { + int get id => throw _privateConstructorUsedError; + int get expiry => throw _privateConstructorUsedError; + List get relays => throw _privateConstructorUsedError; + ConnectionMetadata get proposer => throw _privateConstructorUsedError; + Map get requiredNamespaces => + throw _privateConstructorUsedError; + Map get optionalNamespaces => + throw _privateConstructorUsedError; + String get pairingTopic => throw _privateConstructorUsedError; + Map? get sessionProperties => + throw _privateConstructorUsedError; + Map? get generatedNamespaces => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ProposalDataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProposalDataCopyWith<$Res> { + factory $ProposalDataCopyWith( + ProposalData value, $Res Function(ProposalData) then) = + _$ProposalDataCopyWithImpl<$Res, ProposalData>; + @useResult + $Res call( + {int id, + int expiry, + List relays, + ConnectionMetadata proposer, + Map requiredNamespaces, + Map optionalNamespaces, + String pairingTopic, + Map? sessionProperties, + Map? generatedNamespaces}); + + $ConnectionMetadataCopyWith<$Res> get proposer; +} + +/// @nodoc +class _$ProposalDataCopyWithImpl<$Res, $Val extends ProposalData> + implements $ProposalDataCopyWith<$Res> { + _$ProposalDataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? expiry = null, + Object? relays = null, + Object? proposer = null, + Object? requiredNamespaces = null, + Object? optionalNamespaces = null, + Object? pairingTopic = null, + Object? sessionProperties = freezed, + Object? generatedNamespaces = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + relays: null == relays + ? _value.relays + : relays // ignore: cast_nullable_to_non_nullable + as List, + proposer: null == proposer + ? _value.proposer + : proposer // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + requiredNamespaces: null == requiredNamespaces + ? _value.requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + optionalNamespaces: null == optionalNamespaces + ? _value.optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + sessionProperties: freezed == sessionProperties + ? _value.sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + generatedNamespaces: freezed == generatedNamespaces + ? _value.generatedNamespaces + : generatedNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get proposer { + return $ConnectionMetadataCopyWith<$Res>(_value.proposer, (value) { + return _then(_value.copyWith(proposer: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_ProposalDataCopyWith<$Res> + implements $ProposalDataCopyWith<$Res> { + factory _$$_ProposalDataCopyWith( + _$_ProposalData value, $Res Function(_$_ProposalData) then) = + __$$_ProposalDataCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + int expiry, + List relays, + ConnectionMetadata proposer, + Map requiredNamespaces, + Map optionalNamespaces, + String pairingTopic, + Map? sessionProperties, + Map? generatedNamespaces}); + + @override + $ConnectionMetadataCopyWith<$Res> get proposer; +} + +/// @nodoc +class __$$_ProposalDataCopyWithImpl<$Res> + extends _$ProposalDataCopyWithImpl<$Res, _$_ProposalData> + implements _$$_ProposalDataCopyWith<$Res> { + __$$_ProposalDataCopyWithImpl( + _$_ProposalData _value, $Res Function(_$_ProposalData) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? expiry = null, + Object? relays = null, + Object? proposer = null, + Object? requiredNamespaces = null, + Object? optionalNamespaces = null, + Object? pairingTopic = null, + Object? sessionProperties = freezed, + Object? generatedNamespaces = freezed, + }) { + return _then(_$_ProposalData( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + relays: null == relays + ? _value._relays + : relays // ignore: cast_nullable_to_non_nullable + as List, + proposer: null == proposer + ? _value.proposer + : proposer // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + requiredNamespaces: null == requiredNamespaces + ? _value._requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + optionalNamespaces: null == optionalNamespaces + ? _value._optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + sessionProperties: freezed == sessionProperties + ? _value._sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + generatedNamespaces: freezed == generatedNamespaces + ? _value._generatedNamespaces + : generatedNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_ProposalData implements _ProposalData { + const _$_ProposalData( + {required this.id, + required this.expiry, + required final List relays, + required this.proposer, + required final Map requiredNamespaces, + required final Map optionalNamespaces, + required this.pairingTopic, + final Map? sessionProperties, + final Map? generatedNamespaces}) + : _relays = relays, + _requiredNamespaces = requiredNamespaces, + _optionalNamespaces = optionalNamespaces, + _sessionProperties = sessionProperties, + _generatedNamespaces = generatedNamespaces; + + factory _$_ProposalData.fromJson(Map json) => + _$$_ProposalDataFromJson(json); + + @override + final int id; + @override + final int expiry; + final List _relays; + @override + List get relays { + if (_relays is EqualUnmodifiableListView) return _relays; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_relays); + } + + @override + final ConnectionMetadata proposer; + final Map _requiredNamespaces; + @override + Map get requiredNamespaces { + if (_requiredNamespaces is EqualUnmodifiableMapView) + return _requiredNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_requiredNamespaces); + } + + final Map _optionalNamespaces; + @override + Map get optionalNamespaces { + if (_optionalNamespaces is EqualUnmodifiableMapView) + return _optionalNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_optionalNamespaces); + } + + @override + final String pairingTopic; + final Map? _sessionProperties; + @override + Map? get sessionProperties { + final value = _sessionProperties; + if (value == null) return null; + if (_sessionProperties is EqualUnmodifiableMapView) + return _sessionProperties; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _generatedNamespaces; + @override + Map? get generatedNamespaces { + final value = _generatedNamespaces; + if (value == null) return null; + if (_generatedNamespaces is EqualUnmodifiableMapView) + return _generatedNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + String toString() { + return 'ProposalData(id: $id, expiry: $expiry, relays: $relays, proposer: $proposer, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, pairingTopic: $pairingTopic, sessionProperties: $sessionProperties, generatedNamespaces: $generatedNamespaces)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_ProposalData && + (identical(other.id, id) || other.id == id) && + (identical(other.expiry, expiry) || other.expiry == expiry) && + const DeepCollectionEquality().equals(other._relays, _relays) && + (identical(other.proposer, proposer) || + other.proposer == proposer) && + const DeepCollectionEquality() + .equals(other._requiredNamespaces, _requiredNamespaces) && + const DeepCollectionEquality() + .equals(other._optionalNamespaces, _optionalNamespaces) && + (identical(other.pairingTopic, pairingTopic) || + other.pairingTopic == pairingTopic) && + const DeepCollectionEquality() + .equals(other._sessionProperties, _sessionProperties) && + const DeepCollectionEquality() + .equals(other._generatedNamespaces, _generatedNamespaces)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + id, + expiry, + const DeepCollectionEquality().hash(_relays), + proposer, + const DeepCollectionEquality().hash(_requiredNamespaces), + const DeepCollectionEquality().hash(_optionalNamespaces), + pairingTopic, + const DeepCollectionEquality().hash(_sessionProperties), + const DeepCollectionEquality().hash(_generatedNamespaces)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_ProposalDataCopyWith<_$_ProposalData> get copyWith => + __$$_ProposalDataCopyWithImpl<_$_ProposalData>(this, _$identity); + + @override + Map toJson() { + return _$$_ProposalDataToJson( + this, + ); + } +} + +abstract class _ProposalData implements ProposalData { + const factory _ProposalData( + {required final int id, + required final int expiry, + required final List relays, + required final ConnectionMetadata proposer, + required final Map requiredNamespaces, + required final Map optionalNamespaces, + required final String pairingTopic, + final Map? sessionProperties, + final Map? generatedNamespaces}) = _$_ProposalData; + + factory _ProposalData.fromJson(Map json) = + _$_ProposalData.fromJson; + + @override + int get id; + @override + int get expiry; + @override + List get relays; + @override + ConnectionMetadata get proposer; + @override + Map get requiredNamespaces; + @override + Map get optionalNamespaces; + @override + String get pairingTopic; + @override + Map? get sessionProperties; + @override + Map? get generatedNamespaces; + @override + @JsonKey(ignore: true) + _$$_ProposalDataCopyWith<_$_ProposalData> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/sign_api/models/proposal_models.g.dart b/lib/apis/sign_api/models/proposal_models.g.dart index 1c1ddf0f..47ae9228 100644 --- a/lib/apis/sign_api/models/proposal_models.g.dart +++ b/lib/apis/sign_api/models/proposal_models.g.dart @@ -6,8 +6,8 @@ part of 'proposal_models.dart'; // JsonSerializableGenerator // ************************************************************************** -RequiredNamespace _$RequiredNamespaceFromJson(Map json) => - RequiredNamespace( +_$_RequiredNamespace _$$_RequiredNamespaceFromJson(Map json) => + _$_RequiredNamespace( chains: (json['chains'] as List?)?.map((e) => e as String).toList(), methods: @@ -16,7 +16,8 @@ RequiredNamespace _$RequiredNamespaceFromJson(Map json) => (json['events'] as List).map((e) => e as String).toList(), ); -Map _$RequiredNamespaceToJson(RequiredNamespace instance) { +Map _$$_RequiredNamespaceToJson( + _$_RequiredNamespace instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -31,19 +32,20 @@ Map _$RequiredNamespaceToJson(RequiredNamespace instance) { return val; } -SessionProposal _$SessionProposalFromJson(Map json) => - SessionProposal( +_$_SessionProposal _$$_SessionProposalFromJson(Map json) => + _$_SessionProposal( id: json['id'] as int, params: ProposalData.fromJson(json['params'] as Map), ); -Map _$SessionProposalToJson(SessionProposal instance) => +Map _$$_SessionProposalToJson(_$_SessionProposal instance) => { 'id': instance.id, 'params': instance.params.toJson(), }; -ProposalData _$ProposalDataFromJson(Map json) => ProposalData( +_$_ProposalData _$$_ProposalDataFromJson(Map json) => + _$_ProposalData( id: json['id'] as int, expiry: json['expiry'] as int, relays: (json['relays'] as List) @@ -72,7 +74,7 @@ ProposalData _$ProposalDataFromJson(Map json) => ProposalData( ), ); -Map _$ProposalDataToJson(ProposalData instance) { +Map _$$_ProposalDataToJson(_$_ProposalData instance) { final val = { 'id': instance.id, 'expiry': instance.expiry, @@ -82,6 +84,7 @@ Map _$ProposalDataToJson(ProposalData instance) { instance.requiredNamespaces.map((k, e) => MapEntry(k, e.toJson())), 'optionalNamespaces': instance.optionalNamespaces.map((k, e) => MapEntry(k, e.toJson())), + 'pairingTopic': instance.pairingTopic, }; void writeNotNull(String key, dynamic value) { @@ -91,7 +94,6 @@ Map _$ProposalDataToJson(ProposalData instance) { } writeNotNull('sessionProperties', instance.sessionProperties); - val['pairingTopic'] = instance.pairingTopic; writeNotNull('generatedNamespaces', instance.generatedNamespaces?.map((k, e) => MapEntry(k, e.toJson()))); return val; diff --git a/lib/apis/sign_api/models/session_models.dart b/lib/apis/sign_api/models/session_models.dart index 8e6768b9..3f096a20 100644 --- a/lib/apis/sign_api/models/session_models.dart +++ b/lib/apis/sign_api/models/session_models.dart @@ -1,11 +1,12 @@ import 'dart:async'; -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client_models.dart'; import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart'; import 'package:walletconnect_flutter_v2/apis/sign_api/models/proposal_models.dart'; part 'session_models.g.dart'; +part 'session_models.freezed.dart'; class SessionProposalCompleter { final int id; @@ -32,131 +33,52 @@ class SessionProposalCompleter { } } -@JsonSerializable() -class Namespace { - final List accounts; - final List methods; - final List events; - - const Namespace({ - required this.accounts, - required this.methods, - required this.events, - }); +@freezed +class Namespace with _$Namespace { + @JsonSerializable() + const factory Namespace({ + required List accounts, + required List methods, + required List events, + }) = _Namespace; factory Namespace.fromJson(Map json) => _$NamespaceFromJson(json); - - Map toJson() => _$NamespaceToJson(this); - - @override - String toString() { - return 'Namespace(accounts: $accounts, methods: $methods, events: $events)'; - } - - @override - bool operator ==(Object other) { - return other is Namespace && hashCode == other.hashCode; - } - - @override - int get hashCode => - accounts.fold( - 0, - (prevValue, element) => prevValue + element.hashCode, - ) + - methods.fold( - 0, - (prevValue, element) => prevValue + element.hashCode, - ) + - events.fold( - 0, - (prevValue, element) => prevValue + element.hashCode, - ); } -@JsonSerializable(includeIfNull: false) -class SessionData { - final String topic; - final String pairingTopic; - final Relay relay; - int expiry; - bool acknowledged; - final String controller; - Map namespaces; - final Map? requiredNamespaces; - final Map? optionalNamespaces; - final Map? sessionProperties; - final ConnectionMetadata self; - final ConnectionMetadata peer; - - SessionData({ - required this.topic, - required this.pairingTopic, - required this.relay, - required this.expiry, - required this.acknowledged, - required this.controller, - required this.namespaces, - this.requiredNamespaces, - this.optionalNamespaces, - this.sessionProperties, - required this.self, - required this.peer, - }); +@freezed +class SessionData with _$SessionData { + @JsonSerializable(includeIfNull: false) + const factory SessionData({ + required String topic, + required String pairingTopic, + required Relay relay, + required int expiry, + required bool acknowledged, + required String controller, + required Map namespaces, + Map? requiredNamespaces, + Map? optionalNamespaces, + Map? sessionProperties, + required ConnectionMetadata self, + required ConnectionMetadata peer, + }) = _SessionData; factory SessionData.fromJson(Map json) => _$SessionDataFromJson(json); - - Map toJson() => _$SessionDataToJson(this); - - SessionData withAcknowledged(bool value) { - return SessionData( - topic: topic, - pairingTopic: pairingTopic, - relay: relay, - expiry: expiry, - acknowledged: value, - controller: controller, - namespaces: namespaces, - self: self, - peer: peer, - requiredNamespaces: requiredNamespaces, - optionalNamespaces: optionalNamespaces, - sessionProperties: sessionProperties, - ); - } - - @override - String toString() { - return 'SessionData(topic: $topic, pairingTopic: $pairingTopic, relay: $relay, expiry: $expiry, acknowledged: $acknowledged, controller: $controller, namespaces: $namespaces, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, sessionProperties: $sessionProperties, self: $self, peer: $peer)'; - } } -@JsonSerializable() -class SessionRequest { - /// The JSON-RPC request id - int id; - String topic; - String method; - String chainId; - dynamic params; - - SessionRequest({ - required this.id, - required this.topic, - required this.method, - required this.chainId, - required this.params, - }); +@freezed +class SessionRequest with _$SessionRequest { + @JsonSerializable() + const factory SessionRequest({ + required int id, + required String topic, + required String method, + required String chainId, + required dynamic params, + }) = _SessionRequest; factory SessionRequest.fromJson(Map json) => _$SessionRequestFromJson(json); - - Map toJson() => _$SessionRequestToJson(this); - - @override - String toString() { - return 'SessionRequest(id: $id, topic: $topic, method: $method, chainId: $chainId, params: $params)'; - } } diff --git a/lib/apis/sign_api/models/session_models.freezed.dart b/lib/apis/sign_api/models/session_models.freezed.dart new file mode 100644 index 00000000..526a2f9d --- /dev/null +++ b/lib/apis/sign_api/models/session_models.freezed.dart @@ -0,0 +1,871 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'session_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +Namespace _$NamespaceFromJson(Map json) { + return _Namespace.fromJson(json); +} + +/// @nodoc +mixin _$Namespace { + List get accounts => throw _privateConstructorUsedError; + List get methods => throw _privateConstructorUsedError; + List get events => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $NamespaceCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $NamespaceCopyWith<$Res> { + factory $NamespaceCopyWith(Namespace value, $Res Function(Namespace) then) = + _$NamespaceCopyWithImpl<$Res, Namespace>; + @useResult + $Res call({List accounts, List methods, List events}); +} + +/// @nodoc +class _$NamespaceCopyWithImpl<$Res, $Val extends Namespace> + implements $NamespaceCopyWith<$Res> { + _$NamespaceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? accounts = null, + Object? methods = null, + Object? events = null, + }) { + return _then(_value.copyWith( + accounts: null == accounts + ? _value.accounts + : accounts // ignore: cast_nullable_to_non_nullable + as List, + methods: null == methods + ? _value.methods + : methods // ignore: cast_nullable_to_non_nullable + as List, + events: null == events + ? _value.events + : events // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_NamespaceCopyWith<$Res> implements $NamespaceCopyWith<$Res> { + factory _$$_NamespaceCopyWith( + _$_Namespace value, $Res Function(_$_Namespace) then) = + __$$_NamespaceCopyWithImpl<$Res>; + @override + @useResult + $Res call({List accounts, List methods, List events}); +} + +/// @nodoc +class __$$_NamespaceCopyWithImpl<$Res> + extends _$NamespaceCopyWithImpl<$Res, _$_Namespace> + implements _$$_NamespaceCopyWith<$Res> { + __$$_NamespaceCopyWithImpl( + _$_Namespace _value, $Res Function(_$_Namespace) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? accounts = null, + Object? methods = null, + Object? events = null, + }) { + return _then(_$_Namespace( + accounts: null == accounts + ? _value._accounts + : accounts // ignore: cast_nullable_to_non_nullable + as List, + methods: null == methods + ? _value._methods + : methods // ignore: cast_nullable_to_non_nullable + as List, + events: null == events + ? _value._events + : events // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_Namespace implements _Namespace { + const _$_Namespace( + {required final List accounts, + required final List methods, + required final List events}) + : _accounts = accounts, + _methods = methods, + _events = events; + + factory _$_Namespace.fromJson(Map json) => + _$$_NamespaceFromJson(json); + + final List _accounts; + @override + List get accounts { + if (_accounts is EqualUnmodifiableListView) return _accounts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_accounts); + } + + final List _methods; + @override + List get methods { + if (_methods is EqualUnmodifiableListView) return _methods; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_methods); + } + + final List _events; + @override + List get events { + if (_events is EqualUnmodifiableListView) return _events; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_events); + } + + @override + String toString() { + return 'Namespace(accounts: $accounts, methods: $methods, events: $events)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_Namespace && + const DeepCollectionEquality().equals(other._accounts, _accounts) && + const DeepCollectionEquality().equals(other._methods, _methods) && + const DeepCollectionEquality().equals(other._events, _events)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_accounts), + const DeepCollectionEquality().hash(_methods), + const DeepCollectionEquality().hash(_events)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_NamespaceCopyWith<_$_Namespace> get copyWith => + __$$_NamespaceCopyWithImpl<_$_Namespace>(this, _$identity); + + @override + Map toJson() { + return _$$_NamespaceToJson( + this, + ); + } +} + +abstract class _Namespace implements Namespace { + const factory _Namespace( + {required final List accounts, + required final List methods, + required final List events}) = _$_Namespace; + + factory _Namespace.fromJson(Map json) = + _$_Namespace.fromJson; + + @override + List get accounts; + @override + List get methods; + @override + List get events; + @override + @JsonKey(ignore: true) + _$$_NamespaceCopyWith<_$_Namespace> get copyWith => + throw _privateConstructorUsedError; +} + +SessionData _$SessionDataFromJson(Map json) { + return _SessionData.fromJson(json); +} + +/// @nodoc +mixin _$SessionData { + String get topic => throw _privateConstructorUsedError; + String get pairingTopic => throw _privateConstructorUsedError; + Relay get relay => throw _privateConstructorUsedError; + int get expiry => throw _privateConstructorUsedError; + bool get acknowledged => throw _privateConstructorUsedError; + String get controller => throw _privateConstructorUsedError; + Map get namespaces => throw _privateConstructorUsedError; + Map? get requiredNamespaces => + throw _privateConstructorUsedError; + Map? get optionalNamespaces => + throw _privateConstructorUsedError; + Map? get sessionProperties => + throw _privateConstructorUsedError; + ConnectionMetadata get self => throw _privateConstructorUsedError; + ConnectionMetadata get peer => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SessionDataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionDataCopyWith<$Res> { + factory $SessionDataCopyWith( + SessionData value, $Res Function(SessionData) then) = + _$SessionDataCopyWithImpl<$Res, SessionData>; + @useResult + $Res call( + {String topic, + String pairingTopic, + Relay relay, + int expiry, + bool acknowledged, + String controller, + Map namespaces, + Map? requiredNamespaces, + Map? optionalNamespaces, + Map? sessionProperties, + ConnectionMetadata self, + ConnectionMetadata peer}); + + $ConnectionMetadataCopyWith<$Res> get self; + $ConnectionMetadataCopyWith<$Res> get peer; +} + +/// @nodoc +class _$SessionDataCopyWithImpl<$Res, $Val extends SessionData> + implements $SessionDataCopyWith<$Res> { + _$SessionDataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topic = null, + Object? pairingTopic = null, + Object? relay = null, + Object? expiry = null, + Object? acknowledged = null, + Object? controller = null, + Object? namespaces = null, + Object? requiredNamespaces = freezed, + Object? optionalNamespaces = freezed, + Object? sessionProperties = freezed, + Object? self = null, + Object? peer = null, + }) { + return _then(_value.copyWith( + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + acknowledged: null == acknowledged + ? _value.acknowledged + : acknowledged // ignore: cast_nullable_to_non_nullable + as bool, + controller: null == controller + ? _value.controller + : controller // ignore: cast_nullable_to_non_nullable + as String, + namespaces: null == namespaces + ? _value.namespaces + : namespaces // ignore: cast_nullable_to_non_nullable + as Map, + requiredNamespaces: freezed == requiredNamespaces + ? _value.requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + optionalNamespaces: freezed == optionalNamespaces + ? _value.optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + sessionProperties: freezed == sessionProperties + ? _value.sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + self: null == self + ? _value.self + : self // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + peer: null == peer + ? _value.peer + : peer // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get self { + return $ConnectionMetadataCopyWith<$Res>(_value.self, (value) { + return _then(_value.copyWith(self: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $ConnectionMetadataCopyWith<$Res> get peer { + return $ConnectionMetadataCopyWith<$Res>(_value.peer, (value) { + return _then(_value.copyWith(peer: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_SessionDataCopyWith<$Res> + implements $SessionDataCopyWith<$Res> { + factory _$$_SessionDataCopyWith( + _$_SessionData value, $Res Function(_$_SessionData) then) = + __$$_SessionDataCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String topic, + String pairingTopic, + Relay relay, + int expiry, + bool acknowledged, + String controller, + Map namespaces, + Map? requiredNamespaces, + Map? optionalNamespaces, + Map? sessionProperties, + ConnectionMetadata self, + ConnectionMetadata peer}); + + @override + $ConnectionMetadataCopyWith<$Res> get self; + @override + $ConnectionMetadataCopyWith<$Res> get peer; +} + +/// @nodoc +class __$$_SessionDataCopyWithImpl<$Res> + extends _$SessionDataCopyWithImpl<$Res, _$_SessionData> + implements _$$_SessionDataCopyWith<$Res> { + __$$_SessionDataCopyWithImpl( + _$_SessionData _value, $Res Function(_$_SessionData) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topic = null, + Object? pairingTopic = null, + Object? relay = null, + Object? expiry = null, + Object? acknowledged = null, + Object? controller = null, + Object? namespaces = null, + Object? requiredNamespaces = freezed, + Object? optionalNamespaces = freezed, + Object? sessionProperties = freezed, + Object? self = null, + Object? peer = null, + }) { + return _then(_$_SessionData( + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + pairingTopic: null == pairingTopic + ? _value.pairingTopic + : pairingTopic // ignore: cast_nullable_to_non_nullable + as String, + relay: null == relay + ? _value.relay + : relay // ignore: cast_nullable_to_non_nullable + as Relay, + expiry: null == expiry + ? _value.expiry + : expiry // ignore: cast_nullable_to_non_nullable + as int, + acknowledged: null == acknowledged + ? _value.acknowledged + : acknowledged // ignore: cast_nullable_to_non_nullable + as bool, + controller: null == controller + ? _value.controller + : controller // ignore: cast_nullable_to_non_nullable + as String, + namespaces: null == namespaces + ? _value._namespaces + : namespaces // ignore: cast_nullable_to_non_nullable + as Map, + requiredNamespaces: freezed == requiredNamespaces + ? _value._requiredNamespaces + : requiredNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + optionalNamespaces: freezed == optionalNamespaces + ? _value._optionalNamespaces + : optionalNamespaces // ignore: cast_nullable_to_non_nullable + as Map?, + sessionProperties: freezed == sessionProperties + ? _value._sessionProperties + : sessionProperties // ignore: cast_nullable_to_non_nullable + as Map?, + self: null == self + ? _value.self + : self // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + peer: null == peer + ? _value.peer + : peer // ignore: cast_nullable_to_non_nullable + as ConnectionMetadata, + )); + } +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _$_SessionData implements _SessionData { + const _$_SessionData( + {required this.topic, + required this.pairingTopic, + required this.relay, + required this.expiry, + required this.acknowledged, + required this.controller, + required final Map namespaces, + final Map? requiredNamespaces, + final Map? optionalNamespaces, + final Map? sessionProperties, + required this.self, + required this.peer}) + : _namespaces = namespaces, + _requiredNamespaces = requiredNamespaces, + _optionalNamespaces = optionalNamespaces, + _sessionProperties = sessionProperties; + + factory _$_SessionData.fromJson(Map json) => + _$$_SessionDataFromJson(json); + + @override + final String topic; + @override + final String pairingTopic; + @override + final Relay relay; + @override + final int expiry; + @override + final bool acknowledged; + @override + final String controller; + final Map _namespaces; + @override + Map get namespaces { + if (_namespaces is EqualUnmodifiableMapView) return _namespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_namespaces); + } + + final Map? _requiredNamespaces; + @override + Map? get requiredNamespaces { + final value = _requiredNamespaces; + if (value == null) return null; + if (_requiredNamespaces is EqualUnmodifiableMapView) + return _requiredNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _optionalNamespaces; + @override + Map? get optionalNamespaces { + final value = _optionalNamespaces; + if (value == null) return null; + if (_optionalNamespaces is EqualUnmodifiableMapView) + return _optionalNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _sessionProperties; + @override + Map? get sessionProperties { + final value = _sessionProperties; + if (value == null) return null; + if (_sessionProperties is EqualUnmodifiableMapView) + return _sessionProperties; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final ConnectionMetadata self; + @override + final ConnectionMetadata peer; + + @override + String toString() { + return 'SessionData(topic: $topic, pairingTopic: $pairingTopic, relay: $relay, expiry: $expiry, acknowledged: $acknowledged, controller: $controller, namespaces: $namespaces, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, sessionProperties: $sessionProperties, self: $self, peer: $peer)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_SessionData && + (identical(other.topic, topic) || other.topic == topic) && + (identical(other.pairingTopic, pairingTopic) || + other.pairingTopic == pairingTopic) && + (identical(other.relay, relay) || other.relay == relay) && + (identical(other.expiry, expiry) || other.expiry == expiry) && + (identical(other.acknowledged, acknowledged) || + other.acknowledged == acknowledged) && + (identical(other.controller, controller) || + other.controller == controller) && + const DeepCollectionEquality() + .equals(other._namespaces, _namespaces) && + const DeepCollectionEquality() + .equals(other._requiredNamespaces, _requiredNamespaces) && + const DeepCollectionEquality() + .equals(other._optionalNamespaces, _optionalNamespaces) && + const DeepCollectionEquality() + .equals(other._sessionProperties, _sessionProperties) && + (identical(other.self, self) || other.self == self) && + (identical(other.peer, peer) || other.peer == peer)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + topic, + pairingTopic, + relay, + expiry, + acknowledged, + controller, + const DeepCollectionEquality().hash(_namespaces), + const DeepCollectionEquality().hash(_requiredNamespaces), + const DeepCollectionEquality().hash(_optionalNamespaces), + const DeepCollectionEquality().hash(_sessionProperties), + self, + peer); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_SessionDataCopyWith<_$_SessionData> get copyWith => + __$$_SessionDataCopyWithImpl<_$_SessionData>(this, _$identity); + + @override + Map toJson() { + return _$$_SessionDataToJson( + this, + ); + } +} + +abstract class _SessionData implements SessionData { + const factory _SessionData( + {required final String topic, + required final String pairingTopic, + required final Relay relay, + required final int expiry, + required final bool acknowledged, + required final String controller, + required final Map namespaces, + final Map? requiredNamespaces, + final Map? optionalNamespaces, + final Map? sessionProperties, + required final ConnectionMetadata self, + required final ConnectionMetadata peer}) = _$_SessionData; + + factory _SessionData.fromJson(Map json) = + _$_SessionData.fromJson; + + @override + String get topic; + @override + String get pairingTopic; + @override + Relay get relay; + @override + int get expiry; + @override + bool get acknowledged; + @override + String get controller; + @override + Map get namespaces; + @override + Map? get requiredNamespaces; + @override + Map? get optionalNamespaces; + @override + Map? get sessionProperties; + @override + ConnectionMetadata get self; + @override + ConnectionMetadata get peer; + @override + @JsonKey(ignore: true) + _$$_SessionDataCopyWith<_$_SessionData> get copyWith => + throw _privateConstructorUsedError; +} + +SessionRequest _$SessionRequestFromJson(Map json) { + return _SessionRequest.fromJson(json); +} + +/// @nodoc +mixin _$SessionRequest { + int get id => throw _privateConstructorUsedError; + String get topic => throw _privateConstructorUsedError; + String get method => throw _privateConstructorUsedError; + String get chainId => throw _privateConstructorUsedError; + dynamic get params => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SessionRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionRequestCopyWith<$Res> { + factory $SessionRequestCopyWith( + SessionRequest value, $Res Function(SessionRequest) then) = + _$SessionRequestCopyWithImpl<$Res, SessionRequest>; + @useResult + $Res call( + {int id, String topic, String method, String chainId, dynamic params}); +} + +/// @nodoc +class _$SessionRequestCopyWithImpl<$Res, $Val extends SessionRequest> + implements $SessionRequestCopyWith<$Res> { + _$SessionRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? topic = null, + Object? method = null, + Object? chainId = null, + Object? params = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_SessionRequestCopyWith<$Res> + implements $SessionRequestCopyWith<$Res> { + factory _$$_SessionRequestCopyWith( + _$_SessionRequest value, $Res Function(_$_SessionRequest) then) = + __$$_SessionRequestCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, String topic, String method, String chainId, dynamic params}); +} + +/// @nodoc +class __$$_SessionRequestCopyWithImpl<$Res> + extends _$SessionRequestCopyWithImpl<$Res, _$_SessionRequest> + implements _$$_SessionRequestCopyWith<$Res> { + __$$_SessionRequestCopyWithImpl( + _$_SessionRequest _value, $Res Function(_$_SessionRequest) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? topic = null, + Object? method = null, + Object? chainId = null, + Object? params = freezed, + }) { + return _then(_$_SessionRequest( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + topic: null == topic + ? _value.topic + : topic // ignore: cast_nullable_to_non_nullable + as String, + method: null == method + ? _value.method + : method // ignore: cast_nullable_to_non_nullable + as String, + chainId: null == chainId + ? _value.chainId + : chainId // ignore: cast_nullable_to_non_nullable + as String, + params: freezed == params + ? _value.params + : params // ignore: cast_nullable_to_non_nullable + as dynamic, + )); + } +} + +/// @nodoc + +@JsonSerializable() +class _$_SessionRequest implements _SessionRequest { + const _$_SessionRequest( + {required this.id, + required this.topic, + required this.method, + required this.chainId, + required this.params}); + + factory _$_SessionRequest.fromJson(Map json) => + _$$_SessionRequestFromJson(json); + + @override + final int id; + @override + final String topic; + @override + final String method; + @override + final String chainId; + @override + final dynamic params; + + @override + String toString() { + return 'SessionRequest(id: $id, topic: $topic, method: $method, chainId: $chainId, params: $params)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_SessionRequest && + (identical(other.id, id) || other.id == id) && + (identical(other.topic, topic) || other.topic == topic) && + (identical(other.method, method) || other.method == method) && + (identical(other.chainId, chainId) || other.chainId == chainId) && + const DeepCollectionEquality().equals(other.params, params)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, topic, method, chainId, + const DeepCollectionEquality().hash(params)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_SessionRequestCopyWith<_$_SessionRequest> get copyWith => + __$$_SessionRequestCopyWithImpl<_$_SessionRequest>(this, _$identity); + + @override + Map toJson() { + return _$$_SessionRequestToJson( + this, + ); + } +} + +abstract class _SessionRequest implements SessionRequest { + const factory _SessionRequest( + {required final int id, + required final String topic, + required final String method, + required final String chainId, + required final dynamic params}) = _$_SessionRequest; + + factory _SessionRequest.fromJson(Map json) = + _$_SessionRequest.fromJson; + + @override + int get id; + @override + String get topic; + @override + String get method; + @override + String get chainId; + @override + dynamic get params; + @override + @JsonKey(ignore: true) + _$$_SessionRequestCopyWith<_$_SessionRequest> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/apis/sign_api/models/session_models.g.dart b/lib/apis/sign_api/models/session_models.g.dart index 4df8d46b..b47a1e69 100644 --- a/lib/apis/sign_api/models/session_models.g.dart +++ b/lib/apis/sign_api/models/session_models.g.dart @@ -6,7 +6,7 @@ part of 'session_models.dart'; // JsonSerializableGenerator // ************************************************************************** -Namespace _$NamespaceFromJson(Map json) => Namespace( +_$_Namespace _$$_NamespaceFromJson(Map json) => _$_Namespace( accounts: (json['accounts'] as List).map((e) => e as String).toList(), methods: @@ -15,13 +15,15 @@ Namespace _$NamespaceFromJson(Map json) => Namespace( (json['events'] as List).map((e) => e as String).toList(), ); -Map _$NamespaceToJson(Namespace instance) => { +Map _$$_NamespaceToJson(_$_Namespace instance) => + { 'accounts': instance.accounts, 'methods': instance.methods, 'events': instance.events, }; -SessionData _$SessionDataFromJson(Map json) => SessionData( +_$_SessionData _$$_SessionDataFromJson(Map json) => + _$_SessionData( topic: json['topic'] as String, pairingTopic: json['pairingTopic'] as String, relay: Relay.fromJson(json['relay'] as Map), @@ -49,7 +51,7 @@ SessionData _$SessionDataFromJson(Map json) => SessionData( peer: ConnectionMetadata.fromJson(json['peer'] as Map), ); -Map _$SessionDataToJson(SessionData instance) { +Map _$$_SessionDataToJson(_$_SessionData instance) { final val = { 'topic': instance.topic, 'pairingTopic': instance.pairingTopic, @@ -76,8 +78,8 @@ Map _$SessionDataToJson(SessionData instance) { return val; } -SessionRequest _$SessionRequestFromJson(Map json) => - SessionRequest( +_$_SessionRequest _$$_SessionRequestFromJson(Map json) => + _$_SessionRequest( id: json['id'] as int, topic: json['topic'] as String, method: json['method'] as String, @@ -85,7 +87,7 @@ SessionRequest _$SessionRequestFromJson(Map json) => params: json['params'], ); -Map _$SessionRequestToJson(SessionRequest instance) => +Map _$$_SessionRequestToJson(_$_SessionRequest instance) => { 'id': instance.id, 'topic': instance.topic, diff --git a/lib/apis/sign_api/sessions.dart b/lib/apis/sign_api/sessions.dart index 60fefa83..50811a9d 100644 --- a/lib/apis/sign_api/sessions.dart +++ b/lib/apis/sign_api/sessions.dart @@ -25,10 +25,10 @@ class Sessions extends GenericStore implements ISessions { } if (expiry != null) { - info.expiry = expiry; + info = info.copyWith(expiry: expiry); } if (namespaces != null) { - info.namespaces = namespaces; + info = info.copyWith(namespaces: namespaces); } await set(topic, info); diff --git a/lib/apis/sign_api/sign_engine.dart b/lib/apis/sign_api/sign_engine.dart index b4148bbc..7f62554f 100644 --- a/lib/apis/sign_api/sign_engine.dart +++ b/lib/apis/sign_api/sign_engine.dart @@ -353,7 +353,9 @@ class SignEngine implements ISignEngine { }, ); - session.acknowledged = acknowledged; + session = session.copyWith( + acknowledged: acknowledged, + ); if (acknowledged && sessions.has(sessionTopic)) { // We directly update the latest value. diff --git a/lib/apis/utils/method_constants.dart b/lib/apis/utils/method_constants.dart index 6cbcee54..d80b141e 100644 --- a/lib/apis/utils/method_constants.dart +++ b/lib/apis/utils/method_constants.dart @@ -19,52 +19,148 @@ class MethodConstants { static const Map> RPC_OPTS = { WC_PAIRING_PING: { - 'req': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1000), - 'res': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1001), + 'req': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1000, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1001, + ), }, WC_PAIRING_DELETE: { - 'req': RpcOptions(WalletConnectConstants.THIRTY_SECONDS, false, 1002), - 'res': RpcOptions(WalletConnectConstants.THIRTY_SECONDS, false, 1003), + 'req': RpcOptions( + ttl: WalletConnectConstants.THIRTY_SECONDS, + prompt: false, + tag: 1002, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.THIRTY_SECONDS, + prompt: false, + tag: 1003, + ), }, UNREGISTERED_METHOD: { - 'req': RpcOptions(WalletConnectConstants.ONE_DAY, false, 0), - 'res': RpcOptions(WalletConnectConstants.ONE_DAY, false, 0), + 'req': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 0, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 0, + ), }, WC_SESSION_PROPOSE: { - 'req': RpcOptions(WalletConnectConstants.FIVE_MINUTES, true, 1100), - 'res': RpcOptions(WalletConnectConstants.FIVE_MINUTES, false, 1101), + 'req': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: true, + tag: 1100, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: false, + tag: 1101, + ), }, WC_SESSION_SETTLE: { - 'req': RpcOptions(WalletConnectConstants.FIVE_MINUTES, false, 1102), - 'res': RpcOptions(WalletConnectConstants.FIVE_MINUTES, false, 1103), + 'req': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: false, + tag: 1102, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: false, + tag: 1103, + ), }, WC_SESSION_UPDATE: { - 'req': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1104), - 'res': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1105), + 'req': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1104, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1105, + ), }, WC_SESSION_EXTEND: { - 'req': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1106), - 'res': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1107), + 'req': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1106, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1107, + ), }, WC_SESSION_REQUEST: { - 'req': RpcOptions(WalletConnectConstants.FIVE_MINUTES, true, 1108), - 'res': RpcOptions(WalletConnectConstants.FIVE_MINUTES, false, 1109), + 'req': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: true, + tag: 1108, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: false, + tag: 1109, + ), }, WC_SESSION_EVENT: { - 'req': RpcOptions(WalletConnectConstants.FIVE_MINUTES, true, 1110), - 'res': RpcOptions(WalletConnectConstants.FIVE_MINUTES, false, 1111), + 'req': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: true, + tag: 1110, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.FIVE_MINUTES, + prompt: false, + tag: 1111, + ), }, WC_SESSION_DELETE: { - 'req': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1112), - 'res': RpcOptions(WalletConnectConstants.ONE_DAY, false, 1113), + 'req': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1112, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 1113, + ), }, WC_SESSION_PING: { - 'req': RpcOptions(WalletConnectConstants.THIRTY_SECONDS, false, 1114), - 'res': RpcOptions(WalletConnectConstants.THIRTY_SECONDS, false, 1115), + 'req': RpcOptions( + ttl: WalletConnectConstants.THIRTY_SECONDS, + prompt: false, + tag: 1114, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.THIRTY_SECONDS, + prompt: false, + tag: 1115, + ), }, WC_AUTH_REQUEST: { - 'req': RpcOptions(WalletConnectConstants.ONE_DAY, true, 3000), - 'res': RpcOptions(WalletConnectConstants.ONE_DAY, false, 3001), + 'req': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: true, + tag: 3000, + ), + 'res': RpcOptions( + ttl: WalletConnectConstants.ONE_DAY, + prompt: false, + tag: 3001, + ), }, }; } diff --git a/lib/src/version.dart b/lib/src/version.dart new file mode 100644 index 00000000..f1e9c830 --- /dev/null +++ b/lib/src/version.dart @@ -0,0 +1,2 @@ +// Generated code. Do not modify. +const packageVersion = '2.0.12'; diff --git a/pubspec.yaml b/pubspec.yaml index 1978dd2e..f71b1a6c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: http: ^0.13.5 cryptography: ^2.0.5 convert: ^3.0.1 - json_annotation: ^4.8.0 + json_annotation: ^4.8.1 pointycastle: ^3.6.2 x25519: ^0.1.1 bs58: ^1.0.2 @@ -26,6 +26,7 @@ dependencies: stack_trace: ^1.10.0 web3dart: ^2.5.1 logger: ^1.4.0 + freezed_annotation: ^2.2.0 dev_dependencies: flutter_test: @@ -38,4 +39,5 @@ dev_dependencies: eth_sig_util: ^0.0.9 build_version: ^2.0.0 flutter_lints: ^2.0.0 + freezed: ^2.4.0 diff --git a/test/auth_api/auth_client_test.dart b/test/auth_api/auth_client_test.dart index 2f615654..8d5d9051 100644 --- a/test/auth_api/auth_client_test.dart +++ b/test/auth_api/auth_client_test.dart @@ -476,7 +476,7 @@ void runTests({ test('works', () { final String message = clientA.formatAuthMessage( iss: TEST_ISSUER_EIP191, - cacaoPayload: testCacaoPayload, + cacaoPayload: CacaoRequestPayload.fromCacaoPayload(testCacaoPayload), ); expect(message, TEST_FORMATTED_MESSAGE); }); diff --git a/test/shared/shared_test_utils.mocks.dart b/test/shared/shared_test_utils.mocks.dart index 87ea6652..07906bd2 100644 --- a/test/shared/shared_test_utils.mocks.dart +++ b/test/shared/shared_test_utils.mocks.dart @@ -1,20 +1,21 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in walletconnect_flutter_v2/test/shared/shared_test_utils.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i17; -import 'dart:typed_data' as _i16; +import 'dart:async' as _i18; +import 'dart:typed_data' as _i17; import 'package:event/event.dart' as _i8; import 'package:http/http.dart' as _i9; +import 'package:logger/logger.dart' as _i15; import 'package:mockito/mockito.dart' as _i1; -import 'package:walletconnect_flutter_v2/apis/core/core.dart' as _i22; -import 'package:walletconnect_flutter_v2/apis/core/crypto/crypto.dart' as _i18; +import 'package:walletconnect_flutter_v2/apis/core/core.dart' as _i23; +import 'package:walletconnect_flutter_v2/apis/core/crypto/crypto.dart' as _i19; import 'package:walletconnect_flutter_v2/apis/core/crypto/crypto_models.dart' as _i2; import 'package:walletconnect_flutter_v2/apis/core/crypto/crypto_utils.dart' - as _i15; + as _i16; import 'package:walletconnect_flutter_v2/apis/core/crypto/i_crypto.dart' as _i10; import 'package:walletconnect_flutter_v2/apis/core/crypto/i_crypto_utils.dart' @@ -30,14 +31,14 @@ import 'package:walletconnect_flutter_v2/apis/core/relay_auth/i_relay_auth.dart' import 'package:walletconnect_flutter_v2/apis/core/relay_client/i_relay_client.dart' as _i11; import 'package:walletconnect_flutter_v2/apis/core/relay_client/message_tracker.dart' - as _i19; + as _i20; import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/http_client.dart' - as _i21; + as _i22; import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart' as _i4; import 'package:walletconnect_flutter_v2/apis/core/store/i_store.dart' as _i7; import 'package:walletconnect_flutter_v2/apis/core/store/store_models.dart' - as _i20; + as _i21; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -204,10 +205,20 @@ class _FakeIEcho_14 extends _i1.SmartFake implements _i14.IEcho { ); } +class _FakeLogger_15 extends _i1.SmartFake implements _i15.Logger { + _FakeLogger_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + /// A class which mocks [CryptoUtils]. /// /// See the documentation for Mockito's code generation for more information. -class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { +class MockCryptoUtils extends _i1.Mock implements _i16.CryptoUtils { MockCryptoUtils() { _i1.throwOnMissingStub(this); } @@ -227,13 +238,13 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { ), ) as _i2.CryptoKeyPair); @override - _i16.Uint8List randomBytes(int? length) => (super.noSuchMethod( + _i17.Uint8List randomBytes(int? length) => (super.noSuchMethod( Invocation.method( #randomBytes, [length], ), - returnValue: _i16.Uint8List(0), - ) as _i16.Uint8List); + returnValue: _i17.Uint8List(0), + ) as _i17.Uint8List); @override String generateRandomBytes32() => (super.noSuchMethod( Invocation.method( @@ -243,7 +254,7 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { returnValue: '', ) as String); @override - _i17.Future deriveSymKey( + _i18.Future deriveSymKey( String? privKeyA, String? pubKeyB, ) => @@ -255,8 +266,8 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { pubKeyB, ], ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override String hashKey(String? key) => (super.noSuchMethod( Invocation.method( @@ -274,7 +285,7 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { returnValue: '', ) as String); @override - _i17.Future encrypt( + _i18.Future encrypt( String? message, String? symKey, { int? type, @@ -294,10 +305,10 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { #senderPublicKey: senderPublicKey, }, ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override - _i17.Future decrypt( + _i18.Future decrypt( String? symKey, String? encoded, ) => @@ -309,14 +320,14 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { encoded, ], ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override String serialize( int? type, - _i16.Uint8List? sealed, - _i16.Uint8List? iv, { - _i16.Uint8List? senderPublicKey, + _i17.Uint8List? sealed, + _i17.Uint8List? iv, { + _i17.Uint8List? senderPublicKey, }) => (super.noSuchMethod( Invocation.method( @@ -406,7 +417,7 @@ class MockCryptoUtils extends _i1.Mock implements _i15.CryptoUtils { /// A class which mocks [Crypto]. /// /// See the documentation for Mockito's code generation for more information. -class MockCrypto extends _i1.Mock implements _i18.Crypto { +class MockCrypto extends _i1.Mock implements _i19.Crypto { MockCrypto() { _i1.throwOnMissingStub(this); } @@ -473,14 +484,14 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { returnValue: '', ) as String); @override - _i17.Future init() => (super.noSuchMethod( + _i18.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override bool hasKeys(String? tag) => (super.noSuchMethod( Invocation.method( @@ -490,23 +501,23 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { returnValue: false, ) as bool); @override - _i17.Future getClientId() => (super.noSuchMethod( + _i18.Future getClientId() => (super.noSuchMethod( Invocation.method( #getClientId, [], ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override - _i17.Future generateKeyPair() => (super.noSuchMethod( + _i18.Future generateKeyPair() => (super.noSuchMethod( Invocation.method( #generateKeyPair, [], ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override - _i17.Future generateSharedKey( + _i18.Future generateSharedKey( String? selfPublicKey, String? peerPublicKey, { String? overrideTopic, @@ -520,10 +531,10 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { ], {#overrideTopic: overrideTopic}, ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override - _i17.Future setSymKey( + _i18.Future setSymKey( String? symKey, { String? overrideTopic, }) => @@ -533,28 +544,28 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { [symKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override - _i17.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( + _i18.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( Invocation.method( #deleteKeyPair, [publicKey], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future deleteSymKey(String? topic) => (super.noSuchMethod( + _i18.Future deleteSymKey(String? topic) => (super.noSuchMethod( Invocation.method( #deleteSymKey, [topic], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future encode( + _i18.Future encode( String? topic, Map? payload, { _i2.EncodeOptions? options, @@ -568,10 +579,10 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { ], {#options: options}, ), - returnValue: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future decode( + _i18.Future decode( String? topic, String? encoded, { _i2.DecodeOptions? options, @@ -585,16 +596,16 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { ], {#options: options}, ), - returnValue: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future signJWT(String? aud) => (super.noSuchMethod( + _i18.Future signJWT(String? aud) => (super.noSuchMethod( Invocation.method( #signJWT, [aud], ), - returnValue: _i17.Future.value(''), - ) as _i17.Future); + returnValue: _i18.Future.value(''), + ) as _i18.Future); @override int getPayloadType(String? encoded) => (super.noSuchMethod( Invocation.method( @@ -622,7 +633,7 @@ class MockCrypto extends _i1.Mock implements _i18.Crypto { /// A class which mocks [MessageTracker]. /// /// See the documentation for Mockito's code generation for more information. -class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { +class MockMessageTracker extends _i1.Mock implements _i20.MessageTracker { MockMessageTracker() { _i1.throwOnMissingStub(this); } @@ -646,40 +657,40 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { ), ) as _i7.IStore); @override - _i8.Event<_i20.StoreCreateEvent>> get onCreate => + _i8.Event<_i21.StoreCreateEvent>> get onCreate => (super.noSuchMethod( Invocation.getter(#onCreate), - returnValue: _FakeEvent_8<_i20.StoreCreateEvent>>( + returnValue: _FakeEvent_8<_i21.StoreCreateEvent>>( this, Invocation.getter(#onCreate), ), - ) as _i8.Event<_i20.StoreCreateEvent>>); + ) as _i8.Event<_i21.StoreCreateEvent>>); @override - _i8.Event<_i20.StoreUpdateEvent>> get onUpdate => + _i8.Event<_i21.StoreUpdateEvent>> get onUpdate => (super.noSuchMethod( Invocation.getter(#onUpdate), - returnValue: _FakeEvent_8<_i20.StoreUpdateEvent>>( + returnValue: _FakeEvent_8<_i21.StoreUpdateEvent>>( this, Invocation.getter(#onUpdate), ), - ) as _i8.Event<_i20.StoreUpdateEvent>>); + ) as _i8.Event<_i21.StoreUpdateEvent>>); @override - _i8.Event<_i20.StoreDeleteEvent>> get onDelete => + _i8.Event<_i21.StoreDeleteEvent>> get onDelete => (super.noSuchMethod( Invocation.getter(#onDelete), - returnValue: _FakeEvent_8<_i20.StoreDeleteEvent>>( + returnValue: _FakeEvent_8<_i21.StoreDeleteEvent>>( this, Invocation.getter(#onDelete), ), - ) as _i8.Event<_i20.StoreDeleteEvent>>); + ) as _i8.Event<_i21.StoreDeleteEvent>>); @override - _i8.Event<_i20.StoreSyncEvent> get onSync => (super.noSuchMethod( + _i8.Event<_i21.StoreSyncEvent> get onSync => (super.noSuchMethod( Invocation.getter(#onSync), - returnValue: _FakeEvent_8<_i20.StoreSyncEvent>( + returnValue: _FakeEvent_8<_i21.StoreSyncEvent>( this, Invocation.getter(#onSync), ), - ) as _i8.Event<_i20.StoreSyncEvent>); + ) as _i8.Event<_i21.StoreSyncEvent>); @override Map> get data => (super.noSuchMethod( Invocation.getter(#data), @@ -712,7 +723,7 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { returnValue: '', ) as String); @override - _i17.Future recordMessageEvent( + _i18.Future recordMessageEvent( String? topic, String? message, ) => @@ -724,9 +735,9 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { message, ], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override bool messageIsRecorded( String? topic, @@ -743,14 +754,14 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { returnValue: false, ) as bool); @override - _i17.Future init() => (super.noSuchMethod( + _i18.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override bool has(String? key) => (super.noSuchMethod( Invocation.method( @@ -774,7 +785,7 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { returnValue: >[], ) as List>); @override - _i17.Future set( + _i18.Future set( String? key, Map? value, ) => @@ -786,36 +797,36 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { value, ], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future delete(String? key) => (super.noSuchMethod( + _i18.Future delete(String? key) => (super.noSuchMethod( Invocation.method( #delete, [key], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future persist() => (super.noSuchMethod( + _i18.Future persist() => (super.noSuchMethod( Invocation.method( #persist, [], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override - _i17.Future restore() => (super.noSuchMethod( + _i18.Future restore() => (super.noSuchMethod( Invocation.method( #restore, [], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); @override void checkInitialized() => super.noSuchMethod( Invocation.method( @@ -829,13 +840,13 @@ class MockMessageTracker extends _i1.Mock implements _i19.MessageTracker { /// A class which mocks [HttpWrapper]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { +class MockHttpWrapper extends _i1.Mock implements _i22.HttpWrapper { MockHttpWrapper() { _i1.throwOnMissingStub(this); } @override - _i17.Future<_i9.Response> get( + _i18.Future<_i9.Response> get( Uri? url, { Map? headers, }) => @@ -845,7 +856,7 @@ class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { [url], {#headers: headers}, ), - returnValue: _i17.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i18.Future<_i9.Response>.value(_FakeResponse_9( this, Invocation.method( #get, @@ -853,9 +864,9 @@ class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { {#headers: headers}, ), )), - ) as _i17.Future<_i9.Response>); + ) as _i18.Future<_i9.Response>); @override - _i17.Future<_i9.Response> delete( + _i18.Future<_i9.Response> delete( Uri? url, { Map? headers, }) => @@ -865,7 +876,7 @@ class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { [url], {#headers: headers}, ), - returnValue: _i17.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i18.Future<_i9.Response>.value(_FakeResponse_9( this, Invocation.method( #delete, @@ -873,9 +884,9 @@ class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { {#headers: headers}, ), )), - ) as _i17.Future<_i9.Response>); + ) as _i18.Future<_i9.Response>); @override - _i17.Future<_i9.Response> post( + _i18.Future<_i9.Response> post( Uri? url, { Map? headers, Object? body, @@ -889,7 +900,7 @@ class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { #body: body, }, ), - returnValue: _i17.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i18.Future<_i9.Response>.value(_FakeResponse_9( this, Invocation.method( #post, @@ -900,13 +911,13 @@ class MockHttpWrapper extends _i1.Mock implements _i21.HttpWrapper { }, ), )), - ) as _i17.Future<_i9.Response>); + ) as _i18.Future<_i9.Response>); } /// A class which mocks [Core]. /// /// See the documentation for Mockito's code generation for more information. -class MockCore extends _i1.Mock implements _i22.Core { +class MockCore extends _i1.Mock implements _i23.Core { MockCore() { _i1.throwOnMissingStub(this); } @@ -1007,6 +1018,14 @@ class MockCore extends _i1.Mock implements _i22.Core { returnValueForMissingStub: null, ); @override + _i15.Logger get logger => (super.noSuchMethod( + Invocation.getter(#logger), + returnValue: _FakeLogger_15( + this, + Invocation.getter(#logger), + ), + ) as _i15.Logger); + @override _i7.IStore> get storage => (super.noSuchMethod( Invocation.getter(#storage), returnValue: _FakeIStore_7>( @@ -1033,12 +1052,12 @@ class MockCore extends _i1.Mock implements _i22.Core { returnValue: '', ) as String); @override - _i17.Future start() => (super.noSuchMethod( + _i18.Future start() => (super.noSuchMethod( Invocation.method( #start, [], ), - returnValue: _i17.Future.value(), - returnValueForMissingStub: _i17.Future.value(), - ) as _i17.Future); + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); } diff --git a/test/sign_api/tests/sign_request_and_handler.dart b/test/sign_api/tests/sign_request_and_handler.dart index f2be9a2a..f2dd7a64 100644 --- a/test/sign_api/tests/sign_request_and_handler.dart +++ b/test/sign_api/tests/sign_request_and_handler.dart @@ -310,7 +310,7 @@ void signRequestAndHandler({ e.code, JsonRpcError.invalidParams('swag').code, ); - expect(e.message.contains(TEST_MESSAGE_1.toString()), true); + expect(e.message!.contains(TEST_MESSAGE_1.toString()), true); } // Try an error diff --git a/test/sign_api/validation_test.dart b/test/sign_api/validation_test.dart index 3804df2c..b74a8e45 100644 --- a/test/sign_api/validation_test.dart +++ b/test/sign_api/validation_test.dart @@ -403,10 +403,12 @@ void main() { TEST_NAMESPACES_NONCONFORMING_EVENTS, ]; for (int i = 0; i < nonconformingNamespaces.length; i++) { - testSessionValid.namespaces = nonconformingNamespaces[i]; + final SessionData newSessionData = testSessionValid.copyWith( + namespaces: nonconformingNamespaces[i], + ); expect( SignApiValidatorUtils.isSessionCompatible( - session: testSessionValid, + session: newSessionData, requiredNamespaces: TEST_REQUIRED_NAMESPACES, ), false,