diff --git a/packages/reown_appkit/build.yaml b/packages/reown_appkit/build.yaml index e39e5483..dbf15e1d 100644 --- a/packages/reown_appkit/build.yaml +++ b/packages/reown_appkit/build.yaml @@ -2,7 +2,7 @@ targets: $default: sources: exclude: - - "**/.symlinks/**" + - "**/.symlinks/**" builders: build_version: options: diff --git a/packages/reown_appkit/example/base/ios/Podfile.lock b/packages/reown_appkit/example/base/ios/Podfile.lock index 2342ab7f..aa29679f 100644 --- a/packages/reown_appkit/example/base/ios/Podfile.lock +++ b/packages/reown_appkit/example/base/ios/Podfile.lock @@ -8,15 +8,21 @@ PODS: - Flutter (1.0.0) - flutter_secure_storage (6.0.0): - Flutter + - reown_yttrium (0.0.1): + - Flutter + - YttriumWrapper (= 0.9.57) + - YttriumWrapper (0.9.57) DEPENDENCIES: - coinbase_wallet_sdk (from `.symlinks/plugins/coinbase_wallet_sdk/ios`) - Flutter (from `Flutter`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - reown_yttrium (from `.symlinks/plugins/reown_yttrium/ios`) SPEC REPOS: trunk: - CoinbaseWalletSDK + - YttriumWrapper EXTERNAL SOURCES: coinbase_wallet_sdk: @@ -25,12 +31,16 @@ EXTERNAL SOURCES: :path: Flutter flutter_secure_storage: :path: ".symlinks/plugins/flutter_secure_storage/ios" + reown_yttrium: + :path: ".symlinks/plugins/reown_yttrium/ios" SPEC CHECKSUMS: coinbase_wallet_sdk: c893738400ef78bd20e7f4195cbb38266f7d15e8 CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152 Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13 + reown_yttrium: 518f6a50e4f291cef7e282ab5f2c955aa63f2e27 + YttriumWrapper: ded5842dc952538bb7f09a1074fdd6d7348bfeaa PODFILE CHECKSUM: 0772a2bd8cd4c7aaeb2576ddfaf6b03be722593b diff --git a/packages/reown_appkit/example/modal/ios/Podfile.lock b/packages/reown_appkit/example/modal/ios/Podfile.lock index 5eec8e34..adeee62b 100644 --- a/packages/reown_appkit/example/modal/ios/Podfile.lock +++ b/packages/reown_appkit/example/modal/ios/Podfile.lock @@ -8,15 +8,21 @@ PODS: - Flutter (1.0.0) - flutter_secure_storage (6.0.0): - Flutter + - reown_yttrium (0.0.1): + - Flutter + - YttriumWrapper (= 0.9.57) + - YttriumWrapper (0.9.57) DEPENDENCIES: - coinbase_wallet_sdk (from `.symlinks/plugins/coinbase_wallet_sdk/ios`) - Flutter (from `Flutter`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - reown_yttrium (from `.symlinks/plugins/reown_yttrium/ios`) SPEC REPOS: trunk: - CoinbaseWalletSDK + - YttriumWrapper EXTERNAL SOURCES: coinbase_wallet_sdk: @@ -25,12 +31,16 @@ EXTERNAL SOURCES: :path: Flutter flutter_secure_storage: :path: ".symlinks/plugins/flutter_secure_storage/ios" + reown_yttrium: + :path: ".symlinks/plugins/reown_yttrium/ios" SPEC CHECKSUMS: coinbase_wallet_sdk: c893738400ef78bd20e7f4195cbb38266f7d15e8 CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152 Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13 + reown_yttrium: 518f6a50e4f291cef7e282ab5f2c955aa63f2e27 + YttriumWrapper: ded5842dc952538bb7f09a1074fdd6d7348bfeaa PODFILE CHECKSUM: 0a7d5b7d0e53420cb0284f7b2f171f93843b94d2 diff --git a/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj b/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj index 9cf1d757..83e47c5e 100644 --- a/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj @@ -10,13 +10,13 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 435212C1FA3162F43F8FB262 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1DD40F1533F68D3B32D4714 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; - 8DC111769170E7BC35C64EE4 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE0DE324EA63BF4A2A7124C /* Pods_RunnerTests.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - B0C84E6FA7022C9A9D0B1C09 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 834E8C8D1E3C5DBCF6132E30 /* Pods_Runner.framework */; }; + BB03EF27F09DEBE787D8B072 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8ABA6DBF937AC4FDE9F040B0 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -46,16 +46,16 @@ 092D151B2ABD988600C69848 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 24B1FBF3BCB24A78D0A9EC78 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 2935EEE4951C1F8947B93EB5 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 331DB1F01D60FBD7B0F34DF9 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 73DCC20A9C5186D326697FE5 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 834E8C8D1E3C5DBCF6132E30 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 8E40008FCF6BD20A2D7F7E68 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 7C72929DBB8C63F072D89E4D /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 8ABA6DBF937AC4FDE9F040B0 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -63,10 +63,10 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A2780E4ED7854525ED5AA2BA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - ADE0DE324EA63BF4A2A7124C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B79748CE65C4D84FB7482304 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - E321B1ADD1AA103F236BD5E4 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + A15FA5F2283A4FB72840434C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + C1DD40F1533F68D3B32D4714 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D04E24D267D18E234C589142 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + F315294E9A0D4A0487FE5FB0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -74,7 +74,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8DC111769170E7BC35C64EE4 /* Pods_RunnerTests.framework in Frameworks */, + BB03EF27F09DEBE787D8B072 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -83,22 +83,13 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - B0C84E6FA7022C9A9D0B1C09 /* Pods_Runner.framework in Frameworks */, + 435212C1FA3162F43F8FB262 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 25368CD249EBF9D5A266DCFB /* Frameworks */ = { - isa = PBXGroup; - children = ( - 834E8C8D1E3C5DBCF6132E30 /* Pods_Runner.framework */, - ADE0DE324EA63BF4A2A7124C /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -126,7 +117,7 @@ 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, E880F334C300E1CEFAFD6E4C /* Pods */, - 25368CD249EBF9D5A266DCFB /* Frameworks */, + A4B5C5D42D7751311B985FE2 /* Frameworks */, ); sourceTree = ""; }; @@ -155,15 +146,24 @@ path = Runner; sourceTree = ""; }; + A4B5C5D42D7751311B985FE2 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C1DD40F1533F68D3B32D4714 /* Pods_Runner.framework */, + 8ABA6DBF937AC4FDE9F040B0 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; E880F334C300E1CEFAFD6E4C /* Pods */ = { isa = PBXGroup; children = ( - A2780E4ED7854525ED5AA2BA /* Pods-Runner.debug.xcconfig */, - 8E40008FCF6BD20A2D7F7E68 /* Pods-Runner.release.xcconfig */, - 24B1FBF3BCB24A78D0A9EC78 /* Pods-Runner.profile.xcconfig */, - E321B1ADD1AA103F236BD5E4 /* Pods-RunnerTests.debug.xcconfig */, - B79748CE65C4D84FB7482304 /* Pods-RunnerTests.release.xcconfig */, - 331DB1F01D60FBD7B0F34DF9 /* Pods-RunnerTests.profile.xcconfig */, + D04E24D267D18E234C589142 /* Pods-Runner.debug.xcconfig */, + A15FA5F2283A4FB72840434C /* Pods-Runner.release.xcconfig */, + 73DCC20A9C5186D326697FE5 /* Pods-Runner.profile.xcconfig */, + 2935EEE4951C1F8947B93EB5 /* Pods-RunnerTests.debug.xcconfig */, + 7C72929DBB8C63F072D89E4D /* Pods-RunnerTests.release.xcconfig */, + F315294E9A0D4A0487FE5FB0 /* Pods-RunnerTests.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -175,7 +175,7 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - 03BBF514FB0F452D988BE694 /* [CP] Check Pods Manifest.lock */, + 83E34039C8FF49296349316D /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, 6D09732E2619FACF7894A4A1 /* Frameworks */, @@ -194,14 +194,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - E56AB48D61973DC5C6ACB37E /* [CP] Check Pods Manifest.lock */, + E42B6AB349895E7AAFA0DE27 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 8B3D4B42B7603B770E170522 /* [CP] Embed Pods Frameworks */, + 76872C337EE0688F6AC1CB17 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -278,28 +278,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 03BBF514FB0F452D988BE694 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -316,7 +294,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 8B3D4B42B7603B770E170522 /* [CP] Embed Pods Frameworks */ = { + 76872C337EE0688F6AC1CB17 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -333,6 +311,28 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + 83E34039C8FF49296349316D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -348,7 +348,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - E56AB48D61973DC5C6ACB37E /* [CP] Check Pods Manifest.lock */ = { + E42B6AB349895E7AAFA0DE27 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -500,7 +500,7 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E321B1ADD1AA103F236BD5E4 /* Pods-RunnerTests.debug.xcconfig */; + baseConfigurationReference = 2935EEE4951C1F8947B93EB5 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -518,7 +518,7 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B79748CE65C4D84FB7482304 /* Pods-RunnerTests.release.xcconfig */; + baseConfigurationReference = 7C72929DBB8C63F072D89E4D /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -534,7 +534,7 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 331DB1F01D60FBD7B0F34DF9 /* Pods-RunnerTests.profile.xcconfig */; + baseConfigurationReference = F315294E9A0D4A0487FE5FB0 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; diff --git a/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart b/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart index a654c8d8..f5f06577 100644 --- a/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart +++ b/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart @@ -7,7 +7,7 @@ import 'package:reown_appkit/modal/services/coinbase_service/i_coinbase_service. import 'package:reown_appkit/modal/services/coinbase_service/models/coinbase_data.dart'; import 'package:reown_appkit/modal/services/coinbase_service/models/coinbase_events.dart'; -import 'package:coinbase_wallet_sdk/currency.dart'; +import 'package:coinbase_wallet_sdk/currency.dart' as cb; import 'package:coinbase_wallet_sdk/action.dart'; import 'package:coinbase_wallet_sdk/coinbase_wallet_sdk.dart'; import 'package:coinbase_wallet_sdk/configuration.dart'; @@ -336,7 +336,7 @@ extension on SessionRequestParams { chainId: chainInfo.chainId, rpcUrls: [chainInfo.rpcUrl], chainName: chainInfo.name, - nativeCurrency: Currency( + nativeCurrency: cb.Currency( name: chainInfo.currency, symbol: chainInfo.currency, decimals: 18, diff --git a/packages/reown_appkit/pubspec.yaml b/packages/reown_appkit/pubspec.yaml index f1ffef35..65518c08 100644 --- a/packages/reown_appkit/pubspec.yaml +++ b/packages/reown_appkit/pubspec.yaml @@ -30,8 +30,10 @@ dependencies: pinenacl: ^0.6.0 plugin_platform_interface: ^2.1.8 qr_flutter_wc: ^0.0.3 - reown_core: ^1.3.1 - reown_sign: ^1.3.1 + reown_core: + path: ../reown_core/ + reown_sign: + path: ../reown_sign/ shimmer: ^3.0.0 synchronized: ^3.3.0+3 web_socket_channel: ^3.0.1 diff --git a/packages/reown_appkit/test/shared/shared_test_utils.mocks.dart b/packages/reown_appkit/test/shared/shared_test_utils.mocks.dart index 99c41521..235ddbe4 100644 --- a/packages/reown_appkit/test/shared/shared_test_utils.mocks.dart +++ b/packages/reown_appkit/test/shared/shared_test_utils.mocks.dart @@ -3,21 +3,21 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i24; -import 'dart:typed_data' as _i22; +import 'dart:async' as _i25; +import 'dart:typed_data' as _i23; import 'package:event/event.dart' as _i8; import 'package:http/http.dart' as _i9; -import 'package:logger/logger.dart' as _i20; +import 'package:logger/logger.dart' as _i21; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i23; +import 'package:mockito/src/dummies.dart' as _i24; import 'package:reown_core/connectivity/i_connectivity.dart' as _i18; -import 'package:reown_core/core_impl.dart' as _i29; -import 'package:reown_core/crypto/crypto.dart' as _i25; +import 'package:reown_core/core_impl.dart' as _i30; +import 'package:reown_core/crypto/crypto.dart' as _i26; import 'package:reown_core/crypto/crypto_models.dart' as _i2; -import 'package:reown_core/crypto/crypto_utils.dart' as _i21; +import 'package:reown_core/crypto/crypto_utils.dart' as _i22; import 'package:reown_core/crypto/i_crypto.dart' as _i10; -import 'package:reown_core/crypto/i_crypto_utils.dart' as _i5; +import 'package:reown_core/crypto/i_crypto_utils.dart' as _i4; import 'package:reown_core/echo/i_echo.dart' as _i14; import 'package:reown_core/events/i_events.dart' as _i15; import 'package:reown_core/heartbit/i_heartbeat.dart' as _i16; @@ -26,15 +26,16 @@ import 'package:reown_core/pairing/i_expirer.dart' as _i12; import 'package:reown_core/pairing/i_pairing.dart' as _i13; import 'package:reown_core/relay_auth/i_relay_auth.dart' as _i6; import 'package:reown_core/relay_client/i_relay_client.dart' as _i11; -import 'package:reown_core/relay_client/message_tracker.dart' as _i26; -import 'package:reown_core/relay_client/websocket/http_client.dart' as _i28; +import 'package:reown_core/relay_client/message_tracker.dart' as _i27; +import 'package:reown_core/relay_client/websocket/http_client.dart' as _i29; import 'package:reown_core/relay_client/websocket/websocket_handler.dart' - as _i30; -import 'package:reown_core/store/i_generic_store.dart' as _i4; + as _i31; +import 'package:reown_core/store/i_generic_store.dart' as _i5; import 'package:reown_core/store/i_store.dart' as _i7; import 'package:reown_core/store/link_mode_store.dart' as _i19; -import 'package:reown_core/store/store_models.dart' as _i27; +import 'package:reown_core/store/store_models.dart' as _i28; import 'package:reown_core/verify/i_verify.dart' as _i17; +import 'package:reown_core/yttrium/i_rust_sign_client.dart' as _i20; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -72,14 +73,14 @@ class _FakeIReownCore_3 extends _i1.SmartFake implements _i3.IReownCore { : super(parent, parentInvocation); } -class _FakeIGenericStore_4 extends _i1.SmartFake - implements _i4.IGenericStore { - _FakeIGenericStore_4(Object parent, Invocation parentInvocation) +class _FakeICryptoUtils_4 extends _i1.SmartFake implements _i4.ICryptoUtils { + _FakeICryptoUtils_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeICryptoUtils_5 extends _i1.SmartFake implements _i5.ICryptoUtils { - _FakeICryptoUtils_5(Object parent, Invocation parentInvocation) +class _FakeIGenericStore_5 extends _i1.SmartFake + implements _i5.IGenericStore { + _FakeIGenericStore_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -156,15 +157,21 @@ class _FakeILinkModeStore_19 extends _i1.SmartFake : super(parent, parentInvocation); } -class _FakeLogger_20 extends _i1.SmartFake implements _i20.Logger { - _FakeLogger_20(Object parent, Invocation parentInvocation) +class _FakeIRustSignClient_20 extends _i1.SmartFake + implements _i20.IRustSignClient { + _FakeIRustSignClient_20(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeLogger_21 extends _i1.SmartFake implements _i21.Logger { + _FakeLogger_21(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 _i21.CryptoUtils { +class MockCryptoUtils extends _i1.Mock implements _i22.CryptoUtils { MockCryptoUtils() { _i1.throwOnMissingStub(this); } @@ -181,18 +188,18 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as _i2.CryptoKeyPair); @override - _i22.Uint8List randomBytes(int? length) => + _i23.Uint8List randomBytes(int? length) => (super.noSuchMethod( Invocation.method(#randomBytes, [length]), - returnValue: _i22.Uint8List(0), + returnValue: _i23.Uint8List(0), ) - as _i22.Uint8List); + as _i23.Uint8List); @override String generateRandomBytes32() => (super.noSuchMethod( Invocation.method(#generateRandomBytes32, []), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#generateRandomBytes32, []), ), @@ -200,23 +207,23 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as String); @override - _i24.Future deriveSymKey(String? privKeyA, String? pubKeyB) => + _i25.Future deriveSymKey(String? privKeyA, String? pubKeyB) => (super.noSuchMethod( Invocation.method(#deriveSymKey, [privKeyA, pubKeyB]), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#deriveSymKey, [privKeyA, pubKeyB]), ), ), ) - as _i24.Future); + as _i25.Future); @override String hashKey(String? key) => (super.noSuchMethod( Invocation.method(#hashKey, [key]), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#hashKey, [key]), ), @@ -227,7 +234,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { String hashMessage(String? message) => (super.noSuchMethod( Invocation.method(#hashMessage, [message]), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#hashMessage, [message]), ), @@ -235,7 +242,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as String); @override - _i24.Future encrypt( + _i25.Future encrypt( String? message, String? symKey, { int? type, @@ -248,8 +255,8 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { [message, symKey], {#type: type, #iv: iv, #senderPublicKey: senderPublicKey}, ), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method( #encrypt, @@ -259,27 +266,27 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future decrypt(String? symKey, String? encoded) => + _i25.Future decrypt(String? symKey, String? encoded) => (super.noSuchMethod( Invocation.method(#decrypt, [symKey, encoded]), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#decrypt, [symKey, encoded]), ), ), ) - as _i24.Future); + as _i25.Future); @override String serialize( int? type, - _i22.Uint8List? sealed, - _i22.Uint8List? iv, { - _i22.Uint8List? senderPublicKey, + _i23.Uint8List? sealed, + _i23.Uint8List? iv, { + _i23.Uint8List? senderPublicKey, }) => (super.noSuchMethod( Invocation.method( @@ -287,7 +294,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { [type, sealed, iv], {#senderPublicKey: senderPublicKey}, ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #serialize, @@ -371,15 +378,15 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as bool); @override - _i22.Uint8List encodeTypeByte(int? type) => + _i23.Uint8List encodeTypeByte(int? type) => (super.noSuchMethod( Invocation.method(#encodeTypeByte, [type]), - returnValue: _i22.Uint8List(0), + returnValue: _i23.Uint8List(0), ) - as _i22.Uint8List); + as _i23.Uint8List); @override - int decodeTypeByte(_i22.Uint8List? byte) => + int decodeTypeByte(_i23.Uint8List? byte) => (super.noSuchMethod( Invocation.method(#decodeTypeByte, [byte]), returnValue: 0, @@ -390,7 +397,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { String encodeTypeTwoEnvelope({required String? message}) => (super.noSuchMethod( Invocation.method(#encodeTypeTwoEnvelope, [], {#message: message}), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#encodeTypeTwoEnvelope, [], { #message: message, @@ -403,7 +410,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { String decodeTypeTwoEnvelope({required String? message}) => (super.noSuchMethod( Invocation.method(#decodeTypeTwoEnvelope, [], {#message: message}), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#decodeTypeTwoEnvelope, [], { #message: message, @@ -416,7 +423,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { /// A class which mocks [Crypto]. /// /// See the documentation for Mockito's code generation for more information. -class MockCrypto extends _i1.Mock implements _i25.Crypto { +class MockCrypto extends _i1.Mock implements _i26.Crypto { MockCrypto() { _i1.throwOnMissingStub(this); } @@ -430,23 +437,23 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as _i3.IReownCore); @override - _i4.IGenericStore get keyChain => + _i4.ICryptoUtils get utils => (super.noSuchMethod( - Invocation.getter(#keyChain), - returnValue: _FakeIGenericStore_4( - this, - Invocation.getter(#keyChain), - ), + Invocation.getter(#utils), + returnValue: _FakeICryptoUtils_4(this, Invocation.getter(#utils)), ) - as _i4.IGenericStore); + as _i4.ICryptoUtils); @override - _i5.ICryptoUtils get utils => + _i5.IGenericStore get keyChain => (super.noSuchMethod( - Invocation.getter(#utils), - returnValue: _FakeICryptoUtils_5(this, Invocation.getter(#utils)), + Invocation.getter(#keyChain), + returnValue: _FakeIGenericStore_5( + this, + Invocation.getter(#keyChain), + ), ) - as _i5.ICryptoUtils); + as _i5.IGenericStore); @override _i6.IRelayAuth get relayAuth => @@ -460,7 +467,7 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { String get name => (super.noSuchMethod( Invocation.getter(#name), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#name), ), @@ -468,17 +475,11 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as String); @override - set keyChain(_i4.IGenericStore? _keyChain) => super.noSuchMethod( + set keyChain(_i5.IGenericStore? _keyChain) => super.noSuchMethod( Invocation.setter(#keyChain, _keyChain), returnValueForMissingStub: null, ); - @override - set utils(_i5.ICryptoUtils? _utils) => super.noSuchMethod( - Invocation.setter(#utils, _utils), - returnValueForMissingStub: null, - ); - @override set relayAuth(_i6.IRelayAuth? _relayAuth) => super.noSuchMethod( Invocation.setter(#relayAuth, _relayAuth), @@ -486,13 +487,13 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ); @override - _i24.Future init() => + _i25.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override bool hasKeys(String? tag) => @@ -503,33 +504,33 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as bool); @override - _i24.Future getClientId() => + _i25.Future getClientId() => (super.noSuchMethod( Invocation.method(#getClientId, []), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#getClientId, []), ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future generateKeyPair() => + _i25.Future generateKeyPair() => (super.noSuchMethod( Invocation.method(#generateKeyPair, []), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#generateKeyPair, []), ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future generateSharedKey( + _i25.Future generateSharedKey( String? selfPublicKey, String? peerPublicKey, { String? overrideTopic, @@ -540,8 +541,8 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { [selfPublicKey, peerPublicKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method( #generateSharedKey, @@ -551,18 +552,18 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future setSymKey(String? symKey, {String? overrideTopic}) => + _i25.Future setSymKey(String? symKey, {String? overrideTopic}) => (super.noSuchMethod( Invocation.method( #setSymKey, [symKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method( #setSymKey, @@ -572,59 +573,63 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ), ), ) - as _i24.Future); + as _i25.Future); + + @override + String? getSymKey(String? topic) => + (super.noSuchMethod(Invocation.method(#getSymKey, [topic])) as String?); @override - _i24.Future deleteKeyPair(String? publicKey) => + _i25.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( Invocation.method(#deleteKeyPair, [publicKey]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future deleteSymKey(String? topic) => + _i25.Future deleteSymKey(String? topic) => (super.noSuchMethod( Invocation.method(#deleteSymKey, [topic]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future encode( + _i25.Future encode( String? topic, Map? payload, { _i2.EncodeOptions? options, }) => (super.noSuchMethod( Invocation.method(#encode, [topic, payload], {#options: options}), - returnValue: _i24.Future.value(), + returnValue: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future decode( + _i25.Future decode( String? topic, String? encoded, { _i2.DecodeOptions? options, }) => (super.noSuchMethod( Invocation.method(#decode, [topic, encoded], {#options: options}), - returnValue: _i24.Future.value(), + returnValue: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future signJWT(String? aud) => + _i25.Future signJWT(String? aud) => (super.noSuchMethod( Invocation.method(#signJWT, [aud]), - returnValue: _i24.Future.value( - _i23.dummyValue(this, Invocation.method(#signJWT, [aud])), + returnValue: _i25.Future.value( + _i24.dummyValue(this, Invocation.method(#signJWT, [aud])), ), ) - as _i24.Future); + as _i25.Future); @override int getPayloadType(String? encoded) => @@ -642,21 +647,21 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as String?); @override - _i5.ICryptoUtils getUtils() => + _i4.ICryptoUtils getUtils() => (super.noSuchMethod( Invocation.method(#getUtils, []), - returnValue: _FakeICryptoUtils_5( + returnValue: _FakeICryptoUtils_4( this, Invocation.method(#getUtils, []), ), ) - as _i5.ICryptoUtils); + as _i4.ICryptoUtils); } /// A class which mocks [MessageTracker]. /// /// See the documentation for Mockito's code generation for more information. -class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { +class MockMessageTracker extends _i1.Mock implements _i27.MessageTracker { MockMessageTracker() { _i1.throwOnMissingStub(this); } @@ -665,7 +670,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String get context => (super.noSuchMethod( Invocation.getter(#context), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#context), ), @@ -676,7 +681,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#version), ), @@ -695,63 +700,63 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as _i7.IStore); @override - _i8.Event<_i27.StoreCreateEvent>> get onCreate => + _i8.Event<_i28.StoreCreateEvent>> get onCreate => (super.noSuchMethod( Invocation.getter(#onCreate), returnValue: - _FakeEvent_8<_i27.StoreCreateEvent>>( + _FakeEvent_8<_i28.StoreCreateEvent>>( this, Invocation.getter(#onCreate), ), ) - as _i8.Event<_i27.StoreCreateEvent>>); + as _i8.Event<_i28.StoreCreateEvent>>); @override - _i8.Event<_i27.StoreUpdateEvent>> get onUpdate => + _i8.Event<_i28.StoreUpdateEvent>> get onUpdate => (super.noSuchMethod( Invocation.getter(#onUpdate), returnValue: - _FakeEvent_8<_i27.StoreUpdateEvent>>( + _FakeEvent_8<_i28.StoreUpdateEvent>>( this, Invocation.getter(#onUpdate), ), ) - as _i8.Event<_i27.StoreUpdateEvent>>); + as _i8.Event<_i28.StoreUpdateEvent>>); @override - _i8.Event<_i27.StoreDeleteEvent>> get onDelete => + _i8.Event<_i28.StoreDeleteEvent>> get onDelete => (super.noSuchMethod( Invocation.getter(#onDelete), returnValue: - _FakeEvent_8<_i27.StoreDeleteEvent>>( + _FakeEvent_8<_i28.StoreDeleteEvent>>( this, Invocation.getter(#onDelete), ), ) - as _i8.Event<_i27.StoreDeleteEvent>>); + as _i8.Event<_i28.StoreDeleteEvent>>); @override - _i8.Event<_i27.StoreErrorEvent>> get onError => + _i8.Event<_i28.StoreErrorEvent>> get onError => (super.noSuchMethod( Invocation.getter(#onError), returnValue: - _FakeEvent_8<_i27.StoreErrorEvent>>( + _FakeEvent_8<_i28.StoreErrorEvent>>( this, Invocation.getter(#onError), ), ) - as _i8.Event<_i27.StoreErrorEvent>>); + as _i8.Event<_i28.StoreErrorEvent>>); @override - _i8.Event<_i27.StoreSyncEvent> get onSync => + _i8.Event<_i28.StoreSyncEvent> get onSync => (super.noSuchMethod( Invocation.getter(#onSync), - returnValue: _FakeEvent_8<_i27.StoreSyncEvent>( + returnValue: _FakeEvent_8<_i28.StoreSyncEvent>( this, Invocation.getter(#onSync), ), ) - as _i8.Event<_i27.StoreSyncEvent>); + as _i8.Event<_i28.StoreSyncEvent>); @override Map> get data => @@ -773,7 +778,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String get storageKey => (super.noSuchMethod( Invocation.getter(#storageKey), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#storageKey), ), @@ -790,7 +795,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String hashMessage(String? message) => (super.noSuchMethod( Invocation.method(#hashMessage, [message]), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#hashMessage, [message]), ), @@ -798,13 +803,13 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as String); @override - _i24.Future recordMessageEvent(String? topic, String? message) => + _i25.Future recordMessageEvent(String? topic, String? message) => (super.noSuchMethod( Invocation.method(#recordMessageEvent, [topic, message]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override bool messageIsRecorded(String? topic, String? message) => @@ -815,13 +820,13 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as bool); @override - _i24.Future init() => + _i25.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override bool has(String? key) => @@ -842,40 +847,40 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as List>); @override - _i24.Future set(String? key, Map? value) => + _i25.Future set(String? key, Map? value) => (super.noSuchMethod( Invocation.method(#set, [key, value]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future delete(String? key) => + _i25.Future delete(String? key) => (super.noSuchMethod( Invocation.method(#delete, [key]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future persist() => + _i25.Future persist() => (super.noSuchMethod( Invocation.method(#persist, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future restore() => + _i25.Future restore() => (super.noSuchMethod( Invocation.method(#restore, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override void checkInitialized() => super.noSuchMethod( @@ -887,46 +892,46 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { /// A class which mocks [HttpWrapper]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { +class MockHttpWrapper extends _i1.Mock implements _i29.HttpWrapper { MockHttpWrapper() { _i1.throwOnMissingStub(this); } @override - _i24.Future<_i9.Response> get(Uri? url, {Map? headers}) => + _i25.Future<_i9.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i24.Future<_i9.Response>.value( + returnValue: _i25.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method(#get, [url], {#headers: headers}), ), ), ) - as _i24.Future<_i9.Response>); + as _i25.Future<_i9.Response>); @override - _i24.Future<_i9.Response> delete(Uri? url, {Map? headers}) => + _i25.Future<_i9.Response> delete(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#delete, [url], {#headers: headers}), - returnValue: _i24.Future<_i9.Response>.value( + returnValue: _i25.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method(#delete, [url], {#headers: headers}), ), ), ) - as _i24.Future<_i9.Response>); + as _i25.Future<_i9.Response>); @override - _i24.Future<_i9.Response> post( + _i25.Future<_i9.Response> post( Uri? url, { Map? headers, Object? body, }) => (super.noSuchMethod( Invocation.method(#post, [url], {#headers: headers, #body: body}), - returnValue: _i24.Future<_i9.Response>.value( + returnValue: _i25.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method( @@ -937,13 +942,13 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { ), ), ) - as _i24.Future<_i9.Response>); + as _i25.Future<_i9.Response>); } /// A class which mocks [ReownCore]. /// /// See the documentation for Mockito's code generation for more information. -class MockReownCore extends _i1.Mock implements _i29.ReownCore { +class MockReownCore extends _i1.Mock implements _i30.ReownCore { MockReownCore() { _i1.throwOnMissingStub(this); } @@ -952,7 +957,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get projectId => (super.noSuchMethod( Invocation.getter(#projectId), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#projectId), ), @@ -963,7 +968,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get relayUrl => (super.noSuchMethod( Invocation.getter(#relayUrl), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#relayUrl), ), @@ -974,7 +979,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get pushUrl => (super.noSuchMethod( Invocation.getter(#pushUrl), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#pushUrl), ), @@ -1073,6 +1078,17 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { ) as _i19.ILinkModeStore); + @override + _i20.IRustSignClient get rustSignClient => + (super.noSuchMethod( + Invocation.getter(#rustSignClient), + returnValue: _FakeIRustSignClient_20( + this, + Invocation.getter(#rustSignClient), + ), + ) + as _i20.IRustSignClient); + @override _i7.IStore> get storage => (super.noSuchMethod( @@ -1099,7 +1115,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get protocol => (super.noSuchMethod( Invocation.getter(#protocol), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#protocol), ), @@ -1110,7 +1126,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#version), ), @@ -1118,12 +1134,12 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { as String); @override - _i20.Logger get logger => + _i21.Logger get logger => (super.noSuchMethod( Invocation.getter(#logger), - returnValue: _FakeLogger_20(this, Invocation.getter(#logger)), + returnValue: _FakeLogger_21(this, Invocation.getter(#logger)), ) - as _i20.Logger); + as _i21.Logger); @override set relayUrl(String? _relayUrl) => super.noSuchMethod( @@ -1197,6 +1213,13 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { returnValueForMissingStub: null, ); + @override + set rustSignClient(_i20.IRustSignClient? _rustSignClient) => + super.noSuchMethod( + Invocation.setter(#rustSignClient, _rustSignClient), + returnValueForMissingStub: null, + ); + @override set storage(_i7.IStore>? _storage) => super.noSuchMethod( Invocation.setter(#storage, _storage), @@ -1225,21 +1248,21 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { as bool); @override - _i24.Future start() => + _i25.Future start() => (super.noSuchMethod( Invocation.method(#start, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future addLinkModeSupportedApp(String? universalLink) => + _i25.Future addLinkModeSupportedApp(String? universalLink) => (super.noSuchMethod( Invocation.method(#addLinkModeSupportedApp, [universalLink]), - returnValue: _i24.Future.value(false), + returnValue: _i25.Future.value(false), ) - as _i24.Future); + as _i25.Future); @override List getLinkModeSupportedApps() => @@ -1259,43 +1282,43 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { /// A class which mocks [WebSocketHandler]. /// /// See the documentation for Mockito's code generation for more information. -class MockWebSocketHandler extends _i1.Mock implements _i30.WebSocketHandler { +class MockWebSocketHandler extends _i1.Mock implements _i31.WebSocketHandler { MockWebSocketHandler() { _i1.throwOnMissingStub(this); } @override - _i24.Future get ready => + _i25.Future get ready => (super.noSuchMethod( Invocation.getter(#ready), - returnValue: _i24.Future.value(), + returnValue: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future setup({required String? url}) => + _i25.Future setup({required String? url}) => (super.noSuchMethod( Invocation.method(#setup, [], {#url: url}), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future connect() => + _i25.Future connect() => (super.noSuchMethod( Invocation.method(#connect, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future close() => + _i25.Future close() => (super.noSuchMethod( Invocation.method(#close, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); } diff --git a/packages/reown_core/build.yaml b/packages/reown_core/build.yaml index e39e5483..dbf15e1d 100644 --- a/packages/reown_core/build.yaml +++ b/packages/reown_core/build.yaml @@ -2,7 +2,7 @@ targets: $default: sources: exclude: - - "**/.symlinks/**" + - "**/.symlinks/**" builders: build_version: options: diff --git a/packages/reown_core/lib/core_impl.dart b/packages/reown_core/lib/core_impl.dart index 81923ecb..8d06ec37 100644 --- a/packages/reown_core/lib/core_impl.dart +++ b/packages/reown_core/lib/core_impl.dart @@ -39,6 +39,8 @@ import 'package:reown_core/verify/verify.dart'; import 'package:reown_core/utils/log_level.dart'; import 'package:reown_core/utils/utils.dart'; import 'package:reown_core/models/basic_models.dart'; +import 'package:reown_core/yttrium/i_rust_sign_client.dart'; +import 'package:reown_core/yttrium/rust_sign_client.dart'; import 'package:reown_core/store/secure_store.dart'; class ReownCore implements IReownCore { @@ -86,6 +88,9 @@ class ReownCore implements IReownCore { @override late ILinkModeStore linkModeStore; + @override + late IRustSignClient rustSignClient; + late final LogLevel _logLevel; late final LogCallback? _logCallback; late final Logger _logger; @@ -232,6 +237,9 @@ class ReownCore implements IReownCore { version: StoreVersions.VERSION_LINKMODE, fromJson: (dynamic value) => value as List, ); + rustSignClient = RustSignClient( + core: this, + ); } @override @@ -245,6 +253,7 @@ class ReownCore implements IReownCore { await events.init(); await connectivity.init(); await linkModeStore.init(); + await rustSignClient.init(); heartbeat.init(); } diff --git a/packages/reown_core/lib/crypto/crypto.dart b/packages/reown_core/lib/crypto/crypto.dart index 32e0a282..5402759d 100644 --- a/packages/reown_core/lib/crypto/crypto.dart +++ b/packages/reown_core/lib/crypto/crypto.dart @@ -26,10 +26,12 @@ class Crypto implements ICrypto { final IReownCore core; + final ICryptoUtils utils; + @override IGenericStore keyChain; - ICryptoUtils utils; + @override IRelayAuth relayAuth; Crypto({ @@ -101,6 +103,12 @@ class Crypto implements ICrypto { return topic; } + @override + String? getSymKey(String topic) { + _checkInitialized(); + return keyChain.get(topic); + } + @override Future deleteKeyPair(String publicKey) async { _checkInitialized(); diff --git a/packages/reown_core/lib/crypto/i_crypto.dart b/packages/reown_core/lib/crypto/i_crypto.dart index 26c07ce4..6c6578c6 100644 --- a/packages/reown_core/lib/crypto/i_crypto.dart +++ b/packages/reown_core/lib/crypto/i_crypto.dart @@ -1,5 +1,6 @@ import 'package:reown_core/crypto/crypto_models.dart'; import 'package:reown_core/crypto/i_crypto_utils.dart'; +import 'package:reown_core/relay_auth/i_relay_auth.dart'; import 'package:reown_core/store/i_generic_store.dart'; abstract class ICrypto { @@ -7,6 +8,8 @@ abstract class ICrypto { abstract IGenericStore keyChain; + abstract IRelayAuth relayAuth; + Future init(); bool hasKeys(String tag); @@ -21,6 +24,7 @@ abstract class ICrypto { String symKey, { String? overrideTopic, }); + String? getSymKey(String topic); Future deleteKeyPair(String publicKey); Future deleteSymKey(String topic); Future encode( diff --git a/packages/reown_core/lib/i_core_impl.dart b/packages/reown_core/lib/i_core_impl.dart index e96fffd2..16d42458 100644 --- a/packages/reown_core/lib/i_core_impl.dart +++ b/packages/reown_core/lib/i_core_impl.dart @@ -10,6 +10,7 @@ import 'package:reown_core/relay_client/i_relay_client.dart'; import 'package:reown_core/store/i_store.dart'; import 'package:reown_core/store/link_mode_store.dart'; import 'package:reown_core/verify/i_verify.dart'; +import 'package:reown_core/yttrium/i_rust_sign_client.dart'; abstract class IReownCore { final String protocol = 'wc'; @@ -33,6 +34,7 @@ abstract class IReownCore { abstract final Logger logger; abstract IVerify verify; abstract ILinkModeStore linkModeStore; + abstract IRustSignClient rustSignClient; Future start(); diff --git a/packages/reown_core/lib/models/rust_sign_client_models.dart b/packages/reown_core/lib/models/rust_sign_client_models.dart new file mode 100644 index 00000000..a0bc0bb4 --- /dev/null +++ b/packages/reown_core/lib/models/rust_sign_client_models.dart @@ -0,0 +1,60 @@ +import 'package:convert/convert.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:reown_core/reown_core.dart'; + +part 'rust_sign_client_models.g.dart'; +part 'rust_sign_client_models.freezed.dart'; + +@freezed +sealed class SessionProposal with _$SessionProposal { + const factory SessionProposal({ + required int id, + required String pairingTopic, + required String pairingSymKey, // hex encoded string + required String proposerPublicKey, // hex encoded string + required List> relays, + required Map> requiredNamespaces, + Map>? optionalNamespaces, + required Map metadata, + Map? sessionProperties, + Map? scopedProperties, + int? expiry, + }) = _SessionProposal; + + factory SessionProposal.fromJson(Map json) => + _$SessionProposalFromJson(json); + + factory SessionProposal.fromFfi(SessionProposalFfi ffi) => SessionProposal( + id: int.parse(ffi.id), + pairingTopic: ffi.topic, + pairingSymKey: hex.encode(ffi.pairingSymKey), + proposerPublicKey: hex.encode(ffi.proposerPublicKey), + relays: ffi.relays, + requiredNamespaces: ffi.requiredNamespaces, + optionalNamespaces: ffi.optionalNamespaces, + metadata: ffi.metadata, + sessionProperties: ffi.sessionProperties, + scopedProperties: ffi.scopedProperties, + expiry: ffi.expiryTimestamp ?? + ReownCoreUtils.calculateExpiry( + ReownConstants.FIVE_MINUTES, + ), + ); +} + +@freezed +sealed class ApproveResult with _$ApproveResult { + @JsonSerializable() + const factory ApproveResult({ + required String sessionSymKey, // hex encoded string + required String selfPublicKey, // hex encoded string + }) = _ApproveResult; + + factory ApproveResult.fromJson(Map json) => + _$ApproveResultFromJson(json); + + factory ApproveResult.fromFfi(ApproveResultFfi ffi) => ApproveResult( + sessionSymKey: hex.encode(ffi.sessionSymKey), + selfPublicKey: hex.encode(ffi.selfPublicKey), + ); +} diff --git a/packages/reown_core/lib/models/rust_sign_client_models.freezed.dart b/packages/reown_core/lib/models/rust_sign_client_models.freezed.dart new file mode 100644 index 00000000..033003e9 --- /dev/null +++ b/packages/reown_core/lib/models/rust_sign_client_models.freezed.dart @@ -0,0 +1,610 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// 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 'rust_sign_client_models.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$SessionProposal { + + int get id; String get pairingTopic; String get pairingSymKey;// hex encoded string + String get proposerPublicKey;// hex encoded string + List> get relays; Map> get requiredNamespaces; Map>? get optionalNamespaces; Map get metadata; Map? get sessionProperties; Map? get scopedProperties; int? get expiry; +/// Create a copy of SessionProposal +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionProposalCopyWith get copyWith => _$SessionProposalCopyWithImpl(this as SessionProposal, _$identity); + + /// Serializes this SessionProposal to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionProposal&&(identical(other.id, id) || other.id == id)&&(identical(other.pairingTopic, pairingTopic) || other.pairingTopic == pairingTopic)&&(identical(other.pairingSymKey, pairingSymKey) || other.pairingSymKey == pairingSymKey)&&(identical(other.proposerPublicKey, proposerPublicKey) || other.proposerPublicKey == proposerPublicKey)&&const DeepCollectionEquality().equals(other.relays, relays)&&const DeepCollectionEquality().equals(other.requiredNamespaces, requiredNamespaces)&&const DeepCollectionEquality().equals(other.optionalNamespaces, optionalNamespaces)&&const DeepCollectionEquality().equals(other.metadata, metadata)&&const DeepCollectionEquality().equals(other.sessionProperties, sessionProperties)&&const DeepCollectionEquality().equals(other.scopedProperties, scopedProperties)&&(identical(other.expiry, expiry) || other.expiry == expiry)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,pairingTopic,pairingSymKey,proposerPublicKey,const DeepCollectionEquality().hash(relays),const DeepCollectionEquality().hash(requiredNamespaces),const DeepCollectionEquality().hash(optionalNamespaces),const DeepCollectionEquality().hash(metadata),const DeepCollectionEquality().hash(sessionProperties),const DeepCollectionEquality().hash(scopedProperties),expiry); + +@override +String toString() { + return 'SessionProposal(id: $id, pairingTopic: $pairingTopic, pairingSymKey: $pairingSymKey, proposerPublicKey: $proposerPublicKey, relays: $relays, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, metadata: $metadata, sessionProperties: $sessionProperties, scopedProperties: $scopedProperties, expiry: $expiry)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionProposalCopyWith<$Res> { + factory $SessionProposalCopyWith(SessionProposal value, $Res Function(SessionProposal) _then) = _$SessionProposalCopyWithImpl; +@useResult +$Res call({ + int id, String pairingTopic, String pairingSymKey, String proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiry +}); + + + + +} +/// @nodoc +class _$SessionProposalCopyWithImpl<$Res> + implements $SessionProposalCopyWith<$Res> { + _$SessionProposalCopyWithImpl(this._self, this._then); + + final SessionProposal _self; + final $Res Function(SessionProposal) _then; + +/// Create a copy of SessionProposal +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? pairingTopic = null,Object? pairingSymKey = null,Object? proposerPublicKey = null,Object? relays = null,Object? requiredNamespaces = null,Object? optionalNamespaces = freezed,Object? metadata = null,Object? sessionProperties = freezed,Object? scopedProperties = freezed,Object? expiry = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,pairingTopic: null == pairingTopic ? _self.pairingTopic : pairingTopic // ignore: cast_nullable_to_non_nullable +as String,pairingSymKey: null == pairingSymKey ? _self.pairingSymKey : pairingSymKey // ignore: cast_nullable_to_non_nullable +as String,proposerPublicKey: null == proposerPublicKey ? _self.proposerPublicKey : proposerPublicKey // ignore: cast_nullable_to_non_nullable +as String,relays: null == relays ? _self.relays : relays // ignore: cast_nullable_to_non_nullable +as List>,requiredNamespaces: null == requiredNamespaces ? _self.requiredNamespaces : requiredNamespaces // ignore: cast_nullable_to_non_nullable +as Map>,optionalNamespaces: freezed == optionalNamespaces ? _self.optionalNamespaces : optionalNamespaces // ignore: cast_nullable_to_non_nullable +as Map>?,metadata: null == metadata ? _self.metadata : metadata // ignore: cast_nullable_to_non_nullable +as Map,sessionProperties: freezed == sessionProperties ? _self.sessionProperties : sessionProperties // ignore: cast_nullable_to_non_nullable +as Map?,scopedProperties: freezed == scopedProperties ? _self.scopedProperties : scopedProperties // ignore: cast_nullable_to_non_nullable +as Map?,expiry: freezed == expiry ? _self.expiry : expiry // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SessionProposal]. +extension SessionProposalPatterns on SessionProposal { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SessionProposal value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SessionProposal() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SessionProposal value) $default,){ +final _that = this; +switch (_that) { +case _SessionProposal(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SessionProposal value)? $default,){ +final _that = this; +switch (_that) { +case _SessionProposal() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int id, String pairingTopic, String pairingSymKey, String proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiry)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SessionProposal() when $default != null: +return $default(_that.id,_that.pairingTopic,_that.pairingSymKey,_that.proposerPublicKey,_that.relays,_that.requiredNamespaces,_that.optionalNamespaces,_that.metadata,_that.sessionProperties,_that.scopedProperties,_that.expiry);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int id, String pairingTopic, String pairingSymKey, String proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiry) $default,) {final _that = this; +switch (_that) { +case _SessionProposal(): +return $default(_that.id,_that.pairingTopic,_that.pairingSymKey,_that.proposerPublicKey,_that.relays,_that.requiredNamespaces,_that.optionalNamespaces,_that.metadata,_that.sessionProperties,_that.scopedProperties,_that.expiry);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int id, String pairingTopic, String pairingSymKey, String proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiry)? $default,) {final _that = this; +switch (_that) { +case _SessionProposal() when $default != null: +return $default(_that.id,_that.pairingTopic,_that.pairingSymKey,_that.proposerPublicKey,_that.relays,_that.requiredNamespaces,_that.optionalNamespaces,_that.metadata,_that.sessionProperties,_that.scopedProperties,_that.expiry);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SessionProposal implements SessionProposal { + const _SessionProposal({required this.id, required this.pairingTopic, required this.pairingSymKey, required this.proposerPublicKey, required final List> relays, required final Map> requiredNamespaces, final Map>? optionalNamespaces, required final Map metadata, final Map? sessionProperties, final Map? scopedProperties, this.expiry}): _relays = relays,_requiredNamespaces = requiredNamespaces,_optionalNamespaces = optionalNamespaces,_metadata = metadata,_sessionProperties = sessionProperties,_scopedProperties = scopedProperties; + factory _SessionProposal.fromJson(Map json) => _$SessionProposalFromJson(json); + +@override final int id; +@override final String pairingTopic; +@override final String pairingSymKey; +// hex encoded string +@override final String proposerPublicKey; +// hex encoded string + final List> _relays; +// hex encoded string +@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 { + final value = _optionalNamespaces; + if (value == null) return null; + if (_optionalNamespaces is EqualUnmodifiableMapView) return _optionalNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); +} + + final Map _metadata; +@override Map get metadata { + if (_metadata is EqualUnmodifiableMapView) return _metadata; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_metadata); +} + + 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? _scopedProperties; +@override Map? get scopedProperties { + final value = _scopedProperties; + if (value == null) return null; + if (_scopedProperties is EqualUnmodifiableMapView) return _scopedProperties; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); +} + +@override final int? expiry; + +/// Create a copy of SessionProposal +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SessionProposalCopyWith<_SessionProposal> get copyWith => __$SessionProposalCopyWithImpl<_SessionProposal>(this, _$identity); + +@override +Map toJson() { + return _$SessionProposalToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SessionProposal&&(identical(other.id, id) || other.id == id)&&(identical(other.pairingTopic, pairingTopic) || other.pairingTopic == pairingTopic)&&(identical(other.pairingSymKey, pairingSymKey) || other.pairingSymKey == pairingSymKey)&&(identical(other.proposerPublicKey, proposerPublicKey) || other.proposerPublicKey == proposerPublicKey)&&const DeepCollectionEquality().equals(other._relays, _relays)&&const DeepCollectionEquality().equals(other._requiredNamespaces, _requiredNamespaces)&&const DeepCollectionEquality().equals(other._optionalNamespaces, _optionalNamespaces)&&const DeepCollectionEquality().equals(other._metadata, _metadata)&&const DeepCollectionEquality().equals(other._sessionProperties, _sessionProperties)&&const DeepCollectionEquality().equals(other._scopedProperties, _scopedProperties)&&(identical(other.expiry, expiry) || other.expiry == expiry)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,pairingTopic,pairingSymKey,proposerPublicKey,const DeepCollectionEquality().hash(_relays),const DeepCollectionEquality().hash(_requiredNamespaces),const DeepCollectionEquality().hash(_optionalNamespaces),const DeepCollectionEquality().hash(_metadata),const DeepCollectionEquality().hash(_sessionProperties),const DeepCollectionEquality().hash(_scopedProperties),expiry); + +@override +String toString() { + return 'SessionProposal(id: $id, pairingTopic: $pairingTopic, pairingSymKey: $pairingSymKey, proposerPublicKey: $proposerPublicKey, relays: $relays, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, metadata: $metadata, sessionProperties: $sessionProperties, scopedProperties: $scopedProperties, expiry: $expiry)'; +} + + +} + +/// @nodoc +abstract mixin class _$SessionProposalCopyWith<$Res> implements $SessionProposalCopyWith<$Res> { + factory _$SessionProposalCopyWith(_SessionProposal value, $Res Function(_SessionProposal) _then) = __$SessionProposalCopyWithImpl; +@override @useResult +$Res call({ + int id, String pairingTopic, String pairingSymKey, String proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiry +}); + + + + +} +/// @nodoc +class __$SessionProposalCopyWithImpl<$Res> + implements _$SessionProposalCopyWith<$Res> { + __$SessionProposalCopyWithImpl(this._self, this._then); + + final _SessionProposal _self; + final $Res Function(_SessionProposal) _then; + +/// Create a copy of SessionProposal +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? pairingTopic = null,Object? pairingSymKey = null,Object? proposerPublicKey = null,Object? relays = null,Object? requiredNamespaces = null,Object? optionalNamespaces = freezed,Object? metadata = null,Object? sessionProperties = freezed,Object? scopedProperties = freezed,Object? expiry = freezed,}) { + return _then(_SessionProposal( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,pairingTopic: null == pairingTopic ? _self.pairingTopic : pairingTopic // ignore: cast_nullable_to_non_nullable +as String,pairingSymKey: null == pairingSymKey ? _self.pairingSymKey : pairingSymKey // ignore: cast_nullable_to_non_nullable +as String,proposerPublicKey: null == proposerPublicKey ? _self.proposerPublicKey : proposerPublicKey // ignore: cast_nullable_to_non_nullable +as String,relays: null == relays ? _self._relays : relays // ignore: cast_nullable_to_non_nullable +as List>,requiredNamespaces: null == requiredNamespaces ? _self._requiredNamespaces : requiredNamespaces // ignore: cast_nullable_to_non_nullable +as Map>,optionalNamespaces: freezed == optionalNamespaces ? _self._optionalNamespaces : optionalNamespaces // ignore: cast_nullable_to_non_nullable +as Map>?,metadata: null == metadata ? _self._metadata : metadata // ignore: cast_nullable_to_non_nullable +as Map,sessionProperties: freezed == sessionProperties ? _self._sessionProperties : sessionProperties // ignore: cast_nullable_to_non_nullable +as Map?,scopedProperties: freezed == scopedProperties ? _self._scopedProperties : scopedProperties // ignore: cast_nullable_to_non_nullable +as Map?,expiry: freezed == expiry ? _self.expiry : expiry // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + + +/// @nodoc +mixin _$ApproveResult { + + String get sessionSymKey;// hex encoded string + String get selfPublicKey; +/// Create a copy of ApproveResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ApproveResultCopyWith get copyWith => _$ApproveResultCopyWithImpl(this as ApproveResult, _$identity); + + /// Serializes this ApproveResult to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ApproveResult&&(identical(other.sessionSymKey, sessionSymKey) || other.sessionSymKey == sessionSymKey)&&(identical(other.selfPublicKey, selfPublicKey) || other.selfPublicKey == selfPublicKey)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sessionSymKey,selfPublicKey); + +@override +String toString() { + return 'ApproveResult(sessionSymKey: $sessionSymKey, selfPublicKey: $selfPublicKey)'; +} + + +} + +/// @nodoc +abstract mixin class $ApproveResultCopyWith<$Res> { + factory $ApproveResultCopyWith(ApproveResult value, $Res Function(ApproveResult) _then) = _$ApproveResultCopyWithImpl; +@useResult +$Res call({ + String sessionSymKey, String selfPublicKey +}); + + + + +} +/// @nodoc +class _$ApproveResultCopyWithImpl<$Res> + implements $ApproveResultCopyWith<$Res> { + _$ApproveResultCopyWithImpl(this._self, this._then); + + final ApproveResult _self; + final $Res Function(ApproveResult) _then; + +/// Create a copy of ApproveResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? sessionSymKey = null,Object? selfPublicKey = null,}) { + return _then(_self.copyWith( +sessionSymKey: null == sessionSymKey ? _self.sessionSymKey : sessionSymKey // ignore: cast_nullable_to_non_nullable +as String,selfPublicKey: null == selfPublicKey ? _self.selfPublicKey : selfPublicKey // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ApproveResult]. +extension ApproveResultPatterns on ApproveResult { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _ApproveResult value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ApproveResult() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _ApproveResult value) $default,){ +final _that = this; +switch (_that) { +case _ApproveResult(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _ApproveResult value)? $default,){ +final _that = this; +switch (_that) { +case _ApproveResult() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String sessionSymKey, String selfPublicKey)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ApproveResult() when $default != null: +return $default(_that.sessionSymKey,_that.selfPublicKey);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String sessionSymKey, String selfPublicKey) $default,) {final _that = this; +switch (_that) { +case _ApproveResult(): +return $default(_that.sessionSymKey,_that.selfPublicKey);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String sessionSymKey, String selfPublicKey)? $default,) {final _that = this; +switch (_that) { +case _ApproveResult() when $default != null: +return $default(_that.sessionSymKey,_that.selfPublicKey);case _: + return null; + +} +} + +} + +/// @nodoc + +@JsonSerializable() +class _ApproveResult implements ApproveResult { + const _ApproveResult({required this.sessionSymKey, required this.selfPublicKey}); + factory _ApproveResult.fromJson(Map json) => _$ApproveResultFromJson(json); + +@override final String sessionSymKey; +// hex encoded string +@override final String selfPublicKey; + +/// Create a copy of ApproveResult +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ApproveResultCopyWith<_ApproveResult> get copyWith => __$ApproveResultCopyWithImpl<_ApproveResult>(this, _$identity); + +@override +Map toJson() { + return _$ApproveResultToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApproveResult&&(identical(other.sessionSymKey, sessionSymKey) || other.sessionSymKey == sessionSymKey)&&(identical(other.selfPublicKey, selfPublicKey) || other.selfPublicKey == selfPublicKey)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sessionSymKey,selfPublicKey); + +@override +String toString() { + return 'ApproveResult(sessionSymKey: $sessionSymKey, selfPublicKey: $selfPublicKey)'; +} + + +} + +/// @nodoc +abstract mixin class _$ApproveResultCopyWith<$Res> implements $ApproveResultCopyWith<$Res> { + factory _$ApproveResultCopyWith(_ApproveResult value, $Res Function(_ApproveResult) _then) = __$ApproveResultCopyWithImpl; +@override @useResult +$Res call({ + String sessionSymKey, String selfPublicKey +}); + + + + +} +/// @nodoc +class __$ApproveResultCopyWithImpl<$Res> + implements _$ApproveResultCopyWith<$Res> { + __$ApproveResultCopyWithImpl(this._self, this._then); + + final _ApproveResult _self; + final $Res Function(_ApproveResult) _then; + +/// Create a copy of ApproveResult +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? sessionSymKey = null,Object? selfPublicKey = null,}) { + return _then(_ApproveResult( +sessionSymKey: null == sessionSymKey ? _self.sessionSymKey : sessionSymKey // ignore: cast_nullable_to_non_nullable +as String,selfPublicKey: null == selfPublicKey ? _self.selfPublicKey : selfPublicKey // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/reown_core/lib/models/rust_sign_client_models.g.dart b/packages/reown_core/lib/models/rust_sign_client_models.g.dart new file mode 100644 index 00000000..332b6553 --- /dev/null +++ b/packages/reown_core/lib/models/rust_sign_client_models.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rust_sign_client_models.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SessionProposal _$SessionProposalFromJson(Map json) => + _SessionProposal( + id: (json['id'] as num).toInt(), + pairingTopic: json['pairingTopic'] as String, + pairingSymKey: json['pairingSymKey'] as String, + proposerPublicKey: json['proposerPublicKey'] as String, + relays: (json['relays'] as List) + .map((e) => e as Map) + .toList(), + requiredNamespaces: (json['requiredNamespaces'] as Map) + .map((k, e) => MapEntry(k, e as Map)), + optionalNamespaces: (json['optionalNamespaces'] as Map?) + ?.map((k, e) => MapEntry(k, e as Map)), + metadata: json['metadata'] as Map, + sessionProperties: (json['sessionProperties'] as Map?) + ?.map((k, e) => MapEntry(k, e as String)), + scopedProperties: (json['scopedProperties'] as Map?) + ?.map((k, e) => MapEntry(k, e as String)), + expiry: (json['expiry'] as num?)?.toInt(), + ); + +Map _$SessionProposalToJson(_SessionProposal instance) => + { + 'id': instance.id, + 'pairingTopic': instance.pairingTopic, + 'pairingSymKey': instance.pairingSymKey, + 'proposerPublicKey': instance.proposerPublicKey, + 'relays': instance.relays, + 'requiredNamespaces': instance.requiredNamespaces, + 'optionalNamespaces': instance.optionalNamespaces, + 'metadata': instance.metadata, + 'sessionProperties': instance.sessionProperties, + 'scopedProperties': instance.scopedProperties, + 'expiry': instance.expiry, + }; + +_ApproveResult _$ApproveResultFromJson(Map json) => + _ApproveResult( + sessionSymKey: json['sessionSymKey'] as String, + selfPublicKey: json['selfPublicKey'] as String, + ); + +Map _$ApproveResultToJson(_ApproveResult instance) => + { + 'sessionSymKey': instance.sessionSymKey, + 'selfPublicKey': instance.selfPublicKey, + }; diff --git a/packages/reown_core/lib/pairing/pairing.dart b/packages/reown_core/lib/pairing/pairing.dart index d1298850..0d381025 100644 --- a/packages/reown_core/lib/pairing/pairing.dart +++ b/packages/reown_core/lib/pairing/pairing.dart @@ -5,9 +5,11 @@ import 'package:event/event.dart'; import 'package:reown_core/events/models/basic_event.dart'; import 'package:reown_core/events/models/link_mode_events.dart'; import 'package:reown_core/models/json_rpc_models.dart'; +import 'package:reown_core/models/rust_sign_client_models.dart'; import 'package:reown_core/models/tvf_data.dart'; import 'package:reown_core/pairing/i_json_rpc_history.dart'; import 'package:reown_core/relay_client/relay_client.dart'; +import 'package:reown_core/reown_core.dart'; import 'package:reown_core/store/i_generic_store.dart'; import 'package:reown_core/crypto/crypto_models.dart'; import 'package:reown_core/i_core_impl.dart'; @@ -163,9 +165,6 @@ class Pairing implements IPairing { _checkInitialized(); // print(uri.queryParameters); - final int expiry = ReownCoreUtils.calculateExpiry( - ReownConstants.FIVE_MINUTES, - ); final URIParseResult parsedUri = ReownCoreUtils.parseUri(uri); if (parsedUri.version != URIVersion.v2) { throw Errors.getInternalError( @@ -174,9 +173,15 @@ class Pairing implements IPairing { ); } - final String topic = parsedUri.topic; - final Relay relay = parsedUri.v2Data!.relay; - final String symKey = parsedUri.v2Data!.symKey; + final SessionProposal sessionProposal = await core.rustSignClient.pair( + uri: uri, + ); + + final String topic = sessionProposal.pairingTopic; + final Relay relay = + sessionProposal.relays.map((e) => Relay.fromJson(e)).first; + final String symKey = sessionProposal.pairingSymKey; + final int expiry = sessionProposal.expiry!; final PairingInfo pairing = PairingInfo( topic: topic, expiry: expiry, @@ -648,23 +653,30 @@ class Pairing implements IPairing { 'id: $id topic: $topic, method: $method, result: $result', ); } else { - final opts = MethodConstants.RPC_OPTS[method]!['res']!; - // - await core.relayClient.publish( + // final opts = MethodConstants.RPC_OPTS[method]!['res']!; + // // + // await core.relayClient.publish( + // topic: topic, + // message: message, + // options: PublishOptions( + // ttl: opts.ttl, + // tag: opts.tag, + // correlationId: resultId, + // // tvf data is sent only on tvfMethods methods + // tvf: _shouldSendTVF(opts.tag) ? tvf?.toJson(includeAll: true) : null, + // ), + // ); + // core.logger.d( + // '[$runtimeType] sendResult relayClient, ' + // 'id: $id topic: $topic, method: $method, result: $result', + // ); + await core.rustSignClient.respond( topic: topic, - message: message, - options: PublishOptions( - ttl: opts.ttl, - tag: opts.tag, - correlationId: resultId, - // tvf data is sent only on tvfMethods methods - tvf: _shouldSendTVF(opts.tag) ? tvf?.toJson(includeAll: true) : null, + response: SessionRequestJsonRpcResponseFfi.result( + id: id, + result: result, // TODO result should be dynamic? ), ); - core.logger.d( - '[$runtimeType] sendResult relayClient, ' - 'id: $id topic: $topic, method: $method, result: $result', - ); } } @@ -786,29 +798,36 @@ class Pairing implements IPairing { 'id: $id topic: $topic, method: $method, error: $error', ); } else { - final fallbackMethod = MethodConstants.UNREGISTERED_METHOD; - final methodOpts = MethodConstants.RPC_OPTS[method]; - final fallbackMethodOpts = MethodConstants.RPC_OPTS[fallbackMethod]!; - final relayOpts = methodOpts ?? fallbackMethodOpts; - final fallbackOpts = relayOpts['reject'] ?? relayOpts['res']!; - final ttl = (rpcOptions ?? fallbackOpts).ttl; - final tag = (rpcOptions ?? fallbackOpts).tag; - // - await core.relayClient.publish( + // final fallbackMethod = MethodConstants.UNREGISTERED_METHOD; + // final methodOpts = MethodConstants.RPC_OPTS[method]; + // final fallbackMethodOpts = MethodConstants.RPC_OPTS[fallbackMethod]!; + // final relayOpts = methodOpts ?? fallbackMethodOpts; + // final fallbackOpts = relayOpts['reject'] ?? relayOpts['res']!; + // final ttl = (rpcOptions ?? fallbackOpts).ttl; + // final tag = (rpcOptions ?? fallbackOpts).tag; + // // + // await core.relayClient.publish( + // topic: topic, + // message: message, + // options: PublishOptions( + // ttl: ttl, + // tag: tag, + // correlationId: resultId, + // // tvf data is sent only on tvfMethods methods + // tvf: _shouldSendTVF(tag) ? tvf?.toJson(includeAll: true) : null, + // ), + // ); + // core.logger.d( + // '[$runtimeType] sendError relayClient, ' + // 'id: $id topic: $topic, method: $method, error: $error', + // ); + await core.rustSignClient.respond( topic: topic, - message: message, - options: PublishOptions( - ttl: ttl, - tag: tag, - correlationId: resultId, - // tvf data is sent only on tvfMethods methods - tvf: _shouldSendTVF(tag) ? tvf?.toJson(includeAll: true) : null, + response: SessionRequestJsonRpcResponseFfi.error( + id: id, + error: jsonEncode(error.toString()), ), ); - core.logger.d( - '[$runtimeType] sendError relayClient, ' - 'id: $id topic: $topic, method: $method, error: $error', - ); } } diff --git a/packages/reown_core/lib/relay_client/relay_client_models.dart b/packages/reown_core/lib/relay_client/relay_client_models.dart index 6826140a..99010791 100644 --- a/packages/reown_core/lib/relay_client/relay_client_models.dart +++ b/packages/reown_core/lib/relay_client/relay_client_models.dart @@ -12,7 +12,7 @@ enum TransportType { bool get isLinkMode => this == linkMode; } -@JsonSerializable() +@JsonSerializable(includeIfNull: false) class Relay { final String protocol; final String? data; diff --git a/packages/reown_core/lib/relay_client/relay_client_models.g.dart b/packages/reown_core/lib/relay_client/relay_client_models.g.dart index f6fdbfc2..0d9b0a0d 100644 --- a/packages/reown_core/lib/relay_client/relay_client_models.g.dart +++ b/packages/reown_core/lib/relay_client/relay_client_models.g.dart @@ -11,5 +11,5 @@ Relay _$RelayFromJson(Map json) => Map _$RelayToJson(Relay instance) => { 'protocol': instance.protocol, - 'data': instance.data, + 'data': ?instance.data, }; diff --git a/packages/reown_core/lib/reown_core.dart b/packages/reown_core/lib/reown_core.dart index 808ef010..0dac714d 100644 --- a/packages/reown_core/lib/reown_core.dart +++ b/packages/reown_core/lib/reown_core.dart @@ -26,3 +26,4 @@ export 'core_impl.dart'; export 'package:bs58/bs58.dart'; export 'package:ed25519_edwards/ed25519_edwards.dart' show PublicKey; export 'package:pointycastle/digests/sha256.dart'; +export 'package:reown_yttrium/reown_yttrium.dart'; diff --git a/packages/reown_core/lib/yttrium/i_rust_sign_client.dart b/packages/reown_core/lib/yttrium/i_rust_sign_client.dart new file mode 100644 index 00000000..031e397e --- /dev/null +++ b/packages/reown_core/lib/yttrium/i_rust_sign_client.dart @@ -0,0 +1,36 @@ +import 'package:reown_core/models/rust_sign_client_models.dart'; +import 'package:reown_core/reown_core.dart'; + +abstract class IRustSignClient { + abstract Function( + String topic, + JsonRpcRequest payload, [ + TransportType transportType, + ]) onSessionProposeRequest; + + abstract Function( + String topic, + JsonRpcRequest payload, [ + TransportType transportType, + ]) onSessionRequest; + + Future init(); + + Future pair({required Uri uri}); + + Future approve({ + required SessionProposalFfi proposal, + required Map> approvedNamespaces, + required Map selfMetadata, + }); + + Future reject({ + required SessionProposalFfi proposal, + required ErrorDataFfi error, + }); + + Future respond({ + required String topic, + required SessionRequestJsonRpcResponseFfi response, + }); +} diff --git a/packages/reown_core/lib/yttrium/rust_sign_client.dart b/packages/reown_core/lib/yttrium/rust_sign_client.dart new file mode 100644 index 00000000..58adf5c8 --- /dev/null +++ b/packages/reown_core/lib/yttrium/rust_sign_client.dart @@ -0,0 +1,159 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:convert/convert.dart'; +import 'package:reown_core/reown_core.dart'; +import 'package:reown_core/yttrium/i_rust_sign_client.dart'; +import 'package:reown_core/models/rust_sign_client_models.dart'; + +class RustSignClient implements IRustSignClient { + bool _initialized = false; + static const clientSeed = 'CLIENT_SEED'; + + @override + late Function( + String topic, + JsonRpcRequest payload, [ + TransportType transportType, + ]) onSessionProposeRequest; + + @override + late Function( + String topic, + JsonRpcRequest payload, [ + TransportType transportType, + ]) onSessionRequest; + + final IReownCore core; + final Map pendingProposals = {}; + + RustSignClient({required this.core}); + + @override + Future init() async { + if (_initialized) { + return; + } + try { + final key = await _getKey(); + await ReownYttrium().signClient.init(projectId: core.projectId, key: key); + // start() for start + // online() for when coming from bg + await ReownYttrium().signClient.initListener(); + ReownYttrium().signClient.onSessionRequest = _onSessionRequest; + core.pairing.onPairingCreate.subscribe(_onPairingEvent); + _initialized = true; + } catch (e) { + core.logger.e('[$runtimeType] $e'); + rethrow; + } + } + + void _onSessionRequest(String topic, SessionRequestJsonRpcFfi request) { + core.logger.d('[$runtimeType] signClient onRequest ${request.toJson()}'); + final payload = JsonRpcRequest( + id: request.id, + method: request.method, + params: { + 'chainId': request.params.chainId, + 'request': { + 'method': request.params.request.method, + 'params': jsonDecode(request.params.request.params), + } + }, + ); + onSessionRequest.call(topic, payload); + } + + @override + Future pair({required Uri uri}) async { + _checkInitialized(); + + final pairResponse = await ReownYttrium().signClient.pair(uri: '$uri'); + final sessionProposal = SessionProposal.fromFfi(pairResponse); + pendingProposals[sessionProposal.pairingTopic] = sessionProposal; + + return sessionProposal; + } + + void _onPairingEvent(PairingEvent pairingEvent) { + // TODO could it be id instead of topic? + if (pendingProposals.containsKey(pairingEvent.topic)) { + final sessionProposal = pendingProposals[pairingEvent.topic]!; + pendingProposals.remove(pairingEvent.topic); + onSessionProposeRequest.call( + sessionProposal.pairingTopic, + JsonRpcRequest( + id: sessionProposal.id, + method: MethodConstants.WC_SESSION_PROPOSE, + params: { + ...sessionProposal.toJson(), + 'proposer': { + 'publicKey': sessionProposal.proposerPublicKey, + 'metadata': sessionProposal.metadata, + }, + }, + ), + ); + } + } + + @override + Future approve({ + required SessionProposalFfi proposal, + required Map> approvedNamespaces, + required Map selfMetadata, + }) async { + _checkInitialized(); + + final approveResponse = await ReownYttrium().signClient.approve( + proposal: proposal, + approvedNamespaces: approvedNamespaces.map( + (key, value) => MapEntry(key, SettleNamespaceFfi.fromJson(value)), + ), + selfMetadata: MetadataFfi.fromJson(selfMetadata), + ); + + return ApproveResult.fromFfi(approveResponse); + } + + @override + Future reject({ + required SessionProposalFfi proposal, + required ErrorDataFfi error, + }) async { + _checkInitialized(); + + return await ReownYttrium().signClient.reject( + proposal: proposal, + error: error, + ); + } + + @override + Future respond({ + required String topic, + required SessionRequestJsonRpcResponseFfi response, + }) async { + _checkInitialized(); + + return await ReownYttrium().signClient.respond( + topic: topic, + response: response, + ); + } + + void _checkInitialized() { + if (!_initialized) { + throw Errors.getInternalError(Errors.NOT_INITIALIZED); + } + } + + Future _getKey() async { + final seed = core.crypto.keyChain.get(clientSeed)!; + final seedBytes = Uint8List.fromList(hex.decode(seed)); + final keyPair = await core.crypto.relayAuth.generateKeyPair(seedBytes); + final keyBytes = keyPair.privateKeyBytes.sublist(0, 32); + return hex.encode(keyBytes); + } +} diff --git a/packages/reown_core/pubspec.yaml b/packages/reown_core/pubspec.yaml index e3d91772..d560fad9 100644 --- a/packages/reown_core/pubspec.yaml +++ b/packages/reown_core/pubspec.yaml @@ -25,6 +25,8 @@ dependencies: msgpack_dart: ^1.0.1 package_info_plus: ^8.1.2 pointycastle: ^3.9.1 + reown_yttrium: + path: ../reown_yttrium/ shared_preferences: ^2.3.4 stack_trace: ^1.11.1 stream_channel: ^2.1.2 diff --git a/packages/reown_core/test/shared/shared_test_utils.mocks.dart b/packages/reown_core/test/shared/shared_test_utils.mocks.dart index a4ee529e..42f75323 100644 --- a/packages/reown_core/test/shared/shared_test_utils.mocks.dart +++ b/packages/reown_core/test/shared/shared_test_utils.mocks.dart @@ -3,45 +3,46 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i26; -import 'dart:typed_data' as _i24; +import 'dart:async' as _i27; +import 'dart:typed_data' as _i25; import 'package:event/event.dart' as _i8; import 'package:http/http.dart' as _i9; -import 'package:logger/logger.dart' as _i20; +import 'package:logger/logger.dart' as _i21; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i25; +import 'package:mockito/src/dummies.dart' as _i26; import 'package:reown_core/connectivity/i_connectivity.dart' as _i18; -import 'package:reown_core/core_impl.dart' as _i31; -import 'package:reown_core/crypto/crypto.dart' as _i27; +import 'package:reown_core/core_impl.dart' as _i32; +import 'package:reown_core/crypto/crypto.dart' as _i28; import 'package:reown_core/crypto/crypto_models.dart' as _i2; -import 'package:reown_core/crypto/crypto_utils.dart' as _i23; +import 'package:reown_core/crypto/crypto_utils.dart' as _i24; import 'package:reown_core/crypto/i_crypto.dart' as _i10; -import 'package:reown_core/crypto/i_crypto_utils.dart' as _i5; +import 'package:reown_core/crypto/i_crypto_utils.dart' as _i4; import 'package:reown_core/echo/i_echo.dart' as _i14; import 'package:reown_core/events/i_events.dart' as _i15; import 'package:reown_core/heartbit/i_heartbeat.dart' as _i16; import 'package:reown_core/i_core_impl.dart' as _i3; -import 'package:reown_core/models/basic_models.dart' as _i36; +import 'package:reown_core/models/basic_models.dart' as _i37; import 'package:reown_core/pairing/i_expirer.dart' as _i12; import 'package:reown_core/pairing/i_pairing.dart' as _i13; import 'package:reown_core/relay_auth/i_relay_auth.dart' as _i6; -import 'package:reown_core/relay_client/i_message_tracker.dart' as _i21; +import 'package:reown_core/relay_client/i_message_tracker.dart' as _i22; import 'package:reown_core/relay_client/i_relay_client.dart' as _i11; -import 'package:reown_core/relay_client/json_rpc_2/src/peer.dart' as _i35; -import 'package:reown_core/relay_client/message_tracker.dart' as _i28; -import 'package:reown_core/relay_client/relay_client.dart' as _i33; -import 'package:reown_core/relay_client/relay_client_models.dart' as _i34; -import 'package:reown_core/relay_client/websocket/http_client.dart' as _i30; +import 'package:reown_core/relay_client/json_rpc_2/src/peer.dart' as _i36; +import 'package:reown_core/relay_client/message_tracker.dart' as _i29; +import 'package:reown_core/relay_client/relay_client.dart' as _i34; +import 'package:reown_core/relay_client/relay_client_models.dart' as _i35; +import 'package:reown_core/relay_client/websocket/http_client.dart' as _i31; import 'package:reown_core/relay_client/websocket/i_websocket_handler.dart' - as _i22; + as _i23; import 'package:reown_core/relay_client/websocket/websocket_handler.dart' - as _i32; -import 'package:reown_core/store/i_generic_store.dart' as _i4; + as _i33; +import 'package:reown_core/store/i_generic_store.dart' as _i5; import 'package:reown_core/store/i_store.dart' as _i7; import 'package:reown_core/store/link_mode_store.dart' as _i19; -import 'package:reown_core/store/store_models.dart' as _i29; +import 'package:reown_core/store/store_models.dart' as _i30; import 'package:reown_core/verify/i_verify.dart' as _i17; +import 'package:reown_core/yttrium/i_rust_sign_client.dart' as _i20; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -79,14 +80,14 @@ class _FakeIReownCore_3 extends _i1.SmartFake implements _i3.IReownCore { : super(parent, parentInvocation); } -class _FakeIGenericStore_4 extends _i1.SmartFake - implements _i4.IGenericStore { - _FakeIGenericStore_4(Object parent, Invocation parentInvocation) +class _FakeICryptoUtils_4 extends _i1.SmartFake implements _i4.ICryptoUtils { + _FakeICryptoUtils_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeICryptoUtils_5 extends _i1.SmartFake implements _i5.ICryptoUtils { - _FakeICryptoUtils_5(Object parent, Invocation parentInvocation) +class _FakeIGenericStore_5 extends _i1.SmartFake + implements _i5.IGenericStore { + _FakeIGenericStore_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -163,27 +164,33 @@ class _FakeILinkModeStore_19 extends _i1.SmartFake : super(parent, parentInvocation); } -class _FakeLogger_20 extends _i1.SmartFake implements _i20.Logger { - _FakeLogger_20(Object parent, Invocation parentInvocation) +class _FakeIRustSignClient_20 extends _i1.SmartFake + implements _i20.IRustSignClient { + _FakeIRustSignClient_20(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeIMessageTracker_21 extends _i1.SmartFake - implements _i21.IMessageTracker { - _FakeIMessageTracker_21(Object parent, Invocation parentInvocation) +class _FakeLogger_21 extends _i1.SmartFake implements _i21.Logger { + _FakeLogger_21(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeIWebSocketHandler_22 extends _i1.SmartFake - implements _i22.IWebSocketHandler { - _FakeIWebSocketHandler_22(Object parent, Invocation parentInvocation) +class _FakeIMessageTracker_22 extends _i1.SmartFake + implements _i22.IMessageTracker { + _FakeIMessageTracker_22(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeIWebSocketHandler_23 extends _i1.SmartFake + implements _i23.IWebSocketHandler { + _FakeIWebSocketHandler_23(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 _i23.CryptoUtils { +class MockCryptoUtils extends _i1.Mock implements _i24.CryptoUtils { MockCryptoUtils() { _i1.throwOnMissingStub(this); } @@ -200,18 +207,18 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { as _i2.CryptoKeyPair); @override - _i24.Uint8List randomBytes(int? length) => + _i25.Uint8List randomBytes(int? length) => (super.noSuchMethod( Invocation.method(#randomBytes, [length]), - returnValue: _i24.Uint8List(0), + returnValue: _i25.Uint8List(0), ) - as _i24.Uint8List); + as _i25.Uint8List); @override String generateRandomBytes32() => (super.noSuchMethod( Invocation.method(#generateRandomBytes32, []), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method(#generateRandomBytes32, []), ), @@ -219,23 +226,23 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { as String); @override - _i26.Future deriveSymKey(String? privKeyA, String? pubKeyB) => + _i27.Future deriveSymKey(String? privKeyA, String? pubKeyB) => (super.noSuchMethod( Invocation.method(#deriveSymKey, [privKeyA, pubKeyB]), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method(#deriveSymKey, [privKeyA, pubKeyB]), ), ), ) - as _i26.Future); + as _i27.Future); @override String hashKey(String? key) => (super.noSuchMethod( Invocation.method(#hashKey, [key]), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method(#hashKey, [key]), ), @@ -246,7 +253,7 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { String hashMessage(String? message) => (super.noSuchMethod( Invocation.method(#hashMessage, [message]), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method(#hashMessage, [message]), ), @@ -254,7 +261,7 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { as String); @override - _i26.Future encrypt( + _i27.Future encrypt( String? message, String? symKey, { int? type, @@ -267,8 +274,8 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { [message, symKey], {#type: type, #iv: iv, #senderPublicKey: senderPublicKey}, ), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method( #encrypt, @@ -278,27 +285,27 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { ), ), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future decrypt(String? symKey, String? encoded) => + _i27.Future decrypt(String? symKey, String? encoded) => (super.noSuchMethod( Invocation.method(#decrypt, [symKey, encoded]), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method(#decrypt, [symKey, encoded]), ), ), ) - as _i26.Future); + as _i27.Future); @override String serialize( int? type, - _i24.Uint8List? sealed, - _i24.Uint8List? iv, { - _i24.Uint8List? senderPublicKey, + _i25.Uint8List? sealed, + _i25.Uint8List? iv, { + _i25.Uint8List? senderPublicKey, }) => (super.noSuchMethod( Invocation.method( @@ -306,7 +313,7 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { [type, sealed, iv], {#senderPublicKey: senderPublicKey}, ), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method( #serialize, @@ -390,15 +397,15 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { as bool); @override - _i24.Uint8List encodeTypeByte(int? type) => + _i25.Uint8List encodeTypeByte(int? type) => (super.noSuchMethod( Invocation.method(#encodeTypeByte, [type]), - returnValue: _i24.Uint8List(0), + returnValue: _i25.Uint8List(0), ) - as _i24.Uint8List); + as _i25.Uint8List); @override - int decodeTypeByte(_i24.Uint8List? byte) => + int decodeTypeByte(_i25.Uint8List? byte) => (super.noSuchMethod( Invocation.method(#decodeTypeByte, [byte]), returnValue: 0, @@ -409,7 +416,7 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { String encodeTypeTwoEnvelope({required String? message}) => (super.noSuchMethod( Invocation.method(#encodeTypeTwoEnvelope, [], {#message: message}), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method(#encodeTypeTwoEnvelope, [], { #message: message, @@ -422,7 +429,7 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { String decodeTypeTwoEnvelope({required String? message}) => (super.noSuchMethod( Invocation.method(#decodeTypeTwoEnvelope, [], {#message: message}), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method(#decodeTypeTwoEnvelope, [], { #message: message, @@ -435,7 +442,7 @@ class MockCryptoUtils extends _i1.Mock implements _i23.CryptoUtils { /// A class which mocks [Crypto]. /// /// See the documentation for Mockito's code generation for more information. -class MockCrypto extends _i1.Mock implements _i27.Crypto { +class MockCrypto extends _i1.Mock implements _i28.Crypto { MockCrypto() { _i1.throwOnMissingStub(this); } @@ -449,23 +456,23 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { as _i3.IReownCore); @override - _i4.IGenericStore get keyChain => + _i4.ICryptoUtils get utils => (super.noSuchMethod( - Invocation.getter(#keyChain), - returnValue: _FakeIGenericStore_4( - this, - Invocation.getter(#keyChain), - ), + Invocation.getter(#utils), + returnValue: _FakeICryptoUtils_4(this, Invocation.getter(#utils)), ) - as _i4.IGenericStore); + as _i4.ICryptoUtils); @override - _i5.ICryptoUtils get utils => + _i5.IGenericStore get keyChain => (super.noSuchMethod( - Invocation.getter(#utils), - returnValue: _FakeICryptoUtils_5(this, Invocation.getter(#utils)), + Invocation.getter(#keyChain), + returnValue: _FakeIGenericStore_5( + this, + Invocation.getter(#keyChain), + ), ) - as _i5.ICryptoUtils); + as _i5.IGenericStore); @override _i6.IRelayAuth get relayAuth => @@ -479,7 +486,7 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { String get name => (super.noSuchMethod( Invocation.getter(#name), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#name), ), @@ -487,17 +494,11 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { as String); @override - set keyChain(_i4.IGenericStore? _keyChain) => super.noSuchMethod( + set keyChain(_i5.IGenericStore? _keyChain) => super.noSuchMethod( Invocation.setter(#keyChain, _keyChain), returnValueForMissingStub: null, ); - @override - set utils(_i5.ICryptoUtils? _utils) => super.noSuchMethod( - Invocation.setter(#utils, _utils), - returnValueForMissingStub: null, - ); - @override set relayAuth(_i6.IRelayAuth? _relayAuth) => super.noSuchMethod( Invocation.setter(#relayAuth, _relayAuth), @@ -505,13 +506,13 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { ); @override - _i26.Future init() => + _i27.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override bool hasKeys(String? tag) => @@ -522,33 +523,33 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { as bool); @override - _i26.Future getClientId() => + _i27.Future getClientId() => (super.noSuchMethod( Invocation.method(#getClientId, []), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method(#getClientId, []), ), ), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future generateKeyPair() => + _i27.Future generateKeyPair() => (super.noSuchMethod( Invocation.method(#generateKeyPair, []), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method(#generateKeyPair, []), ), ), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future generateSharedKey( + _i27.Future generateSharedKey( String? selfPublicKey, String? peerPublicKey, { String? overrideTopic, @@ -559,8 +560,8 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { [selfPublicKey, peerPublicKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method( #generateSharedKey, @@ -570,18 +571,18 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { ), ), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future setSymKey(String? symKey, {String? overrideTopic}) => + _i27.Future setSymKey(String? symKey, {String? overrideTopic}) => (super.noSuchMethod( Invocation.method( #setSymKey, [symKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method( #setSymKey, @@ -591,59 +592,63 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { ), ), ) - as _i26.Future); + as _i27.Future); + + @override + String? getSymKey(String? topic) => + (super.noSuchMethod(Invocation.method(#getSymKey, [topic])) as String?); @override - _i26.Future deleteKeyPair(String? publicKey) => + _i27.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( Invocation.method(#deleteKeyPair, [publicKey]), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future deleteSymKey(String? topic) => + _i27.Future deleteSymKey(String? topic) => (super.noSuchMethod( Invocation.method(#deleteSymKey, [topic]), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future encode( + _i27.Future encode( String? topic, Map? payload, { _i2.EncodeOptions? options, }) => (super.noSuchMethod( Invocation.method(#encode, [topic, payload], {#options: options}), - returnValue: _i26.Future.value(), + returnValue: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future decode( + _i27.Future decode( String? topic, String? encoded, { _i2.DecodeOptions? options, }) => (super.noSuchMethod( Invocation.method(#decode, [topic, encoded], {#options: options}), - returnValue: _i26.Future.value(), + returnValue: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future signJWT(String? aud) => + _i27.Future signJWT(String? aud) => (super.noSuchMethod( Invocation.method(#signJWT, [aud]), - returnValue: _i26.Future.value( - _i25.dummyValue(this, Invocation.method(#signJWT, [aud])), + returnValue: _i27.Future.value( + _i26.dummyValue(this, Invocation.method(#signJWT, [aud])), ), ) - as _i26.Future); + as _i27.Future); @override int getPayloadType(String? encoded) => @@ -661,21 +666,21 @@ class MockCrypto extends _i1.Mock implements _i27.Crypto { as String?); @override - _i5.ICryptoUtils getUtils() => + _i4.ICryptoUtils getUtils() => (super.noSuchMethod( Invocation.method(#getUtils, []), - returnValue: _FakeICryptoUtils_5( + returnValue: _FakeICryptoUtils_4( this, Invocation.method(#getUtils, []), ), ) - as _i5.ICryptoUtils); + as _i4.ICryptoUtils); } /// A class which mocks [MessageTracker]. /// /// See the documentation for Mockito's code generation for more information. -class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { +class MockMessageTracker extends _i1.Mock implements _i29.MessageTracker { MockMessageTracker() { _i1.throwOnMissingStub(this); } @@ -684,7 +689,7 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { String get context => (super.noSuchMethod( Invocation.getter(#context), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#context), ), @@ -695,7 +700,7 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#version), ), @@ -714,63 +719,63 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { as _i7.IStore); @override - _i8.Event<_i29.StoreCreateEvent>> get onCreate => + _i8.Event<_i30.StoreCreateEvent>> get onCreate => (super.noSuchMethod( Invocation.getter(#onCreate), returnValue: - _FakeEvent_8<_i29.StoreCreateEvent>>( + _FakeEvent_8<_i30.StoreCreateEvent>>( this, Invocation.getter(#onCreate), ), ) - as _i8.Event<_i29.StoreCreateEvent>>); + as _i8.Event<_i30.StoreCreateEvent>>); @override - _i8.Event<_i29.StoreUpdateEvent>> get onUpdate => + _i8.Event<_i30.StoreUpdateEvent>> get onUpdate => (super.noSuchMethod( Invocation.getter(#onUpdate), returnValue: - _FakeEvent_8<_i29.StoreUpdateEvent>>( + _FakeEvent_8<_i30.StoreUpdateEvent>>( this, Invocation.getter(#onUpdate), ), ) - as _i8.Event<_i29.StoreUpdateEvent>>); + as _i8.Event<_i30.StoreUpdateEvent>>); @override - _i8.Event<_i29.StoreDeleteEvent>> get onDelete => + _i8.Event<_i30.StoreDeleteEvent>> get onDelete => (super.noSuchMethod( Invocation.getter(#onDelete), returnValue: - _FakeEvent_8<_i29.StoreDeleteEvent>>( + _FakeEvent_8<_i30.StoreDeleteEvent>>( this, Invocation.getter(#onDelete), ), ) - as _i8.Event<_i29.StoreDeleteEvent>>); + as _i8.Event<_i30.StoreDeleteEvent>>); @override - _i8.Event<_i29.StoreErrorEvent>> get onError => + _i8.Event<_i30.StoreErrorEvent>> get onError => (super.noSuchMethod( Invocation.getter(#onError), returnValue: - _FakeEvent_8<_i29.StoreErrorEvent>>( + _FakeEvent_8<_i30.StoreErrorEvent>>( this, Invocation.getter(#onError), ), ) - as _i8.Event<_i29.StoreErrorEvent>>); + as _i8.Event<_i30.StoreErrorEvent>>); @override - _i8.Event<_i29.StoreSyncEvent> get onSync => + _i8.Event<_i30.StoreSyncEvent> get onSync => (super.noSuchMethod( Invocation.getter(#onSync), - returnValue: _FakeEvent_8<_i29.StoreSyncEvent>( + returnValue: _FakeEvent_8<_i30.StoreSyncEvent>( this, Invocation.getter(#onSync), ), ) - as _i8.Event<_i29.StoreSyncEvent>); + as _i8.Event<_i30.StoreSyncEvent>); @override Map> get data => @@ -792,7 +797,7 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { String get storageKey => (super.noSuchMethod( Invocation.getter(#storageKey), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#storageKey), ), @@ -809,7 +814,7 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { String hashMessage(String? message) => (super.noSuchMethod( Invocation.method(#hashMessage, [message]), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.method(#hashMessage, [message]), ), @@ -817,13 +822,13 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { as String); @override - _i26.Future recordMessageEvent(String? topic, String? message) => + _i27.Future recordMessageEvent(String? topic, String? message) => (super.noSuchMethod( Invocation.method(#recordMessageEvent, [topic, message]), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override bool messageIsRecorded(String? topic, String? message) => @@ -834,13 +839,13 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { as bool); @override - _i26.Future init() => + _i27.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override bool has(String? key) => @@ -861,40 +866,40 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { as List>); @override - _i26.Future set(String? key, Map? value) => + _i27.Future set(String? key, Map? value) => (super.noSuchMethod( Invocation.method(#set, [key, value]), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future delete(String? key) => + _i27.Future delete(String? key) => (super.noSuchMethod( Invocation.method(#delete, [key]), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future persist() => + _i27.Future persist() => (super.noSuchMethod( Invocation.method(#persist, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future restore() => + _i27.Future restore() => (super.noSuchMethod( Invocation.method(#restore, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override void checkInitialized() => super.noSuchMethod( @@ -906,46 +911,46 @@ class MockMessageTracker extends _i1.Mock implements _i28.MessageTracker { /// A class which mocks [HttpWrapper]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpWrapper extends _i1.Mock implements _i30.HttpWrapper { +class MockHttpWrapper extends _i1.Mock implements _i31.HttpWrapper { MockHttpWrapper() { _i1.throwOnMissingStub(this); } @override - _i26.Future<_i9.Response> get(Uri? url, {Map? headers}) => + _i27.Future<_i9.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i26.Future<_i9.Response>.value( + returnValue: _i27.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method(#get, [url], {#headers: headers}), ), ), ) - as _i26.Future<_i9.Response>); + as _i27.Future<_i9.Response>); @override - _i26.Future<_i9.Response> delete(Uri? url, {Map? headers}) => + _i27.Future<_i9.Response> delete(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#delete, [url], {#headers: headers}), - returnValue: _i26.Future<_i9.Response>.value( + returnValue: _i27.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method(#delete, [url], {#headers: headers}), ), ), ) - as _i26.Future<_i9.Response>); + as _i27.Future<_i9.Response>); @override - _i26.Future<_i9.Response> post( + _i27.Future<_i9.Response> post( Uri? url, { Map? headers, Object? body, }) => (super.noSuchMethod( Invocation.method(#post, [url], {#headers: headers, #body: body}), - returnValue: _i26.Future<_i9.Response>.value( + returnValue: _i27.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method( @@ -956,13 +961,13 @@ class MockHttpWrapper extends _i1.Mock implements _i30.HttpWrapper { ), ), ) - as _i26.Future<_i9.Response>); + as _i27.Future<_i9.Response>); } /// A class which mocks [ReownCore]. /// /// See the documentation for Mockito's code generation for more information. -class MockReownCore extends _i1.Mock implements _i31.ReownCore { +class MockReownCore extends _i1.Mock implements _i32.ReownCore { MockReownCore() { _i1.throwOnMissingStub(this); } @@ -971,7 +976,7 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { String get projectId => (super.noSuchMethod( Invocation.getter(#projectId), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#projectId), ), @@ -982,7 +987,7 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { String get relayUrl => (super.noSuchMethod( Invocation.getter(#relayUrl), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#relayUrl), ), @@ -993,7 +998,7 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { String get pushUrl => (super.noSuchMethod( Invocation.getter(#pushUrl), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#pushUrl), ), @@ -1092,6 +1097,17 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { ) as _i19.ILinkModeStore); + @override + _i20.IRustSignClient get rustSignClient => + (super.noSuchMethod( + Invocation.getter(#rustSignClient), + returnValue: _FakeIRustSignClient_20( + this, + Invocation.getter(#rustSignClient), + ), + ) + as _i20.IRustSignClient); + @override _i7.IStore> get storage => (super.noSuchMethod( @@ -1118,7 +1134,7 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { String get protocol => (super.noSuchMethod( Invocation.getter(#protocol), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#protocol), ), @@ -1129,7 +1145,7 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i25.dummyValue( + returnValue: _i26.dummyValue( this, Invocation.getter(#version), ), @@ -1137,12 +1153,12 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { as String); @override - _i20.Logger get logger => + _i21.Logger get logger => (super.noSuchMethod( Invocation.getter(#logger), - returnValue: _FakeLogger_20(this, Invocation.getter(#logger)), + returnValue: _FakeLogger_21(this, Invocation.getter(#logger)), ) - as _i20.Logger); + as _i21.Logger); @override set relayUrl(String? _relayUrl) => super.noSuchMethod( @@ -1216,6 +1232,13 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { returnValueForMissingStub: null, ); + @override + set rustSignClient(_i20.IRustSignClient? _rustSignClient) => + super.noSuchMethod( + Invocation.setter(#rustSignClient, _rustSignClient), + returnValueForMissingStub: null, + ); + @override set storage(_i7.IStore>? _storage) => super.noSuchMethod( Invocation.setter(#storage, _storage), @@ -1244,21 +1267,21 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { as bool); @override - _i26.Future start() => + _i27.Future start() => (super.noSuchMethod( Invocation.method(#start, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future addLinkModeSupportedApp(String? universalLink) => + _i27.Future addLinkModeSupportedApp(String? universalLink) => (super.noSuchMethod( Invocation.method(#addLinkModeSupportedApp, [universalLink]), - returnValue: _i26.Future.value(false), + returnValue: _i27.Future.value(false), ) - as _i26.Future); + as _i27.Future); @override List getLinkModeSupportedApps() => @@ -1278,51 +1301,51 @@ class MockReownCore extends _i1.Mock implements _i31.ReownCore { /// A class which mocks [WebSocketHandler]. /// /// See the documentation for Mockito's code generation for more information. -class MockWebSocketHandler extends _i1.Mock implements _i32.WebSocketHandler { +class MockWebSocketHandler extends _i1.Mock implements _i33.WebSocketHandler { MockWebSocketHandler() { _i1.throwOnMissingStub(this); } @override - _i26.Future get ready => + _i27.Future get ready => (super.noSuchMethod( Invocation.getter(#ready), - returnValue: _i26.Future.value(), + returnValue: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future setup({required String? url}) => + _i27.Future setup({required String? url}) => (super.noSuchMethod( Invocation.method(#setup, [], {#url: url}), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future connect() => + _i27.Future connect() => (super.noSuchMethod( Invocation.method(#connect, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future close() => + _i27.Future close() => (super.noSuchMethod( Invocation.method(#close, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); } /// A class which mocks [RelayClient]. /// /// See the documentation for Mockito's code generation for more information. -class MockRelayClient extends _i1.Mock implements _i33.RelayClient { +class MockRelayClient extends _i1.Mock implements _i34.RelayClient { MockRelayClient() { _i1.throwOnMissingStub(this); } @@ -1350,59 +1373,59 @@ class MockRelayClient extends _i1.Mock implements _i33.RelayClient { as _i8.Event<_i8.EventArgs>); @override - _i8.Event<_i34.ErrorEvent> get onRelayClientError => + _i8.Event<_i35.ErrorEvent> get onRelayClientError => (super.noSuchMethod( Invocation.getter(#onRelayClientError), - returnValue: _FakeEvent_8<_i34.ErrorEvent>( + returnValue: _FakeEvent_8<_i35.ErrorEvent>( this, Invocation.getter(#onRelayClientError), ), ) - as _i8.Event<_i34.ErrorEvent>); + as _i8.Event<_i35.ErrorEvent>); @override - _i8.Event<_i34.MessageEvent> get onRelayClientMessage => + _i8.Event<_i35.MessageEvent> get onRelayClientMessage => (super.noSuchMethod( Invocation.getter(#onRelayClientMessage), - returnValue: _FakeEvent_8<_i34.MessageEvent>( + returnValue: _FakeEvent_8<_i35.MessageEvent>( this, Invocation.getter(#onRelayClientMessage), ), ) - as _i8.Event<_i34.MessageEvent>); + as _i8.Event<_i35.MessageEvent>); @override - _i8.Event<_i34.MessageEvent> get onLinkModeMessage => + _i8.Event<_i35.MessageEvent> get onLinkModeMessage => (super.noSuchMethod( Invocation.getter(#onLinkModeMessage), - returnValue: _FakeEvent_8<_i34.MessageEvent>( + returnValue: _FakeEvent_8<_i35.MessageEvent>( this, Invocation.getter(#onLinkModeMessage), ), ) - as _i8.Event<_i34.MessageEvent>); + as _i8.Event<_i35.MessageEvent>); @override - _i8.Event<_i34.SubscriptionEvent> get onSubscriptionCreated => + _i8.Event<_i35.SubscriptionEvent> get onSubscriptionCreated => (super.noSuchMethod( Invocation.getter(#onSubscriptionCreated), - returnValue: _FakeEvent_8<_i34.SubscriptionEvent>( + returnValue: _FakeEvent_8<_i35.SubscriptionEvent>( this, Invocation.getter(#onSubscriptionCreated), ), ) - as _i8.Event<_i34.SubscriptionEvent>); + as _i8.Event<_i35.SubscriptionEvent>); @override - _i8.Event<_i34.SubscriptionDeletionEvent> get onSubscriptionDeleted => + _i8.Event<_i35.SubscriptionDeletionEvent> get onSubscriptionDeleted => (super.noSuchMethod( Invocation.getter(#onSubscriptionDeleted), - returnValue: _FakeEvent_8<_i34.SubscriptionDeletionEvent>( + returnValue: _FakeEvent_8<_i35.SubscriptionDeletionEvent>( this, Invocation.getter(#onSubscriptionDeleted), ), ) - as _i8.Event<_i34.SubscriptionDeletionEvent>); + as _i8.Event<_i35.SubscriptionDeletionEvent>); @override _i8.Event<_i8.EventArgs> get onSubscriptionResubscribed => @@ -1427,45 +1450,45 @@ class MockRelayClient extends _i1.Mock implements _i33.RelayClient { as _i8.Event<_i8.EventArgs>); @override - Map> get pendingSubscriptions => + Map> get pendingSubscriptions => (super.noSuchMethod( Invocation.getter(#pendingSubscriptions), - returnValue: >{}, + returnValue: >{}, ) - as Map>); + as Map>); @override - _i21.IMessageTracker get messageTracker => + _i22.IMessageTracker get messageTracker => (super.noSuchMethod( Invocation.getter(#messageTracker), - returnValue: _FakeIMessageTracker_21( + returnValue: _FakeIMessageTracker_22( this, Invocation.getter(#messageTracker), ), ) - as _i21.IMessageTracker); + as _i22.IMessageTracker); @override - _i4.IGenericStore get topicMap => + _i5.IGenericStore get topicMap => (super.noSuchMethod( Invocation.getter(#topicMap), - returnValue: _FakeIGenericStore_4( + returnValue: _FakeIGenericStore_5( this, Invocation.getter(#topicMap), ), ) - as _i4.IGenericStore); + as _i5.IGenericStore); @override - _i22.IWebSocketHandler get socketHandler => + _i23.IWebSocketHandler get socketHandler => (super.noSuchMethod( Invocation.getter(#socketHandler), - returnValue: _FakeIWebSocketHandler_22( + returnValue: _FakeIWebSocketHandler_23( this, Invocation.getter(#socketHandler), ), ) - as _i22.IWebSocketHandler); + as _i23.IWebSocketHandler); @override _i3.IReownCore get core => @@ -1481,28 +1504,28 @@ class MockRelayClient extends _i1.Mock implements _i33.RelayClient { as bool); @override - set jsonRPC(_i35.Peer? _jsonRPC) => super.noSuchMethod( + set jsonRPC(_i36.Peer? _jsonRPC) => super.noSuchMethod( Invocation.setter(#jsonRPC, _jsonRPC), returnValueForMissingStub: null, ); @override set pendingSubscriptions( - Map>? _pendingSubscriptions, + Map>? _pendingSubscriptions, ) => super.noSuchMethod( Invocation.setter(#pendingSubscriptions, _pendingSubscriptions), returnValueForMissingStub: null, ); @override - set messageTracker(_i21.IMessageTracker? _messageTracker) => + set messageTracker(_i22.IMessageTracker? _messageTracker) => super.noSuchMethod( Invocation.setter(#messageTracker, _messageTracker), returnValueForMissingStub: null, ); @override - set topicMap(_i4.IGenericStore? _topicMap) => super.noSuchMethod( + set topicMap(_i5.IGenericStore? _topicMap) => super.noSuchMethod( Invocation.setter(#topicMap, _topicMap), returnValueForMissingStub: null, ); @@ -1514,19 +1537,19 @@ class MockRelayClient extends _i1.Mock implements _i33.RelayClient { ); @override - _i26.Future init() => + _i27.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future publish({ + _i27.Future publish({ required String? topic, required String? message, - required _i36.PublishOptions? options, + required _i37.PublishOptions? options, }) => (super.noSuchMethod( Invocation.method(#publish, [], { @@ -1534,79 +1557,79 @@ class MockRelayClient extends _i1.Mock implements _i33.RelayClient { #message: message, #options: options, }), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future publishPayload({ + _i27.Future publishPayload({ required Map? payload, - required _i36.PublishOptions? options, + required _i37.PublishOptions? options, }) => (super.noSuchMethod( Invocation.method(#publishPayload, [], { #payload: payload, #options: options, }), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future subscribe({required _i36.SubscribeOptions? options}) => + _i27.Future subscribe({required _i37.SubscribeOptions? options}) => (super.noSuchMethod( Invocation.method(#subscribe, [], {#options: options}), - returnValue: _i26.Future.value( - _i25.dummyValue( + returnValue: _i27.Future.value( + _i26.dummyValue( this, Invocation.method(#subscribe, [], {#options: options}), ), ), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future unsubscribe({required String? topic}) => + _i27.Future unsubscribe({required String? topic}) => (super.noSuchMethod( Invocation.method(#unsubscribe, [], {#topic: topic}), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future connect({String? relayUrl}) => + _i27.Future connect({String? relayUrl}) => (super.noSuchMethod( Invocation.method(#connect, [], {#relayUrl: relayUrl}), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future disconnect() => + _i27.Future disconnect() => (super.noSuchMethod( Invocation.method(#disconnect, []), - returnValue: _i26.Future.value(), - returnValueForMissingStub: _i26.Future.value(), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future handleLinkModeMessage(String? topic, String? message) => + _i27.Future handleLinkModeMessage(String? topic, String? message) => (super.noSuchMethod( Invocation.method(#handleLinkModeMessage, [topic, message]), - returnValue: _i26.Future.value(false), + returnValue: _i27.Future.value(false), ) - as _i26.Future); + as _i27.Future); @override - _i26.Future handlePublish(String? topic, String? message) => + _i27.Future handlePublish(String? topic, String? message) => (super.noSuchMethod( Invocation.method(#handlePublish, [topic, message]), - returnValue: _i26.Future.value(false), + returnValue: _i27.Future.value(false), ) - as _i26.Future); + as _i27.Future); } diff --git a/packages/reown_sign/build.yaml b/packages/reown_sign/build.yaml index e39e5483..dbf15e1d 100644 --- a/packages/reown_sign/build.yaml +++ b/packages/reown_sign/build.yaml @@ -2,7 +2,7 @@ targets: $default: sources: exclude: - - "**/.symlinks/**" + - "**/.symlinks/**" builders: build_version: options: diff --git a/packages/reown_sign/lib/sign_engine.dart b/packages/reown_sign/lib/sign_engine.dart index 6964c307..2afe0373 100644 --- a/packages/reown_sign/lib/sign_engine.dart +++ b/packages/reown_sign/lib/sign_engine.dart @@ -4,6 +4,7 @@ import 'dart:math'; import 'package:convert/convert.dart'; import 'package:event/event.dart'; +import 'package:reown_core/models/rust_sign_client_models.dart'; import 'package:flutter/foundation.dart'; import 'package:reown_core/models/tvf_data.dart'; import 'package:reown_core/pairing/utils/json_rpc_utils.dart'; @@ -283,21 +284,43 @@ class ReownSign implements IReownSign { final ProposalData proposal = proposals.get(id.toString())!; - final String selfPubKey = await core.crypto.generateKeyPair(); + // selfPubKey is now generated on rust side and returned on the approval response final String peerPubKey = proposal.proposer.publicKey; - final String sessionTopic = await core.crypto.generateSharedKey( - selfPubKey, - peerPubKey, + // sessionTopic is now generated from `sessionSymKey` returned on the approval response + + // pairingSymKey was previously saved on secure storage during pair function on core package + final String pairingSymKey = core.crypto.getSymKey(proposal.pairingTopic)!; + final proposalFfi = SessionProposalFfi.fromJson({ + ...proposal.toJson(), + 'id': proposal.id.toString(), + 'topic': proposal.pairingTopic, + 'pairingSymKey': hex.decode(pairingSymKey), + 'proposerPublicKey': hex.decode(peerPubKey), + 'metadata': proposal.proposer.metadata.toJson(), + }); + final approvedNamespaces = namespaces.map( + (key, namespace) => MapEntry(key, namespace.toJson()), + ); + final ApproveResult approveResult = await core.rustSignClient + .approve( + proposal: proposalFfi, + approvedNamespaces: approvedNamespaces, + selfMetadata: metadata.toJson(), + ) + .timeout(const Duration(seconds: 60)); + + final String selfPubKey = approveResult.selfPublicKey; + final String sessionTopic = await core.crypto.setSymKey( + approveResult.sessionSymKey, ); - // print('approve session topic: $sessionTopic'); final protocol = relayProtocol ?? ReownConstants.RELAYER_DEFAULT_PROTOCOL; final relay = Relay(protocol); - // Respond to the proposal - final sessionProposalResponse = WcSessionProposeResponse( - relay: relay, - responderPublicKey: selfPubKey, - ); + // No needed anymore, will be handled by Rust Client + // final sessionProposalResponse = WcSessionProposeResponse( + // relay: relay, + // responderPublicKey: selfPubKey, + // ); await _deleteProposal(id); await core.pairing.activate(topic: proposal.pairingTopic); @@ -307,7 +330,9 @@ class ReownSign implements IReownSign { ); await core.relayClient.subscribe( - options: SubscribeOptions(topic: sessionTopic, skipSubscribe: true), + options: SubscribeOptions( + topic: sessionTopic, + ), ); final int expiry = ReownCoreUtils.calculateExpiry( @@ -319,7 +344,7 @@ class ReownSign implements IReownSign { pairingTopic: proposal.pairingTopic, relay: relay, expiry: expiry, - acknowledged: false, + acknowledged: true, controller: selfPubKey, namespaces: namespaces, self: ConnectionMetadata(publicKey: selfPubKey, metadata: metadata), @@ -333,29 +358,34 @@ class ReownSign implements IReownSign { await sessions.set(sessionTopic, session); await _setSessionExpiry(sessionTopic, expiry); - // `wc_sessionSettle` is not critical throughout the entire session. - final sessionSettleRequest = WcSessionSettleRequest( - relay: relay, - namespaces: namespaces, - sessionProperties: sessionProperties, - expiry: expiry, - controller: ConnectionMetadata(publicKey: selfPubKey, metadata: metadata), - ); - bool acknowledged = await core.pairing - .sendApproveSessionRequest( - sessionTopic, - proposal.pairingTopic, - responseId: proposal.id, - sessionProposalResponse: sessionProposalResponse.toJson(), - sessionSettlementRequest: sessionSettleRequest.toJson(), - ) - .timeout(const Duration(seconds: 60)) - .catchError((_) => false) - .then((_) => true); - - session = session.copyWith(acknowledged: acknowledged); + // No needed anymore, will be handled by Rust Client + // final sessionSettleRequest = WcSessionSettleRequest( + // relay: relay, + // namespaces: namespaces, + // sessionProperties: sessionProperties, + // expiry: expiry, + // controller: ConnectionMetadata( + // publicKey: selfPubKey, + // metadata: metadata, + // ), + // ); + // bool acknowledged = await core.pairing + // .sendApproveSessionRequest( + // sessionTopic, + // proposal.pairingTopic, + // responseId: proposal.id, + // sessionProposalResponse: sessionProposalResponse.toJson(), + // sessionSettlementRequest: sessionSettleRequest.toJson(), + // ) + // .timeout(const Duration(seconds: 60)) + // .catchError((_) => false) + // .then((_) => true); + + // session = session.copyWith( + // acknowledged: acknowledged, + // ); - if (acknowledged && sessions.has(sessionTopic)) { + if (session.acknowledged && sessions.has(sessionTopic)) { // We directly update the latest value. await sessions.set(sessionTopic, session); } @@ -378,20 +408,27 @@ class ReownSign implements IReownSign { // Attempt to send a response, if the pairing is not active, this will fail // but we don't care try { - final method = MethodConstants.WC_SESSION_PROPOSE; - final rpcOpts = MethodConstants.RPC_OPTS[method]; - await core.pairing.sendError( - id, + final String pairingSymKey = core.crypto.getSymKey( proposal.pairingTopic, - method, - JsonRpcError(code: reason.code, message: reason.message), - rpcOptions: rpcOpts?['reject'], + )!; + final proposalFfi = SessionProposalFfi.fromJson({ + ...proposal.toJson(), + 'id': proposal.id.toString(), + 'topic': proposal.pairingTopic, + 'pairingSymKey': hex.decode(pairingSymKey), + 'proposerPublicKey': hex.decode(proposal.proposer.publicKey), + 'metadata': proposal.proposer.metadata.toJson(), + }); + await core.rustSignClient.reject( + proposal: proposalFfi, + error: ErrorDataFfi.fromJson(reason.toJson()), ); - } catch (_) { + + await _deleteProposal(id); + } catch (e) { // print('got here'); } } - await _deleteProposal(id); } @override @@ -851,9 +888,10 @@ class ReownSign implements IReownSign { /// ---- Relay Events ---- /// void _registerRelayClientFunctions() { + core.rustSignClient.onSessionProposeRequest = _onSessionProposeRequest; core.pairing.register( method: MethodConstants.WC_SESSION_PROPOSE, - function: _onSessionProposeRequest, + function: _dummyCallback, type: ProtocolType.sign, ); core.pairing.register( @@ -881,9 +919,10 @@ class ReownSign implements IReownSign { function: _onSessionDeleteRequest, type: ProtocolType.sign, ); + core.rustSignClient.onSessionRequest = _onSessionRequest; core.pairing.register( method: MethodConstants.WC_SESSION_REQUEST, - function: _onSessionRequest, + function: _dummyCallback, type: ProtocolType.sign, ); core.pairing.register( @@ -904,6 +943,10 @@ class ReownSign implements IReownSign { // ); } + void _dummyCallback(String topic, JsonRpcRequest payload, [dynamic _]) { + // dummy callback to hold flutter logic on reown_sign + } + bool _shouldIgnoreSessionPropose(String topic) { final PairingInfo? pairingInfo = core.pairing.getPairing(topic: topic); final implementSessionAuth = onSessionAuthRequest.subscriberCount > 0; @@ -1029,8 +1072,8 @@ class ReownSign implements IReownSign { try { await _isValidSessionSettleRequest(request.namespaces, request.expiry); - final SessionProposalCompleter sProposalCompleter = pendingProposals - .removeLast(); + final SessionProposalCompleter sProposalCompleter = + pendingProposals.removeLast(); // print(sProposalCompleter); // Create the session @@ -1808,14 +1851,13 @@ class ReownSign implements IReownSign { final expirationTime = (cacaoPayload.exp != null) ? 'Expiration Time: ${cacaoPayload.exp}' : null; - final notBefore = (cacaoPayload.nbf != null) - ? 'Not Before: ${cacaoPayload.nbf}' - : null; + final notBefore = + (cacaoPayload.nbf != null) ? 'Not Before: ${cacaoPayload.nbf}' : null; final requestId = (cacaoPayload.requestId != null) ? 'Request ID: ${cacaoPayload.requestId}' : null; - final resources = - cacaoPayload.resources != null && cacaoPayload.resources!.isNotEmpty + final resources = cacaoPayload.resources != null && + cacaoPayload.resources!.isNotEmpty ? 'Resources:\n${cacaoPayload.resources!.map((resource) => '- $resource').join('\n')}' : null; final recap = ReCapsUtils.getRecapFromResources( @@ -1864,8 +1906,7 @@ class ReownSign implements IReownSign { final walletUniversalLink = (walletLink ?? ''); final linkModeApps = core.getLinkModeSupportedApps(); final containsLink = linkModeApps.contains(walletLink); - final isLinkMode = - selfLinkMode && + final isLinkMode = selfLinkMode && selfLink.isNotEmpty && walletUniversalLink.isNotEmpty && containsLink; @@ -1890,9 +1931,8 @@ class ReownSign implements IReownSign { AuthApiValidators.isValidAuthenticate(params); final isLinkMode = _isLinkModeAuthenticate(walletUniversalLink); - final transportType = isLinkMode - ? TransportType.linkMode - : TransportType.relay; + final transportType = + isLinkMode ? TransportType.linkMode : TransportType.relay; if (!transportType.isLinkMode) { _confirmOnlineStateOrThrow(); } @@ -2191,17 +2231,15 @@ class ReownSign implements IReownSign { methods: approvedMethods, ), authentication: cacaos, - transportType: isLinkMode - ? TransportType.linkMode - : TransportType.relay, + transportType: + isLinkMode ? TransportType.linkMode : TransportType.relay, ); await core.relayClient.subscribe( options: SubscribeOptions( topic: sessionTopic, - transportType: isLinkMode - ? TransportType.linkMode - : TransportType.relay, + transportType: + isLinkMode ? TransportType.linkMode : TransportType.relay, ), ); await sessions.set(sessionTopic, session); @@ -2269,8 +2307,7 @@ class ReownSign implements IReownSign { if (!pendingSessionAuthRequests.containsKey(id)) { throw Errors.getInternalError( Errors.MISSING_OR_INVALID, - context: - 'approveSessionAuthenticate() ' + context: 'approveSessionAuthenticate() ' 'Could not find pending auth request with id $id', ).toSignError(); } @@ -2412,8 +2449,7 @@ class ReownSign implements IReownSign { if (!pendingSessionAuthRequests.containsKey(id)) { throw Errors.getInternalError( Errors.MISSING_OR_INVALID, - context: - 'rejectSessionAuthenticate() ' + context: 'rejectSessionAuthenticate() ' 'Could not find pending auth request with id $id', ).toSignError(); } diff --git a/packages/reown_sign/pubspec.yaml b/packages/reown_sign/pubspec.yaml index 4545fe38..071c4efb 100644 --- a/packages/reown_sign/pubspec.yaml +++ b/packages/reown_sign/pubspec.yaml @@ -16,7 +16,8 @@ dependencies: freezed_annotation: ^3.1.0 http: ^1.2.2 pointycastle: ^3.9.1 - reown_core: ^1.3.1 + reown_core: + path: ../reown_core/ web3dart: ^2.7.3 dev_dependencies: diff --git a/packages/reown_sign/test/shared/shared_test_utils.mocks.dart b/packages/reown_sign/test/shared/shared_test_utils.mocks.dart index 64078b51..33add3f2 100644 --- a/packages/reown_sign/test/shared/shared_test_utils.mocks.dart +++ b/packages/reown_sign/test/shared/shared_test_utils.mocks.dart @@ -3,21 +3,21 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i24; -import 'dart:typed_data' as _i22; +import 'dart:async' as _i25; +import 'dart:typed_data' as _i23; import 'package:event/event.dart' as _i8; import 'package:http/http.dart' as _i9; -import 'package:logger/logger.dart' as _i20; +import 'package:logger/logger.dart' as _i21; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i23; +import 'package:mockito/src/dummies.dart' as _i24; import 'package:reown_core/connectivity/i_connectivity.dart' as _i18; -import 'package:reown_core/core_impl.dart' as _i29; -import 'package:reown_core/crypto/crypto.dart' as _i25; +import 'package:reown_core/core_impl.dart' as _i30; +import 'package:reown_core/crypto/crypto.dart' as _i26; import 'package:reown_core/crypto/crypto_models.dart' as _i2; -import 'package:reown_core/crypto/crypto_utils.dart' as _i21; +import 'package:reown_core/crypto/crypto_utils.dart' as _i22; import 'package:reown_core/crypto/i_crypto.dart' as _i10; -import 'package:reown_core/crypto/i_crypto_utils.dart' as _i5; +import 'package:reown_core/crypto/i_crypto_utils.dart' as _i4; import 'package:reown_core/echo/i_echo.dart' as _i14; import 'package:reown_core/events/i_events.dart' as _i15; import 'package:reown_core/heartbit/i_heartbeat.dart' as _i16; @@ -26,15 +26,16 @@ import 'package:reown_core/pairing/i_expirer.dart' as _i12; import 'package:reown_core/pairing/i_pairing.dart' as _i13; import 'package:reown_core/relay_auth/i_relay_auth.dart' as _i6; import 'package:reown_core/relay_client/i_relay_client.dart' as _i11; -import 'package:reown_core/relay_client/message_tracker.dart' as _i26; -import 'package:reown_core/relay_client/websocket/http_client.dart' as _i28; +import 'package:reown_core/relay_client/message_tracker.dart' as _i27; +import 'package:reown_core/relay_client/websocket/http_client.dart' as _i29; import 'package:reown_core/relay_client/websocket/websocket_handler.dart' - as _i30; -import 'package:reown_core/store/i_generic_store.dart' as _i4; + as _i31; +import 'package:reown_core/store/i_generic_store.dart' as _i5; import 'package:reown_core/store/i_store.dart' as _i7; import 'package:reown_core/store/link_mode_store.dart' as _i19; -import 'package:reown_core/store/store_models.dart' as _i27; +import 'package:reown_core/store/store_models.dart' as _i28; import 'package:reown_core/verify/i_verify.dart' as _i17; +import 'package:reown_core/yttrium/i_rust_sign_client.dart' as _i20; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -72,14 +73,14 @@ class _FakeIReownCore_3 extends _i1.SmartFake implements _i3.IReownCore { : super(parent, parentInvocation); } -class _FakeIGenericStore_4 extends _i1.SmartFake - implements _i4.IGenericStore { - _FakeIGenericStore_4(Object parent, Invocation parentInvocation) +class _FakeICryptoUtils_4 extends _i1.SmartFake implements _i4.ICryptoUtils { + _FakeICryptoUtils_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeICryptoUtils_5 extends _i1.SmartFake implements _i5.ICryptoUtils { - _FakeICryptoUtils_5(Object parent, Invocation parentInvocation) +class _FakeIGenericStore_5 extends _i1.SmartFake + implements _i5.IGenericStore { + _FakeIGenericStore_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -156,15 +157,21 @@ class _FakeILinkModeStore_19 extends _i1.SmartFake : super(parent, parentInvocation); } -class _FakeLogger_20 extends _i1.SmartFake implements _i20.Logger { - _FakeLogger_20(Object parent, Invocation parentInvocation) +class _FakeIRustSignClient_20 extends _i1.SmartFake + implements _i20.IRustSignClient { + _FakeIRustSignClient_20(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeLogger_21 extends _i1.SmartFake implements _i21.Logger { + _FakeLogger_21(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 _i21.CryptoUtils { +class MockCryptoUtils extends _i1.Mock implements _i22.CryptoUtils { MockCryptoUtils() { _i1.throwOnMissingStub(this); } @@ -181,18 +188,18 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as _i2.CryptoKeyPair); @override - _i22.Uint8List randomBytes(int? length) => + _i23.Uint8List randomBytes(int? length) => (super.noSuchMethod( Invocation.method(#randomBytes, [length]), - returnValue: _i22.Uint8List(0), + returnValue: _i23.Uint8List(0), ) - as _i22.Uint8List); + as _i23.Uint8List); @override String generateRandomBytes32() => (super.noSuchMethod( Invocation.method(#generateRandomBytes32, []), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#generateRandomBytes32, []), ), @@ -200,23 +207,23 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as String); @override - _i24.Future deriveSymKey(String? privKeyA, String? pubKeyB) => + _i25.Future deriveSymKey(String? privKeyA, String? pubKeyB) => (super.noSuchMethod( Invocation.method(#deriveSymKey, [privKeyA, pubKeyB]), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#deriveSymKey, [privKeyA, pubKeyB]), ), ), ) - as _i24.Future); + as _i25.Future); @override String hashKey(String? key) => (super.noSuchMethod( Invocation.method(#hashKey, [key]), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#hashKey, [key]), ), @@ -227,7 +234,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { String hashMessage(String? message) => (super.noSuchMethod( Invocation.method(#hashMessage, [message]), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#hashMessage, [message]), ), @@ -235,7 +242,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as String); @override - _i24.Future encrypt( + _i25.Future encrypt( String? message, String? symKey, { int? type, @@ -248,8 +255,8 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { [message, symKey], {#type: type, #iv: iv, #senderPublicKey: senderPublicKey}, ), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method( #encrypt, @@ -259,27 +266,27 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future decrypt(String? symKey, String? encoded) => + _i25.Future decrypt(String? symKey, String? encoded) => (super.noSuchMethod( Invocation.method(#decrypt, [symKey, encoded]), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#decrypt, [symKey, encoded]), ), ), ) - as _i24.Future); + as _i25.Future); @override String serialize( int? type, - _i22.Uint8List? sealed, - _i22.Uint8List? iv, { - _i22.Uint8List? senderPublicKey, + _i23.Uint8List? sealed, + _i23.Uint8List? iv, { + _i23.Uint8List? senderPublicKey, }) => (super.noSuchMethod( Invocation.method( @@ -287,7 +294,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { [type, sealed, iv], {#senderPublicKey: senderPublicKey}, ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #serialize, @@ -371,15 +378,15 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { as bool); @override - _i22.Uint8List encodeTypeByte(int? type) => + _i23.Uint8List encodeTypeByte(int? type) => (super.noSuchMethod( Invocation.method(#encodeTypeByte, [type]), - returnValue: _i22.Uint8List(0), + returnValue: _i23.Uint8List(0), ) - as _i22.Uint8List); + as _i23.Uint8List); @override - int decodeTypeByte(_i22.Uint8List? byte) => + int decodeTypeByte(_i23.Uint8List? byte) => (super.noSuchMethod( Invocation.method(#decodeTypeByte, [byte]), returnValue: 0, @@ -390,7 +397,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { String encodeTypeTwoEnvelope({required String? message}) => (super.noSuchMethod( Invocation.method(#encodeTypeTwoEnvelope, [], {#message: message}), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#encodeTypeTwoEnvelope, [], { #message: message, @@ -403,7 +410,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { String decodeTypeTwoEnvelope({required String? message}) => (super.noSuchMethod( Invocation.method(#decodeTypeTwoEnvelope, [], {#message: message}), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#decodeTypeTwoEnvelope, [], { #message: message, @@ -416,7 +423,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { /// A class which mocks [Crypto]. /// /// See the documentation for Mockito's code generation for more information. -class MockCrypto extends _i1.Mock implements _i25.Crypto { +class MockCrypto extends _i1.Mock implements _i26.Crypto { MockCrypto() { _i1.throwOnMissingStub(this); } @@ -430,23 +437,23 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as _i3.IReownCore); @override - _i4.IGenericStore get keyChain => + _i4.ICryptoUtils get utils => (super.noSuchMethod( - Invocation.getter(#keyChain), - returnValue: _FakeIGenericStore_4( - this, - Invocation.getter(#keyChain), - ), + Invocation.getter(#utils), + returnValue: _FakeICryptoUtils_4(this, Invocation.getter(#utils)), ) - as _i4.IGenericStore); + as _i4.ICryptoUtils); @override - _i5.ICryptoUtils get utils => + _i5.IGenericStore get keyChain => (super.noSuchMethod( - Invocation.getter(#utils), - returnValue: _FakeICryptoUtils_5(this, Invocation.getter(#utils)), + Invocation.getter(#keyChain), + returnValue: _FakeIGenericStore_5( + this, + Invocation.getter(#keyChain), + ), ) - as _i5.ICryptoUtils); + as _i5.IGenericStore); @override _i6.IRelayAuth get relayAuth => @@ -460,7 +467,7 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { String get name => (super.noSuchMethod( Invocation.getter(#name), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#name), ), @@ -468,17 +475,11 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as String); @override - set keyChain(_i4.IGenericStore? _keyChain) => super.noSuchMethod( + set keyChain(_i5.IGenericStore? _keyChain) => super.noSuchMethod( Invocation.setter(#keyChain, _keyChain), returnValueForMissingStub: null, ); - @override - set utils(_i5.ICryptoUtils? _utils) => super.noSuchMethod( - Invocation.setter(#utils, _utils), - returnValueForMissingStub: null, - ); - @override set relayAuth(_i6.IRelayAuth? _relayAuth) => super.noSuchMethod( Invocation.setter(#relayAuth, _relayAuth), @@ -486,13 +487,13 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ); @override - _i24.Future init() => + _i25.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override bool hasKeys(String? tag) => @@ -503,33 +504,33 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as bool); @override - _i24.Future getClientId() => + _i25.Future getClientId() => (super.noSuchMethod( Invocation.method(#getClientId, []), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#getClientId, []), ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future generateKeyPair() => + _i25.Future generateKeyPair() => (super.noSuchMethod( Invocation.method(#generateKeyPair, []), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method(#generateKeyPair, []), ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future generateSharedKey( + _i25.Future generateSharedKey( String? selfPublicKey, String? peerPublicKey, { String? overrideTopic, @@ -540,8 +541,8 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { [selfPublicKey, peerPublicKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method( #generateSharedKey, @@ -551,18 +552,18 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ), ), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future setSymKey(String? symKey, {String? overrideTopic}) => + _i25.Future setSymKey(String? symKey, {String? overrideTopic}) => (super.noSuchMethod( Invocation.method( #setSymKey, [symKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i24.Future.value( - _i23.dummyValue( + returnValue: _i25.Future.value( + _i24.dummyValue( this, Invocation.method( #setSymKey, @@ -572,59 +573,63 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ), ), ) - as _i24.Future); + as _i25.Future); + + @override + String? getSymKey(String? topic) => + (super.noSuchMethod(Invocation.method(#getSymKey, [topic])) as String?); @override - _i24.Future deleteKeyPair(String? publicKey) => + _i25.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( Invocation.method(#deleteKeyPair, [publicKey]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future deleteSymKey(String? topic) => + _i25.Future deleteSymKey(String? topic) => (super.noSuchMethod( Invocation.method(#deleteSymKey, [topic]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future encode( + _i25.Future encode( String? topic, Map? payload, { _i2.EncodeOptions? options, }) => (super.noSuchMethod( Invocation.method(#encode, [topic, payload], {#options: options}), - returnValue: _i24.Future.value(), + returnValue: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future decode( + _i25.Future decode( String? topic, String? encoded, { _i2.DecodeOptions? options, }) => (super.noSuchMethod( Invocation.method(#decode, [topic, encoded], {#options: options}), - returnValue: _i24.Future.value(), + returnValue: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future signJWT(String? aud) => + _i25.Future signJWT(String? aud) => (super.noSuchMethod( Invocation.method(#signJWT, [aud]), - returnValue: _i24.Future.value( - _i23.dummyValue(this, Invocation.method(#signJWT, [aud])), + returnValue: _i25.Future.value( + _i24.dummyValue(this, Invocation.method(#signJWT, [aud])), ), ) - as _i24.Future); + as _i25.Future); @override int getPayloadType(String? encoded) => @@ -642,21 +647,21 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { as String?); @override - _i5.ICryptoUtils getUtils() => + _i4.ICryptoUtils getUtils() => (super.noSuchMethod( Invocation.method(#getUtils, []), - returnValue: _FakeICryptoUtils_5( + returnValue: _FakeICryptoUtils_4( this, Invocation.method(#getUtils, []), ), ) - as _i5.ICryptoUtils); + as _i4.ICryptoUtils); } /// A class which mocks [MessageTracker]. /// /// See the documentation for Mockito's code generation for more information. -class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { +class MockMessageTracker extends _i1.Mock implements _i27.MessageTracker { MockMessageTracker() { _i1.throwOnMissingStub(this); } @@ -665,7 +670,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String get context => (super.noSuchMethod( Invocation.getter(#context), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#context), ), @@ -676,7 +681,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#version), ), @@ -695,63 +700,63 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as _i7.IStore); @override - _i8.Event<_i27.StoreCreateEvent>> get onCreate => + _i8.Event<_i28.StoreCreateEvent>> get onCreate => (super.noSuchMethod( Invocation.getter(#onCreate), returnValue: - _FakeEvent_8<_i27.StoreCreateEvent>>( + _FakeEvent_8<_i28.StoreCreateEvent>>( this, Invocation.getter(#onCreate), ), ) - as _i8.Event<_i27.StoreCreateEvent>>); + as _i8.Event<_i28.StoreCreateEvent>>); @override - _i8.Event<_i27.StoreUpdateEvent>> get onUpdate => + _i8.Event<_i28.StoreUpdateEvent>> get onUpdate => (super.noSuchMethod( Invocation.getter(#onUpdate), returnValue: - _FakeEvent_8<_i27.StoreUpdateEvent>>( + _FakeEvent_8<_i28.StoreUpdateEvent>>( this, Invocation.getter(#onUpdate), ), ) - as _i8.Event<_i27.StoreUpdateEvent>>); + as _i8.Event<_i28.StoreUpdateEvent>>); @override - _i8.Event<_i27.StoreDeleteEvent>> get onDelete => + _i8.Event<_i28.StoreDeleteEvent>> get onDelete => (super.noSuchMethod( Invocation.getter(#onDelete), returnValue: - _FakeEvent_8<_i27.StoreDeleteEvent>>( + _FakeEvent_8<_i28.StoreDeleteEvent>>( this, Invocation.getter(#onDelete), ), ) - as _i8.Event<_i27.StoreDeleteEvent>>); + as _i8.Event<_i28.StoreDeleteEvent>>); @override - _i8.Event<_i27.StoreErrorEvent>> get onError => + _i8.Event<_i28.StoreErrorEvent>> get onError => (super.noSuchMethod( Invocation.getter(#onError), returnValue: - _FakeEvent_8<_i27.StoreErrorEvent>>( + _FakeEvent_8<_i28.StoreErrorEvent>>( this, Invocation.getter(#onError), ), ) - as _i8.Event<_i27.StoreErrorEvent>>); + as _i8.Event<_i28.StoreErrorEvent>>); @override - _i8.Event<_i27.StoreSyncEvent> get onSync => + _i8.Event<_i28.StoreSyncEvent> get onSync => (super.noSuchMethod( Invocation.getter(#onSync), - returnValue: _FakeEvent_8<_i27.StoreSyncEvent>( + returnValue: _FakeEvent_8<_i28.StoreSyncEvent>( this, Invocation.getter(#onSync), ), ) - as _i8.Event<_i27.StoreSyncEvent>); + as _i8.Event<_i28.StoreSyncEvent>); @override Map> get data => @@ -773,7 +778,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String get storageKey => (super.noSuchMethod( Invocation.getter(#storageKey), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#storageKey), ), @@ -790,7 +795,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { String hashMessage(String? message) => (super.noSuchMethod( Invocation.method(#hashMessage, [message]), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method(#hashMessage, [message]), ), @@ -798,13 +803,13 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as String); @override - _i24.Future recordMessageEvent(String? topic, String? message) => + _i25.Future recordMessageEvent(String? topic, String? message) => (super.noSuchMethod( Invocation.method(#recordMessageEvent, [topic, message]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override bool messageIsRecorded(String? topic, String? message) => @@ -815,13 +820,13 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as bool); @override - _i24.Future init() => + _i25.Future init() => (super.noSuchMethod( Invocation.method(#init, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override bool has(String? key) => @@ -842,40 +847,40 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { as List>); @override - _i24.Future set(String? key, Map? value) => + _i25.Future set(String? key, Map? value) => (super.noSuchMethod( Invocation.method(#set, [key, value]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future delete(String? key) => + _i25.Future delete(String? key) => (super.noSuchMethod( Invocation.method(#delete, [key]), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future persist() => + _i25.Future persist() => (super.noSuchMethod( Invocation.method(#persist, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future restore() => + _i25.Future restore() => (super.noSuchMethod( Invocation.method(#restore, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override void checkInitialized() => super.noSuchMethod( @@ -887,46 +892,46 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { /// A class which mocks [HttpWrapper]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { +class MockHttpWrapper extends _i1.Mock implements _i29.HttpWrapper { MockHttpWrapper() { _i1.throwOnMissingStub(this); } @override - _i24.Future<_i9.Response> get(Uri? url, {Map? headers}) => + _i25.Future<_i9.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i24.Future<_i9.Response>.value( + returnValue: _i25.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method(#get, [url], {#headers: headers}), ), ), ) - as _i24.Future<_i9.Response>); + as _i25.Future<_i9.Response>); @override - _i24.Future<_i9.Response> delete(Uri? url, {Map? headers}) => + _i25.Future<_i9.Response> delete(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#delete, [url], {#headers: headers}), - returnValue: _i24.Future<_i9.Response>.value( + returnValue: _i25.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method(#delete, [url], {#headers: headers}), ), ), ) - as _i24.Future<_i9.Response>); + as _i25.Future<_i9.Response>); @override - _i24.Future<_i9.Response> post( + _i25.Future<_i9.Response> post( Uri? url, { Map? headers, Object? body, }) => (super.noSuchMethod( Invocation.method(#post, [url], {#headers: headers, #body: body}), - returnValue: _i24.Future<_i9.Response>.value( + returnValue: _i25.Future<_i9.Response>.value( _FakeResponse_9( this, Invocation.method( @@ -937,13 +942,13 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { ), ), ) - as _i24.Future<_i9.Response>); + as _i25.Future<_i9.Response>); } /// A class which mocks [ReownCore]. /// /// See the documentation for Mockito's code generation for more information. -class MockReownCore extends _i1.Mock implements _i29.ReownCore { +class MockReownCore extends _i1.Mock implements _i30.ReownCore { MockReownCore() { _i1.throwOnMissingStub(this); } @@ -952,7 +957,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get projectId => (super.noSuchMethod( Invocation.getter(#projectId), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#projectId), ), @@ -963,7 +968,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get relayUrl => (super.noSuchMethod( Invocation.getter(#relayUrl), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#relayUrl), ), @@ -974,7 +979,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get pushUrl => (super.noSuchMethod( Invocation.getter(#pushUrl), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#pushUrl), ), @@ -1073,6 +1078,17 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { ) as _i19.ILinkModeStore); + @override + _i20.IRustSignClient get rustSignClient => + (super.noSuchMethod( + Invocation.getter(#rustSignClient), + returnValue: _FakeIRustSignClient_20( + this, + Invocation.getter(#rustSignClient), + ), + ) + as _i20.IRustSignClient); + @override _i7.IStore> get storage => (super.noSuchMethod( @@ -1099,7 +1115,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get protocol => (super.noSuchMethod( Invocation.getter(#protocol), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#protocol), ), @@ -1110,7 +1126,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#version), ), @@ -1118,12 +1134,12 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { as String); @override - _i20.Logger get logger => + _i21.Logger get logger => (super.noSuchMethod( Invocation.getter(#logger), - returnValue: _FakeLogger_20(this, Invocation.getter(#logger)), + returnValue: _FakeLogger_21(this, Invocation.getter(#logger)), ) - as _i20.Logger); + as _i21.Logger); @override set relayUrl(String? _relayUrl) => super.noSuchMethod( @@ -1197,6 +1213,13 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { returnValueForMissingStub: null, ); + @override + set rustSignClient(_i20.IRustSignClient? _rustSignClient) => + super.noSuchMethod( + Invocation.setter(#rustSignClient, _rustSignClient), + returnValueForMissingStub: null, + ); + @override set storage(_i7.IStore>? _storage) => super.noSuchMethod( Invocation.setter(#storage, _storage), @@ -1225,21 +1248,21 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { as bool); @override - _i24.Future start() => + _i25.Future start() => (super.noSuchMethod( Invocation.method(#start, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future addLinkModeSupportedApp(String? universalLink) => + _i25.Future addLinkModeSupportedApp(String? universalLink) => (super.noSuchMethod( Invocation.method(#addLinkModeSupportedApp, [universalLink]), - returnValue: _i24.Future.value(false), + returnValue: _i25.Future.value(false), ) - as _i24.Future); + as _i25.Future); @override List getLinkModeSupportedApps() => @@ -1259,43 +1282,43 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { /// A class which mocks [WebSocketHandler]. /// /// See the documentation for Mockito's code generation for more information. -class MockWebSocketHandler extends _i1.Mock implements _i30.WebSocketHandler { +class MockWebSocketHandler extends _i1.Mock implements _i31.WebSocketHandler { MockWebSocketHandler() { _i1.throwOnMissingStub(this); } @override - _i24.Future get ready => + _i25.Future get ready => (super.noSuchMethod( Invocation.getter(#ready), - returnValue: _i24.Future.value(), + returnValue: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future setup({required String? url}) => + _i25.Future setup({required String? url}) => (super.noSuchMethod( Invocation.method(#setup, [], {#url: url}), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future connect() => + _i25.Future connect() => (super.noSuchMethod( Invocation.method(#connect, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); @override - _i24.Future close() => + _i25.Future close() => (super.noSuchMethod( Invocation.method(#close, []), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), ) - as _i24.Future); + as _i25.Future); } diff --git a/packages/reown_walletkit/build.yaml b/packages/reown_walletkit/build.yaml index e39e5483..dbf15e1d 100644 --- a/packages/reown_walletkit/build.yaml +++ b/packages/reown_walletkit/build.yaml @@ -2,7 +2,7 @@ targets: $default: sources: exclude: - - "**/.symlinks/**" + - "**/.symlinks/**" builders: build_version: options: diff --git a/packages/reown_walletkit/example/android/app/build.gradle b/packages/reown_walletkit/example/android/app/build.gradle index 785818df..a5c95b80 100644 --- a/packages/reown_walletkit/example/android/app/build.gradle +++ b/packages/reown_walletkit/example/android/app/build.gradle @@ -52,7 +52,7 @@ android { applicationId "com.walletconnect.flutterwallet" // 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 23 + minSdkVersion flutter.minSdkVersion targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/packages/reown_walletkit/example/android/build.gradle b/packages/reown_walletkit/example/android/build.gradle index 16fa9e2f..ff5bb269 100644 --- a/packages/reown_walletkit/example/android/build.gradle +++ b/packages/reown_walletkit/example/android/build.gradle @@ -2,7 +2,8 @@ allprojects { repositories { google() mavenCentral() - maven { url 'https://jitpack.io' } // TODO document this. +// maven { url 'https://jitpack.io' } // TODO document this. + mavenLocal { url '/Users/alfreedom/.m2/repository' } } } diff --git a/packages/reown_walletkit/example/ios/Podfile.lock b/packages/reown_walletkit/example/ios/Podfile.lock index dda7a9ff..8e0b97b3 100644 --- a/packages/reown_walletkit/example/ios/Podfile.lock +++ b/packages/reown_walletkit/example/ios/Podfile.lock @@ -8,16 +8,22 @@ PODS: - qr_code_scanner (0.2.0): - Flutter - MTBBarcodeScanner + - reown_yttrium (0.0.1): + - Flutter + - YttriumWrapper (= 0.9.57) + - YttriumWrapper (0.9.57) DEPENDENCIES: - Flutter (from `Flutter`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - qr_bar_code_scanner_dialog (from `.symlinks/plugins/qr_bar_code_scanner_dialog/ios`) - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) + - reown_yttrium (from `.symlinks/plugins/reown_yttrium/ios`) SPEC REPOS: trunk: - MTBBarcodeScanner + - YttriumWrapper EXTERNAL SOURCES: Flutter: @@ -28,6 +34,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/qr_bar_code_scanner_dialog/ios" qr_code_scanner: :path: ".symlinks/plugins/qr_code_scanner/ios" + reown_yttrium: + :path: ".symlinks/plugins/reown_yttrium/ios" SPEC CHECKSUMS: Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 @@ -35,6 +43,8 @@ SPEC CHECKSUMS: MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb qr_bar_code_scanner_dialog: a4cb7ad7201cbf8b888f3e6e58972b611ac43b28 qr_code_scanner: d77f94ecc9abf96d9b9b8fc04ef13f611e5a147a + reown_yttrium: 518f6a50e4f291cef7e282ab5f2c955aa63f2e27 + YttriumWrapper: ded5842dc952538bb7f09a1074fdd6d7348bfeaa PODFILE CHECKSUM: 0772a2bd8cd4c7aaeb2576ddfaf6b03be722593b diff --git a/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj b/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj index 46c5c0b3..6a17c0fb 100644 --- a/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - E5EF171D13377094DDE927E9 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CBA7E88A93B0E0D40C19A1E /* Pods_Runner.framework */; }; + AB2314560D8ABB0687440717 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E3DB53E6FA7EE2C2946EF3E /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -34,13 +34,14 @@ /* Begin PBXFileReference section */ 091D8F532C4A7A5000904D6C /* Info-internal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-internal.plist"; sourceTree = ""; }; 0978D7E02C6B682E00E3593C /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + 0EB559B68A2B47948540A259 /* Pods-Runner.profile-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-internal.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 1CBA7E88A93B0E0D40C19A1E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 27EC75F9197EFD43D473841D /* Pods-Runner.profile-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-production.xcconfig"; sourceTree = ""; }; - 38D486D0A797BC69D694AA91 /* Pods-Runner.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-internal.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 57A2E4F788A29DC2A22A80B8 /* Pods-Runner.release-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-production.xcconfig"; sourceTree = ""; }; + 406098D5D91641055C9EFBC5 /* Pods-Runner.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-internal.xcconfig"; sourceTree = ""; }; + 4E3DB53E6FA7EE2C2946EF3E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 69790BA659D1F891EC2B44D3 /* Pods-Runner.debug-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-internal.xcconfig"; sourceTree = ""; }; + 738388E092CD154B8BF4FDBD /* Pods-Runner.profile-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-production.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 768EBD407C0AF5CD9D783372 /* Pods-Runner.debug-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-internal.xcconfig"; sourceTree = ""; }; @@ -52,9 +53,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A2AB60DD894F4A6F8EE73446 /* Pods-Runner.profile-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-internal.xcconfig"; sourceTree = ""; }; - FE4D3D9EE88AB0B9D349E419 /* Pods-Runner.debug-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-production.xcconfig"; sourceTree = ""; }; - 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; + D00484D0B635A8E1864E0FD3 /* Pods-Runner.debug-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-production.xcconfig"; sourceTree = ""; }; + E5CD0C8858BC2219BFE664DE /* Pods-Runner.release-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-production.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,17 +63,17 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - E5EF171D13377094DDE927E9 /* Pods_Runner.framework in Frameworks */, + AB2314560D8ABB0687440717 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 14B4C43CDE9477B6E3333B69 /* Frameworks */ = { + 27151E96596DDBD9D27D6E59 /* Frameworks */ = { isa = PBXGroup; children = ( - 1CBA7E88A93B0E0D40C19A1E /* Pods_Runner.framework */, + 4E3DB53E6FA7EE2C2946EF3E /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -81,7 +81,6 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, @@ -97,7 +96,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, C4281BF2C021B5570082F0DC /* Pods */, - 14B4C43CDE9477B6E3333B69 /* Frameworks */, + 27151E96596DDBD9D27D6E59 /* Frameworks */, ); sourceTree = ""; }; @@ -129,12 +128,12 @@ C4281BF2C021B5570082F0DC /* Pods */ = { isa = PBXGroup; children = ( - FE4D3D9EE88AB0B9D349E419 /* Pods-Runner.debug-production.xcconfig */, - 768EBD407C0AF5CD9D783372 /* Pods-Runner.debug-internal.xcconfig */, - 57A2E4F788A29DC2A22A80B8 /* Pods-Runner.release-production.xcconfig */, - 38D486D0A797BC69D694AA91 /* Pods-Runner.release-internal.xcconfig */, - 27EC75F9197EFD43D473841D /* Pods-Runner.profile-production.xcconfig */, - A2AB60DD894F4A6F8EE73446 /* Pods-Runner.profile-internal.xcconfig */, + D00484D0B635A8E1864E0FD3 /* Pods-Runner.debug-production.xcconfig */, + 69790BA659D1F891EC2B44D3 /* Pods-Runner.debug-internal.xcconfig */, + E5CD0C8858BC2219BFE664DE /* Pods-Runner.release-production.xcconfig */, + 406098D5D91641055C9EFBC5 /* Pods-Runner.release-internal.xcconfig */, + 738388E092CD154B8BF4FDBD /* Pods-Runner.profile-production.xcconfig */, + 0EB559B68A2B47948540A259 /* Pods-Runner.profile-internal.xcconfig */, ); path = Pods; sourceTree = ""; @@ -146,14 +145,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 2BA928068C1D309A5FBF62B3 /* [CP] Check Pods Manifest.lock */, + 79D2858893E475669C75F783 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 7A9216D7631D78D57E0817B7 /* [CP] Embed Pods Frameworks */, + BC33F7DF04B473B8A3B97806 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -219,7 +218,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 2BA928068C1D309A5FBF62B3 /* [CP] Check Pods Manifest.lock */ = { + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 79D2858893E475669C75F783 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -257,7 +272,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 7A9216D7631D78D57E0817B7 /* [CP] Embed Pods Frameworks */ = { + BC33F7DF04B473B8A3B97806 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( diff --git a/packages/reown_walletkit/example/lib/dependencies/walletkit_service.dart b/packages/reown_walletkit/example/lib/dependencies/walletkit_service.dart index cf8343e4..fd3782a6 100644 --- a/packages/reown_walletkit/example/lib/dependencies/walletkit_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/walletkit_service.dart @@ -163,7 +163,7 @@ class WalletKitService extends IWalletKitService { } void _logListener(String event) { - debugPrint('[WalletKit] $event'); + // debugPrint('[WalletKit] $event'); } @override @@ -247,9 +247,9 @@ class WalletKitService extends IWalletKitService { } else { final error = Errors.getSdkError(Errors.USER_REJECTED).toSignError(); await _walletKit!.rejectSession(id: args.id, reason: error); - await _walletKit!.core.pairing.disconnect( - topic: args.params.pairingTopic, - ); + // await _walletKit!.core.pairing.disconnect( + // topic: args.params.pairingTopic, + // ); MethodsUtils.handleRedirect( '', proposer.metadata.redirect, diff --git a/packages/reown_walletkit/example/lib/pages/settings_page.dart b/packages/reown_walletkit/example/lib/pages/settings_page.dart index 4c96265f..42081a63 100644 --- a/packages/reown_walletkit/example/lib/pages/settings_page.dart +++ b/packages/reown_walletkit/example/lib/pages/settings_page.dart @@ -610,7 +610,7 @@ class _SolanaAccountsState extends State<_SolanaAccounts> { if (!mounted) return; setState(() => _balance = value); }).catchError((error) { - debugPrint(error); + debugPrint(error.toString()); }); } catch (e) { debugPrint(e.toString()); diff --git a/packages/reown_walletkit/example/macos/Podfile.lock b/packages/reown_walletkit/example/macos/Podfile.lock index 1f667557..fd2d9ccd 100644 --- a/packages/reown_walletkit/example/macos/Podfile.lock +++ b/packages/reown_walletkit/example/macos/Podfile.lock @@ -1,35 +1,69 @@ PODS: + - connectivity_plus (0.0.1): + - FlutterMacOS - FlutterMacOS (1.0.0) - package_info_plus (0.0.1): - FlutterMacOS + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - Sentry/HybridSDK (8.46.0) + - sentry_flutter (8.14.2): + - Flutter + - FlutterMacOS + - Sentry/HybridSDK (= 8.46.0) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - sqflite_darwin (0.0.4): + - Flutter + - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS DEPENDENCIES: + - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) + - sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) +SPEC REPOS: + trunk: + - Sentry + EXTERNAL SOURCES: + connectivity_plus: + :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos FlutterMacOS: :path: Flutter/ephemeral package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin + sentry_flutter: + :path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin + sqflite_darwin: + :path: Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: + connectivity_plus: 4adf20a405e25b42b9c9f87feff8f4b6fde18a4e FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c - shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 + package_info_plus: f0052d280d17aa382b932f399edf32507174e870 + path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 + Sentry: da60d980b197a46db0b35ea12cb8f39af48d8854 + sentry_flutter: 27892878729f42701297c628eb90e7c6529f3684 + shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 + sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 + url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/packages/reown_walletkit/example/macos/Runner.xcodeproj/project.pbxproj b/packages/reown_walletkit/example/macos/Runner.xcodeproj/project.pbxproj index 4156de8c..a3344345 100644 --- a/packages/reown_walletkit/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/reown_walletkit/example/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + EC3347F98C5E1C842F791D47 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F89681D79898D565F526589E /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -52,6 +53,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 2B809AFC0513269F1CED100C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 33CC10ED2044A3C60003C045 /* wallet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = wallet.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -67,7 +69,10 @@ 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 843DCD2D6A2490B8D1874BED /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + B7151992271D0DFB5D121C6E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + F89681D79898D565F526589E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,6 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + EC3347F98C5E1C842F791D47 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -98,6 +104,8 @@ 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, + 928D833CEF181B2113A79FDC /* Pods */, + AFA93F44702A53D3794B2984 /* Frameworks */, ); sourceTree = ""; }; @@ -144,6 +152,25 @@ path = Runner; sourceTree = ""; }; + 928D833CEF181B2113A79FDC /* Pods */ = { + isa = PBXGroup; + children = ( + 843DCD2D6A2490B8D1874BED /* Pods-Runner.debug.xcconfig */, + 2B809AFC0513269F1CED100C /* Pods-Runner.release.xcconfig */, + B7151992271D0DFB5D121C6E /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + AFA93F44702A53D3794B2984 /* Frameworks */ = { + isa = PBXGroup; + children = ( + F89681D79898D565F526589E /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -151,11 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 4A9FEF7E29FED711A7A08EC9 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + DC827C0B56B6DC9E2E07C5A7 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -263,6 +292,45 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 4A9FEF7E29FED711A7A08EC9 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + DC827C0B56B6DC9E2E07C5A7 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/packages/reown_walletkit/example/macos/Runner/AppDelegate.swift b/packages/reown_walletkit/example/macos/Runner/AppDelegate.swift index d53ef643..8e02df28 100644 --- a/packages/reown_walletkit/example/macos/Runner/AppDelegate.swift +++ b/packages/reown_walletkit/example/macos/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import Cocoa import FlutterMacOS -@NSApplicationMain +@main class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true diff --git a/packages/reown_walletkit/pubspec.yaml b/packages/reown_walletkit/pubspec.yaml index 5cc66db2..29a66438 100644 --- a/packages/reown_walletkit/pubspec.yaml +++ b/packages/reown_walletkit/pubspec.yaml @@ -13,8 +13,10 @@ dependencies: event: ^3.1.0 flutter: sdk: flutter - reown_core: ^1.3.1 - reown_sign: ^1.3.1 + reown_core: + path: ../reown_core/ + reown_sign: + path: ../reown_sign/ dev_dependencies: build_runner: ^2.4.13 diff --git a/packages/reown_walletkit/test/shared/shared_test_utils.mocks.dart b/packages/reown_walletkit/test/shared/shared_test_utils.mocks.dart index f2f386cd..bc88e48b 100644 --- a/packages/reown_walletkit/test/shared/shared_test_utils.mocks.dart +++ b/packages/reown_walletkit/test/shared/shared_test_utils.mocks.dart @@ -3,21 +3,21 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i24; -import 'dart:typed_data' as _i22; +import 'dart:async' as _i25; +import 'dart:typed_data' as _i23; import 'package:event/event.dart' as _i8; import 'package:http/http.dart' as _i9; -import 'package:logger/logger.dart' as _i20; +import 'package:logger/logger.dart' as _i21; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i23; +import 'package:mockito/src/dummies.dart' as _i24; import 'package:reown_core/connectivity/i_connectivity.dart' as _i18; -import 'package:reown_core/core_impl.dart' as _i29; -import 'package:reown_core/crypto/crypto.dart' as _i25; +import 'package:reown_core/core_impl.dart' as _i30; +import 'package:reown_core/crypto/crypto.dart' as _i26; import 'package:reown_core/crypto/crypto_models.dart' as _i2; -import 'package:reown_core/crypto/crypto_utils.dart' as _i21; +import 'package:reown_core/crypto/crypto_utils.dart' as _i22; import 'package:reown_core/crypto/i_crypto.dart' as _i10; -import 'package:reown_core/crypto/i_crypto_utils.dart' as _i5; +import 'package:reown_core/crypto/i_crypto_utils.dart' as _i4; import 'package:reown_core/echo/i_echo.dart' as _i14; import 'package:reown_core/events/i_events.dart' as _i15; import 'package:reown_core/heartbit/i_heartbeat.dart' as _i16; @@ -26,15 +26,16 @@ import 'package:reown_core/pairing/i_expirer.dart' as _i12; import 'package:reown_core/pairing/i_pairing.dart' as _i13; import 'package:reown_core/relay_auth/i_relay_auth.dart' as _i6; import 'package:reown_core/relay_client/i_relay_client.dart' as _i11; -import 'package:reown_core/relay_client/message_tracker.dart' as _i26; -import 'package:reown_core/relay_client/websocket/http_client.dart' as _i28; +import 'package:reown_core/relay_client/message_tracker.dart' as _i27; +import 'package:reown_core/relay_client/websocket/http_client.dart' as _i29; import 'package:reown_core/relay_client/websocket/websocket_handler.dart' - as _i30; -import 'package:reown_core/store/i_generic_store.dart' as _i4; + as _i31; +import 'package:reown_core/store/i_generic_store.dart' as _i5; import 'package:reown_core/store/i_store.dart' as _i7; import 'package:reown_core/store/link_mode_store.dart' as _i19; -import 'package:reown_core/store/store_models.dart' as _i27; +import 'package:reown_core/store/store_models.dart' as _i28; import 'package:reown_core/verify/i_verify.dart' as _i17; +import 'package:reown_core/yttrium/i_rust_sign_client.dart' as _i20; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -91,9 +92,8 @@ class _FakeIReownCore_3 extends _i1.SmartFake implements _i3.IReownCore { ); } -class _FakeIGenericStore_4 extends _i1.SmartFake - implements _i4.IGenericStore { - _FakeIGenericStore_4( +class _FakeICryptoUtils_4 extends _i1.SmartFake implements _i4.ICryptoUtils { + _FakeICryptoUtils_4( Object parent, Invocation parentInvocation, ) : super( @@ -102,8 +102,9 @@ class _FakeIGenericStore_4 extends _i1.SmartFake ); } -class _FakeICryptoUtils_5 extends _i1.SmartFake implements _i5.ICryptoUtils { - _FakeICryptoUtils_5( +class _FakeIGenericStore_5 extends _i1.SmartFake + implements _i5.IGenericStore { + _FakeIGenericStore_5( Object parent, Invocation parentInvocation, ) : super( @@ -255,8 +256,19 @@ class _FakeILinkModeStore_19 extends _i1.SmartFake ); } -class _FakeLogger_20 extends _i1.SmartFake implements _i20.Logger { - _FakeLogger_20( +class _FakeIRustSignClient_20 extends _i1.SmartFake + implements _i20.IRustSignClient { + _FakeIRustSignClient_20( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLogger_21 extends _i1.SmartFake implements _i21.Logger { + _FakeLogger_21( Object parent, Invocation parentInvocation, ) : super( @@ -268,7 +280,7 @@ class _FakeLogger_20 extends _i1.SmartFake implements _i20.Logger { /// A class which mocks [CryptoUtils]. /// /// See the documentation for Mockito's code generation for more information. -class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { +class MockCryptoUtils extends _i1.Mock implements _i22.CryptoUtils { MockCryptoUtils() { _i1.throwOnMissingStub(this); } @@ -289,13 +301,13 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ) as _i2.CryptoKeyPair); @override - _i22.Uint8List randomBytes(int? length) => (super.noSuchMethod( + _i23.Uint8List randomBytes(int? length) => (super.noSuchMethod( Invocation.method( #randomBytes, [length], ), - returnValue: _i22.Uint8List(0), - ) as _i22.Uint8List); + returnValue: _i23.Uint8List(0), + ) as _i23.Uint8List); @override String generateRandomBytes32() => (super.noSuchMethod( @@ -303,7 +315,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { #generateRandomBytes32, [], ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #generateRandomBytes32, @@ -313,7 +325,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ) as String); @override - _i24.Future deriveSymKey( + _i25.Future deriveSymKey( String? privKeyA, String? pubKeyB, ) => @@ -325,7 +337,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { pubKeyB, ], ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #deriveSymKey, @@ -335,7 +347,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ], ), )), - ) as _i24.Future); + ) as _i25.Future); @override String hashKey(String? key) => (super.noSuchMethod( @@ -343,7 +355,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { #hashKey, [key], ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #hashKey, @@ -358,7 +370,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { #hashMessage, [message], ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #hashMessage, @@ -368,7 +380,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ) as String); @override - _i24.Future encrypt( + _i25.Future encrypt( String? message, String? symKey, { int? type, @@ -388,7 +400,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { #senderPublicKey: senderPublicKey, }, ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #encrypt, @@ -403,10 +415,10 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { }, ), )), - ) as _i24.Future); + ) as _i25.Future); @override - _i24.Future decrypt( + _i25.Future decrypt( String? symKey, String? encoded, ) => @@ -418,7 +430,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { encoded, ], ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #decrypt, @@ -428,14 +440,14 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ], ), )), - ) as _i24.Future); + ) as _i25.Future); @override String serialize( int? type, - _i22.Uint8List? sealed, - _i22.Uint8List? iv, { - _i22.Uint8List? senderPublicKey, + _i23.Uint8List? sealed, + _i23.Uint8List? iv, { + _i23.Uint8List? senderPublicKey, }) => (super.noSuchMethod( Invocation.method( @@ -447,7 +459,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ], {#senderPublicKey: senderPublicKey}, ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #serialize, @@ -546,16 +558,16 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { ) as bool); @override - _i22.Uint8List encodeTypeByte(int? type) => (super.noSuchMethod( + _i23.Uint8List encodeTypeByte(int? type) => (super.noSuchMethod( Invocation.method( #encodeTypeByte, [type], ), - returnValue: _i22.Uint8List(0), - ) as _i22.Uint8List); + returnValue: _i23.Uint8List(0), + ) as _i23.Uint8List); @override - int decodeTypeByte(_i22.Uint8List? byte) => (super.noSuchMethod( + int decodeTypeByte(_i23.Uint8List? byte) => (super.noSuchMethod( Invocation.method( #decodeTypeByte, [byte], @@ -571,7 +583,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { [], {#message: message}, ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #encodeTypeTwoEnvelope, @@ -589,7 +601,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { [], {#message: message}, ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #decodeTypeTwoEnvelope, @@ -603,7 +615,7 @@ class MockCryptoUtils extends _i1.Mock implements _i21.CryptoUtils { /// A class which mocks [Crypto]. /// /// See the documentation for Mockito's code generation for more information. -class MockCrypto extends _i1.Mock implements _i25.Crypto { +class MockCrypto extends _i1.Mock implements _i26.Crypto { MockCrypto() { _i1.throwOnMissingStub(this); } @@ -618,37 +630,28 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ) as _i3.IReownCore); @override - _i4.IGenericStore get keyChain => (super.noSuchMethod( - Invocation.getter(#keyChain), - returnValue: _FakeIGenericStore_4( + _i4.ICryptoUtils get utils => (super.noSuchMethod( + Invocation.getter(#utils), + returnValue: _FakeICryptoUtils_4( this, - Invocation.getter(#keyChain), - ), - ) as _i4.IGenericStore); - - @override - set keyChain(_i4.IGenericStore? _keyChain) => super.noSuchMethod( - Invocation.setter( - #keyChain, - _keyChain, + Invocation.getter(#utils), ), - returnValueForMissingStub: null, - ); + ) as _i4.ICryptoUtils); @override - _i5.ICryptoUtils get utils => (super.noSuchMethod( - Invocation.getter(#utils), - returnValue: _FakeICryptoUtils_5( + _i5.IGenericStore get keyChain => (super.noSuchMethod( + Invocation.getter(#keyChain), + returnValue: _FakeIGenericStore_5( this, - Invocation.getter(#utils), + Invocation.getter(#keyChain), ), - ) as _i5.ICryptoUtils); + ) as _i5.IGenericStore); @override - set utils(_i5.ICryptoUtils? _utils) => super.noSuchMethod( + set keyChain(_i5.IGenericStore? _keyChain) => super.noSuchMethod( Invocation.setter( - #utils, - _utils, + #keyChain, + _keyChain, ), returnValueForMissingStub: null, ); @@ -674,21 +677,21 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { @override String get name => (super.noSuchMethod( Invocation.getter(#name), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#name), ), ) as String); @override - _i24.Future init() => (super.noSuchMethod( + _i25.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override bool hasKeys(String? tag) => (super.noSuchMethod( @@ -700,37 +703,37 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ) as bool); @override - _i24.Future getClientId() => (super.noSuchMethod( + _i25.Future getClientId() => (super.noSuchMethod( Invocation.method( #getClientId, [], ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #getClientId, [], ), )), - ) as _i24.Future); + ) as _i25.Future); @override - _i24.Future generateKeyPair() => (super.noSuchMethod( + _i25.Future generateKeyPair() => (super.noSuchMethod( Invocation.method( #generateKeyPair, [], ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #generateKeyPair, [], ), )), - ) as _i24.Future); + ) as _i25.Future); @override - _i24.Future generateSharedKey( + _i25.Future generateSharedKey( String? selfPublicKey, String? peerPublicKey, { String? overrideTopic, @@ -744,7 +747,7 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ], {#overrideTopic: overrideTopic}, ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #generateSharedKey, @@ -755,10 +758,10 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { {#overrideTopic: overrideTopic}, ), )), - ) as _i24.Future); + ) as _i25.Future); @override - _i24.Future setSymKey( + _i25.Future setSymKey( String? symKey, { String? overrideTopic, }) => @@ -768,7 +771,7 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { [symKey], {#overrideTopic: overrideTopic}, ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #setSymKey, @@ -776,30 +779,36 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { {#overrideTopic: overrideTopic}, ), )), - ) as _i24.Future); + ) as _i25.Future); @override - _i24.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( + String? getSymKey(String? topic) => (super.noSuchMethod(Invocation.method( + #getSymKey, + [topic], + )) as String?); + + @override + _i25.Future deleteKeyPair(String? publicKey) => (super.noSuchMethod( Invocation.method( #deleteKeyPair, [publicKey], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future deleteSymKey(String? topic) => (super.noSuchMethod( + _i25.Future deleteSymKey(String? topic) => (super.noSuchMethod( Invocation.method( #deleteSymKey, [topic], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future encode( + _i25.Future encode( String? topic, Map? payload, { _i2.EncodeOptions? options, @@ -813,11 +822,11 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ], {#options: options}, ), - returnValue: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future decode( + _i25.Future decode( String? topic, String? encoded, { _i2.DecodeOptions? options, @@ -831,23 +840,23 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { ], {#options: options}, ), - returnValue: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future signJWT(String? aud) => (super.noSuchMethod( + _i25.Future signJWT(String? aud) => (super.noSuchMethod( Invocation.method( #signJWT, [aud], ), - returnValue: _i24.Future.value(_i23.dummyValue( + returnValue: _i25.Future.value(_i24.dummyValue( this, Invocation.method( #signJWT, [aud], ), )), - ) as _i24.Future); + ) as _i25.Future); @override int getPayloadType(String? encoded) => (super.noSuchMethod( @@ -866,25 +875,25 @@ class MockCrypto extends _i1.Mock implements _i25.Crypto { )) as String?); @override - _i5.ICryptoUtils getUtils() => (super.noSuchMethod( + _i4.ICryptoUtils getUtils() => (super.noSuchMethod( Invocation.method( #getUtils, [], ), - returnValue: _FakeICryptoUtils_5( + returnValue: _FakeICryptoUtils_4( this, Invocation.method( #getUtils, [], ), ), - ) as _i5.ICryptoUtils); + ) as _i4.ICryptoUtils); } /// A class which mocks [MessageTracker]. /// /// See the documentation for Mockito's code generation for more information. -class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { +class MockMessageTracker extends _i1.Mock implements _i27.MessageTracker { MockMessageTracker() { _i1.throwOnMissingStub(this); } @@ -892,7 +901,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { @override String get context => (super.noSuchMethod( Invocation.getter(#context), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#context), ), @@ -901,7 +910,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { @override String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#version), ), @@ -917,53 +926,53 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { ) as _i7.IStore); @override - _i8.Event<_i27.StoreCreateEvent>> get onCreate => + _i8.Event<_i28.StoreCreateEvent>> get onCreate => (super.noSuchMethod( Invocation.getter(#onCreate), - returnValue: _FakeEvent_8<_i27.StoreCreateEvent>>( + returnValue: _FakeEvent_8<_i28.StoreCreateEvent>>( this, Invocation.getter(#onCreate), ), - ) as _i8.Event<_i27.StoreCreateEvent>>); + ) as _i8.Event<_i28.StoreCreateEvent>>); @override - _i8.Event<_i27.StoreUpdateEvent>> get onUpdate => + _i8.Event<_i28.StoreUpdateEvent>> get onUpdate => (super.noSuchMethod( Invocation.getter(#onUpdate), - returnValue: _FakeEvent_8<_i27.StoreUpdateEvent>>( + returnValue: _FakeEvent_8<_i28.StoreUpdateEvent>>( this, Invocation.getter(#onUpdate), ), - ) as _i8.Event<_i27.StoreUpdateEvent>>); + ) as _i8.Event<_i28.StoreUpdateEvent>>); @override - _i8.Event<_i27.StoreDeleteEvent>> get onDelete => + _i8.Event<_i28.StoreDeleteEvent>> get onDelete => (super.noSuchMethod( Invocation.getter(#onDelete), - returnValue: _FakeEvent_8<_i27.StoreDeleteEvent>>( + returnValue: _FakeEvent_8<_i28.StoreDeleteEvent>>( this, Invocation.getter(#onDelete), ), - ) as _i8.Event<_i27.StoreDeleteEvent>>); + ) as _i8.Event<_i28.StoreDeleteEvent>>); @override - _i8.Event<_i27.StoreErrorEvent>> get onError => + _i8.Event<_i28.StoreErrorEvent>> get onError => (super.noSuchMethod( Invocation.getter(#onError), - returnValue: _FakeEvent_8<_i27.StoreErrorEvent>>( + returnValue: _FakeEvent_8<_i28.StoreErrorEvent>>( this, Invocation.getter(#onError), ), - ) as _i8.Event<_i27.StoreErrorEvent>>); + ) as _i8.Event<_i28.StoreErrorEvent>>); @override - _i8.Event<_i27.StoreSyncEvent> get onSync => (super.noSuchMethod( + _i8.Event<_i28.StoreSyncEvent> get onSync => (super.noSuchMethod( Invocation.getter(#onSync), - returnValue: _FakeEvent_8<_i27.StoreSyncEvent>( + returnValue: _FakeEvent_8<_i28.StoreSyncEvent>( this, Invocation.getter(#onSync), ), - ) as _i8.Event<_i27.StoreSyncEvent>); + ) as _i8.Event<_i28.StoreSyncEvent>); @override Map> get data => (super.noSuchMethod( @@ -989,7 +998,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { @override String get storageKey => (super.noSuchMethod( Invocation.getter(#storageKey), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#storageKey), ), @@ -1001,7 +1010,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { #hashMessage, [message], ), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.method( #hashMessage, @@ -1011,7 +1020,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { ) as String); @override - _i24.Future recordMessageEvent( + _i25.Future recordMessageEvent( String? topic, String? message, ) => @@ -1023,9 +1032,9 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { message, ], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override bool messageIsRecorded( @@ -1044,14 +1053,14 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { ) as bool); @override - _i24.Future init() => (super.noSuchMethod( + _i25.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override bool has(String? key) => (super.noSuchMethod( @@ -1079,7 +1088,7 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { ) as List>); @override - _i24.Future set( + _i25.Future set( String? key, Map? value, ) => @@ -1091,39 +1100,39 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { value, ], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future delete(String? key) => (super.noSuchMethod( + _i25.Future delete(String? key) => (super.noSuchMethod( Invocation.method( #delete, [key], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future persist() => (super.noSuchMethod( + _i25.Future persist() => (super.noSuchMethod( Invocation.method( #persist, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future restore() => (super.noSuchMethod( + _i25.Future restore() => (super.noSuchMethod( Invocation.method( #restore, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override void checkInitialized() => super.noSuchMethod( @@ -1138,13 +1147,13 @@ class MockMessageTracker extends _i1.Mock implements _i26.MessageTracker { /// A class which mocks [HttpWrapper]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { +class MockHttpWrapper extends _i1.Mock implements _i29.HttpWrapper { MockHttpWrapper() { _i1.throwOnMissingStub(this); } @override - _i24.Future<_i9.Response> get( + _i25.Future<_i9.Response> get( Uri? url, { Map? headers, }) => @@ -1154,7 +1163,7 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { [url], {#headers: headers}, ), - returnValue: _i24.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i25.Future<_i9.Response>.value(_FakeResponse_9( this, Invocation.method( #get, @@ -1162,10 +1171,10 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { {#headers: headers}, ), )), - ) as _i24.Future<_i9.Response>); + ) as _i25.Future<_i9.Response>); @override - _i24.Future<_i9.Response> delete( + _i25.Future<_i9.Response> delete( Uri? url, { Map? headers, }) => @@ -1175,7 +1184,7 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { [url], {#headers: headers}, ), - returnValue: _i24.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i25.Future<_i9.Response>.value(_FakeResponse_9( this, Invocation.method( #delete, @@ -1183,10 +1192,10 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { {#headers: headers}, ), )), - ) as _i24.Future<_i9.Response>); + ) as _i25.Future<_i9.Response>); @override - _i24.Future<_i9.Response> post( + _i25.Future<_i9.Response> post( Uri? url, { Map? headers, Object? body, @@ -1200,7 +1209,7 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { #body: body, }, ), - returnValue: _i24.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i25.Future<_i9.Response>.value(_FakeResponse_9( this, Invocation.method( #post, @@ -1211,13 +1220,13 @@ class MockHttpWrapper extends _i1.Mock implements _i28.HttpWrapper { }, ), )), - ) as _i24.Future<_i9.Response>); + ) as _i25.Future<_i9.Response>); } /// A class which mocks [ReownCore]. /// /// See the documentation for Mockito's code generation for more information. -class MockReownCore extends _i1.Mock implements _i29.ReownCore { +class MockReownCore extends _i1.Mock implements _i30.ReownCore { MockReownCore() { _i1.throwOnMissingStub(this); } @@ -1225,7 +1234,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { @override String get projectId => (super.noSuchMethod( Invocation.getter(#projectId), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#projectId), ), @@ -1234,7 +1243,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { @override String get relayUrl => (super.noSuchMethod( Invocation.getter(#relayUrl), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#relayUrl), ), @@ -1252,7 +1261,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { @override String get pushUrl => (super.noSuchMethod( Invocation.getter(#pushUrl), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#pushUrl), ), @@ -1447,6 +1456,25 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { returnValueForMissingStub: null, ); + @override + _i20.IRustSignClient get rustSignClient => (super.noSuchMethod( + Invocation.getter(#rustSignClient), + returnValue: _FakeIRustSignClient_20( + this, + Invocation.getter(#rustSignClient), + ), + ) as _i20.IRustSignClient); + + @override + set rustSignClient(_i20.IRustSignClient? _rustSignClient) => + super.noSuchMethod( + Invocation.setter( + #rustSignClient, + _rustSignClient, + ), + returnValueForMissingStub: null, + ); + @override _i7.IStore> get storage => (super.noSuchMethod( Invocation.getter(#storage), @@ -1487,7 +1515,7 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { @override String get protocol => (super.noSuchMethod( Invocation.getter(#protocol), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#protocol), ), @@ -1496,20 +1524,20 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { @override String get version => (super.noSuchMethod( Invocation.getter(#version), - returnValue: _i23.dummyValue( + returnValue: _i24.dummyValue( this, Invocation.getter(#version), ), ) as String); @override - _i20.Logger get logger => (super.noSuchMethod( + _i21.Logger get logger => (super.noSuchMethod( Invocation.getter(#logger), - returnValue: _FakeLogger_20( + returnValue: _FakeLogger_21( this, Invocation.getter(#logger), ), - ) as _i20.Logger); + ) as _i21.Logger); @override void addLogListener(dynamic Function(String)? callback) => super.noSuchMethod( @@ -1531,24 +1559,24 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { ) as bool); @override - _i24.Future start() => (super.noSuchMethod( + _i25.Future start() => (super.noSuchMethod( Invocation.method( #start, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future addLinkModeSupportedApp(String? universalLink) => + _i25.Future addLinkModeSupportedApp(String? universalLink) => (super.noSuchMethod( Invocation.method( #addLinkModeSupportedApp, [universalLink], ), - returnValue: _i24.Future.value(false), - ) as _i24.Future); + returnValue: _i25.Future.value(false), + ) as _i25.Future); @override List getLinkModeSupportedApps() => (super.noSuchMethod( @@ -1572,45 +1600,45 @@ class MockReownCore extends _i1.Mock implements _i29.ReownCore { /// A class which mocks [WebSocketHandler]. /// /// See the documentation for Mockito's code generation for more information. -class MockWebSocketHandler extends _i1.Mock implements _i30.WebSocketHandler { +class MockWebSocketHandler extends _i1.Mock implements _i31.WebSocketHandler { MockWebSocketHandler() { _i1.throwOnMissingStub(this); } @override - _i24.Future get ready => (super.noSuchMethod( + _i25.Future get ready => (super.noSuchMethod( Invocation.getter(#ready), - returnValue: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future setup({required String? url}) => (super.noSuchMethod( + _i25.Future setup({required String? url}) => (super.noSuchMethod( Invocation.method( #setup, [], {#url: url}, ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future connect() => (super.noSuchMethod( + _i25.Future connect() => (super.noSuchMethod( Invocation.method( #connect, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); @override - _i24.Future close() => (super.noSuchMethod( + _i25.Future close() => (super.noSuchMethod( Invocation.method( #close, [], ), - returnValue: _i24.Future.value(), - returnValueForMissingStub: _i24.Future.value(), - ) as _i24.Future); + returnValue: _i25.Future.value(), + returnValueForMissingStub: _i25.Future.value(), + ) as _i25.Future); } diff --git a/packages/reown_yttrium/android/build.gradle b/packages/reown_yttrium/android/build.gradle index b013a30e..2e7a082a 100644 --- a/packages/reown_yttrium/android/build.gradle +++ b/packages/reown_yttrium/android/build.gradle @@ -77,7 +77,7 @@ android { } // Use specific yttrium version for CI builds, default version for local builds -def yttriumVersion = project.hasProperty("yttriumCiVersion") ? project.getProperty("yttriumCiVersion") : "0.9.4" +def yttriumVersion = project.hasProperty("yttriumCiVersion") ? project.getProperty("yttriumCiVersion") : "unspecified" dependencies { implementation("net.java.dev.jna:jna:5.15.0@aar") diff --git a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ChainAbstraction.kt b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ChainAbstraction.kt new file mode 100644 index 00000000..74738aa5 --- /dev/null +++ b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ChainAbstraction.kt @@ -0,0 +1,177 @@ +package com.reown.reown_yttrium + +import android.content.Context +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.EventChannel +import io.flutter.plugin.common.MethodChannel +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import uniffi.uniffi_yttrium.ChainAbstractionClient +import uniffi.uniffi_yttrium.Eip1559Estimation +import uniffi.yttrium.Call +import uniffi.yttrium.Currency +import uniffi.yttrium.PrepareDetailedResponse +import uniffi.yttrium.PrepareDetailedResponseSuccess +import uniffi.yttrium.PulseMetadata +import uniffi.yttrium.UiFields +import kotlin.collections.set + +class ChainAbstraction { + companion object { + private lateinit var chainAbstractionClient: ChainAbstractionClient + private var pendingPrepareDetailed: MutableMap = mutableMapOf() + private lateinit var applicationContext: Context + + // Called during plugin registration + fun setApplicationContext(context: Context) { + applicationContext = context + } + + fun initialize(params: Any?, result: MethodChannel.Result) { + val dict = params as? Map<*, *> ?: return result.error("initialize", "Invalid parameters: not a map", null) + + val projectId = dict["projectId"] as? String ?: return errorMissing("projectId", params, result) + val pulseMetadataDict = dict["pulseMetadata"] as? Map<*, *> ?: return errorMissing("pulseMetadata", params, result) + + val url = pulseMetadataDict["url"] as? String ?: return errorMissing("url", params, result) + val packageName = applicationContext.packageName ?: pulseMetadataDict["packageName"] as? String ?: return errorMissing("packageName", params, result) + val sdkVersion = pulseMetadataDict["sdkVersion"] as? String ?: return errorMissing("sdkVersion", params, result) + val sdkPlatform = pulseMetadataDict["sdkPlatform"] as? String ?: return errorMissing("sdkPlatform", params, result) + + val pulseMetadata = PulseMetadata(url, packageName, sdkVersion, sdkPlatform) + + chainAbstractionClient = ChainAbstractionClient(projectId = projectId, pulseMetadata = pulseMetadata) + + result.success(true) + } + + fun erc20TokenBalance(params: Any?, result: MethodChannel.Result) { + println("erc20TokenBalance called with $params") + + val dict = params as? Map<*, *> ?: return result.error("erc20TokenBalance", "Invalid parameters: not a map", null) + + val tokenAddress = dict["token"] as? String ?: return errorMissing("token", params, result) + val ownerAddress = dict["owner"] as? String ?: return errorMissing("owner", params, result) + val chainId = dict["chainId"] as? String ?: return errorMissing("chainId", params, result) + + CoroutineScope(Dispatchers.IO).launch { + try { + val balanceResponse = chainAbstractionClient.erc20TokenBalance(chainId, tokenAddress, ownerAddress) + println("erc20TokenBalance response $balanceResponse") + result.success(balanceResponse) + } catch (e: Exception) { + result.error("erc20TokenBalance", "Yttrium erc20TokenBalance Error: ${e.message}", null) + } + } + } + + fun estimateFees(params: Any?, result: MethodChannel.Result) { + println("estimateFees called with $params") + + (params as? Map<*, *>)?.let { dict -> + val chainId = dict["chainId"] as? String + + if (chainId != null) { + CoroutineScope(Dispatchers.IO).launch { + try { + val feesResponse: Eip1559Estimation = chainAbstractionClient.estimateFees(chainId) + println("estimateFees response $feesResponse") + result.success(feesResponse.toMap()) + } catch (e: Exception) { + result.error("estimateFees", "Yttrium estimateFees Error: ${e.message}", null) + } + } + return + } + } + + result.error("estimateFees", "Invalid parameters $params", null) + } + + fun prepareDetailed(params: Any?, result: MethodChannel.Result) { + println("prepareDetailed called with $params") + + val dict = params as? Map<*, *> ?: return result.error("prepareDetailed", "Invalid parameters: not a map", null) + + val chainId = dict["chainId"] as? String ?: return errorMissing("chainId", params, result) + val from = dict["from"] as? String ?: return errorMissing("from", params, result) + val accounts = (dict["accounts"] as? List<*>)?.filterIsInstance() ?: return errorMissing("accounts", params, result) + val call = dict["call"] as? Map<*, *> ?: return errorMissing("call", params, result) + val to = call["to"] as? String ?: return errorMissing("call.to", params, result) + val value = call["value"] as? String ?: return errorMissing("call.value", params, result) + val input = call["input"] as? String ?: return errorMissing("call.input", params, result) + val localCurrency = dict["localCurrency"] as? String ?: return errorMissing("localCurrency", params, result) + val useLifi = dict["useLifi"] as? Boolean ?: return errorMissing("useLifi", params, result) + + CoroutineScope(Dispatchers.IO).launch { + val response = chainAbstractionClient.prepareDetailed( + chainId = chainId, + from = from, + accounts = accounts, + call = Call( + to = to, + value = value, + input = input + ), + localCurrency = Currency.valueOf(localCurrency.uppercase()), + useLifi = useLifi, + ) + + when (response) { + is PrepareDetailedResponse.Success -> { + when (val success = response.v1) { + is PrepareDetailedResponseSuccess.Available -> { + val uiFields = success.v1 + pendingPrepareDetailed[uiFields.routeResponse.orchestrationId] = uiFields + println("prepareDetailed response $uiFields") + result.success(mapOf("available" to uiFields.toMap())) + } + is PrepareDetailedResponseSuccess.NotRequired -> { + val notRequired = success.v1 + println("prepareDetailed notRequired $notRequired") + result.success(mapOf("notRequired" to notRequired.toMap())) + } + } + } + is PrepareDetailedResponse.Error -> { + println("prepareDetailed: error -> ${response.v1}") + result.success(response.v1.toMap()) + } + } + } + } + + fun execute(params: Any?, result: MethodChannel.Result) { + println("execute called with $params") + + val dict = params as? Map<*, *> ?: return result.error("execute", "Invalid parameters: not a map", null) + + val orchestrationId = dict["orchestrationId"] as? String ?: return errorMissing("orchestrationId", params, result) + val routeTxnSigs = (dict["routeTxnSigs"] as? List<*>)?.filterIsInstance() + ?: return errorMissing("routeTxnSigs", params, result) + val initialTxnSig = dict["initialTxnSig"] as? String ?: return errorMissing("initialTxnSig", params, result) + + CoroutineScope(Dispatchers.IO).launch { + try { + val prepareDetailedResult = pendingPrepareDetailed[orchestrationId] + val executionResult = prepareDetailedResult?.let { + chainAbstractionClient.execute( + uiFields = it, + routeTxnSigs = routeTxnSigs, + initialTxnSig = initialTxnSig + ) + } + + println("execute response $executionResult") + pendingPrepareDetailed.remove(orchestrationId) + result.success(executionResult?.toMap()) + } catch (e: Exception) { + println("execute error: $e") + result.error("execute", "Yttrium execute Error: ${e.message}", null) + } + } + } + + } +} diff --git a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Extensions.kt b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Extensions.kt index f4388c97..71aab5ec 100644 --- a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Extensions.kt +++ b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Extensions.kt @@ -7,9 +7,9 @@ import uniffi.yttrium.ExecuteDetails import uniffi.yttrium.FeeEstimatedTransaction import uniffi.yttrium.FundingMetadata import uniffi.yttrium.InitialTransactionMetadata -import uniffi.yttrium.Metadata import uniffi.yttrium.PrepareResponseAvailable import uniffi.yttrium.PrepareResponseError +import uniffi.yttrium.PrepareResponseMetadata import uniffi.yttrium.PrepareResponseNotRequired import uniffi.yttrium.Transaction import uniffi.yttrium.TransactionFee @@ -17,6 +17,7 @@ import uniffi.yttrium.TxnDetails import uniffi.yttrium.SolanaTxnDetails import uniffi.yttrium.UiFields import uniffi.yttrium.Route +import uniffi.yttrium.SettleNamespace import uniffi.yttrium.SolanaTransaction import uniffi.yttrium.Transactions @@ -66,7 +67,8 @@ fun Transactions.toMap(): List> = when (this) { } fun PrepareResponseAvailable.toMap(): Map { - val transactions = transactions.map { it.toMap() }.first() // Route does not have toMap() so it's done here + val transactions = + transactions.map { it.toMap() }.first() // Route does not have toMap() so it's done here return mapOf( "orchestrationId" to orchestrationId, "initialTransaction" to initialTransaction.toMap(), @@ -87,7 +89,7 @@ fun Transaction.toMap(): Map { ) } -fun Metadata.toMap(): Map { +fun PrepareResponseMetadata.toMap(): Map { return mapOf( "fundingFrom" to fundingFrom.map { it.toMap() }, "initialTransaction" to initialTransaction.toMap(), @@ -183,4 +185,36 @@ fun ExecuteDetails.toMap(): Map { "initialTxnReceipt" to initialTxnReceipt, "initialTxnHash" to initialTxnHash ) +} + +fun String.hexStringToByteArray(): ByteArray { + require(length % 2 == 0) { "Hex string must have an even length" } + return chunked(2) + .map { it.toInt(16).toByte() } + .toByteArray() +} + +fun ByteArray.byteArrayToHexString(): String = + joinToString("") { "%02x".format(it) } + +fun Map<*, *>.toSettleNamespace(): SettleNamespace { + val accounts = (this["accounts"] as? List<*>)?.filterIsInstance() ?: emptyList() + val chains = (this["chains"] as? List<*>)?.filterIsInstance() ?: emptyList() + val methods = (this["methods"] as? List<*>)?.filterIsInstance() ?: emptyList() + val events = (this["events"] as? List<*>)?.filterIsInstance() ?: emptyList() + + return SettleNamespace( + accounts = accounts, + chains = chains, + methods = methods, + events = events, + ) +} + +fun Map<*, *>.toApprovedNamespace(): Map { + return this.mapNotNull { (key, value) -> + val k = key as? String + val v = (value as? Map<*, *>)?.toSettleNamespace() + if (k != null && v != null) k to v else null + }.toMap() } \ No newline at end of file diff --git a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ReownYttriumPlugin.kt b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ReownYttriumPlugin.kt index 5d6ce471..e980a740 100644 --- a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ReownYttriumPlugin.kt +++ b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/ReownYttriumPlugin.kt @@ -1,223 +1,58 @@ package com.reown.reown_yttrium -import android.content.Context - +import android.util.Log import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel.MethodCallHandler import io.flutter.plugin.common.MethodChannel.Result -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import uniffi.uniffi_yttrium.ChainAbstractionClient -import uniffi.uniffi_yttrium.Eip1559Estimation -import uniffi.yttrium.Call -import uniffi.yttrium.Currency -import uniffi.yttrium.PrepareDetailedResponse -import uniffi.yttrium.PrepareDetailedResponseSuccess -import uniffi.yttrium.PulseMetadata -import uniffi.yttrium.UiFields - -/** ReownYttriumPlugin */ -class ReownYttriumPlugin: FlutterPlugin, MethodCallHandler { - /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private lateinit var channel : MethodChannel - private lateinit var applicationContext: Context // ✅ Store application context +import uniffi.yttrium.Logger +import uniffi.yttrium.registerLogger - private lateinit var client: ChainAbstractionClient - private var pendingPrepareDetailed: MutableMap = mutableMapOf() +class ReownYttriumPlugin : FlutterPlugin, MethodCallHandler { + private lateinit var methodChannel: MethodChannel override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - applicationContext = flutterPluginBinding.applicationContext // ✅ Get application context - channel = MethodChannel(flutterPluginBinding.binaryMessenger, "reown_yttrium") - channel.setMethodCallHandler(this) - } - - override fun onMethodCall(call: MethodCall, result: Result) { - when (call.method) { - "init" -> initialize(call.arguments, result) - "erc20TokenBalance" -> erc20TokenBalance(call.arguments, result) - "estimateFees" -> estimateFees(call.arguments, result) - "prepareDetailed" -> prepareDetailed(call.arguments, result) - "execute" -> execute(call.arguments, result) - else -> result.notImplemented() - } - } - - private fun initialize(params: Any?, result: Result) { - (params as? Map<*, *>)?.let { dict -> - val projectId = dict["projectId"] as? String - val pulseMetadataDict = dict["pulseMetadata"] as? Map<*, *> - - pulseMetadataDict?.let { metadata -> - val url = metadata["url"] as? String - val packageName = metadata["packageName"] as? String - val sdkVersion = metadata["sdkVersion"] as? String - val sdkPlatform = metadata["sdkPlatform"] as? String - - if (projectId != null && url != null && packageName != null && sdkVersion != null && sdkPlatform != null) { - val packageNAME = applicationContext.packageName ?: packageName - val pulseMetadata = PulseMetadata(url, packageNAME, sdkVersion, sdkPlatform) - - client = ChainAbstractionClient(projectId, pulseMetadata) - result.success(true) - return - } - } - } - - // If any required field is missing, return an error - result.error("initialize", "Invalid parameters", params) - } - - private fun erc20TokenBalance(params: Any?, result: Result) { - println("erc20TokenBalance called with $params") - - (params as? Map<*, *>)?.let { dict -> - val tokenAddress = dict["token"] as? String - val ownerAddress = dict["owner"] as? String - val chainId = dict["chainId"] as? String - - if (tokenAddress != null && ownerAddress != null && chainId != null) { - CoroutineScope(Dispatchers.IO).launch { - try { - val balanceResponse = client.erc20TokenBalance(chainId, tokenAddress, ownerAddress) - println("erc20TokenBalance response $balanceResponse") - result.success(balanceResponse) - - } catch (e: Exception) { - result.error("erc20TokenBalance", "Yttrium erc20TokenBalance Error: ${e.message}", null) - } - } - return - } - } + Sign.setEventChannel(flutterPluginBinding.binaryMessenger) + ChainAbstraction.setApplicationContext(flutterPluginBinding.applicationContext) - result.error("erc20TokenBalance", "Invalid parameters", params) - } - - private fun estimateFees(params: Any?, result: Result) { - println("estimateFees called with $params") - - (params as? Map<*, *>)?.let { dict -> - val chainId = dict["chainId"] as? String + methodChannel = MethodChannel(flutterPluginBinding.binaryMessenger, "reown_yttrium") + methodChannel.setMethodCallHandler(this) - if (chainId != null) { - CoroutineScope(Dispatchers.IO).launch { - try { - val feesResponse: Eip1559Estimation = client.estimateFees(chainId) - println("estimateFees response $feesResponse") - result.success(feesResponse.toMap()) - } catch (e: Exception) { - result.error("estimateFees", "Yttrium estimateFees Error: ${e.message}", null) - } - } - return - } + android.os.Handler(android.os.Looper.getMainLooper()).post { + registerLogger(RustLogger()) } - - result.error("estimateFees", "Invalid parameters $params", null) - } - - private fun prepareDetailed(params: Any?, result: Result) { - println("prepareDetailed called with $params") - - (params as? Map<*, *>)?.let { dict -> - val chainId = dict["chainId"] as? String - val from = dict["from"] as? String - val accounts = (dict["accounts"] as? List<*>)?.filterIsInstance() - val call = dict["call"] as? Map<*, *> - val to = call?.get("to") as? String - val value = call?.get("value") as? String - val input = call?.get("input") as? String - val localCurrency = dict["localCurrency"] as? String - val useLifi = dict["useLifi"] as? Boolean - - if (chainId != null && from != null && call != null && to != null && value != null && input != null && localCurrency != null) { - CoroutineScope(Dispatchers.IO).launch { - val response = client.prepareDetailed( - chainId = chainId, - from = from, - accounts = accounts!!, - call = Call( - to = to, - value = value, - input = input - ), - localCurrency = Currency.valueOf(localCurrency.uppercase()), - useLifi = useLifi!!, - ) - - when (response) { - is PrepareDetailedResponse.Success -> { - when (response.v1) { - is PrepareDetailedResponseSuccess.Available -> { - val uiFields: UiFields = (response.v1 as PrepareDetailedResponseSuccess.Available).v1 - pendingPrepareDetailed[uiFields.routeResponse.orchestrationId] = uiFields - println("prepareDetailed response $uiFields") - result.success(mapOf("available" to uiFields.toMap())) - } - is PrepareDetailedResponseSuccess.NotRequired -> { - val notRequired = (response.v1 as PrepareDetailedResponseSuccess.NotRequired).v1 - println("prepareDetailed notRequired $notRequired") - result.success(mapOf("notRequired" to notRequired.toMap())) - } - } - } - is PrepareDetailedResponse.Error -> { - println("prepareDetailed: error -> ${response.v1}") - result.success(response.v1.toMap()) - } - } - } - return - } - } - - result.error("prepareDetailed", "Invalid parameters $params", null) } - private fun execute(params: Any?, result: Result) { - println("execute called with $params") - - (params as? Map<*, *>)?.let { dict -> - val orchestrationId = dict["orchestrationId"] as? String - val routeTxnSigs = (dict["routeTxnSigs"] as? List<*>)?.filterIsInstance() - val initialTxnSig = dict["initialTxnSig"] as? String - - if (orchestrationId != null && routeTxnSigs != null && initialTxnSig != null) { - CoroutineScope(Dispatchers.IO).launch { - try { - val prepareDetailedResult = pendingPrepareDetailed[orchestrationId] - val executionResult = prepareDetailedResult?.let { - client.execute( - uiFields = it, - routeTxnSigs = routeTxnSigs, - initialTxnSig = initialTxnSig - ) - } - - println("execute response $executionResult") - pendingPrepareDetailed.remove(orchestrationId) - result.success(executionResult?.toMap()) - - } catch (e: Exception) { - println("execute response $e") - result.error("execute", "Yttrium execute Error: ${e.message}", null) - } - } - return - } + override fun onMethodCall(call: MethodCall, result: Result) { + when (call.method) { + // Chain Abstraction methods + "ca_init" -> ChainAbstraction.initialize(call.arguments, result) + "ca_erc20TokenBalance" -> ChainAbstraction.erc20TokenBalance(call.arguments, result) + "ca_estimateFees" -> ChainAbstraction.estimateFees(call.arguments, result) + "ca_prepareDetailed" -> ChainAbstraction.prepareDetailed(call.arguments, result) + "ca_execute" -> ChainAbstraction.execute(call.arguments, result) + // + // Sign methods + "sign_init" -> Sign.initialize(call.arguments, result) + "sign_generateKey" -> Sign.generateKey(result) + "sign_pair" -> Sign.pair(call.arguments, result) + "sign_approve" -> Sign.approve(call.arguments, result) + "sign_reject" -> Sign.reject(call.arguments, result) + "sign_respond" -> Sign.respond(call.arguments, result) +// "sign_respond_error" -> Sign.respondError(call.arguments, result) + // + else -> result.notImplemented() } - - result.error("execute", "Invalid parameters", params) } override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) + methodChannel.setMethodCallHandler(null) } } + +class RustLogger: Logger { + override fun log(message: String) { + Log.d("🧪 RustLogger", message) + } +} \ No newline at end of file diff --git a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Sign.kt b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Sign.kt new file mode 100644 index 00000000..262f2b9c --- /dev/null +++ b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Sign.kt @@ -0,0 +1,293 @@ +package com.reown.reown_yttrium + +import android.util.Log +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.EventChannel +import io.flutter.plugin.common.EventChannel.StreamHandler +import io.flutter.plugin.common.MethodChannel +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import uniffi.yttrium.PairingFfi +import uniffi.yttrium.SessionFfi +import uniffi.yttrium.SessionProposalFfi +import uniffi.yttrium.SessionRequestJsonRpcFfi +import uniffi.yttrium.SessionRequestJsonRpcResponseFfi +import uniffi.yttrium.SettleNamespace +import uniffi.yttrium.SignClient +import uniffi.yttrium.SignListener +import uniffi.yttrium.StorageFfi +import uniffi.yttrium.Topic +import uniffi.yttrium.metadataFromJson +import uniffi.yttrium.rejectReasonFromJson +import uniffi.yttrium.sessionFfiToJson +import uniffi.yttrium.sessionProposalFfiFromJson +import uniffi.yttrium.sessionProposalFfiToJson +import uniffi.yttrium.sessionRequestJsonRpcErrorResponseFfiFromJson +import uniffi.yttrium.sessionRequestJsonRpcFfiToJson +import uniffi.yttrium.sessionRequestJsonRpcResultResponseFfiFromJson +import kotlin.collections.get + +class Sign { + companion object { + private lateinit var signClient: SignClient + private lateinit var eventChannel: EventChannel + private var signListenerHandler = SignListenerHandler() + + // Called during plugin registration + fun setEventChannel(messenger: BinaryMessenger) { + eventChannel = EventChannel(messenger, "reown_yttrium/session_requests") + eventChannel.setStreamHandler(signListenerHandler) + } + + fun initialize(params: Any?, result: MethodChannel.Result) { + val dict = params as? Map<*, *> ?: return result.error("Yttrium.Sign.initialize", "Invalid parameters: not a map", null) + val projectId = dict["projectId"] as? String ?: return result.error("Yttrium.Sign.initialize", "Invalid projectId", null) + val key = dict["key"] as? String ?: return result.error("Yttrium.Sign.initialize", "Invalid key", null) + + CoroutineScope(Dispatchers.IO).launch { + try { + signClient = SignClient( + projectId = projectId, + key = key.hexStringToByteArray(), + sessionStore = SignStorage(), // TODO + ) + signClient.start() + signClient.registerSignListener(signListenerHandler) + Log.d("🤖 Yttrium.Sign", "initialize success") + result.success(true) + } catch (e: Exception) { + result.error("Yttrium.Sign.initialize", e.message, null) + } + } + } + + fun generateKey(result: MethodChannel.Result) { + check(::signClient.isInitialized) { "Initialize Yttrium.Sign.SignClient before using it." } + + try { + val key = signClient.generateKey() + result.success(key.byteArrayToHexString()) + } catch (e: Exception) { + result.error("Yttrium.Sign.generateKey", e.message, null) + } + } + + fun pair(params: Any?, result: MethodChannel.Result) { + check(::signClient.isInitialized) { "Initialize SignClient before using it." } + + val pairingUri = params as? String ?: return result.error("Yttrium.Sign.pair", "Invalid parameters: not a String", null) + + CoroutineScope(Dispatchers.IO).launch { + try { + val response: SessionProposalFfi = signClient.pair(pairingUri); + result.success(sessionProposalFfiToJson(response)) + } catch (e: Exception) { + result.error("Yttrium.Sign.pair", e.message, null) + } + } + } + + fun approve(params: Any?, result: MethodChannel.Result) { + check(::signClient.isInitialized) { "Initialize SignClient before using it." } + + val dict = params as? Map<*, *> ?: return result.error("Yttrium.Sign.approve", "Invalid parameters: not a map", null) + + val proposal = dict["proposal"] as? String ?: return result.error("Yttrium.Sign.approve", "Invalid parameter proposal", null) + val approvedNamespaces = dict["approvedNamespaces"] as? Map<*, *> ?: return result.error("Yttrium.Sign.approve", "Invalid parameter approvedNamespaces", null) + val selfMetadata = dict["selfMetadata"] as? String ?: return result.error("Yttrium.Sign.approve", "Invalid parameter selfMetadata", null) + + CoroutineScope(Dispatchers.IO).launch { + try { + val response: SessionFfi = signClient.approve( + proposal = sessionProposalFfiFromJson(proposal), + approvedNamespaces = approvedNamespaces.toApprovedNamespace(), + selfMetadata = metadataFromJson(selfMetadata), + ) + result.success(sessionFfiToJson(response)) + } catch (e: Exception) { + result.error("Yttrium.Sign.approve", e.message, null) + } + } + } + + fun reject(params: Any?, result: MethodChannel.Result) { + check(::signClient.isInitialized) { "Initialize SignClient before using it." } + + val dict = params as? Map<*, *> ?: return result.error("Yttrium.Sign.reject", "Invalid parameters: not a map", null) + + val proposal = dict["proposal"] as? String ?: return result.error("Yttrium.Sign.reject", "Invalid parameter proposal", null) + val reason = dict["reason"] as? String ?: return result.error("Yttrium.Sign.reject", "Invalid parameter reason", null) + + CoroutineScope(Dispatchers.IO).launch { + try { + signClient.reject( + proposal = sessionProposalFfiFromJson(proposal), + reason = rejectReasonFromJson(reason), + ); + result.success(true) + } catch (e: Exception) { + result.error("Yttrium.Sign.reject", e.message, null) + } + } + } + + fun respond(params: Any?, result: MethodChannel.Result) { + check(::signClient.isInitialized) { "Initialize SignClient before using it." } + + val dict = params as? Map<*, *> ?: return result.error("Yttrium.Sign.respond", "Invalid parameters: not a map", null) + + val topic = dict["topic"] as? String ?: return result.error("Yttrium.Sign.respond", "Invalid parameter topic", null) + val responseResult = dict["result"] as? String + val responseError = dict["error"] as? String + + CoroutineScope(Dispatchers.IO).launch { + try { + lateinit var response: SessionRequestJsonRpcResponseFfi + if (responseResult != null) { + response = SessionRequestJsonRpcResponseFfi.Result( + v1 = sessionRequestJsonRpcResultResponseFfiFromJson( + json = responseResult + ) + ); + } else { + response = SessionRequestJsonRpcResponseFfi.Error( + v1 = sessionRequestJsonRpcErrorResponseFfiFromJson( + json = responseError!! + ) + ); + } + val topic = signClient.respond( + topic = topic, + response = response, + ); + result.success(topic) + } catch (e: Exception) { + result.error("Yttrium.Sign.respond", e.message, null) + } + } + } + +// fun respondError(params: Any?, result: MethodChannel.Result) { +// check(::signClient.isInitialized) { "Initialize SignClient before using it." } +// +// val dict = params as? Map<*, *> ?: return result.error("Yttrium.Sign.respond", "Invalid parameters: not a map", null) +// +// val topic = dict["topic"] as? String ?: return result.error("Yttrium.Sign.respond", "Invalid parameter topic", null) +// val response = dict["response"] as? String ?: return result.error("Yttrium.Sign.respond", "Invalid parameter response", null) +// +// CoroutineScope(Dispatchers.IO).launch { +// try { +// val topic = signClient.respond( +// topic = topic, +// response = SessionRequestJsonRpcResponseFfi.Error( +// v1 = sessionRequestJsonRpcErrorResponseFfiFromJson( +// response +// ) +// ) +// ); +// result.success(topic) +// } catch (e: Exception) { +// result.error("Yttrium.Sign.respond", e.message, null) +// } +// } +// } + } +} + +class SignListenerHandler : SignListener, StreamHandler { + private var eventChannelSink: EventChannel.EventSink? = null + + override fun onListen(arguments: Any?, events: EventChannel.EventSink?) { + // onListen is called when receiveBroadcastStream().listen(_onEvent) is called on Flutter side + if (events != null && eventChannelSink == null) { + eventChannelSink = events + Log.d("🤖 Yttrium.Sign", "onListen: $eventChannelSink") + } + } + + override fun onCancel(arguments: Any?) { + Log.d("🤖 Yttrium.Sign", "onCancel: $eventChannelSink") + eventChannelSink = null; + } + + override fun onSessionRequest(topic: String, sessionRequest: SessionRequestJsonRpcFfi) { + Log.d("🤖 Yttrium.Sign", "onSessionRequest: $eventChannelSink") + val sessionRequestEvent = mapOf( + "topic" to topic, + "sessionRequest" to sessionRequestJsonRpcFfiToJson(sessionRequest), + ) + eventChannelSink?.success(sessionRequestEvent) + } + + override fun onSessionConnect(id: ULong, topic: String) { + Log.d("🤖 Yttrium.Sign", "onSessionConnect: $id, $topic") + } + + override fun onSessionDisconnect(id: ULong, topic: String) { + Log.d("🤖 Yttrium.Sign", "onSessionDisconnect: $id, $topic") + } + + override fun onSessionEvent(topic: String, name: String, data: String, chainId: String) { + Log.d("🤖 Yttrium.Sign", "onSessionEvent: $topic, $name, $data, $chainId") + } + + override fun onSessionExtend(id: ULong, topic: String) { + Log.d("🤖 Yttrium.Sign", "onSessionExtend: $id, $topic") + } + + override fun onSessionReject(id: ULong, topic: String) { + Log.d("🤖 Yttrium.Sign", "onSessionReject: $id, $topic") + } + + override fun onSessionRequestResponse(id: ULong, topic: String, response: SessionRequestJsonRpcResponseFfi) { + Log.d("🤖 Yttrium.Sign", "onSessionRequestResponse: $id, $topic, $response") + } + + override fun onSessionUpdate(id: ULong, topic: String, namespaces: Map) { + Log.d("🤖 Yttrium.Sign", "onSessionUpdate: $id, $topic, $namespaces") + } +} + +internal class SignStorage : StorageFfi { + override fun addSession(session: SessionFfi) { + Log.d("🤖 Yttrium.Sign", "addSession: $session") + } + + override fun deleteSession(topic: String) { + Log.d("🤖 Yttrium.Sign", "deleteSession: $topic") + } + + override fun getAllSessions(): List { + Log.d("🤖 Yttrium.Sign", "getAllSessions") + return arrayListOf() + } + + override fun getAllTopics(): List { + Log.d("🤖 Yttrium.Sign", "getAllTopics") + return arrayListOf() + } + + override fun getDecryptionKeyForTopic(topic: String): ByteArray? { + Log.d("🤖 Yttrium.Sign", "getDecryptionKeyForTopic: $topic") + return null + } + + override fun getPairing(topic: String, rpcId: ULong): PairingFfi? { + Log.d("🤖 Yttrium.Sign", "getPairing: $topic, $rpcId") + return null + } + + override fun getSession(topic: String): SessionFfi? { + Log.d("🤖 Yttrium.Sign", "getSession: $topic") + return null + } + + override fun savePairing(topic: String, rpcId: ULong, symKey: ByteArray, selfKey: ByteArray) { + Log.d("🤖 Yttrium.Sign", "savePairing: $topic, $rpcId, $symKey, $selfKey") + } + + override fun savePartialSession(topic: String, symKey: ByteArray) { + Log.d("🤖 Yttrium.Sign", "savePartialSession: $topic, $symKey") + } +} diff --git a/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Utils.kt b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Utils.kt new file mode 100644 index 00000000..ab14a024 --- /dev/null +++ b/packages/reown_yttrium/android/src/main/kotlin/com/reown/reown_yttrium/Utils.kt @@ -0,0 +1,7 @@ +package com.reown.reown_yttrium + +import io.flutter.plugin.common.MethodChannel + +fun errorMissing(key: String, originalParams: Any?, result: MethodChannel.Result): Nothing { + throw IllegalArgumentException("Missing parameter: $key") // stops execution +} \ No newline at end of file diff --git a/packages/reown_yttrium/build.yaml b/packages/reown_yttrium/build.yaml index fff70e6e..cb87cd0c 100644 --- a/packages/reown_yttrium/build.yaml +++ b/packages/reown_yttrium/build.yaml @@ -2,7 +2,7 @@ targets: $default: sources: exclude: - - "**/.symlinks/**" + - "**/.symlinks/**" builders: # build_version: # options: diff --git a/packages/reown_yttrium/ios/Classes/ChainAbstraction.swift b/packages/reown_yttrium/ios/Classes/ChainAbstraction.swift new file mode 100644 index 00000000..84e0f828 --- /dev/null +++ b/packages/reown_yttrium/ios/Classes/ChainAbstraction.swift @@ -0,0 +1,199 @@ +//import Flutter +//import UIKit +//import YttriumWrapper +// +//class ChainAbstraction { +// +// struct CustomError: Error { +// let message: String +// } +// +// private static var client: ChainAbstractionClient? +// private static var pendingPrepareDetailed: [String: UiFields] = [:] +// +// static func initialize(_ params: Any, result: @escaping FlutterResult) { +// guard let dict = params as? [String: Any], +// let projectId = dict["projectId"] as? String, +// let pulseMetadataDict = dict["pulseMetadata"] as? [String: Any], +// let url = pulseMetadataDict["url"] as? String, +// let bundleId = pulseMetadataDict["bundleId"] as? String, +// let sdkVersion = pulseMetadataDict["sdkVersion"] as? String, +// let sdkPlatform = pulseMetadataDict["sdkPlatform"] as? String else { +// result(FlutterError(code: "initialize", message: "Invalid parameters", details: params)) +// return +// } +// +// let bundleID = Bundle.main.bundleIdentifier ?? bundleId +// let pulseMetadata = PulseMetadata(url: url, +// bundleId: bundleID, +// sdkVersion: sdkVersion, +// sdkPlatform: sdkPlatform) +// +// client = ChainAbstractionClient(projectId: projectId, +// pulseMetadata: pulseMetadata) +// +// result(true) +// } +// +// static func erc20TokenBalance(_ params: Any, result: @escaping FlutterResult) { +// print("erc20TokenBalance called with ", params) +// +// guard client != nil else { +// result(FlutterError(code: "Sui", message: "ChainAbstractionClient not initialized", details: nil)) +// return +// } +// +// guard let dict = params as? [String: Any], +// let chainId = dict["chainId"] as? String, +// let token = dict["token"] as? FfiAddress, // aka String +// let owner = dict["owner"] as? FfiAddress else { +// result(FlutterError(code: "erc20TokenBalance", message: "Invalid parameters", details: params)) +// return +// } +// +// Task { +// do { +// let balanceResponse = try await client!.erc20TokenBalance(chainId: chainId, +// token: token, +// owner: owner) +// +// if let balance = balanceResponse as String? { +// print("balanceResponse", balance) +// result(balance) +// } else { +// result(FlutterError(code: "erc20TokenBalance", message: "Response error: balance is nil", details: nil)) +// } +// } catch { +// result(FlutterError(code: "erc20TokenBalance", message: error.localizedDescription, details: nil)) +// } +// } +// } +// +// static func estimateFees(_ params: Any, result: @escaping FlutterResult) { +// print("estimateFees called with ", params) +// +// guard client != nil else { +// result(FlutterError(code: "Sui", message: "ChainAbstractionClient not initialized", details: nil)) +// return +// } +// +// guard let dict = params as? [String: Any], +// let chainId = dict["chainId"] as? String else { +// result(FlutterError(code: "estimateFees", message: "Invalid parameters", details: params)) +// return +// } +// +// Task { +// do { +// let feesResponse = try await client!.estimateFees(chainId: chainId) +// +// if let fees = feesResponse as Eip1559Estimation? { +// print("feesResponse", fees) +// result(fees.toJson()) +// } else { +// result(FlutterError(code: "estimateFees", message: "Response error: fees is nil", details: nil)) +// } +// } catch { +// result(FlutterError(code: "estimateFees", message: error.localizedDescription, details: nil)) +// } +// } +// } +// +// static func prepareDetailed(_ params: Any, result: @escaping FlutterResult) { +// print("prepareDetailed called with ", params) +// +// guard client != nil else { +// result(FlutterError(code: "Sui", message: "ChainAbstractionClient not initialized", details: nil)) +// return +// } +// +// guard let dict = params as? [String: Any], +// let chainId = dict["chainId"] as? String, +// let from = dict["from"] as? String, +// let accounts = dict["accounts"] as? [String], +// let useLifi = dict["useLifi"] as? Bool, +// let call = dict["call"] as? [String: Any], +// let to = call["to"] as? String, // Address (String) +// let value = call["value"] as? String, // U256 (String) +// let input = call["input"] as? String, // Bytes (String) +// let localCurrency = dict["localCurrency"] as? String else { +// result(FlutterError(code: "prepareDetailed", message: "Invalid parameters", details: nil)) +// return +// } +// +// Task { +// do { +// let currency = Currency.fromString(value: localCurrency) +// let call = Call(to: to, value: value, input: input) +// let prepareResponse = try await client!.prepareDetailed(chainId: chainId, +// from: from, +// call: call, +// accounts: accounts, +// localCurrency: currency, +// useLifi: useLifi) +// +// switch prepareResponse { +// case .success(let successData): +// switch successData { +// case .available(let uiFields): +// pendingPrepareDetailed[uiFields.routeResponse.orchestrationId] = uiFields +// result(["available": uiFields.toJson()]) +// case .notRequired(let prepareResponseNotRequired): +// result(["notRequired": prepareResponseNotRequired.toJson()]) +// } +// case .error(let errorData): +// result(errorData.toJson()) +// } +// } catch { +// result(FlutterError(code: "prepareDetailed", message: error.localizedDescription, details: nil)) +// } +// } +// } +// +// static func execute(_ params: Any, result: @escaping FlutterResult) { +// print("execute called with ", params) +// +// guard client != nil else { +// result(FlutterError(code: "Sui", message: "ChainAbstractionClient not initialized", details: nil)) +// return +// } +// +// guard let dict = params as? [String: Any], +// let orchestrationId = dict["orchestrationId"] as? String, +// let rawSigs = dict["routeTxnSigs"] as? [Any], +// let initialTxnSig = dict["initialTxnSig"] as? String else { +// result(FlutterError(code: "execute", message: "Invalid parameters", details: params)) +// return +// } +// +// Task { +// do { +// guard let uiFields = pendingPrepareDetailed[orchestrationId] else { +// throw CustomError(message: "prepareDetailed result not found, try again") +// } +// +// // Try converting to [RouteSig] +// let routeTxnSigs: [RouteSig] = rawSigs.compactMap { $0 as? RouteSig } +// if routeTxnSigs.count != rawSigs.count { +// result(FlutterError(code: "execute", message: "Invalid item(s) in routeTxnSigs", details: params)) +// return +// } +// +// +// +// let executeResponse = try await client!.execute(uiFields: uiFields, +// routeTxnSigs: routeTxnSigs, +// initialTxnSig: initialTxnSig) +// +// pendingPrepareDetailed.removeValue(forKey: orchestrationId) +// +// let jsonResponse = executeResponse.toJson() +// print("execute success", jsonResponse) +// result(jsonResponse) +// } catch { +// result(FlutterError(code: "execute", message: error.localizedDescription, details: nil)) +// } +// } +// } +//} +// diff --git a/packages/reown_yttrium/ios/Classes/Extensions.swift b/packages/reown_yttrium/ios/Classes/Extensions.swift index ef203c1b..f8c0091f 100644 --- a/packages/reown_yttrium/ios/Classes/Extensions.swift +++ b/packages/reown_yttrium/ios/Classes/Extensions.swift @@ -1,187 +1,258 @@ -import YttriumWrapper +// import YttriumWrapper -extension Eip1559Estimation { - func toJson() -> [String: Any] { - return [ - "maxFeePerGas": self.maxFeePerGas, - "maxPriorityFeePerGas": self.maxPriorityFeePerGas - ] - } -} - -extension UiFields { - func toJson() -> [String: Any] { - return [ - "routeResponse": routeResponse.toJson(), - "route": route.map { $0.toJson() }, - "localRouteTotal": localRouteTotal.toJson(), - "bridge": bridge.map { $0.toJson() }, - "localBridgeTotal": localBridgeTotal.toJson(), - "initial": initial.toJson(), - "localTotal": localTotal.toJson() - ] - } -} - -extension PrepareResponseAvailable { - func toJson() -> [String: Any] { - return [ - "orchestrationId": orchestrationId, - "initialTransaction": initialTransaction.toJson(), - "transactions": transactions.map { $0.toJson() }, - "metadata": metadata.toJson() - ] - } -} - -extension Transaction { - func toJson() -> [String: Any] { - return [ - "chainId": chainId, - "from": from, - "to": to, - "value": value, - "input": input, - "gasLimit": gasLimit, - "nonce": nonce - ] - } -} +//extension Eip1559Estimation { +// func toJson() -> [String: Any] { +// return [ +// "maxFeePerGas": self.maxFeePerGas, +// "maxPriorityFeePerGas": self.maxPriorityFeePerGas +// ] +// } +//} +// +//extension SolanaTransaction { +// func toJson() -> [String: Any] { +// return [ +// "chainId": chainId, +// "from": from, +// "transaction": transaction +// ] +// } +//} +// +//extension SolanaTxnDetails { +// func toJson() -> [String: Any] { +// return [ +// "transaction": transaction.toJson(), +// "transactionHashToSign": transactionHashToSign +// ] +// } +//} +// +//extension Route { +// func toJson() -> [[String: Any]] { +// switch self { +// case .eip155(let txns): +// return (txns as [TxnDetails]).map { $0.toJson() } // list of TxnDetails +// case .solana(let txns): +// return (txns as [SolanaTxnDetails]).map { $0.toJson() } // list of SolanaTxnDetails +// } +// } +//} +// +//extension UiFields { +// func toJson() -> [String: Any] { +// let route = route.map { $0.toJson() }.first +// return [ +// "routeResponse": routeResponse.toJson(), +// "route": route ?? [], +// "localRouteTotal": localRouteTotal.toJson(), +// "bridge": bridge.map { $0.toJson() }, +// "localBridgeTotal": localBridgeTotal.toJson(), +// "initial": initial.toJson(), +// "localTotal": localTotal.toJson() +// ] +// } +//} +// +//extension Transactions { +// func toJson() -> [[String: Any]] { +// switch self { +// case .eip155(let txns): +// return (txns as [Transaction]).map { $0.toJson() } // list of Transaction +// case .solana(let txns): +// return (txns as [SolanaTransaction]).map { $0.toJson() } // list of SolanaTransaction +// } +// } +//} +// +//extension PrepareResponseAvailable { +// func toJson() -> [String: Any] { +// let transactions = transactions.map { $0.toJson() }.first // list of `Transactions` +// return [ +// "orchestrationId": orchestrationId, +// "initialTransaction": initialTransaction.toJson(), +// "transactions": transactions ?? [], +// "metadata": metadata.toJson() +// ] +// } +//} +// +//extension Transaction { +// func toJson() -> [String: Any] { +// return [ +// "chainId": chainId, +// "from": from, +// "to": to, +// "value": value, +// "input": input, +// "gasLimit": gasLimit, +// "nonce": nonce +// ] +// } +//} +// +//extension Metadata { +// func toJson() -> [String: Any] { +// return [ +// "fundingFrom": fundingFrom.map { $0.toJson() }, +// "initialTransaction": initialTransaction.toJson(), +// "checkIn": String(checkIn) +// ] +// } +//} +// +//extension FundingMetadata { +// func toJson() -> [String: Any] { +// return [ +// "chainId": chainId, +// "tokenContract": tokenContract, +// "symbol": symbol, +// "amount": amount, +// "bridgingFee": bridgingFee, +// "decimals": decimals +// ] +// } +//} +// +//extension InitialTransactionMetadata { +// func toJson() -> [String: Any] { +// return [ +// "transferTo": transferTo, +// "amount": amount, +// "tokenContract": tokenContract, +// "symbol": symbol, +// "decimals": decimals +// ] +// } +//} +// +//extension TxnDetails { +// func toJson() -> [String: Any] { +// return [ +// "transaction": transaction.toJson(), +// "transactionHashToSign": transactionHashToSign, +// "fee": fee.toJson() +// ] +// } +//} +// +//extension FeeEstimatedTransaction { +// func toJson() -> [String: Any] { +// return [ +// "chainId": chainId, +// "from": from, +// "to": to, +// "value": value, +// "input": input, +// "gasLimit": gasLimit, +// "nonce": nonce, +// "maxFeePerGas": maxFeePerGas, +// "maxPriorityFeePerGas": maxPriorityFeePerGas +// ] +// } +//} +// +//extension TransactionFee { +// func toJson() -> [String: Any] { +// return [ +// "fee": fee.toJson(), +// "localFee": localFee.toJson() +// ] +// } +//} +// +//extension PrepareResponseNotRequired { +// func toJson() -> [String: Any] { +// return [ +// "initialTransaction": initialTransaction.toJson(), +// "transactions": transactions.map { $0.toJson() } +// ] +// } +//} +// +//extension PrepareResponseError { +// func toJson() -> [String: Any] { +// return [ +// "error": error.toJson(), // BridgingError +// "reason": reason, +// ] +// } +//} +// +//extension BridgingError { +// func toJson() -> String { +// switch self { +// case .assetNotSupported: +// return "assetNotSupported" +// case .noRoutesAvailable: +// return "noRoutesAvailable" +// case .insufficientFunds: +// return "insufficientFunds" +// case .insufficientGasFunds: +// return "insufficientGasFunds" +// default: +// return "unknown" +// } +// } +//} +// +//extension Amount { +// func toJson() -> [String: Any] { +// return [ +// "symbol": symbol, +// "amount": amount, +// "unit": unit, +// "formatted": formatted, +// "formattedAlt": formattedAlt +// ] +// } +//} +// +//extension ExecuteDetails { +// func toJson() -> [String: Any] { +// return [ +// "initialTxnReceipt": initialTxnReceipt, +// "initialTxnHash": initialTxnHash +// ] +// } +//} +// +//extension Currency { +// static func fromString(value: String) -> Currency { +// switch value.lowercased() { +// case "usd": return .usd +// case "eur": return .eur +// case "gbp": return .gbp +// case "aud": return .aud +// case "cad": return .cad +// case "inr": return .inr +// case "jpy": return .jpy +// case "btc": return .btc +// case "eth": return .eth +// default: return .usd +// } +// } +//} -extension Metadata { - func toJson() -> [String: Any] { - return [ - "fundingFrom": fundingFrom.map { $0.toJson() }, - "initialTransaction": initialTransaction.toJson(), - "checkIn": String(checkIn) - ] - } -} - -extension FundingMetadata { - func toJson() -> [String: Any] { - return [ - "chainId": chainId, - "tokenContract": tokenContract, - "symbol": symbol, - "amount": amount, - "bridgingFee": bridgingFee, - "decimals": decimals - ] - } -} - -extension InitialTransactionMetadata { - func toJson() -> [String: Any] { - return [ - "transferTo": transferTo, - "amount": amount, - "tokenContract": tokenContract, - "symbol": symbol, - "decimals": decimals - ] - } -} - -extension TxnDetails { - func toJson() -> [String: Any] { - return [ - "transaction": transaction.toJson(), - "transactionHashToSign": transactionHashToSign, - "fee": fee.toJson() - ] - } -} - -extension FeeEstimatedTransaction { - func toJson() -> [String: Any] { - return [ - "chainId": chainId, - "from": from, - "to": to, - "value": value, - "input": input, - "gasLimit": gasLimit, - "nonce": nonce, - "maxFeePerGas": maxFeePerGas, - "maxPriorityFeePerGas": maxPriorityFeePerGas - ] - } -} - -extension TransactionFee { - func toJson() -> [String: Any] { - return [ - "fee": fee.toJson(), - "localFee": localFee.toJson() - ] - } -} - -extension PrepareResponseNotRequired { - func toJson() -> [String: Any] { - return [ - "initialTransaction": initialTransaction.toJson(), - "transactions": transactions.map { $0.toJson() } - ] - } -} - -extension PrepareResponseError { - func toJson() -> [String: Any] { - return [ - "error": error.toJson() - ] - } -} - -extension BridgingError { - func toJson() -> [String: Any] { - switch self { - case .noRoutesAvailable: - return ["error": "noRoutesAvailable"] - case .insufficientFunds: - return ["error": "insufficientFunds"] - case .insufficientGasFunds: - return ["error": "insufficientGasFunds"] +extension String { + func hexStringToData() -> Data? { + guard count % 2 == 0 else { return nil } + var data = Data() + data.reserveCapacity(count / 2) + + stride(from: 0, to: count, by: 2).forEach { i in + let start = index(startIndex, offsetBy: i) + let end = index(start, offsetBy: 2) + if let byte = UInt8(self[start.. [String: Any] { - return [ - "symbol": symbol, - "amount": amount, - "unit": unit, - "formatted": formatted, - "formattedAlt": formattedAlt - ] - } -} - -extension ExecuteDetails { - func toJson() -> [String: Any] { - return [ - "initialTxnReceipt": initialTxnReceipt, - "initialTxnHash": initialTxnHash - ] +extension Data { + func dataToHexString() -> String { + map { String(format: "%02x", $0) }.joined() } } - -extension Currency { - static func fromString(value: String) -> Currency { - switch value.lowercased() { - case "usd": return .usd - case "eur": return .eur - case "gbp": return .gbp - case "aud": return .aud - case "cad": return .cad - case "inr": return .inr - case "jpy": return .jpy - case "btc": return .btc - case "eth": return .eth - default: return .usd - } - } -} \ No newline at end of file diff --git a/packages/reown_yttrium/ios/Classes/ReownYttriumPlugin.swift b/packages/reown_yttrium/ios/Classes/ReownYttriumPlugin.swift index 7671f507..9ae158f3 100644 --- a/packages/reown_yttrium/ios/Classes/ReownYttriumPlugin.swift +++ b/packages/reown_yttrium/ios/Classes/ReownYttriumPlugin.swift @@ -1,14 +1,7 @@ import Flutter import UIKit -import YttriumWrapper public class ReownYttriumPlugin: NSObject, FlutterPlugin { - struct CustomError: Error { - let message: String - } - - private var client: ChainAbstractionClient? - private var pendingPrepareDetailed: [String: UiFields] = [:] public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "reown_yttrium", binaryMessenger: registrar.messenger()) @@ -18,166 +11,30 @@ public class ReownYttriumPlugin: NSObject, FlutterPlugin { public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { switch call.method { - case "init": - initialize(call.arguments ?? {}, result: result) - case "erc20TokenBalance": - erc20TokenBalance(call.arguments ?? {}, result: result) - case "estimateFees": - estimateFees(call.arguments ?? {}, result: result) - case "prepareDetailed": - prepareDetailed(call.arguments ?? {}, result: result) - case "execute": - execute(call.arguments ?? {}, result: result) + // ChainAbstraction methods +// case "ca_init": +// ChainAbstraction.initialize(call.arguments ?? {}, result: result) +// case "ca_erc20TokenBalance": +// ChainAbstraction.erc20TokenBalance(call.arguments ?? {}, result: result) +// case "ca_estimateFees": +// ChainAbstraction.estimateFees(call.arguments ?? {}, result: result) +// case "ca_prepareDetailed": +// ChainAbstraction.prepareDetailed(call.arguments ?? {}, result: result) +// case "ca_execute": +// ChainAbstraction.execute(call.arguments ?? {}, result: result) + case "sign_init": + Sign.initialize(call.arguments ?? {}, result: result) + case "sign_setKey": + Sign.setKey(call.arguments ?? {}, result: result) + case "sign_generateKey": + Sign.generateKey(result: result) + case "sign_pair": + Sign.pair(call.arguments ?? {}, result: result) + case "sign_approve": + Sign.approve(call.arguments ?? {}, result: result) default: result(FlutterMethodNotImplemented) } } - - func initialize(_ params: Any, result: @escaping FlutterResult) { - guard let dict = params as? [String: Any], - let projectId = dict["projectId"] as? String, - let pulseMetadataDict = dict["pulseMetadata"] as? [String: Any], - let url = pulseMetadataDict["url"] as? String, - let bundleId = pulseMetadataDict["bundleId"] as? String, - let sdkVersion = pulseMetadataDict["sdkVersion"] as? String, - let sdkPlatform = pulseMetadataDict["sdkPlatform"] as? String else { - result(FlutterError(code: "initialize", message: "Invalid parameters", details: params)) - return - } - - let bundleID = Bundle.main.bundleIdentifier ?? bundleId - let pulseMetadata = PulseMetadata(url: url, bundleId: bundleID, sdkVersion: sdkVersion, sdkPlatform: sdkPlatform) - - client = ChainAbstractionClient(projectId: projectId, pulseMetadata: pulseMetadata) - - result(true) - } - - func erc20TokenBalance(_ params: Any, result: @escaping FlutterResult) { - print("erc20TokenBalance called with ", params) - - guard let dict = params as? [String: Any], - let chainId = dict["chainId"] as? String, - let token = dict["token"] as? FfiAddress, // aka String - let owner = dict["owner"] as? FfiAddress, - let client = client else { - result(FlutterError(code: "erc20TokenBalance", message: "Invalid parameters", details: params)) - return - } - - Task { - do { - let balanceResponse = try await client.erc20TokenBalance(chainId: chainId, token: token, owner: owner) - - if let balance = balanceResponse as String? { - print("balanceResponse", balance) - result(balance) - } else { - result(FlutterError(code: "erc20TokenBalance", message: "Response error: balance is nil", details: nil)) - } - } catch { - result(FlutterError(code: "erc20TokenBalance", message: error.localizedDescription, details: nil)) - } - } - } - - func estimateFees(_ params: Any, result: @escaping FlutterResult) { - print("estimateFees called with ", params) - - guard let dict = params as? [String: Any], - let chainId = dict["chainId"] as? String, - let client = client else { - result(FlutterError(code: "estimateFees", message: "Invalid parameters", details: params)) - return - } - - Task { - do { - let feesResponse = try await client.estimateFees(chainId: chainId) - - if let fees = feesResponse as Eip1559Estimation? { - print("feesResponse", fees) - result(fees.toJson()) - } else { - result(FlutterError(code: "estimateFees", message: "Response error: fees is nil", details: nil)) - } - } catch { - result(FlutterError(code: "estimateFees", message: error.localizedDescription, details: nil)) - } - } - } - - func prepareDetailed(_ params: Any, result: @escaping FlutterResult) { - print("prepareDetailed called with ", params) - - guard let dict = params as? [String: Any], - let chainId = dict["chainId"] as? String, - let from = dict["from"] as? String, - let call = dict["call"] as? [String: Any], - let to = call["to"] as? String, // Address (String) - let value = call["value"] as? String, // U256 (String) - let input = call["input"] as? String, // Bytes (String) - let localCurrency = dict["localCurrency"] as? String, - let client = client else { - result(FlutterError(code: "prepareDetailed", message: "Invalid parameters", details: nil)) - return - } - - Task { - do { - let currency = Currency.fromString(value: localCurrency) - let call = Call(to: to, value: value, input: input) - let prepareResponse = try await client.prepareDetailed(chainId: chainId, from: from, call: call, localCurrency: currency) - - switch prepareResponse { - case .success(let successData): - switch successData { - case .available(let uiFields): - pendingPrepareDetailed[uiFields.routeResponse.orchestrationId] = uiFields - result(["available": uiFields.toJson()]) - case .notRequired(let prepareResponseNotRequired): - result(["notRequired": prepareResponseNotRequired.toJson()]) - } - case .error(let errorData): - result(errorData.toJson()) - } - } catch { - result(FlutterError(code: "prepareDetailed", message: error.localizedDescription, details: nil)) - } - } - } - - func execute(_ params: Any, result: @escaping FlutterResult) { - print("execute called with ", params) - - guard let dict = params as? [String: Any], - let orchestrationId = dict["orchestrationId"] as? String, - let routeTxnSigs = dict["routeTxnSigs"] as? [String], - let initialTxnSig = dict["initialTxnSig"] as? String, - let client = client else { - result(FlutterError(code: "execute", message: "Invalid parameters", details: params)) - return - } - - Task { - do { - guard let uiFields = pendingPrepareDetailed[orchestrationId] else { - throw CustomError(message: "prepareDetailed result not found, try again") - } - - let executeResponse = try await client.execute(uiFields: uiFields, - routeTxnSigs: routeTxnSigs, - initialTxnSig: initialTxnSig) - - pendingPrepareDetailed.removeValue(forKey: orchestrationId) - - let jsonResponse = executeResponse.toJson() - print("execute success", jsonResponse) - result(jsonResponse) - } catch { - result(FlutterError(code: "execute", message: error.localizedDescription, details: nil)) - } - } - } - } + diff --git a/packages/reown_yttrium/ios/Classes/Sign.swift b/packages/reown_yttrium/ios/Classes/Sign.swift new file mode 100644 index 00000000..d54532b2 --- /dev/null +++ b/packages/reown_yttrium/ios/Classes/Sign.swift @@ -0,0 +1,100 @@ +import Flutter +import UIKit +import YttriumWrapper + +class Sign { + + private static var client: SignClient? + + static func initialize(_ params: Any, result: @escaping FlutterResult) { + guard let dict = params as? [String: Any], + let projectId = dict["projectId"] as? String else { + result(FlutterError(code: "initialize", message: "Invalid parameters", details: params)) + return + } + + client = SignClient(projectId: projectId) + + result(true) + } + + static func setKey(_ params: Any, result: @escaping FlutterResult) { + guard client != nil else { + result(FlutterError(code: "Sign.setKey", message: "SignClient not initialized", details: nil)) + return + } + + guard let key = params as? String, + let keyData = key.hexStringToData() as Data? else { + result(FlutterError(code: "Sign.setKey", message: "Invalid parameters", details: params)) + return + } + + Task { + await client!.setKey(key: keyData) + result(true) + } + } + + static func generateKey(result: @escaping FlutterResult) { + guard client != nil else { + result(FlutterError(code: "Sign.generateKey", message: "SignClient not initialized", details: nil)) + return + } + + Task { + let keyData = client!.generateKey() + result(keyData.dataToHexString()) + } + } + + static func pair(_ params: Any, result: @escaping FlutterResult) { + guard client != nil else { + result(FlutterError(code: "Sign.pair", message: "SignClient not initialized", details: nil)) + return + } + + guard let pairingUri = params as? String else { + result(FlutterError(code: "Sign.pair", message: "Invalid parameters", details: params)) + return + } + + Task { + do { + let pairResponse = try await client!.pairJson(uri: pairingUri) + result(pairResponse) + } catch { + result(FlutterError(code: "Sign.pair", + message: error.localizedDescription, + details: nil)) + } + } + } + + static func approve(_ params: Any, result: @escaping FlutterResult) { + guard client != nil else { + result(FlutterError(code: "Sign.approve", message: "SignClient not initialized", details: nil)) + return + } + + guard let dict = params as? [String: Any], + let proposal = dict["proposal"] as? String, + let approvedNamespaces = dict["approvedNamespaces"] as? String, + let selfMetadata = dict["selfMetadata"] as? String else { + result(FlutterError(code: "Sign.approve", message: "Invalid parameters", details: params)) + return + } + + Task { + do { + let approveResponse = try await client!.approveJson(proposal: proposal, + approvedNamespaces: approvedNamespaces, + selfMetadata: selfMetadata) + result(approveResponse) + } catch { + result(FlutterError(code: "Sign.approve", message: error.localizedDescription, details: nil)) + } + } + } +} + diff --git a/packages/reown_yttrium/ios/reown_yttrium.podspec b/packages/reown_yttrium/ios/reown_yttrium.podspec index 087d98db..6b1181b1 100644 --- a/packages/reown_yttrium/ios/reown_yttrium.podspec +++ b/packages/reown_yttrium/ios/reown_yttrium.podspec @@ -15,7 +15,7 @@ A new Flutter plugin project. s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'YttriumWrapper' , '0.8.35' + s.dependency 'YttriumWrapper' , '0.9.57' s.platform = :ios, '13.0' # Flutter.framework does not contain a i386 slice. diff --git a/packages/reown_yttrium/lib/channels/events_channel/rust_sign_client_event_channel.dart b/packages/reown_yttrium/lib/channels/events_channel/rust_sign_client_event_channel.dart new file mode 100644 index 00000000..1e8b09ae --- /dev/null +++ b/packages/reown_yttrium/lib/channels/events_channel/rust_sign_client_event_channel.dart @@ -0,0 +1,25 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:reown_yttrium/clients/models/rust_sign_client.dart'; +import 'package:reown_yttrium/utils/channel_utils.dart'; + +class EventChannelSign { + final _eventChannel = const EventChannel('reown_yttrium/session_requests'); + + late final Function(SessionRequestNativeEvent data) onEvent; + + void init() { + debugPrint('☢️ [$runtimeType] init'); + _eventChannel.receiveBroadcastStream().listen(_onEvent); + } + + void _onEvent(dynamic event) { + try { + debugPrint('☢️ [$runtimeType] _onEvent $event'); + final result = ChannelUtils.handlePlatformResult(event); + onEvent.call(SessionRequestNativeEvent.fromJson(result)); + } catch (e, s) { + debugPrint('☢️ [$runtimeType] _onEvent error: $e, $s'); + } + } +} diff --git a/packages/reown_yttrium/lib/channels/methods_channel/chain_abstraction_methods_channel.dart b/packages/reown_yttrium/lib/channels/methods_channel/chain_abstraction_methods_channel.dart new file mode 100644 index 00000000..035a50cc --- /dev/null +++ b/packages/reown_yttrium/lib/channels/methods_channel/chain_abstraction_methods_channel.dart @@ -0,0 +1,180 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:reown_yttrium/clients/models/shared.dart'; // TODO shouldn't use models +import 'package:reown_yttrium/clients/models/chain_abstraction.dart'; // TODO shouldn't use models +import 'package:reown_yttrium/utils/channel_utils.dart'; + +class MethodChannelChainAbstraction { + /// The method channel used to interact with the native platform. + @visibleForTesting + final methodChannel = const MethodChannel('reown_yttrium'); + + Future init({ + required String projectId, + required PulseMetadataCompat pulseMetadata, + }) async { + try { + final result = await methodChannel.invokeMethod('ca_init', { + 'projectId': projectId, + 'pulseMetadata': pulseMetadata.toJson(), + }); + return result ?? false; + } on PlatformException catch (e) { + debugPrint('[$runtimeType] init $e'); + rethrow; + } + } + + Future erc20TokenBalance({ + required String chainId, + required String token, + required String owner, + }) async { + try { + return await methodChannel.invokeMethod('ca_erc20TokenBalance', { + 'chainId': chainId, + 'token': token, + 'owner': owner, + }); + } on PlatformException catch (e) { + debugPrint('[$runtimeType] erc20TokenBalance $e'); + rethrow; + } + } + + Future estimateFees({ + required String chainId, + }) async { + try { + final response = await methodChannel.invokeMethod( + 'ca_estimateFees', + { + 'chainId': chainId, + }, + ); + return Eip1559EstimationCompat.fromJson({ + 'maxPriorityFeePerGas': response['maxPriorityFeePerGas'], + 'maxFeePerGas': response['maxFeePerGas'], + }); + } on PlatformException catch (e) { + debugPrint('[$runtimeType] estimateFees $e'); + rethrow; + } + } + + Future prepareDetailed({ + required String chainId, + required String from, + required List accounts, + required CallCompat call, + required Currency localCurrency, + required bool useLifi, + }) async { + try { + final parameters = { + 'chainId': chainId, + 'from': from, + 'accounts': accounts, + 'call': call.toJson(), + 'localCurrency': localCurrency.name, + 'useLifi': useLifi, + }; + debugPrint( + '[$runtimeType] prepareDetailed, parameters: ${jsonEncode(parameters)}', + ); + final response = await methodChannel.invokeMethod( + 'ca_prepareDetailed', + parameters, + ); + + debugPrint( + '[$runtimeType] prepareDetailed, response: ${jsonEncode(response)}', + ); + if (response.containsKey('available')) { + final responseData = + ChannelUtils.handlePlatformResult(response['available']); + return PrepareDetailedResponseCompat.success( + value: PrepareDetailedResponseSuccessCompat.available( + value: UiFieldsCompat.fromJson( + responseData!, + ), + ), + ); + } + if (response.containsKey('notRequired')) { + final responseData = + ChannelUtils.handlePlatformResult(response['notRequired']); + return PrepareDetailedResponseCompat.success( + value: PrepareDetailedResponseSuccessCompat.notRequired( + value: PrepareResponseNotRequiredCompat.fromJson( + responseData!, + ), + ), + ); + } + if ((response ?? {}).containsKey('error')) { + final error = response!['error']; + final reason = response?['reason']; + return PrepareDetailedResponseCompat.error( + value: PrepareDetailedResponseError( + error: BridgingError.fromString(error), + reason: reason ?? 'no reason', + ), + ); + } + throw PlatformException( + code: 'prepareDetailed', + message: 'unable to parse response', + ); + } on PlatformException catch (e, s) { + debugPrint('[$runtimeType] prepareDetailed, PlatformException: $e'); + debugPrint(s.toString()); + rethrow; + } catch (e, s) { + debugPrint('[$runtimeType] prepareDetailed, Exception: $e'); + debugPrint(s.toString()); + rethrow; + } + } + + /// --------------------------------- + /// ⚠️ This method is experimental. Use with caution. + /// --------------------------------- + Future execute({ + required UiFieldsCompat uiFields, + required List routeTxnSigs, + required PrimitiveSignatureCompat initialTxnSig, + }) async { + try { + final response = await methodChannel.invokeMethod( + 'ca_execute', + { + 'orchestrationId': uiFields.routeResponse.orchestrationId, + 'routeTxnSigs': routeTxnSigs.map((e) => e.hexValue).toList(), + 'initialTxnSig': initialTxnSig.hexValue, + }, + ); + + if (response is Map) { + return ExecuteDetailsCompat( + initialTxnReceipt: response['initialTxnReceipt'] as String, + initialTxnHash: response['initialTxnHash'] as String, + ); + } + + throw PlatformException( + code: 'execute', + message: 'unable to parse response', + ); + } on PlatformException catch (e) { + debugPrint('[$runtimeType] execute $e'); + rethrow; + } catch (e, s) { + debugPrint('[$runtimeType] prepareDetailed $e'); + debugPrint(s.toString()); + rethrow; + } + } +} diff --git a/packages/reown_yttrium/lib/channels/methods_channel/rust_sign_client_methods_channel.dart b/packages/reown_yttrium/lib/channels/methods_channel/rust_sign_client_methods_channel.dart new file mode 100644 index 00000000..22c6d27c --- /dev/null +++ b/packages/reown_yttrium/lib/channels/methods_channel/rust_sign_client_methods_channel.dart @@ -0,0 +1,113 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:reown_yttrium/utils/channel_utils.dart'; + +class MethodChannelSign { + /// The method channel used to interact with the native platform. + final _methodChannel = const MethodChannel('reown_yttrium'); + + Future init({ + required String projectId, + required String key, + }) async { + try { + final result = await _methodChannel.invokeMethod('sign_init', { + 'projectId': projectId, + 'key': key, + }); + return result!; + } on PlatformException catch (e) { + debugPrint('[$runtimeType] sign_init $e'); + rethrow; + } + } + + Future generateKey() async { + try { + final result = await _methodChannel.invokeMethod( + 'sign_generateKey', + ); + return result!; + } on PlatformException catch (e) { + debugPrint('[$runtimeType] sign_generateKey $e'); + rethrow; + } + } + + Future> pair({required String uri}) async { + try { + final result = await _methodChannel.invokeMethod( + 'sign_pair', + uri, + ); + return ChannelUtils.handlePlatformResult(jsonDecode(result!)); + } on PlatformException catch (e) { + debugPrint('[$runtimeType] sign_pair $e'); + rethrow; + } + } + + Future> approve({ + required Map proposal, + required Map> approvedNamespaces, + required Map selfMetadata, + }) async { + try { + final result = await _methodChannel.invokeMethod( + 'sign_approve', + { + 'proposal': jsonEncode(proposal), + 'approvedNamespaces': approvedNamespaces, + 'selfMetadata': jsonEncode(selfMetadata), + }, + ); + return ChannelUtils.handlePlatformResult(jsonDecode(result!)); + } on PlatformException catch (e) { + debugPrint('[$runtimeType] sign_approve $e'); + rethrow; + } + } + + Future reject({ + required Map proposal, + required Map reason, + }) async { + try { + final result = await _methodChannel.invokeMethod( + 'sign_reject', + { + 'proposal': jsonEncode(proposal), + 'reason': jsonEncode(reason), + }, + ); + return result!; + } on PlatformException catch (e) { + debugPrint('[$runtimeType] sign_reject $e'); + rethrow; + } + } + + Future respond({ + required String topic, + required Map response, + }) async { + try { + final result = await _methodChannel.invokeMethod( + 'sign_respond', + { + 'topic': topic, + // jsonRpcResponse (result) as json String + 'result': response.containsKey('result') ? response : null, + // jsonRpcResponse (error) as json String + 'error': response.containsKey('error') ? response : null, + }, + ); + return result!; + } on PlatformException catch (e) { + debugPrint('[$runtimeType] sign_respond $e'); + rethrow; + } + } +} diff --git a/packages/reown_yttrium/lib/clients/chain_abstraction_client.dart b/packages/reown_yttrium/lib/clients/chain_abstraction_client.dart new file mode 100644 index 00000000..8d4605b6 --- /dev/null +++ b/packages/reown_yttrium/lib/clients/chain_abstraction_client.dart @@ -0,0 +1,76 @@ +import 'package:reown_yttrium/clients/i_chain_abstraction_client.dart'; +import 'package:reown_yttrium/clients/models/chain_abstraction.dart'; +import 'package:reown_yttrium/clients/models/shared.dart'; +import 'package:reown_yttrium/reown_yttrium_platform_interface.dart'; + +class ChainAbstractionClient implements IChainAbstractionClient { + @override + Future init({ + required String projectId, + required PulseMetadataCompat pulseMetadata, + }) async { + return await ReownYttriumPlatformInterface.instance.chainAbstractionChannel + .init( + projectId: projectId, + pulseMetadata: pulseMetadata, + ); + } + + @override + Future erc20TokenBalance({ + required String chainId, + required String token, + required String owner, + }) async { + return await ReownYttriumPlatformInterface.instance.chainAbstractionChannel + .erc20TokenBalance( + chainId: chainId, + token: token, + owner: owner, + ); + } + + @override + Future estimateFees({ + required String chainId, + }) async { + return await ReownYttriumPlatformInterface.instance.chainAbstractionChannel + .estimateFees( + chainId: chainId, + ); + } + + @override + Future prepareDetailed({ + required String chainId, + required String from, + required List accounts, + required CallCompat call, + required Currency localCurrency, + required bool useLifi, + }) async { + return await ReownYttriumPlatformInterface.instance.chainAbstractionChannel + .prepareDetailed( + chainId: chainId, + from: from, + accounts: accounts, + call: call, + localCurrency: localCurrency, + useLifi: useLifi, + ); + } + + @override + Future execute({ + required UiFieldsCompat uiFields, + required List routeTxnSigs, + required PrimitiveSignatureCompat initialTxnSig, + }) async { + return await ReownYttriumPlatformInterface.instance.chainAbstractionChannel + .execute( + uiFields: uiFields, + routeTxnSigs: routeTxnSigs, + initialTxnSig: initialTxnSig, + ); + } +} diff --git a/packages/reown_yttrium/lib/clients/i_chain_abstraction_client.dart b/packages/reown_yttrium/lib/clients/i_chain_abstraction_client.dart new file mode 100644 index 00000000..f1d562ca --- /dev/null +++ b/packages/reown_yttrium/lib/clients/i_chain_abstraction_client.dart @@ -0,0 +1,34 @@ +import 'package:reown_yttrium/clients/models/chain_abstraction.dart'; +import 'package:reown_yttrium/clients/models/shared.dart'; + +abstract class IChainAbstractionClient { + Future init({ + required String projectId, + required PulseMetadataCompat pulseMetadata, + }); + + Future erc20TokenBalance({ + required String chainId, + required String token, + required String owner, + }); + + Future estimateFees({ + required String chainId, + }); + + Future prepareDetailed({ + required String chainId, + required String from, + required List accounts, + required CallCompat call, + required Currency localCurrency, + required bool useLifi, + }); + + Future execute({ + required UiFieldsCompat uiFields, + required List routeTxnSigs, + required PrimitiveSignatureCompat initialTxnSig, + }); +} diff --git a/packages/reown_yttrium/lib/clients/i_rust_sign_client.dart b/packages/reown_yttrium/lib/clients/i_rust_sign_client.dart new file mode 100644 index 00000000..7c715c31 --- /dev/null +++ b/packages/reown_yttrium/lib/clients/i_rust_sign_client.dart @@ -0,0 +1,35 @@ +import 'dart:async'; +import 'package:reown_yttrium/clients/models/rust_sign_client.dart'; + +abstract class ISignClient { + abstract Function( + String topic, + SessionRequestJsonRpcFfi request, + ) onSessionRequest; + + Future init({required String projectId, required String key}); + + Future initListener(); + + Future generateKey(); + + Future pair({ + required String uri, + }); + + Future approve({ + required SessionProposalFfi proposal, + required Map approvedNamespaces, + required MetadataFfi selfMetadata, + }); + + Future reject({ + required SessionProposalFfi proposal, + required ErrorDataFfi error, + }); + + Future respond({ + required String topic, + required SessionRequestJsonRpcResponseFfi response, + }); +} diff --git a/packages/reown_yttrium/lib/models/chain_abstraction.dart b/packages/reown_yttrium/lib/clients/models/chain_abstraction.dart similarity index 91% rename from packages/reown_yttrium/lib/models/chain_abstraction.dart rename to packages/reown_yttrium/lib/clients/models/chain_abstraction.dart index fd66369f..f74edda7 100644 --- a/packages/reown_yttrium/lib/models/chain_abstraction.dart +++ b/packages/reown_yttrium/lib/clients/models/chain_abstraction.dart @@ -12,35 +12,42 @@ enum Currency { inr, jpy, btc, - eth, - ; + eth; } enum BridgingError { noRoutesAvailable, insufficientFunds, insufficientGasFunds, + assetNotSupported, + transactionSimulationFailed, unknown; factory BridgingError.fromString(String value) { - if (value == 'noRoutesAvailable') { - return BridgingError.noRoutesAvailable; - } else if (value == 'insufficientFunds') { - return BridgingError.insufficientFunds; - } else if (value == 'insufficientGasFunds') { - return BridgingError.insufficientGasFunds; + switch (value) { + case 'noRoutesAvailable': + return BridgingError.noRoutesAvailable; + case 'insufficientFunds': + return BridgingError.insufficientFunds; + case 'insufficientGasFunds': + return BridgingError.insufficientGasFunds; + case 'assetNotSupported': + return BridgingError.assetNotSupported; + case 'transactionSimulationFailed': + return BridgingError.transactionSimulationFailed; + default: + return BridgingError.unknown; } - return BridgingError.unknown; } } /// Bridging check error response that should be returned as a normal HTTP 200 /// response -class PrepareResponseError { +class PrepareDetailedResponseError { final BridgingError error; final String reason; - const PrepareResponseError({ + const PrepareDetailedResponseError({ required this.error, required this.reason, }); @@ -51,7 +58,7 @@ class PrepareResponseError { @override bool operator ==(Object other) => identical(this, other) || - other is PrepareResponseError && + other is PrepareDetailedResponseError && runtimeType == other.runtimeType && error == other.error && reason == other.reason; @@ -186,7 +193,7 @@ sealed class PrepareDetailedResponseCompat required PrepareDetailedResponseSuccessCompat value, }) = PrepareDetailedResponseCompat_Success; const factory PrepareDetailedResponseCompat.error({ - required PrepareResponseError value, + required PrepareDetailedResponseError value, }) = PrepareDetailedResponseCompat_Error; } @@ -270,20 +277,6 @@ class PrimitiveSignatureCompat { }; } -@freezed -sealed class PulseMetadataCompat with _$PulseMetadataCompat { - const factory PulseMetadataCompat({ - String? url, - String? bundleId, - String? packageName, - required String sdkVersion, - required String sdkPlatform, - }) = _PulseMetadataCompat; - - factory PulseMetadataCompat.fromJson(Map json) => - _$PulseMetadataCompatFromJson(json); -} - @freezed sealed class TransactionCompat with _$TransactionCompat { const factory TransactionCompat({ diff --git a/packages/reown_yttrium/lib/models/chain_abstraction.freezed.dart b/packages/reown_yttrium/lib/clients/models/chain_abstraction.freezed.dart similarity index 94% rename from packages/reown_yttrium/lib/models/chain_abstraction.freezed.dart rename to packages/reown_yttrium/lib/clients/models/chain_abstraction.freezed.dart index c44ba0ea..2820e8db 100644 --- a/packages/reown_yttrium/lib/models/chain_abstraction.freezed.dart +++ b/packages/reown_yttrium/lib/clients/models/chain_abstraction.freezed.dart @@ -2533,7 +2533,7 @@ return error(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen({TResult Function( PrepareDetailedResponseSuccessCompat value)? success,TResult Function( PrepareResponseError value)? error,required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen({TResult Function( PrepareDetailedResponseSuccessCompat value)? success,TResult Function( PrepareDetailedResponseError value)? error,required TResult orElse(),}) {final _that = this; switch (_that) { case PrepareDetailedResponseCompat_Success() when success != null: return success(_that.value);case PrepareDetailedResponseCompat_Error() when error != null: @@ -2555,7 +2555,7 @@ return error(_that.value);case _: /// } /// ``` -@optionalTypeArgs TResult when({required TResult Function( PrepareDetailedResponseSuccessCompat value) success,required TResult Function( PrepareResponseError value) error,}) {final _that = this; +@optionalTypeArgs TResult when({required TResult Function( PrepareDetailedResponseSuccessCompat value) success,required TResult Function( PrepareDetailedResponseError value) error,}) {final _that = this; switch (_that) { case PrepareDetailedResponseCompat_Success(): return success(_that.value);case PrepareDetailedResponseCompat_Error(): @@ -2573,7 +2573,7 @@ return error(_that.value);} /// } /// ``` -@optionalTypeArgs TResult? whenOrNull({TResult? Function( PrepareDetailedResponseSuccessCompat value)? success,TResult? Function( PrepareResponseError value)? error,}) {final _that = this; +@optionalTypeArgs TResult? whenOrNull({TResult? Function( PrepareDetailedResponseSuccessCompat value)? success,TResult? Function( PrepareDetailedResponseError value)? error,}) {final _that = this; switch (_that) { case PrepareDetailedResponseCompat_Success() when success != null: return success(_that.value);case PrepareDetailedResponseCompat_Error() when error != null: @@ -2667,7 +2667,7 @@ class PrepareDetailedResponseCompat_Error extends PrepareDetailedResponseCompat const PrepareDetailedResponseCompat_Error({required this.value}): super._(); -@override final PrepareResponseError value; +@override final PrepareDetailedResponseError value; /// Create a copy of PrepareDetailedResponseCompat /// with the given fields replaced by the non-null parameter values. @@ -2699,7 +2699,7 @@ abstract mixin class $PrepareDetailedResponseCompat_ErrorCopyWith<$Res> implemen factory $PrepareDetailedResponseCompat_ErrorCopyWith(PrepareDetailedResponseCompat_Error value, $Res Function(PrepareDetailedResponseCompat_Error) _then) = _$PrepareDetailedResponseCompat_ErrorCopyWithImpl; @useResult $Res call({ - PrepareResponseError value + PrepareDetailedResponseError value }); @@ -2719,7 +2719,7 @@ class _$PrepareDetailedResponseCompat_ErrorCopyWithImpl<$Res> @pragma('vm:prefer-inline') $Res call({Object? value = null,}) { return _then(PrepareDetailedResponseCompat_Error( value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable -as PrepareResponseError, +as PrepareDetailedResponseError, )); } @@ -3669,275 +3669,6 @@ $TransactionCompatCopyWith<$Res> get initialTransaction { } -/// @nodoc -mixin _$PulseMetadataCompat { - - String? get url; String? get bundleId; String? get packageName; String get sdkVersion; String get sdkPlatform; -/// Create a copy of PulseMetadataCompat -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$PulseMetadataCompatCopyWith get copyWith => _$PulseMetadataCompatCopyWithImpl(this as PulseMetadataCompat, _$identity); - - /// Serializes this PulseMetadataCompat to a JSON map. - Map toJson(); - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is PulseMetadataCompat&&(identical(other.url, url) || other.url == url)&&(identical(other.bundleId, bundleId) || other.bundleId == bundleId)&&(identical(other.packageName, packageName) || other.packageName == packageName)&&(identical(other.sdkVersion, sdkVersion) || other.sdkVersion == sdkVersion)&&(identical(other.sdkPlatform, sdkPlatform) || other.sdkPlatform == sdkPlatform)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,url,bundleId,packageName,sdkVersion,sdkPlatform); - -@override -String toString() { - return 'PulseMetadataCompat(url: $url, bundleId: $bundleId, packageName: $packageName, sdkVersion: $sdkVersion, sdkPlatform: $sdkPlatform)'; -} - - -} - -/// @nodoc -abstract mixin class $PulseMetadataCompatCopyWith<$Res> { - factory $PulseMetadataCompatCopyWith(PulseMetadataCompat value, $Res Function(PulseMetadataCompat) _then) = _$PulseMetadataCompatCopyWithImpl; -@useResult -$Res call({ - String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform -}); - - - - -} -/// @nodoc -class _$PulseMetadataCompatCopyWithImpl<$Res> - implements $PulseMetadataCompatCopyWith<$Res> { - _$PulseMetadataCompatCopyWithImpl(this._self, this._then); - - final PulseMetadataCompat _self; - final $Res Function(PulseMetadataCompat) _then; - -/// Create a copy of PulseMetadataCompat -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? url = freezed,Object? bundleId = freezed,Object? packageName = freezed,Object? sdkVersion = null,Object? sdkPlatform = null,}) { - return _then(_self.copyWith( -url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable -as String?,bundleId: freezed == bundleId ? _self.bundleId : bundleId // ignore: cast_nullable_to_non_nullable -as String?,packageName: freezed == packageName ? _self.packageName : packageName // ignore: cast_nullable_to_non_nullable -as String?,sdkVersion: null == sdkVersion ? _self.sdkVersion : sdkVersion // ignore: cast_nullable_to_non_nullable -as String,sdkPlatform: null == sdkPlatform ? _self.sdkPlatform : sdkPlatform // ignore: cast_nullable_to_non_nullable -as String, - )); -} - -} - - -/// Adds pattern-matching-related methods to [PulseMetadataCompat]. -extension PulseMetadataCompatPatterns on PulseMetadataCompat { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap(TResult Function( _PulseMetadataCompat value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _PulseMetadataCompat() when $default != null: -return $default(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map(TResult Function( _PulseMetadataCompat value) $default,){ -final _that = this; -switch (_that) { -case _PulseMetadataCompat(): -return $default(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull(TResult? Function( _PulseMetadataCompat value)? $default,){ -final _that = this; -switch (_that) { -case _PulseMetadataCompat() when $default != null: -return $default(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen(TResult Function( String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _PulseMetadataCompat() when $default != null: -return $default(_that.url,_that.bundleId,_that.packageName,_that.sdkVersion,_that.sdkPlatform);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when(TResult Function( String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform) $default,) {final _that = this; -switch (_that) { -case _PulseMetadataCompat(): -return $default(_that.url,_that.bundleId,_that.packageName,_that.sdkVersion,_that.sdkPlatform);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform)? $default,) {final _that = this; -switch (_that) { -case _PulseMetadataCompat() when $default != null: -return $default(_that.url,_that.bundleId,_that.packageName,_that.sdkVersion,_that.sdkPlatform);case _: - return null; - -} -} - -} - -/// @nodoc -@JsonSerializable() - -class _PulseMetadataCompat implements PulseMetadataCompat { - const _PulseMetadataCompat({this.url, this.bundleId, this.packageName, required this.sdkVersion, required this.sdkPlatform}); - factory _PulseMetadataCompat.fromJson(Map json) => _$PulseMetadataCompatFromJson(json); - -@override final String? url; -@override final String? bundleId; -@override final String? packageName; -@override final String sdkVersion; -@override final String sdkPlatform; - -/// Create a copy of PulseMetadataCompat -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$PulseMetadataCompatCopyWith<_PulseMetadataCompat> get copyWith => __$PulseMetadataCompatCopyWithImpl<_PulseMetadataCompat>(this, _$identity); - -@override -Map toJson() { - return _$PulseMetadataCompatToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _PulseMetadataCompat&&(identical(other.url, url) || other.url == url)&&(identical(other.bundleId, bundleId) || other.bundleId == bundleId)&&(identical(other.packageName, packageName) || other.packageName == packageName)&&(identical(other.sdkVersion, sdkVersion) || other.sdkVersion == sdkVersion)&&(identical(other.sdkPlatform, sdkPlatform) || other.sdkPlatform == sdkPlatform)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,url,bundleId,packageName,sdkVersion,sdkPlatform); - -@override -String toString() { - return 'PulseMetadataCompat(url: $url, bundleId: $bundleId, packageName: $packageName, sdkVersion: $sdkVersion, sdkPlatform: $sdkPlatform)'; -} - - -} - -/// @nodoc -abstract mixin class _$PulseMetadataCompatCopyWith<$Res> implements $PulseMetadataCompatCopyWith<$Res> { - factory _$PulseMetadataCompatCopyWith(_PulseMetadataCompat value, $Res Function(_PulseMetadataCompat) _then) = __$PulseMetadataCompatCopyWithImpl; -@override @useResult -$Res call({ - String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform -}); - - - - -} -/// @nodoc -class __$PulseMetadataCompatCopyWithImpl<$Res> - implements _$PulseMetadataCompatCopyWith<$Res> { - __$PulseMetadataCompatCopyWithImpl(this._self, this._then); - - final _PulseMetadataCompat _self; - final $Res Function(_PulseMetadataCompat) _then; - -/// Create a copy of PulseMetadataCompat -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? url = freezed,Object? bundleId = freezed,Object? packageName = freezed,Object? sdkVersion = null,Object? sdkPlatform = null,}) { - return _then(_PulseMetadataCompat( -url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable -as String?,bundleId: freezed == bundleId ? _self.bundleId : bundleId // ignore: cast_nullable_to_non_nullable -as String?,packageName: freezed == packageName ? _self.packageName : packageName // ignore: cast_nullable_to_non_nullable -as String?,sdkVersion: null == sdkVersion ? _self.sdkVersion : sdkVersion // ignore: cast_nullable_to_non_nullable -as String,sdkPlatform: null == sdkPlatform ? _self.sdkPlatform : sdkPlatform // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - - /// @nodoc mixin _$TransactionCompat { diff --git a/packages/reown_yttrium/lib/models/chain_abstraction.g.dart b/packages/reown_yttrium/lib/clients/models/chain_abstraction.g.dart similarity index 95% rename from packages/reown_yttrium/lib/models/chain_abstraction.g.dart rename to packages/reown_yttrium/lib/clients/models/chain_abstraction.g.dart index 15035552..f6ceeeb3 100644 --- a/packages/reown_yttrium/lib/models/chain_abstraction.g.dart +++ b/packages/reown_yttrium/lib/clients/models/chain_abstraction.g.dart @@ -225,25 +225,6 @@ Map _$PrepareResponseNotRequiredCompatToJson( 'transactions': instance.transactions.map((e) => e.toJson()).toList(), }; -_PulseMetadataCompat _$PulseMetadataCompatFromJson(Map json) => - _PulseMetadataCompat( - url: json['url'] as String?, - bundleId: json['bundleId'] as String?, - packageName: json['packageName'] as String?, - sdkVersion: json['sdkVersion'] as String, - sdkPlatform: json['sdkPlatform'] as String, - ); - -Map _$PulseMetadataCompatToJson( - _PulseMetadataCompat instance, -) => { - 'url': instance.url, - 'bundleId': instance.bundleId, - 'packageName': instance.packageName, - 'sdkVersion': instance.sdkVersion, - 'sdkPlatform': instance.sdkPlatform, -}; - _TransactionCompat _$TransactionCompatFromJson(Map json) => _TransactionCompat( chainId: json['chainId'] as String, diff --git a/packages/reown_yttrium/lib/clients/models/rust_sign_client.dart b/packages/reown_yttrium/lib/clients/models/rust_sign_client.dart new file mode 100644 index 00000000..88d4486b --- /dev/null +++ b/packages/reown_yttrium/lib/clients/models/rust_sign_client.dart @@ -0,0 +1,193 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'rust_sign_client.g.dart'; +part 'rust_sign_client.freezed.dart'; + +@freezed +sealed class SessionProposalFfi with _$SessionProposalFfi { + const factory SessionProposalFfi({ + required String id, + required String topic, + required List pairingSymKey, + required List proposerPublicKey, + required List> relays, + required Map> requiredNamespaces, + Map>? optionalNamespaces, + required Map metadata, + Map? sessionProperties, + Map? scopedProperties, + int? expiryTimestamp, + }) = _SessionProposalFfi; + + factory SessionProposalFfi.fromJson(Map json) => + _$SessionProposalFfiFromJson(json); +} + +@freezed +sealed class SettleNamespaceFfi with _$SettleNamespaceFfi { + const factory SettleNamespaceFfi({ + required List accounts, + required List methods, + required List events, + required List chains, + }) = _SettleNamespaceFfi; + + factory SettleNamespaceFfi.fromJson(Map json) => + _$SettleNamespaceFfiFromJson(json); +} + +@freezed +sealed class MetadataFfi with _$MetadataFfi { + @JsonSerializable(includeIfNull: false) + const factory MetadataFfi({ + required String name, + required String description, + @Default('') String url, + @Default([]) List icons, + String? verifyUrl, + RedirectFfi? redirect, + }) = _MetadataFfi; + + factory MetadataFfi.fromJson(Map json) => + _$MetadataFfiFromJson(json); +} + +@freezed +sealed class RedirectFfi with _$RedirectFfi { + @JsonSerializable() + const factory RedirectFfi({ + String? native, + String? universal, + @Default(false) bool linkMode, + }) = _RedirectFfi; + + factory RedirectFfi.fromJson(Map json) => + _$RedirectFfiFromJson(json); +} + +@freezed +sealed class ApproveResultFfi with _$ApproveResultFfi { + @JsonSerializable() + const factory ApproveResultFfi({ + required List sessionSymKey, + required List selfPublicKey, + }) = _ApproveResultFfi; + + factory ApproveResultFfi.fromJson(Map json) => + _$ApproveResultFfiFromJson(json); +} + +// RUST +@freezed +sealed class SessionRequestRequestFfi with _$SessionRequestRequestFfi { + const factory SessionRequestRequestFfi({ + required String method, + required String params, // JSON string + int? expiry, + }) = _SessionRequestRequestFfi; + + factory SessionRequestRequestFfi.fromJson(Map json) => + _$SessionRequestRequestFfiFromJson(json); +} + +// RUST +// Should be paired with WcSessionRequestRequest in reow_sign +@freezed +sealed class SessionRequestFfi with _$SessionRequestFfi { + const factory SessionRequestFfi({ + required String chainId, + required SessionRequestRequestFfi request, + }) = _SessionRequestFfi; + + factory SessionRequestFfi.fromJson(Map json) => + _$SessionRequestFfiFromJson(json); +} + +// RUST +// Should be paired with JsonRpcRequest in reow_core +@freezed +sealed class SessionRequestJsonRpcFfi with _$SessionRequestJsonRpcFfi { + const factory SessionRequestJsonRpcFfi({ + required int id, + required String method, + required SessionRequestFfi params, + }) = _SessionRequestJsonRpcFfi; + + factory SessionRequestJsonRpcFfi.fromJson(Map json) => + _$SessionRequestJsonRpcFfiFromJson(json); +} + +// Comes from native through EventChannel +// should probably go in a different file as it does not pertains to rust itself +@freezed +sealed class SessionRequestNativeEvent with _$SessionRequestNativeEvent { + const factory SessionRequestNativeEvent({ + required String topic, + // JSON String. Should be transformed into SessionRequestJsonRpcFfi + required String sessionRequest, + }) = _SessionRequestNativeEvent; + + factory SessionRequestNativeEvent.fromJson(Map json) => + _$SessionRequestNativeEventFromJson(json); +} + +// @freezed +// class SessionRequestJsonRpcResultResponseFfi +// with _$SessionRequestJsonRpcResultResponseFfi { +// const factory SessionRequestJsonRpcResultResponseFfi({ +// required int id, +// @Default('2.0') String jsonrpc, +// required String result, // JSON string +// }) = _SessionRequestJsonRpcResultResponseFfi; + +// factory SessionRequestJsonRpcResultResponseFfi.fromJson( +// Map json) => +// _$SessionRequestJsonRpcResultResponseFfiFromJson(json); +// } + +// @freezed +// class SessionRequestJsonRpcErrorResponseFfi +// with _$SessionRequestJsonRpcErrorResponseFfi { +// const factory SessionRequestJsonRpcErrorResponseFfi({ +// required int id, +// @Default('2.0') String jsonrpc, +// required String error, // JSON string +// }) = _SessionRequestJsonRpcErrorResponseFfi; + +// factory SessionRequestJsonRpcErrorResponseFfi.fromJson( +// Map json) => +// _$SessionRequestJsonRpcErrorResponseFfiFromJson(json); +// } + +@freezed +sealed class SessionRequestJsonRpcResponseFfi + with _$SessionRequestJsonRpcResponseFfi { + const factory SessionRequestJsonRpcResponseFfi.result({ + required int id, + @Default('2.0') String jsonrpc, + required String result, + }) = Result; + + const factory SessionRequestJsonRpcResponseFfi.error({ + required int id, + @Default('2.0') String jsonrpc, + required String error, + }) = Error; + + factory SessionRequestJsonRpcResponseFfi.fromJson( + Map json) => + _$SessionRequestJsonRpcResponseFfiFromJson(json); +} + +@freezed +sealed class ErrorDataFfi with _$ErrorDataFfi { + const factory ErrorDataFfi({ + required int code, + required String message, + String? data, + }) = _ErrorDataFfi; + + factory ErrorDataFfi.fromJson(Map json) => + _$ErrorDataFfiFromJson(json); +} +// All of these is what we refer when we say "fixing crypto UX" but it's a common effort. diff --git a/packages/reown_yttrium/lib/clients/models/rust_sign_client.freezed.dart b/packages/reown_yttrium/lib/clients/models/rust_sign_client.freezed.dart new file mode 100644 index 00000000..d052a25e --- /dev/null +++ b/packages/reown_yttrium/lib/clients/models/rust_sign_client.freezed.dart @@ -0,0 +1,3203 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// 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 'rust_sign_client.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$SessionProposalFfi { + + String get id; String get topic; List get pairingSymKey; List get proposerPublicKey; List> get relays; Map> get requiredNamespaces; Map>? get optionalNamespaces; Map get metadata; Map? get sessionProperties; Map? get scopedProperties; int? get expiryTimestamp; +/// Create a copy of SessionProposalFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionProposalFfiCopyWith get copyWith => _$SessionProposalFfiCopyWithImpl(this as SessionProposalFfi, _$identity); + + /// Serializes this SessionProposalFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionProposalFfi&&(identical(other.id, id) || other.id == id)&&(identical(other.topic, topic) || other.topic == topic)&&const DeepCollectionEquality().equals(other.pairingSymKey, pairingSymKey)&&const DeepCollectionEquality().equals(other.proposerPublicKey, proposerPublicKey)&&const DeepCollectionEquality().equals(other.relays, relays)&&const DeepCollectionEquality().equals(other.requiredNamespaces, requiredNamespaces)&&const DeepCollectionEquality().equals(other.optionalNamespaces, optionalNamespaces)&&const DeepCollectionEquality().equals(other.metadata, metadata)&&const DeepCollectionEquality().equals(other.sessionProperties, sessionProperties)&&const DeepCollectionEquality().equals(other.scopedProperties, scopedProperties)&&(identical(other.expiryTimestamp, expiryTimestamp) || other.expiryTimestamp == expiryTimestamp)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,topic,const DeepCollectionEquality().hash(pairingSymKey),const DeepCollectionEquality().hash(proposerPublicKey),const DeepCollectionEquality().hash(relays),const DeepCollectionEquality().hash(requiredNamespaces),const DeepCollectionEquality().hash(optionalNamespaces),const DeepCollectionEquality().hash(metadata),const DeepCollectionEquality().hash(sessionProperties),const DeepCollectionEquality().hash(scopedProperties),expiryTimestamp); + +@override +String toString() { + return 'SessionProposalFfi(id: $id, topic: $topic, pairingSymKey: $pairingSymKey, proposerPublicKey: $proposerPublicKey, relays: $relays, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, metadata: $metadata, sessionProperties: $sessionProperties, scopedProperties: $scopedProperties, expiryTimestamp: $expiryTimestamp)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionProposalFfiCopyWith<$Res> { + factory $SessionProposalFfiCopyWith(SessionProposalFfi value, $Res Function(SessionProposalFfi) _then) = _$SessionProposalFfiCopyWithImpl; +@useResult +$Res call({ + String id, String topic, List pairingSymKey, List proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiryTimestamp +}); + + + + +} +/// @nodoc +class _$SessionProposalFfiCopyWithImpl<$Res> + implements $SessionProposalFfiCopyWith<$Res> { + _$SessionProposalFfiCopyWithImpl(this._self, this._then); + + final SessionProposalFfi _self; + final $Res Function(SessionProposalFfi) _then; + +/// Create a copy of SessionProposalFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? topic = null,Object? pairingSymKey = null,Object? proposerPublicKey = null,Object? relays = null,Object? requiredNamespaces = null,Object? optionalNamespaces = freezed,Object? metadata = null,Object? sessionProperties = freezed,Object? scopedProperties = freezed,Object? expiryTimestamp = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,topic: null == topic ? _self.topic : topic // ignore: cast_nullable_to_non_nullable +as String,pairingSymKey: null == pairingSymKey ? _self.pairingSymKey : pairingSymKey // ignore: cast_nullable_to_non_nullable +as List,proposerPublicKey: null == proposerPublicKey ? _self.proposerPublicKey : proposerPublicKey // ignore: cast_nullable_to_non_nullable +as List,relays: null == relays ? _self.relays : relays // ignore: cast_nullable_to_non_nullable +as List>,requiredNamespaces: null == requiredNamespaces ? _self.requiredNamespaces : requiredNamespaces // ignore: cast_nullable_to_non_nullable +as Map>,optionalNamespaces: freezed == optionalNamespaces ? _self.optionalNamespaces : optionalNamespaces // ignore: cast_nullable_to_non_nullable +as Map>?,metadata: null == metadata ? _self.metadata : metadata // ignore: cast_nullable_to_non_nullable +as Map,sessionProperties: freezed == sessionProperties ? _self.sessionProperties : sessionProperties // ignore: cast_nullable_to_non_nullable +as Map?,scopedProperties: freezed == scopedProperties ? _self.scopedProperties : scopedProperties // ignore: cast_nullable_to_non_nullable +as Map?,expiryTimestamp: freezed == expiryTimestamp ? _self.expiryTimestamp : expiryTimestamp // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SessionProposalFfi]. +extension SessionProposalFfiPatterns on SessionProposalFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SessionProposalFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SessionProposalFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SessionProposalFfi value) $default,){ +final _that = this; +switch (_that) { +case _SessionProposalFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SessionProposalFfi value)? $default,){ +final _that = this; +switch (_that) { +case _SessionProposalFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String topic, List pairingSymKey, List proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiryTimestamp)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SessionProposalFfi() when $default != null: +return $default(_that.id,_that.topic,_that.pairingSymKey,_that.proposerPublicKey,_that.relays,_that.requiredNamespaces,_that.optionalNamespaces,_that.metadata,_that.sessionProperties,_that.scopedProperties,_that.expiryTimestamp);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String id, String topic, List pairingSymKey, List proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiryTimestamp) $default,) {final _that = this; +switch (_that) { +case _SessionProposalFfi(): +return $default(_that.id,_that.topic,_that.pairingSymKey,_that.proposerPublicKey,_that.relays,_that.requiredNamespaces,_that.optionalNamespaces,_that.metadata,_that.sessionProperties,_that.scopedProperties,_that.expiryTimestamp);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String topic, List pairingSymKey, List proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiryTimestamp)? $default,) {final _that = this; +switch (_that) { +case _SessionProposalFfi() when $default != null: +return $default(_that.id,_that.topic,_that.pairingSymKey,_that.proposerPublicKey,_that.relays,_that.requiredNamespaces,_that.optionalNamespaces,_that.metadata,_that.sessionProperties,_that.scopedProperties,_that.expiryTimestamp);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SessionProposalFfi implements SessionProposalFfi { + const _SessionProposalFfi({required this.id, required this.topic, required final List pairingSymKey, required final List proposerPublicKey, required final List> relays, required final Map> requiredNamespaces, final Map>? optionalNamespaces, required final Map metadata, final Map? sessionProperties, final Map? scopedProperties, this.expiryTimestamp}): _pairingSymKey = pairingSymKey,_proposerPublicKey = proposerPublicKey,_relays = relays,_requiredNamespaces = requiredNamespaces,_optionalNamespaces = optionalNamespaces,_metadata = metadata,_sessionProperties = sessionProperties,_scopedProperties = scopedProperties; + factory _SessionProposalFfi.fromJson(Map json) => _$SessionProposalFfiFromJson(json); + +@override final String id; +@override final String topic; + final List _pairingSymKey; +@override List get pairingSymKey { + if (_pairingSymKey is EqualUnmodifiableListView) return _pairingSymKey; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_pairingSymKey); +} + + final List _proposerPublicKey; +@override List get proposerPublicKey { + if (_proposerPublicKey is EqualUnmodifiableListView) return _proposerPublicKey; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_proposerPublicKey); +} + + 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 { + final value = _optionalNamespaces; + if (value == null) return null; + if (_optionalNamespaces is EqualUnmodifiableMapView) return _optionalNamespaces; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); +} + + final Map _metadata; +@override Map get metadata { + if (_metadata is EqualUnmodifiableMapView) return _metadata; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_metadata); +} + + 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? _scopedProperties; +@override Map? get scopedProperties { + final value = _scopedProperties; + if (value == null) return null; + if (_scopedProperties is EqualUnmodifiableMapView) return _scopedProperties; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); +} + +@override final int? expiryTimestamp; + +/// Create a copy of SessionProposalFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SessionProposalFfiCopyWith<_SessionProposalFfi> get copyWith => __$SessionProposalFfiCopyWithImpl<_SessionProposalFfi>(this, _$identity); + +@override +Map toJson() { + return _$SessionProposalFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SessionProposalFfi&&(identical(other.id, id) || other.id == id)&&(identical(other.topic, topic) || other.topic == topic)&&const DeepCollectionEquality().equals(other._pairingSymKey, _pairingSymKey)&&const DeepCollectionEquality().equals(other._proposerPublicKey, _proposerPublicKey)&&const DeepCollectionEquality().equals(other._relays, _relays)&&const DeepCollectionEquality().equals(other._requiredNamespaces, _requiredNamespaces)&&const DeepCollectionEquality().equals(other._optionalNamespaces, _optionalNamespaces)&&const DeepCollectionEquality().equals(other._metadata, _metadata)&&const DeepCollectionEquality().equals(other._sessionProperties, _sessionProperties)&&const DeepCollectionEquality().equals(other._scopedProperties, _scopedProperties)&&(identical(other.expiryTimestamp, expiryTimestamp) || other.expiryTimestamp == expiryTimestamp)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,topic,const DeepCollectionEquality().hash(_pairingSymKey),const DeepCollectionEquality().hash(_proposerPublicKey),const DeepCollectionEquality().hash(_relays),const DeepCollectionEquality().hash(_requiredNamespaces),const DeepCollectionEquality().hash(_optionalNamespaces),const DeepCollectionEquality().hash(_metadata),const DeepCollectionEquality().hash(_sessionProperties),const DeepCollectionEquality().hash(_scopedProperties),expiryTimestamp); + +@override +String toString() { + return 'SessionProposalFfi(id: $id, topic: $topic, pairingSymKey: $pairingSymKey, proposerPublicKey: $proposerPublicKey, relays: $relays, requiredNamespaces: $requiredNamespaces, optionalNamespaces: $optionalNamespaces, metadata: $metadata, sessionProperties: $sessionProperties, scopedProperties: $scopedProperties, expiryTimestamp: $expiryTimestamp)'; +} + + +} + +/// @nodoc +abstract mixin class _$SessionProposalFfiCopyWith<$Res> implements $SessionProposalFfiCopyWith<$Res> { + factory _$SessionProposalFfiCopyWith(_SessionProposalFfi value, $Res Function(_SessionProposalFfi) _then) = __$SessionProposalFfiCopyWithImpl; +@override @useResult +$Res call({ + String id, String topic, List pairingSymKey, List proposerPublicKey, List> relays, Map> requiredNamespaces, Map>? optionalNamespaces, Map metadata, Map? sessionProperties, Map? scopedProperties, int? expiryTimestamp +}); + + + + +} +/// @nodoc +class __$SessionProposalFfiCopyWithImpl<$Res> + implements _$SessionProposalFfiCopyWith<$Res> { + __$SessionProposalFfiCopyWithImpl(this._self, this._then); + + final _SessionProposalFfi _self; + final $Res Function(_SessionProposalFfi) _then; + +/// Create a copy of SessionProposalFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? topic = null,Object? pairingSymKey = null,Object? proposerPublicKey = null,Object? relays = null,Object? requiredNamespaces = null,Object? optionalNamespaces = freezed,Object? metadata = null,Object? sessionProperties = freezed,Object? scopedProperties = freezed,Object? expiryTimestamp = freezed,}) { + return _then(_SessionProposalFfi( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,topic: null == topic ? _self.topic : topic // ignore: cast_nullable_to_non_nullable +as String,pairingSymKey: null == pairingSymKey ? _self._pairingSymKey : pairingSymKey // ignore: cast_nullable_to_non_nullable +as List,proposerPublicKey: null == proposerPublicKey ? _self._proposerPublicKey : proposerPublicKey // ignore: cast_nullable_to_non_nullable +as List,relays: null == relays ? _self._relays : relays // ignore: cast_nullable_to_non_nullable +as List>,requiredNamespaces: null == requiredNamespaces ? _self._requiredNamespaces : requiredNamespaces // ignore: cast_nullable_to_non_nullable +as Map>,optionalNamespaces: freezed == optionalNamespaces ? _self._optionalNamespaces : optionalNamespaces // ignore: cast_nullable_to_non_nullable +as Map>?,metadata: null == metadata ? _self._metadata : metadata // ignore: cast_nullable_to_non_nullable +as Map,sessionProperties: freezed == sessionProperties ? _self._sessionProperties : sessionProperties // ignore: cast_nullable_to_non_nullable +as Map?,scopedProperties: freezed == scopedProperties ? _self._scopedProperties : scopedProperties // ignore: cast_nullable_to_non_nullable +as Map?,expiryTimestamp: freezed == expiryTimestamp ? _self.expiryTimestamp : expiryTimestamp // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + + +/// @nodoc +mixin _$SettleNamespaceFfi { + + List get accounts; List get methods; List get events; List get chains; +/// Create a copy of SettleNamespaceFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SettleNamespaceFfiCopyWith get copyWith => _$SettleNamespaceFfiCopyWithImpl(this as SettleNamespaceFfi, _$identity); + + /// Serializes this SettleNamespaceFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SettleNamespaceFfi&&const DeepCollectionEquality().equals(other.accounts, accounts)&&const DeepCollectionEquality().equals(other.methods, methods)&&const DeepCollectionEquality().equals(other.events, events)&&const DeepCollectionEquality().equals(other.chains, chains)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(accounts),const DeepCollectionEquality().hash(methods),const DeepCollectionEquality().hash(events),const DeepCollectionEquality().hash(chains)); + +@override +String toString() { + return 'SettleNamespaceFfi(accounts: $accounts, methods: $methods, events: $events, chains: $chains)'; +} + + +} + +/// @nodoc +abstract mixin class $SettleNamespaceFfiCopyWith<$Res> { + factory $SettleNamespaceFfiCopyWith(SettleNamespaceFfi value, $Res Function(SettleNamespaceFfi) _then) = _$SettleNamespaceFfiCopyWithImpl; +@useResult +$Res call({ + List accounts, List methods, List events, List chains +}); + + + + +} +/// @nodoc +class _$SettleNamespaceFfiCopyWithImpl<$Res> + implements $SettleNamespaceFfiCopyWith<$Res> { + _$SettleNamespaceFfiCopyWithImpl(this._self, this._then); + + final SettleNamespaceFfi _self; + final $Res Function(SettleNamespaceFfi) _then; + +/// Create a copy of SettleNamespaceFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? accounts = null,Object? methods = null,Object? events = null,Object? chains = null,}) { + return _then(_self.copyWith( +accounts: null == accounts ? _self.accounts : accounts // ignore: cast_nullable_to_non_nullable +as List,methods: null == methods ? _self.methods : methods // ignore: cast_nullable_to_non_nullable +as List,events: null == events ? _self.events : events // ignore: cast_nullable_to_non_nullable +as List,chains: null == chains ? _self.chains : chains // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SettleNamespaceFfi]. +extension SettleNamespaceFfiPatterns on SettleNamespaceFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SettleNamespaceFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SettleNamespaceFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SettleNamespaceFfi value) $default,){ +final _that = this; +switch (_that) { +case _SettleNamespaceFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SettleNamespaceFfi value)? $default,){ +final _that = this; +switch (_that) { +case _SettleNamespaceFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List accounts, List methods, List events, List chains)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SettleNamespaceFfi() when $default != null: +return $default(_that.accounts,_that.methods,_that.events,_that.chains);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List accounts, List methods, List events, List chains) $default,) {final _that = this; +switch (_that) { +case _SettleNamespaceFfi(): +return $default(_that.accounts,_that.methods,_that.events,_that.chains);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List accounts, List methods, List events, List chains)? $default,) {final _that = this; +switch (_that) { +case _SettleNamespaceFfi() when $default != null: +return $default(_that.accounts,_that.methods,_that.events,_that.chains);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SettleNamespaceFfi implements SettleNamespaceFfi { + const _SettleNamespaceFfi({required final List accounts, required final List methods, required final List events, required final List chains}): _accounts = accounts,_methods = methods,_events = events,_chains = chains; + factory _SettleNamespaceFfi.fromJson(Map json) => _$SettleNamespaceFfiFromJson(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); +} + + final List _chains; +@override List get chains { + if (_chains is EqualUnmodifiableListView) return _chains; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_chains); +} + + +/// Create a copy of SettleNamespaceFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SettleNamespaceFfiCopyWith<_SettleNamespaceFfi> get copyWith => __$SettleNamespaceFfiCopyWithImpl<_SettleNamespaceFfi>(this, _$identity); + +@override +Map toJson() { + return _$SettleNamespaceFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SettleNamespaceFfi&&const DeepCollectionEquality().equals(other._accounts, _accounts)&&const DeepCollectionEquality().equals(other._methods, _methods)&&const DeepCollectionEquality().equals(other._events, _events)&&const DeepCollectionEquality().equals(other._chains, _chains)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_accounts),const DeepCollectionEquality().hash(_methods),const DeepCollectionEquality().hash(_events),const DeepCollectionEquality().hash(_chains)); + +@override +String toString() { + return 'SettleNamespaceFfi(accounts: $accounts, methods: $methods, events: $events, chains: $chains)'; +} + + +} + +/// @nodoc +abstract mixin class _$SettleNamespaceFfiCopyWith<$Res> implements $SettleNamespaceFfiCopyWith<$Res> { + factory _$SettleNamespaceFfiCopyWith(_SettleNamespaceFfi value, $Res Function(_SettleNamespaceFfi) _then) = __$SettleNamespaceFfiCopyWithImpl; +@override @useResult +$Res call({ + List accounts, List methods, List events, List chains +}); + + + + +} +/// @nodoc +class __$SettleNamespaceFfiCopyWithImpl<$Res> + implements _$SettleNamespaceFfiCopyWith<$Res> { + __$SettleNamespaceFfiCopyWithImpl(this._self, this._then); + + final _SettleNamespaceFfi _self; + final $Res Function(_SettleNamespaceFfi) _then; + +/// Create a copy of SettleNamespaceFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? accounts = null,Object? methods = null,Object? events = null,Object? chains = null,}) { + return _then(_SettleNamespaceFfi( +accounts: null == accounts ? _self._accounts : accounts // ignore: cast_nullable_to_non_nullable +as List,methods: null == methods ? _self._methods : methods // ignore: cast_nullable_to_non_nullable +as List,events: null == events ? _self._events : events // ignore: cast_nullable_to_non_nullable +as List,chains: null == chains ? _self._chains : chains // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$MetadataFfi { + + String get name; String get description; String get url; List get icons; String? get verifyUrl; RedirectFfi? get redirect; +/// Create a copy of MetadataFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MetadataFfiCopyWith get copyWith => _$MetadataFfiCopyWithImpl(this as MetadataFfi, _$identity); + + /// Serializes this MetadataFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MetadataFfi&&(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.verifyUrl, verifyUrl) || other.verifyUrl == verifyUrl)&&(identical(other.redirect, redirect) || other.redirect == redirect)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,name,description,url,const DeepCollectionEquality().hash(icons),verifyUrl,redirect); + +@override +String toString() { + return 'MetadataFfi(name: $name, description: $description, url: $url, icons: $icons, verifyUrl: $verifyUrl, redirect: $redirect)'; +} + + +} + +/// @nodoc +abstract mixin class $MetadataFfiCopyWith<$Res> { + factory $MetadataFfiCopyWith(MetadataFfi value, $Res Function(MetadataFfi) _then) = _$MetadataFfiCopyWithImpl; +@useResult +$Res call({ + String name, String description, String url, List icons, String? verifyUrl, RedirectFfi? redirect +}); + + +$RedirectFfiCopyWith<$Res>? get redirect; + +} +/// @nodoc +class _$MetadataFfiCopyWithImpl<$Res> + implements $MetadataFfiCopyWith<$Res> { + _$MetadataFfiCopyWithImpl(this._self, this._then); + + final MetadataFfi _self; + final $Res Function(MetadataFfi) _then; + +/// Create a copy of MetadataFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? description = null,Object? url = null,Object? icons = null,Object? verifyUrl = freezed,Object? redirect = freezed,}) { + return _then(_self.copyWith( +name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable +as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable +as String,icons: null == icons ? _self.icons : icons // ignore: cast_nullable_to_non_nullable +as List,verifyUrl: freezed == verifyUrl ? _self.verifyUrl : verifyUrl // ignore: cast_nullable_to_non_nullable +as String?,redirect: freezed == redirect ? _self.redirect : redirect // ignore: cast_nullable_to_non_nullable +as RedirectFfi?, + )); +} +/// Create a copy of MetadataFfi +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RedirectFfiCopyWith<$Res>? get redirect { + if (_self.redirect == null) { + return null; + } + + return $RedirectFfiCopyWith<$Res>(_self.redirect!, (value) { + return _then(_self.copyWith(redirect: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [MetadataFfi]. +extension MetadataFfiPatterns on MetadataFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _MetadataFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MetadataFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _MetadataFfi value) $default,){ +final _that = this; +switch (_that) { +case _MetadataFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _MetadataFfi value)? $default,){ +final _that = this; +switch (_that) { +case _MetadataFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String name, String description, String url, List icons, String? verifyUrl, RedirectFfi? redirect)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MetadataFfi() when $default != null: +return $default(_that.name,_that.description,_that.url,_that.icons,_that.verifyUrl,_that.redirect);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String name, String description, String url, List icons, String? verifyUrl, RedirectFfi? redirect) $default,) {final _that = this; +switch (_that) { +case _MetadataFfi(): +return $default(_that.name,_that.description,_that.url,_that.icons,_that.verifyUrl,_that.redirect);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String name, String description, String url, List icons, String? verifyUrl, RedirectFfi? redirect)? $default,) {final _that = this; +switch (_that) { +case _MetadataFfi() when $default != null: +return $default(_that.name,_that.description,_that.url,_that.icons,_that.verifyUrl,_that.redirect);case _: + return null; + +} +} + +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false) +class _MetadataFfi implements MetadataFfi { + const _MetadataFfi({required this.name, required this.description, this.url = '', final List icons = const [], this.verifyUrl, this.redirect}): _icons = icons; + factory _MetadataFfi.fromJson(Map json) => _$MetadataFfiFromJson(json); + +@override final String name; +@override final String description; +@override@JsonKey() final String url; + final List _icons; +@override@JsonKey() List get icons { + if (_icons is EqualUnmodifiableListView) return _icons; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_icons); +} + +@override final String? verifyUrl; +@override final RedirectFfi? redirect; + +/// Create a copy of MetadataFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MetadataFfiCopyWith<_MetadataFfi> get copyWith => __$MetadataFfiCopyWithImpl<_MetadataFfi>(this, _$identity); + +@override +Map toJson() { + return _$MetadataFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MetadataFfi&&(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.verifyUrl, verifyUrl) || other.verifyUrl == verifyUrl)&&(identical(other.redirect, redirect) || other.redirect == redirect)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,name,description,url,const DeepCollectionEquality().hash(_icons),verifyUrl,redirect); + +@override +String toString() { + return 'MetadataFfi(name: $name, description: $description, url: $url, icons: $icons, verifyUrl: $verifyUrl, redirect: $redirect)'; +} + + +} + +/// @nodoc +abstract mixin class _$MetadataFfiCopyWith<$Res> implements $MetadataFfiCopyWith<$Res> { + factory _$MetadataFfiCopyWith(_MetadataFfi value, $Res Function(_MetadataFfi) _then) = __$MetadataFfiCopyWithImpl; +@override @useResult +$Res call({ + String name, String description, String url, List icons, String? verifyUrl, RedirectFfi? redirect +}); + + +@override $RedirectFfiCopyWith<$Res>? get redirect; + +} +/// @nodoc +class __$MetadataFfiCopyWithImpl<$Res> + implements _$MetadataFfiCopyWith<$Res> { + __$MetadataFfiCopyWithImpl(this._self, this._then); + + final _MetadataFfi _self; + final $Res Function(_MetadataFfi) _then; + +/// Create a copy of MetadataFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? description = null,Object? url = null,Object? icons = null,Object? verifyUrl = freezed,Object? redirect = freezed,}) { + return _then(_MetadataFfi( +name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable +as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable +as String,icons: null == icons ? _self._icons : icons // ignore: cast_nullable_to_non_nullable +as List,verifyUrl: freezed == verifyUrl ? _self.verifyUrl : verifyUrl // ignore: cast_nullable_to_non_nullable +as String?,redirect: freezed == redirect ? _self.redirect : redirect // ignore: cast_nullable_to_non_nullable +as RedirectFfi?, + )); +} + +/// Create a copy of MetadataFfi +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RedirectFfiCopyWith<$Res>? get redirect { + if (_self.redirect == null) { + return null; + } + + return $RedirectFfiCopyWith<$Res>(_self.redirect!, (value) { + return _then(_self.copyWith(redirect: value)); + }); +} +} + + +/// @nodoc +mixin _$RedirectFfi { + + String? get native; String? get universal; bool get linkMode; +/// Create a copy of RedirectFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$RedirectFfiCopyWith get copyWith => _$RedirectFfiCopyWithImpl(this as RedirectFfi, _$identity); + + /// Serializes this RedirectFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RedirectFfi&&(identical(other.native, native) || other.native == native)&&(identical(other.universal, universal) || other.universal == universal)&&(identical(other.linkMode, linkMode) || other.linkMode == linkMode)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,native,universal,linkMode); + +@override +String toString() { + return 'RedirectFfi(native: $native, universal: $universal, linkMode: $linkMode)'; +} + + +} + +/// @nodoc +abstract mixin class $RedirectFfiCopyWith<$Res> { + factory $RedirectFfiCopyWith(RedirectFfi value, $Res Function(RedirectFfi) _then) = _$RedirectFfiCopyWithImpl; +@useResult +$Res call({ + String? native, String? universal, bool linkMode +}); + + + + +} +/// @nodoc +class _$RedirectFfiCopyWithImpl<$Res> + implements $RedirectFfiCopyWith<$Res> { + _$RedirectFfiCopyWithImpl(this._self, this._then); + + final RedirectFfi _self; + final $Res Function(RedirectFfi) _then; + +/// Create a copy of RedirectFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? native = freezed,Object? universal = freezed,Object? linkMode = null,}) { + return _then(_self.copyWith( +native: freezed == native ? _self.native : native // ignore: cast_nullable_to_non_nullable +as String?,universal: freezed == universal ? _self.universal : universal // ignore: cast_nullable_to_non_nullable +as String?,linkMode: null == linkMode ? _self.linkMode : linkMode // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [RedirectFfi]. +extension RedirectFfiPatterns on RedirectFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _RedirectFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _RedirectFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _RedirectFfi value) $default,){ +final _that = this; +switch (_that) { +case _RedirectFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _RedirectFfi value)? $default,){ +final _that = this; +switch (_that) { +case _RedirectFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String? native, String? universal, bool linkMode)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _RedirectFfi() when $default != null: +return $default(_that.native,_that.universal,_that.linkMode);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String? native, String? universal, bool linkMode) $default,) {final _that = this; +switch (_that) { +case _RedirectFfi(): +return $default(_that.native,_that.universal,_that.linkMode);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? native, String? universal, bool linkMode)? $default,) {final _that = this; +switch (_that) { +case _RedirectFfi() when $default != null: +return $default(_that.native,_that.universal,_that.linkMode);case _: + return null; + +} +} + +} + +/// @nodoc + +@JsonSerializable() +class _RedirectFfi implements RedirectFfi { + const _RedirectFfi({this.native, this.universal, this.linkMode = false}); + factory _RedirectFfi.fromJson(Map json) => _$RedirectFfiFromJson(json); + +@override final String? native; +@override final String? universal; +@override@JsonKey() final bool linkMode; + +/// Create a copy of RedirectFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$RedirectFfiCopyWith<_RedirectFfi> get copyWith => __$RedirectFfiCopyWithImpl<_RedirectFfi>(this, _$identity); + +@override +Map toJson() { + return _$RedirectFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _RedirectFfi&&(identical(other.native, native) || other.native == native)&&(identical(other.universal, universal) || other.universal == universal)&&(identical(other.linkMode, linkMode) || other.linkMode == linkMode)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,native,universal,linkMode); + +@override +String toString() { + return 'RedirectFfi(native: $native, universal: $universal, linkMode: $linkMode)'; +} + + +} + +/// @nodoc +abstract mixin class _$RedirectFfiCopyWith<$Res> implements $RedirectFfiCopyWith<$Res> { + factory _$RedirectFfiCopyWith(_RedirectFfi value, $Res Function(_RedirectFfi) _then) = __$RedirectFfiCopyWithImpl; +@override @useResult +$Res call({ + String? native, String? universal, bool linkMode +}); + + + + +} +/// @nodoc +class __$RedirectFfiCopyWithImpl<$Res> + implements _$RedirectFfiCopyWith<$Res> { + __$RedirectFfiCopyWithImpl(this._self, this._then); + + final _RedirectFfi _self; + final $Res Function(_RedirectFfi) _then; + +/// Create a copy of RedirectFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? native = freezed,Object? universal = freezed,Object? linkMode = null,}) { + return _then(_RedirectFfi( +native: freezed == native ? _self.native : native // ignore: cast_nullable_to_non_nullable +as String?,universal: freezed == universal ? _self.universal : universal // ignore: cast_nullable_to_non_nullable +as String?,linkMode: null == linkMode ? _self.linkMode : linkMode // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + +/// @nodoc +mixin _$ApproveResultFfi { + + List get sessionSymKey; List get selfPublicKey; +/// Create a copy of ApproveResultFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ApproveResultFfiCopyWith get copyWith => _$ApproveResultFfiCopyWithImpl(this as ApproveResultFfi, _$identity); + + /// Serializes this ApproveResultFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ApproveResultFfi&&const DeepCollectionEquality().equals(other.sessionSymKey, sessionSymKey)&&const DeepCollectionEquality().equals(other.selfPublicKey, selfPublicKey)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(sessionSymKey),const DeepCollectionEquality().hash(selfPublicKey)); + +@override +String toString() { + return 'ApproveResultFfi(sessionSymKey: $sessionSymKey, selfPublicKey: $selfPublicKey)'; +} + + +} + +/// @nodoc +abstract mixin class $ApproveResultFfiCopyWith<$Res> { + factory $ApproveResultFfiCopyWith(ApproveResultFfi value, $Res Function(ApproveResultFfi) _then) = _$ApproveResultFfiCopyWithImpl; +@useResult +$Res call({ + List sessionSymKey, List selfPublicKey +}); + + + + +} +/// @nodoc +class _$ApproveResultFfiCopyWithImpl<$Res> + implements $ApproveResultFfiCopyWith<$Res> { + _$ApproveResultFfiCopyWithImpl(this._self, this._then); + + final ApproveResultFfi _self; + final $Res Function(ApproveResultFfi) _then; + +/// Create a copy of ApproveResultFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? sessionSymKey = null,Object? selfPublicKey = null,}) { + return _then(_self.copyWith( +sessionSymKey: null == sessionSymKey ? _self.sessionSymKey : sessionSymKey // ignore: cast_nullable_to_non_nullable +as List,selfPublicKey: null == selfPublicKey ? _self.selfPublicKey : selfPublicKey // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ApproveResultFfi]. +extension ApproveResultFfiPatterns on ApproveResultFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _ApproveResultFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ApproveResultFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _ApproveResultFfi value) $default,){ +final _that = this; +switch (_that) { +case _ApproveResultFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _ApproveResultFfi value)? $default,){ +final _that = this; +switch (_that) { +case _ApproveResultFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List sessionSymKey, List selfPublicKey)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ApproveResultFfi() when $default != null: +return $default(_that.sessionSymKey,_that.selfPublicKey);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List sessionSymKey, List selfPublicKey) $default,) {final _that = this; +switch (_that) { +case _ApproveResultFfi(): +return $default(_that.sessionSymKey,_that.selfPublicKey);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List sessionSymKey, List selfPublicKey)? $default,) {final _that = this; +switch (_that) { +case _ApproveResultFfi() when $default != null: +return $default(_that.sessionSymKey,_that.selfPublicKey);case _: + return null; + +} +} + +} + +/// @nodoc + +@JsonSerializable() +class _ApproveResultFfi implements ApproveResultFfi { + const _ApproveResultFfi({required final List sessionSymKey, required final List selfPublicKey}): _sessionSymKey = sessionSymKey,_selfPublicKey = selfPublicKey; + factory _ApproveResultFfi.fromJson(Map json) => _$ApproveResultFfiFromJson(json); + + final List _sessionSymKey; +@override List get sessionSymKey { + if (_sessionSymKey is EqualUnmodifiableListView) return _sessionSymKey; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_sessionSymKey); +} + + final List _selfPublicKey; +@override List get selfPublicKey { + if (_selfPublicKey is EqualUnmodifiableListView) return _selfPublicKey; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_selfPublicKey); +} + + +/// Create a copy of ApproveResultFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ApproveResultFfiCopyWith<_ApproveResultFfi> get copyWith => __$ApproveResultFfiCopyWithImpl<_ApproveResultFfi>(this, _$identity); + +@override +Map toJson() { + return _$ApproveResultFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApproveResultFfi&&const DeepCollectionEquality().equals(other._sessionSymKey, _sessionSymKey)&&const DeepCollectionEquality().equals(other._selfPublicKey, _selfPublicKey)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_sessionSymKey),const DeepCollectionEquality().hash(_selfPublicKey)); + +@override +String toString() { + return 'ApproveResultFfi(sessionSymKey: $sessionSymKey, selfPublicKey: $selfPublicKey)'; +} + + +} + +/// @nodoc +abstract mixin class _$ApproveResultFfiCopyWith<$Res> implements $ApproveResultFfiCopyWith<$Res> { + factory _$ApproveResultFfiCopyWith(_ApproveResultFfi value, $Res Function(_ApproveResultFfi) _then) = __$ApproveResultFfiCopyWithImpl; +@override @useResult +$Res call({ + List sessionSymKey, List selfPublicKey +}); + + + + +} +/// @nodoc +class __$ApproveResultFfiCopyWithImpl<$Res> + implements _$ApproveResultFfiCopyWith<$Res> { + __$ApproveResultFfiCopyWithImpl(this._self, this._then); + + final _ApproveResultFfi _self; + final $Res Function(_ApproveResultFfi) _then; + +/// Create a copy of ApproveResultFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? sessionSymKey = null,Object? selfPublicKey = null,}) { + return _then(_ApproveResultFfi( +sessionSymKey: null == sessionSymKey ? _self._sessionSymKey : sessionSymKey // ignore: cast_nullable_to_non_nullable +as List,selfPublicKey: null == selfPublicKey ? _self._selfPublicKey : selfPublicKey // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$SessionRequestRequestFfi { + + String get method; String get params;// JSON string + int? get expiry; +/// Create a copy of SessionRequestRequestFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionRequestRequestFfiCopyWith get copyWith => _$SessionRequestRequestFfiCopyWithImpl(this as SessionRequestRequestFfi, _$identity); + + /// Serializes this SessionRequestRequestFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionRequestRequestFfi&&(identical(other.method, method) || other.method == method)&&(identical(other.params, params) || other.params == params)&&(identical(other.expiry, expiry) || other.expiry == expiry)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,method,params,expiry); + +@override +String toString() { + return 'SessionRequestRequestFfi(method: $method, params: $params, expiry: $expiry)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionRequestRequestFfiCopyWith<$Res> { + factory $SessionRequestRequestFfiCopyWith(SessionRequestRequestFfi value, $Res Function(SessionRequestRequestFfi) _then) = _$SessionRequestRequestFfiCopyWithImpl; +@useResult +$Res call({ + String method, String params, int? expiry +}); + + + + +} +/// @nodoc +class _$SessionRequestRequestFfiCopyWithImpl<$Res> + implements $SessionRequestRequestFfiCopyWith<$Res> { + _$SessionRequestRequestFfiCopyWithImpl(this._self, this._then); + + final SessionRequestRequestFfi _self; + final $Res Function(SessionRequestRequestFfi) _then; + +/// Create a copy of SessionRequestRequestFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? method = null,Object? params = null,Object? expiry = freezed,}) { + return _then(_self.copyWith( +method: null == method ? _self.method : method // ignore: cast_nullable_to_non_nullable +as String,params: null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable +as String,expiry: freezed == expiry ? _self.expiry : expiry // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SessionRequestRequestFfi]. +extension SessionRequestRequestFfiPatterns on SessionRequestRequestFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SessionRequestRequestFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SessionRequestRequestFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SessionRequestRequestFfi value) $default,){ +final _that = this; +switch (_that) { +case _SessionRequestRequestFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SessionRequestRequestFfi value)? $default,){ +final _that = this; +switch (_that) { +case _SessionRequestRequestFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String method, String params, int? expiry)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SessionRequestRequestFfi() when $default != null: +return $default(_that.method,_that.params,_that.expiry);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String method, String params, int? expiry) $default,) {final _that = this; +switch (_that) { +case _SessionRequestRequestFfi(): +return $default(_that.method,_that.params,_that.expiry);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String method, String params, int? expiry)? $default,) {final _that = this; +switch (_that) { +case _SessionRequestRequestFfi() when $default != null: +return $default(_that.method,_that.params,_that.expiry);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SessionRequestRequestFfi implements SessionRequestRequestFfi { + const _SessionRequestRequestFfi({required this.method, required this.params, this.expiry}); + factory _SessionRequestRequestFfi.fromJson(Map json) => _$SessionRequestRequestFfiFromJson(json); + +@override final String method; +@override final String params; +// JSON string +@override final int? expiry; + +/// Create a copy of SessionRequestRequestFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SessionRequestRequestFfiCopyWith<_SessionRequestRequestFfi> get copyWith => __$SessionRequestRequestFfiCopyWithImpl<_SessionRequestRequestFfi>(this, _$identity); + +@override +Map toJson() { + return _$SessionRequestRequestFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SessionRequestRequestFfi&&(identical(other.method, method) || other.method == method)&&(identical(other.params, params) || other.params == params)&&(identical(other.expiry, expiry) || other.expiry == expiry)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,method,params,expiry); + +@override +String toString() { + return 'SessionRequestRequestFfi(method: $method, params: $params, expiry: $expiry)'; +} + + +} + +/// @nodoc +abstract mixin class _$SessionRequestRequestFfiCopyWith<$Res> implements $SessionRequestRequestFfiCopyWith<$Res> { + factory _$SessionRequestRequestFfiCopyWith(_SessionRequestRequestFfi value, $Res Function(_SessionRequestRequestFfi) _then) = __$SessionRequestRequestFfiCopyWithImpl; +@override @useResult +$Res call({ + String method, String params, int? expiry +}); + + + + +} +/// @nodoc +class __$SessionRequestRequestFfiCopyWithImpl<$Res> + implements _$SessionRequestRequestFfiCopyWith<$Res> { + __$SessionRequestRequestFfiCopyWithImpl(this._self, this._then); + + final _SessionRequestRequestFfi _self; + final $Res Function(_SessionRequestRequestFfi) _then; + +/// Create a copy of SessionRequestRequestFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? method = null,Object? params = null,Object? expiry = freezed,}) { + return _then(_SessionRequestRequestFfi( +method: null == method ? _self.method : method // ignore: cast_nullable_to_non_nullable +as String,params: null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable +as String,expiry: freezed == expiry ? _self.expiry : expiry // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + + +/// @nodoc +mixin _$SessionRequestFfi { + + String get chainId; SessionRequestRequestFfi get request; +/// Create a copy of SessionRequestFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionRequestFfiCopyWith get copyWith => _$SessionRequestFfiCopyWithImpl(this as SessionRequestFfi, _$identity); + + /// Serializes this SessionRequestFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionRequestFfi&&(identical(other.chainId, chainId) || other.chainId == chainId)&&(identical(other.request, request) || other.request == request)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,chainId,request); + +@override +String toString() { + return 'SessionRequestFfi(chainId: $chainId, request: $request)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionRequestFfiCopyWith<$Res> { + factory $SessionRequestFfiCopyWith(SessionRequestFfi value, $Res Function(SessionRequestFfi) _then) = _$SessionRequestFfiCopyWithImpl; +@useResult +$Res call({ + String chainId, SessionRequestRequestFfi request +}); + + +$SessionRequestRequestFfiCopyWith<$Res> get request; + +} +/// @nodoc +class _$SessionRequestFfiCopyWithImpl<$Res> + implements $SessionRequestFfiCopyWith<$Res> { + _$SessionRequestFfiCopyWithImpl(this._self, this._then); + + final SessionRequestFfi _self; + final $Res Function(SessionRequestFfi) _then; + +/// Create a copy of SessionRequestFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? chainId = null,Object? request = null,}) { + return _then(_self.copyWith( +chainId: null == chainId ? _self.chainId : chainId // ignore: cast_nullable_to_non_nullable +as String,request: null == request ? _self.request : request // ignore: cast_nullable_to_non_nullable +as SessionRequestRequestFfi, + )); +} +/// Create a copy of SessionRequestFfi +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SessionRequestRequestFfiCopyWith<$Res> get request { + + return $SessionRequestRequestFfiCopyWith<$Res>(_self.request, (value) { + return _then(_self.copyWith(request: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [SessionRequestFfi]. +extension SessionRequestFfiPatterns on SessionRequestFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SessionRequestFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SessionRequestFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SessionRequestFfi value) $default,){ +final _that = this; +switch (_that) { +case _SessionRequestFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SessionRequestFfi value)? $default,){ +final _that = this; +switch (_that) { +case _SessionRequestFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String chainId, SessionRequestRequestFfi request)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SessionRequestFfi() when $default != null: +return $default(_that.chainId,_that.request);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String chainId, SessionRequestRequestFfi request) $default,) {final _that = this; +switch (_that) { +case _SessionRequestFfi(): +return $default(_that.chainId,_that.request);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String chainId, SessionRequestRequestFfi request)? $default,) {final _that = this; +switch (_that) { +case _SessionRequestFfi() when $default != null: +return $default(_that.chainId,_that.request);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SessionRequestFfi implements SessionRequestFfi { + const _SessionRequestFfi({required this.chainId, required this.request}); + factory _SessionRequestFfi.fromJson(Map json) => _$SessionRequestFfiFromJson(json); + +@override final String chainId; +@override final SessionRequestRequestFfi request; + +/// Create a copy of SessionRequestFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SessionRequestFfiCopyWith<_SessionRequestFfi> get copyWith => __$SessionRequestFfiCopyWithImpl<_SessionRequestFfi>(this, _$identity); + +@override +Map toJson() { + return _$SessionRequestFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SessionRequestFfi&&(identical(other.chainId, chainId) || other.chainId == chainId)&&(identical(other.request, request) || other.request == request)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,chainId,request); + +@override +String toString() { + return 'SessionRequestFfi(chainId: $chainId, request: $request)'; +} + + +} + +/// @nodoc +abstract mixin class _$SessionRequestFfiCopyWith<$Res> implements $SessionRequestFfiCopyWith<$Res> { + factory _$SessionRequestFfiCopyWith(_SessionRequestFfi value, $Res Function(_SessionRequestFfi) _then) = __$SessionRequestFfiCopyWithImpl; +@override @useResult +$Res call({ + String chainId, SessionRequestRequestFfi request +}); + + +@override $SessionRequestRequestFfiCopyWith<$Res> get request; + +} +/// @nodoc +class __$SessionRequestFfiCopyWithImpl<$Res> + implements _$SessionRequestFfiCopyWith<$Res> { + __$SessionRequestFfiCopyWithImpl(this._self, this._then); + + final _SessionRequestFfi _self; + final $Res Function(_SessionRequestFfi) _then; + +/// Create a copy of SessionRequestFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? chainId = null,Object? request = null,}) { + return _then(_SessionRequestFfi( +chainId: null == chainId ? _self.chainId : chainId // ignore: cast_nullable_to_non_nullable +as String,request: null == request ? _self.request : request // ignore: cast_nullable_to_non_nullable +as SessionRequestRequestFfi, + )); +} + +/// Create a copy of SessionRequestFfi +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SessionRequestRequestFfiCopyWith<$Res> get request { + + return $SessionRequestRequestFfiCopyWith<$Res>(_self.request, (value) { + return _then(_self.copyWith(request: value)); + }); +} +} + + +/// @nodoc +mixin _$SessionRequestJsonRpcFfi { + + int get id; String get method; SessionRequestFfi get params; +/// Create a copy of SessionRequestJsonRpcFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionRequestJsonRpcFfiCopyWith get copyWith => _$SessionRequestJsonRpcFfiCopyWithImpl(this as SessionRequestJsonRpcFfi, _$identity); + + /// Serializes this SessionRequestJsonRpcFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionRequestJsonRpcFfi&&(identical(other.id, id) || other.id == id)&&(identical(other.method, method) || other.method == method)&&(identical(other.params, params) || other.params == params)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,method,params); + +@override +String toString() { + return 'SessionRequestJsonRpcFfi(id: $id, method: $method, params: $params)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionRequestJsonRpcFfiCopyWith<$Res> { + factory $SessionRequestJsonRpcFfiCopyWith(SessionRequestJsonRpcFfi value, $Res Function(SessionRequestJsonRpcFfi) _then) = _$SessionRequestJsonRpcFfiCopyWithImpl; +@useResult +$Res call({ + int id, String method, SessionRequestFfi params +}); + + +$SessionRequestFfiCopyWith<$Res> get params; + +} +/// @nodoc +class _$SessionRequestJsonRpcFfiCopyWithImpl<$Res> + implements $SessionRequestJsonRpcFfiCopyWith<$Res> { + _$SessionRequestJsonRpcFfiCopyWithImpl(this._self, this._then); + + final SessionRequestJsonRpcFfi _self; + final $Res Function(SessionRequestJsonRpcFfi) _then; + +/// Create a copy of SessionRequestJsonRpcFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? method = null,Object? params = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,method: null == method ? _self.method : method // ignore: cast_nullable_to_non_nullable +as String,params: null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable +as SessionRequestFfi, + )); +} +/// Create a copy of SessionRequestJsonRpcFfi +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SessionRequestFfiCopyWith<$Res> get params { + + return $SessionRequestFfiCopyWith<$Res>(_self.params, (value) { + return _then(_self.copyWith(params: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [SessionRequestJsonRpcFfi]. +extension SessionRequestJsonRpcFfiPatterns on SessionRequestJsonRpcFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SessionRequestJsonRpcFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SessionRequestJsonRpcFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SessionRequestJsonRpcFfi value) $default,){ +final _that = this; +switch (_that) { +case _SessionRequestJsonRpcFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SessionRequestJsonRpcFfi value)? $default,){ +final _that = this; +switch (_that) { +case _SessionRequestJsonRpcFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int id, String method, SessionRequestFfi params)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SessionRequestJsonRpcFfi() when $default != null: +return $default(_that.id,_that.method,_that.params);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int id, String method, SessionRequestFfi params) $default,) {final _that = this; +switch (_that) { +case _SessionRequestJsonRpcFfi(): +return $default(_that.id,_that.method,_that.params);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int id, String method, SessionRequestFfi params)? $default,) {final _that = this; +switch (_that) { +case _SessionRequestJsonRpcFfi() when $default != null: +return $default(_that.id,_that.method,_that.params);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SessionRequestJsonRpcFfi implements SessionRequestJsonRpcFfi { + const _SessionRequestJsonRpcFfi({required this.id, required this.method, required this.params}); + factory _SessionRequestJsonRpcFfi.fromJson(Map json) => _$SessionRequestJsonRpcFfiFromJson(json); + +@override final int id; +@override final String method; +@override final SessionRequestFfi params; + +/// Create a copy of SessionRequestJsonRpcFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SessionRequestJsonRpcFfiCopyWith<_SessionRequestJsonRpcFfi> get copyWith => __$SessionRequestJsonRpcFfiCopyWithImpl<_SessionRequestJsonRpcFfi>(this, _$identity); + +@override +Map toJson() { + return _$SessionRequestJsonRpcFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SessionRequestJsonRpcFfi&&(identical(other.id, id) || other.id == id)&&(identical(other.method, method) || other.method == method)&&(identical(other.params, params) || other.params == params)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,method,params); + +@override +String toString() { + return 'SessionRequestJsonRpcFfi(id: $id, method: $method, params: $params)'; +} + + +} + +/// @nodoc +abstract mixin class _$SessionRequestJsonRpcFfiCopyWith<$Res> implements $SessionRequestJsonRpcFfiCopyWith<$Res> { + factory _$SessionRequestJsonRpcFfiCopyWith(_SessionRequestJsonRpcFfi value, $Res Function(_SessionRequestJsonRpcFfi) _then) = __$SessionRequestJsonRpcFfiCopyWithImpl; +@override @useResult +$Res call({ + int id, String method, SessionRequestFfi params +}); + + +@override $SessionRequestFfiCopyWith<$Res> get params; + +} +/// @nodoc +class __$SessionRequestJsonRpcFfiCopyWithImpl<$Res> + implements _$SessionRequestJsonRpcFfiCopyWith<$Res> { + __$SessionRequestJsonRpcFfiCopyWithImpl(this._self, this._then); + + final _SessionRequestJsonRpcFfi _self; + final $Res Function(_SessionRequestJsonRpcFfi) _then; + +/// Create a copy of SessionRequestJsonRpcFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? method = null,Object? params = null,}) { + return _then(_SessionRequestJsonRpcFfi( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,method: null == method ? _self.method : method // ignore: cast_nullable_to_non_nullable +as String,params: null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable +as SessionRequestFfi, + )); +} + +/// Create a copy of SessionRequestJsonRpcFfi +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SessionRequestFfiCopyWith<$Res> get params { + + return $SessionRequestFfiCopyWith<$Res>(_self.params, (value) { + return _then(_self.copyWith(params: value)); + }); +} +} + + +/// @nodoc +mixin _$SessionRequestNativeEvent { + + String get topic;// JSON String. Should be transformed into SessionRequestJsonRpcFfi + String get sessionRequest; +/// Create a copy of SessionRequestNativeEvent +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionRequestNativeEventCopyWith get copyWith => _$SessionRequestNativeEventCopyWithImpl(this as SessionRequestNativeEvent, _$identity); + + /// Serializes this SessionRequestNativeEvent to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionRequestNativeEvent&&(identical(other.topic, topic) || other.topic == topic)&&(identical(other.sessionRequest, sessionRequest) || other.sessionRequest == sessionRequest)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,topic,sessionRequest); + +@override +String toString() { + return 'SessionRequestNativeEvent(topic: $topic, sessionRequest: $sessionRequest)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionRequestNativeEventCopyWith<$Res> { + factory $SessionRequestNativeEventCopyWith(SessionRequestNativeEvent value, $Res Function(SessionRequestNativeEvent) _then) = _$SessionRequestNativeEventCopyWithImpl; +@useResult +$Res call({ + String topic, String sessionRequest +}); + + + + +} +/// @nodoc +class _$SessionRequestNativeEventCopyWithImpl<$Res> + implements $SessionRequestNativeEventCopyWith<$Res> { + _$SessionRequestNativeEventCopyWithImpl(this._self, this._then); + + final SessionRequestNativeEvent _self; + final $Res Function(SessionRequestNativeEvent) _then; + +/// Create a copy of SessionRequestNativeEvent +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? topic = null,Object? sessionRequest = null,}) { + return _then(_self.copyWith( +topic: null == topic ? _self.topic : topic // ignore: cast_nullable_to_non_nullable +as String,sessionRequest: null == sessionRequest ? _self.sessionRequest : sessionRequest // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SessionRequestNativeEvent]. +extension SessionRequestNativeEventPatterns on SessionRequestNativeEvent { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SessionRequestNativeEvent value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SessionRequestNativeEvent() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SessionRequestNativeEvent value) $default,){ +final _that = this; +switch (_that) { +case _SessionRequestNativeEvent(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SessionRequestNativeEvent value)? $default,){ +final _that = this; +switch (_that) { +case _SessionRequestNativeEvent() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String topic, String sessionRequest)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SessionRequestNativeEvent() when $default != null: +return $default(_that.topic,_that.sessionRequest);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String topic, String sessionRequest) $default,) {final _that = this; +switch (_that) { +case _SessionRequestNativeEvent(): +return $default(_that.topic,_that.sessionRequest);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String topic, String sessionRequest)? $default,) {final _that = this; +switch (_that) { +case _SessionRequestNativeEvent() when $default != null: +return $default(_that.topic,_that.sessionRequest);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SessionRequestNativeEvent implements SessionRequestNativeEvent { + const _SessionRequestNativeEvent({required this.topic, required this.sessionRequest}); + factory _SessionRequestNativeEvent.fromJson(Map json) => _$SessionRequestNativeEventFromJson(json); + +@override final String topic; +// JSON String. Should be transformed into SessionRequestJsonRpcFfi +@override final String sessionRequest; + +/// Create a copy of SessionRequestNativeEvent +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SessionRequestNativeEventCopyWith<_SessionRequestNativeEvent> get copyWith => __$SessionRequestNativeEventCopyWithImpl<_SessionRequestNativeEvent>(this, _$identity); + +@override +Map toJson() { + return _$SessionRequestNativeEventToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SessionRequestNativeEvent&&(identical(other.topic, topic) || other.topic == topic)&&(identical(other.sessionRequest, sessionRequest) || other.sessionRequest == sessionRequest)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,topic,sessionRequest); + +@override +String toString() { + return 'SessionRequestNativeEvent(topic: $topic, sessionRequest: $sessionRequest)'; +} + + +} + +/// @nodoc +abstract mixin class _$SessionRequestNativeEventCopyWith<$Res> implements $SessionRequestNativeEventCopyWith<$Res> { + factory _$SessionRequestNativeEventCopyWith(_SessionRequestNativeEvent value, $Res Function(_SessionRequestNativeEvent) _then) = __$SessionRequestNativeEventCopyWithImpl; +@override @useResult +$Res call({ + String topic, String sessionRequest +}); + + + + +} +/// @nodoc +class __$SessionRequestNativeEventCopyWithImpl<$Res> + implements _$SessionRequestNativeEventCopyWith<$Res> { + __$SessionRequestNativeEventCopyWithImpl(this._self, this._then); + + final _SessionRequestNativeEvent _self; + final $Res Function(_SessionRequestNativeEvent) _then; + +/// Create a copy of SessionRequestNativeEvent +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? topic = null,Object? sessionRequest = null,}) { + return _then(_SessionRequestNativeEvent( +topic: null == topic ? _self.topic : topic // ignore: cast_nullable_to_non_nullable +as String,sessionRequest: null == sessionRequest ? _self.sessionRequest : sessionRequest // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +SessionRequestJsonRpcResponseFfi _$SessionRequestJsonRpcResponseFfiFromJson( + Map json +) { + switch (json['runtimeType']) { + case 'result': + return Result.fromJson( + json + ); + case 'error': + return Error.fromJson( + json + ); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'SessionRequestJsonRpcResponseFfi', + 'Invalid union type "${json['runtimeType']}"!' +); + } + +} + +/// @nodoc +mixin _$SessionRequestJsonRpcResponseFfi { + + int get id; String get jsonrpc; +/// Create a copy of SessionRequestJsonRpcResponseFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SessionRequestJsonRpcResponseFfiCopyWith get copyWith => _$SessionRequestJsonRpcResponseFfiCopyWithImpl(this as SessionRequestJsonRpcResponseFfi, _$identity); + + /// Serializes this SessionRequestJsonRpcResponseFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SessionRequestJsonRpcResponseFfi&&(identical(other.id, id) || other.id == id)&&(identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,jsonrpc); + +@override +String toString() { + return 'SessionRequestJsonRpcResponseFfi(id: $id, jsonrpc: $jsonrpc)'; +} + + +} + +/// @nodoc +abstract mixin class $SessionRequestJsonRpcResponseFfiCopyWith<$Res> { + factory $SessionRequestJsonRpcResponseFfiCopyWith(SessionRequestJsonRpcResponseFfi value, $Res Function(SessionRequestJsonRpcResponseFfi) _then) = _$SessionRequestJsonRpcResponseFfiCopyWithImpl; +@useResult +$Res call({ + int id, String jsonrpc +}); + + + + +} +/// @nodoc +class _$SessionRequestJsonRpcResponseFfiCopyWithImpl<$Res> + implements $SessionRequestJsonRpcResponseFfiCopyWith<$Res> { + _$SessionRequestJsonRpcResponseFfiCopyWithImpl(this._self, this._then); + + final SessionRequestJsonRpcResponseFfi _self; + final $Res Function(SessionRequestJsonRpcResponseFfi) _then; + +/// Create a copy of SessionRequestJsonRpcResponseFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? jsonrpc = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,jsonrpc: null == jsonrpc ? _self.jsonrpc : jsonrpc // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SessionRequestJsonRpcResponseFfi]. +extension SessionRequestJsonRpcResponseFfiPatterns on SessionRequestJsonRpcResponseFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( Result value)? result,TResult Function( Error value)? error,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case Result() when result != null: +return result(_that);case Error() when error != null: +return error(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( Result value) result,required TResult Function( Error value) error,}){ +final _that = this; +switch (_that) { +case Result(): +return result(_that);case Error(): +return error(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( Result value)? result,TResult? Function( Error value)? error,}){ +final _that = this; +switch (_that) { +case Result() when result != null: +return result(_that);case Error() when error != null: +return error(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( int id, String jsonrpc, String result)? result,TResult Function( int id, String jsonrpc, String error)? error,required TResult orElse(),}) {final _that = this; +switch (_that) { +case Result() when result != null: +return result(_that.id,_that.jsonrpc,_that.result);case Error() when error != null: +return error(_that.id,_that.jsonrpc,_that.error);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( int id, String jsonrpc, String result) result,required TResult Function( int id, String jsonrpc, String error) error,}) {final _that = this; +switch (_that) { +case Result(): +return result(_that.id,_that.jsonrpc,_that.result);case Error(): +return error(_that.id,_that.jsonrpc,_that.error);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( int id, String jsonrpc, String result)? result,TResult? Function( int id, String jsonrpc, String error)? error,}) {final _that = this; +switch (_that) { +case Result() when result != null: +return result(_that.id,_that.jsonrpc,_that.result);case Error() when error != null: +return error(_that.id,_that.jsonrpc,_that.error);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class Result implements SessionRequestJsonRpcResponseFfi { + const Result({required this.id, this.jsonrpc = '2.0', required this.result, final String? $type}): $type = $type ?? 'result'; + factory Result.fromJson(Map json) => _$ResultFromJson(json); + +@override final int id; +@override@JsonKey() final String jsonrpc; + final String result; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SessionRequestJsonRpcResponseFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ResultCopyWith get copyWith => _$ResultCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$ResultToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Result&&(identical(other.id, id) || other.id == id)&&(identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc)&&(identical(other.result, result) || other.result == result)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,jsonrpc,result); + +@override +String toString() { + return 'SessionRequestJsonRpcResponseFfi.result(id: $id, jsonrpc: $jsonrpc, result: $result)'; +} + + +} + +/// @nodoc +abstract mixin class $ResultCopyWith<$Res> implements $SessionRequestJsonRpcResponseFfiCopyWith<$Res> { + factory $ResultCopyWith(Result value, $Res Function(Result) _then) = _$ResultCopyWithImpl; +@override @useResult +$Res call({ + int id, String jsonrpc, String result +}); + + + + +} +/// @nodoc +class _$ResultCopyWithImpl<$Res> + implements $ResultCopyWith<$Res> { + _$ResultCopyWithImpl(this._self, this._then); + + final Result _self; + final $Res Function(Result) _then; + +/// Create a copy of SessionRequestJsonRpcResponseFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? jsonrpc = null,Object? result = null,}) { + return _then(Result( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,jsonrpc: null == jsonrpc ? _self.jsonrpc : jsonrpc // ignore: cast_nullable_to_non_nullable +as String,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +/// @nodoc +@JsonSerializable() + +class Error implements SessionRequestJsonRpcResponseFfi { + const Error({required this.id, this.jsonrpc = '2.0', required this.error, final String? $type}): $type = $type ?? 'error'; + factory Error.fromJson(Map json) => _$ErrorFromJson(json); + +@override final int id; +@override@JsonKey() final String jsonrpc; + final String error; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SessionRequestJsonRpcResponseFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ErrorCopyWith get copyWith => _$ErrorCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$ErrorToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Error&&(identical(other.id, id) || other.id == id)&&(identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc)&&(identical(other.error, error) || other.error == error)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,jsonrpc,error); + +@override +String toString() { + return 'SessionRequestJsonRpcResponseFfi.error(id: $id, jsonrpc: $jsonrpc, error: $error)'; +} + + +} + +/// @nodoc +abstract mixin class $ErrorCopyWith<$Res> implements $SessionRequestJsonRpcResponseFfiCopyWith<$Res> { + factory $ErrorCopyWith(Error value, $Res Function(Error) _then) = _$ErrorCopyWithImpl; +@override @useResult +$Res call({ + int id, String jsonrpc, String error +}); + + + + +} +/// @nodoc +class _$ErrorCopyWithImpl<$Res> + implements $ErrorCopyWith<$Res> { + _$ErrorCopyWithImpl(this._self, this._then); + + final Error _self; + final $Res Function(Error) _then; + +/// Create a copy of SessionRequestJsonRpcResponseFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? jsonrpc = null,Object? error = null,}) { + return _then(Error( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,jsonrpc: null == jsonrpc ? _self.jsonrpc : jsonrpc // ignore: cast_nullable_to_non_nullable +as String,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + +/// @nodoc +mixin _$ErrorDataFfi { + + int get code; String get message; String? get data; +/// Create a copy of ErrorDataFfi +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ErrorDataFfiCopyWith get copyWith => _$ErrorDataFfiCopyWithImpl(this as ErrorDataFfi, _$identity); + + /// Serializes this ErrorDataFfi to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ErrorDataFfi&&(identical(other.code, code) || other.code == code)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,code,message,data); + +@override +String toString() { + return 'ErrorDataFfi(code: $code, message: $message, data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $ErrorDataFfiCopyWith<$Res> { + factory $ErrorDataFfiCopyWith(ErrorDataFfi value, $Res Function(ErrorDataFfi) _then) = _$ErrorDataFfiCopyWithImpl; +@useResult +$Res call({ + int code, String message, String? data +}); + + + + +} +/// @nodoc +class _$ErrorDataFfiCopyWithImpl<$Res> + implements $ErrorDataFfiCopyWith<$Res> { + _$ErrorDataFfiCopyWithImpl(this._self, this._then); + + final ErrorDataFfi _self; + final $Res Function(ErrorDataFfi) _then; + +/// Create a copy of ErrorDataFfi +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? code = null,Object? message = null,Object? data = freezed,}) { + return _then(_self.copyWith( +code: null == code ? _self.code : code // ignore: cast_nullable_to_non_nullable +as int,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ErrorDataFfi]. +extension ErrorDataFfiPatterns on ErrorDataFfi { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _ErrorDataFfi value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ErrorDataFfi() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _ErrorDataFfi value) $default,){ +final _that = this; +switch (_that) { +case _ErrorDataFfi(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _ErrorDataFfi value)? $default,){ +final _that = this; +switch (_that) { +case _ErrorDataFfi() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int code, String message, String? data)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ErrorDataFfi() when $default != null: +return $default(_that.code,_that.message,_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int code, String message, String? data) $default,) {final _that = this; +switch (_that) { +case _ErrorDataFfi(): +return $default(_that.code,_that.message,_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int code, String message, String? data)? $default,) {final _that = this; +switch (_that) { +case _ErrorDataFfi() when $default != null: +return $default(_that.code,_that.message,_that.data);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _ErrorDataFfi implements ErrorDataFfi { + const _ErrorDataFfi({required this.code, required this.message, this.data}); + factory _ErrorDataFfi.fromJson(Map json) => _$ErrorDataFfiFromJson(json); + +@override final int code; +@override final String message; +@override final String? data; + +/// Create a copy of ErrorDataFfi +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ErrorDataFfiCopyWith<_ErrorDataFfi> get copyWith => __$ErrorDataFfiCopyWithImpl<_ErrorDataFfi>(this, _$identity); + +@override +Map toJson() { + return _$ErrorDataFfiToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ErrorDataFfi&&(identical(other.code, code) || other.code == code)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,code,message,data); + +@override +String toString() { + return 'ErrorDataFfi(code: $code, message: $message, data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class _$ErrorDataFfiCopyWith<$Res> implements $ErrorDataFfiCopyWith<$Res> { + factory _$ErrorDataFfiCopyWith(_ErrorDataFfi value, $Res Function(_ErrorDataFfi) _then) = __$ErrorDataFfiCopyWithImpl; +@override @useResult +$Res call({ + int code, String message, String? data +}); + + + + +} +/// @nodoc +class __$ErrorDataFfiCopyWithImpl<$Res> + implements _$ErrorDataFfiCopyWith<$Res> { + __$ErrorDataFfiCopyWithImpl(this._self, this._then); + + final _ErrorDataFfi _self; + final $Res Function(_ErrorDataFfi) _then; + +/// Create a copy of ErrorDataFfi +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? code = null,Object? message = null,Object? data = freezed,}) { + return _then(_ErrorDataFfi( +code: null == code ? _self.code : code // ignore: cast_nullable_to_non_nullable +as int,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/packages/reown_yttrium/lib/clients/models/rust_sign_client.g.dart b/packages/reown_yttrium/lib/clients/models/rust_sign_client.g.dart new file mode 100644 index 00000000..de50c03f --- /dev/null +++ b/packages/reown_yttrium/lib/clients/models/rust_sign_client.g.dart @@ -0,0 +1,220 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rust_sign_client.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SessionProposalFfi _$SessionProposalFfiFromJson(Map json) => + _SessionProposalFfi( + id: json['id'] as String, + topic: json['topic'] as String, + pairingSymKey: (json['pairingSymKey'] as List) + .map((e) => (e as num).toInt()) + .toList(), + proposerPublicKey: (json['proposerPublicKey'] as List) + .map((e) => (e as num).toInt()) + .toList(), + relays: (json['relays'] as List) + .map((e) => e as Map) + .toList(), + requiredNamespaces: (json['requiredNamespaces'] as Map) + .map((k, e) => MapEntry(k, e as Map)), + optionalNamespaces: (json['optionalNamespaces'] as Map?) + ?.map((k, e) => MapEntry(k, e as Map)), + metadata: json['metadata'] as Map, + sessionProperties: (json['sessionProperties'] as Map?) + ?.map((k, e) => MapEntry(k, e as String)), + scopedProperties: (json['scopedProperties'] as Map?) + ?.map((k, e) => MapEntry(k, e as String)), + expiryTimestamp: (json['expiryTimestamp'] as num?)?.toInt(), + ); + +Map _$SessionProposalFfiToJson(_SessionProposalFfi instance) => + { + 'id': instance.id, + 'topic': instance.topic, + 'pairingSymKey': instance.pairingSymKey, + 'proposerPublicKey': instance.proposerPublicKey, + 'relays': instance.relays, + 'requiredNamespaces': instance.requiredNamespaces, + 'optionalNamespaces': instance.optionalNamespaces, + 'metadata': instance.metadata, + 'sessionProperties': instance.sessionProperties, + 'scopedProperties': instance.scopedProperties, + 'expiryTimestamp': instance.expiryTimestamp, + }; + +_SettleNamespaceFfi _$SettleNamespaceFfiFromJson( + Map json, +) => _SettleNamespaceFfi( + accounts: (json['accounts'] as List) + .map((e) => e as String) + .toList(), + methods: (json['methods'] as List).map((e) => e as String).toList(), + events: (json['events'] as List).map((e) => e as String).toList(), + chains: (json['chains'] as List).map((e) => e as String).toList(), +); + +Map _$SettleNamespaceFfiToJson(_SettleNamespaceFfi instance) => + { + 'accounts': instance.accounts, + 'methods': instance.methods, + 'events': instance.events, + 'chains': instance.chains, + }; + +_MetadataFfi _$MetadataFfiFromJson(Map json) => _MetadataFfi( + name: json['name'] as String, + description: json['description'] as String, + url: json['url'] as String? ?? '', + icons: + (json['icons'] as List?)?.map((e) => e as String).toList() ?? + const [], + verifyUrl: json['verifyUrl'] as String?, + redirect: json['redirect'] == null + ? null + : RedirectFfi.fromJson(json['redirect'] as Map), +); + +Map _$MetadataFfiToJson(_MetadataFfi instance) => + { + 'name': instance.name, + 'description': instance.description, + 'url': instance.url, + 'icons': instance.icons, + 'verifyUrl': ?instance.verifyUrl, + 'redirect': ?instance.redirect?.toJson(), + }; + +_RedirectFfi _$RedirectFfiFromJson(Map json) => _RedirectFfi( + native: json['native'] as String?, + universal: json['universal'] as String?, + linkMode: json['linkMode'] as bool? ?? false, +); + +Map _$RedirectFfiToJson(_RedirectFfi instance) => + { + 'native': instance.native, + 'universal': instance.universal, + 'linkMode': instance.linkMode, + }; + +_ApproveResultFfi _$ApproveResultFfiFromJson(Map json) => + _ApproveResultFfi( + sessionSymKey: (json['sessionSymKey'] as List) + .map((e) => (e as num).toInt()) + .toList(), + selfPublicKey: (json['selfPublicKey'] as List) + .map((e) => (e as num).toInt()) + .toList(), + ); + +Map _$ApproveResultFfiToJson(_ApproveResultFfi instance) => + { + 'sessionSymKey': instance.sessionSymKey, + 'selfPublicKey': instance.selfPublicKey, + }; + +_SessionRequestRequestFfi _$SessionRequestRequestFfiFromJson( + Map json, +) => _SessionRequestRequestFfi( + method: json['method'] as String, + params: json['params'] as String, + expiry: (json['expiry'] as num?)?.toInt(), +); + +Map _$SessionRequestRequestFfiToJson( + _SessionRequestRequestFfi instance, +) => { + 'method': instance.method, + 'params': instance.params, + 'expiry': instance.expiry, +}; + +_SessionRequestFfi _$SessionRequestFfiFromJson(Map json) => + _SessionRequestFfi( + chainId: json['chainId'] as String, + request: SessionRequestRequestFfi.fromJson( + json['request'] as Map, + ), + ); + +Map _$SessionRequestFfiToJson(_SessionRequestFfi instance) => + { + 'chainId': instance.chainId, + 'request': instance.request.toJson(), + }; + +_SessionRequestJsonRpcFfi _$SessionRequestJsonRpcFfiFromJson( + Map json, +) => _SessionRequestJsonRpcFfi( + id: (json['id'] as num).toInt(), + method: json['method'] as String, + params: SessionRequestFfi.fromJson(json['params'] as Map), +); + +Map _$SessionRequestJsonRpcFfiToJson( + _SessionRequestJsonRpcFfi instance, +) => { + 'id': instance.id, + 'method': instance.method, + 'params': instance.params.toJson(), +}; + +_SessionRequestNativeEvent _$SessionRequestNativeEventFromJson( + Map json, +) => _SessionRequestNativeEvent( + topic: json['topic'] as String, + sessionRequest: json['sessionRequest'] as String, +); + +Map _$SessionRequestNativeEventToJson( + _SessionRequestNativeEvent instance, +) => { + 'topic': instance.topic, + 'sessionRequest': instance.sessionRequest, +}; + +Result _$ResultFromJson(Map json) => Result( + id: (json['id'] as num).toInt(), + jsonrpc: json['jsonrpc'] as String? ?? '2.0', + result: json['result'] as String, + $type: json['runtimeType'] as String?, +); + +Map _$ResultToJson(Result instance) => { + 'id': instance.id, + 'jsonrpc': instance.jsonrpc, + 'result': instance.result, + 'runtimeType': instance.$type, +}; + +Error _$ErrorFromJson(Map json) => Error( + id: (json['id'] as num).toInt(), + jsonrpc: json['jsonrpc'] as String? ?? '2.0', + error: json['error'] as String, + $type: json['runtimeType'] as String?, +); + +Map _$ErrorToJson(Error instance) => { + 'id': instance.id, + 'jsonrpc': instance.jsonrpc, + 'error': instance.error, + 'runtimeType': instance.$type, +}; + +_ErrorDataFfi _$ErrorDataFfiFromJson(Map json) => + _ErrorDataFfi( + code: (json['code'] as num).toInt(), + message: json['message'] as String, + data: json['data'] as String?, + ); + +Map _$ErrorDataFfiToJson(_ErrorDataFfi instance) => + { + 'code': instance.code, + 'message': instance.message, + 'data': instance.data, + }; diff --git a/packages/reown_yttrium/lib/clients/models/shared.dart b/packages/reown_yttrium/lib/clients/models/shared.dart new file mode 100644 index 00000000..d94da3fd --- /dev/null +++ b/packages/reown_yttrium/lib/clients/models/shared.dart @@ -0,0 +1,18 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'shared.freezed.dart'; +part 'shared.g.dart'; + +@freezed +sealed class PulseMetadataCompat with _$PulseMetadataCompat { + const factory PulseMetadataCompat({ + String? url, + String? bundleId, + String? packageName, + required String sdkVersion, + required String sdkPlatform, + }) = _PulseMetadataCompat; + + factory PulseMetadataCompat.fromJson(Map json) => + _$PulseMetadataCompatFromJson(json); +} diff --git a/packages/reown_yttrium/lib/clients/models/shared.freezed.dart b/packages/reown_yttrium/lib/clients/models/shared.freezed.dart new file mode 100644 index 00000000..3c2c4686 --- /dev/null +++ b/packages/reown_yttrium/lib/clients/models/shared.freezed.dart @@ -0,0 +1,283 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// 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 'shared.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$PulseMetadataCompat { + + String? get url; String? get bundleId; String? get packageName; String get sdkVersion; String get sdkPlatform; +/// Create a copy of PulseMetadataCompat +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PulseMetadataCompatCopyWith get copyWith => _$PulseMetadataCompatCopyWithImpl(this as PulseMetadataCompat, _$identity); + + /// Serializes this PulseMetadataCompat to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PulseMetadataCompat&&(identical(other.url, url) || other.url == url)&&(identical(other.bundleId, bundleId) || other.bundleId == bundleId)&&(identical(other.packageName, packageName) || other.packageName == packageName)&&(identical(other.sdkVersion, sdkVersion) || other.sdkVersion == sdkVersion)&&(identical(other.sdkPlatform, sdkPlatform) || other.sdkPlatform == sdkPlatform)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,url,bundleId,packageName,sdkVersion,sdkPlatform); + +@override +String toString() { + return 'PulseMetadataCompat(url: $url, bundleId: $bundleId, packageName: $packageName, sdkVersion: $sdkVersion, sdkPlatform: $sdkPlatform)'; +} + + +} + +/// @nodoc +abstract mixin class $PulseMetadataCompatCopyWith<$Res> { + factory $PulseMetadataCompatCopyWith(PulseMetadataCompat value, $Res Function(PulseMetadataCompat) _then) = _$PulseMetadataCompatCopyWithImpl; +@useResult +$Res call({ + String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform +}); + + + + +} +/// @nodoc +class _$PulseMetadataCompatCopyWithImpl<$Res> + implements $PulseMetadataCompatCopyWith<$Res> { + _$PulseMetadataCompatCopyWithImpl(this._self, this._then); + + final PulseMetadataCompat _self; + final $Res Function(PulseMetadataCompat) _then; + +/// Create a copy of PulseMetadataCompat +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? url = freezed,Object? bundleId = freezed,Object? packageName = freezed,Object? sdkVersion = null,Object? sdkPlatform = null,}) { + return _then(_self.copyWith( +url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable +as String?,bundleId: freezed == bundleId ? _self.bundleId : bundleId // ignore: cast_nullable_to_non_nullable +as String?,packageName: freezed == packageName ? _self.packageName : packageName // ignore: cast_nullable_to_non_nullable +as String?,sdkVersion: null == sdkVersion ? _self.sdkVersion : sdkVersion // ignore: cast_nullable_to_non_nullable +as String,sdkPlatform: null == sdkPlatform ? _self.sdkPlatform : sdkPlatform // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [PulseMetadataCompat]. +extension PulseMetadataCompatPatterns on PulseMetadataCompat { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _PulseMetadataCompat value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PulseMetadataCompat() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _PulseMetadataCompat value) $default,){ +final _that = this; +switch (_that) { +case _PulseMetadataCompat(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _PulseMetadataCompat value)? $default,){ +final _that = this; +switch (_that) { +case _PulseMetadataCompat() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PulseMetadataCompat() when $default != null: +return $default(_that.url,_that.bundleId,_that.packageName,_that.sdkVersion,_that.sdkPlatform);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform) $default,) {final _that = this; +switch (_that) { +case _PulseMetadataCompat(): +return $default(_that.url,_that.bundleId,_that.packageName,_that.sdkVersion,_that.sdkPlatform);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform)? $default,) {final _that = this; +switch (_that) { +case _PulseMetadataCompat() when $default != null: +return $default(_that.url,_that.bundleId,_that.packageName,_that.sdkVersion,_that.sdkPlatform);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _PulseMetadataCompat implements PulseMetadataCompat { + const _PulseMetadataCompat({this.url, this.bundleId, this.packageName, required this.sdkVersion, required this.sdkPlatform}); + factory _PulseMetadataCompat.fromJson(Map json) => _$PulseMetadataCompatFromJson(json); + +@override final String? url; +@override final String? bundleId; +@override final String? packageName; +@override final String sdkVersion; +@override final String sdkPlatform; + +/// Create a copy of PulseMetadataCompat +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PulseMetadataCompatCopyWith<_PulseMetadataCompat> get copyWith => __$PulseMetadataCompatCopyWithImpl<_PulseMetadataCompat>(this, _$identity); + +@override +Map toJson() { + return _$PulseMetadataCompatToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PulseMetadataCompat&&(identical(other.url, url) || other.url == url)&&(identical(other.bundleId, bundleId) || other.bundleId == bundleId)&&(identical(other.packageName, packageName) || other.packageName == packageName)&&(identical(other.sdkVersion, sdkVersion) || other.sdkVersion == sdkVersion)&&(identical(other.sdkPlatform, sdkPlatform) || other.sdkPlatform == sdkPlatform)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,url,bundleId,packageName,sdkVersion,sdkPlatform); + +@override +String toString() { + return 'PulseMetadataCompat(url: $url, bundleId: $bundleId, packageName: $packageName, sdkVersion: $sdkVersion, sdkPlatform: $sdkPlatform)'; +} + + +} + +/// @nodoc +abstract mixin class _$PulseMetadataCompatCopyWith<$Res> implements $PulseMetadataCompatCopyWith<$Res> { + factory _$PulseMetadataCompatCopyWith(_PulseMetadataCompat value, $Res Function(_PulseMetadataCompat) _then) = __$PulseMetadataCompatCopyWithImpl; +@override @useResult +$Res call({ + String? url, String? bundleId, String? packageName, String sdkVersion, String sdkPlatform +}); + + + + +} +/// @nodoc +class __$PulseMetadataCompatCopyWithImpl<$Res> + implements _$PulseMetadataCompatCopyWith<$Res> { + __$PulseMetadataCompatCopyWithImpl(this._self, this._then); + + final _PulseMetadataCompat _self; + final $Res Function(_PulseMetadataCompat) _then; + +/// Create a copy of PulseMetadataCompat +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? url = freezed,Object? bundleId = freezed,Object? packageName = freezed,Object? sdkVersion = null,Object? sdkPlatform = null,}) { + return _then(_PulseMetadataCompat( +url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable +as String?,bundleId: freezed == bundleId ? _self.bundleId : bundleId // ignore: cast_nullable_to_non_nullable +as String?,packageName: freezed == packageName ? _self.packageName : packageName // ignore: cast_nullable_to_non_nullable +as String?,sdkVersion: null == sdkVersion ? _self.sdkVersion : sdkVersion // ignore: cast_nullable_to_non_nullable +as String,sdkPlatform: null == sdkPlatform ? _self.sdkPlatform : sdkPlatform // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/reown_yttrium/lib/clients/models/shared.g.dart b/packages/reown_yttrium/lib/clients/models/shared.g.dart new file mode 100644 index 00000000..a55812f0 --- /dev/null +++ b/packages/reown_yttrium/lib/clients/models/shared.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'shared.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PulseMetadataCompat _$PulseMetadataCompatFromJson(Map json) => + _PulseMetadataCompat( + url: json['url'] as String?, + bundleId: json['bundleId'] as String?, + packageName: json['packageName'] as String?, + sdkVersion: json['sdkVersion'] as String, + sdkPlatform: json['sdkPlatform'] as String, + ); + +Map _$PulseMetadataCompatToJson( + _PulseMetadataCompat instance, +) => { + 'url': instance.url, + 'bundleId': instance.bundleId, + 'packageName': instance.packageName, + 'sdkVersion': instance.sdkVersion, + 'sdkPlatform': instance.sdkPlatform, +}; diff --git a/packages/reown_yttrium/lib/clients/rust_sign_client.dart b/packages/reown_yttrium/lib/clients/rust_sign_client.dart new file mode 100644 index 00000000..6381c046 --- /dev/null +++ b/packages/reown_yttrium/lib/clients/rust_sign_client.dart @@ -0,0 +1,101 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:reown_yttrium/channels/methods_channel/rust_sign_client_methods_channel.dart'; +import 'package:reown_yttrium/clients/i_rust_sign_client.dart'; +import 'package:reown_yttrium/clients/models/rust_sign_client.dart'; +import 'package:reown_yttrium/reown_yttrium_platform_interface.dart'; + +class SignClient implements ISignClient { + bool _initialized = false; + + MethodChannelSign get _methodChannelSign => + ReownYttriumPlatformInterface.instance.methodChannelSign; + + @override + late Function( + String topic, + SessionRequestJsonRpcFfi request, + ) onSessionRequest; + + @override + Future init({required String projectId, required String key}) async { + final result = await _methodChannelSign.init( + projectId: projectId, + key: key, + ); + _initialized = result; + return _initialized; + } + + @override + Future initListener() async { + if (!_initialized) { + throw Exception('SignClient is not initialized. Call SignClient.init()'); + } + ReownYttriumPlatformInterface.instance.eventChannelSign + ..init() + ..onEvent = _onRequestEvent; + } + + void _onRequestEvent(SessionRequestNativeEvent eventRequest) { + debugPrint('☢️ [$runtimeType] _onSessionRequest $eventRequest'); + final topic = eventRequest.topic; + final sessionRequestJson = SessionRequestJsonRpcFfi.fromJson(jsonDecode( + eventRequest.sessionRequest, + )); + onSessionRequest.call(topic, sessionRequestJson); + } + + @override + Future generateKey() async { + return await _methodChannelSign.generateKey(); + } + + @override + Future pair({ + required String uri, + }) async { + final result = await _methodChannelSign.pair(uri: uri); + return SessionProposalFfi.fromJson(result); + } + + @override + Future approve({ + required SessionProposalFfi proposal, + required Map approvedNamespaces, + required MetadataFfi selfMetadata, + }) async { + final result = await _methodChannelSign.approve( + proposal: proposal.toJson(), + approvedNamespaces: approvedNamespaces.map( + (key, value) => MapEntry(key, value.toJson()), + ), + selfMetadata: selfMetadata.toJson(), + ); + return ApproveResultFfi.fromJson(result); + } + + @override + Future reject({ + required SessionProposalFfi proposal, + required ErrorDataFfi error, + }) async { + return await _methodChannelSign.reject( + proposal: proposal.toJson(), + reason: error.toJson(), + ); + } + + @override + Future respond({ + required String topic, + required SessionRequestJsonRpcResponseFfi response, + }) async { + return await _methodChannelSign.respond( + topic: topic, + response: response.toJson(), + ); + } +} diff --git a/packages/reown_yttrium/lib/reown_yttrium.dart b/packages/reown_yttrium/lib/reown_yttrium.dart index 0782b78c..88ae12f2 100644 --- a/packages/reown_yttrium/lib/reown_yttrium.dart +++ b/packages/reown_yttrium/lib/reown_yttrium.dart @@ -1,64 +1,23 @@ -import 'package:reown_yttrium/models/chain_abstraction.dart'; -import 'reown_yttrium_platform_interface.dart'; +import 'package:reown_yttrium/clients/chain_abstraction_client.dart'; +import 'package:reown_yttrium/clients/i_chain_abstraction_client.dart'; +import 'package:reown_yttrium/clients/i_rust_sign_client.dart'; +import 'package:reown_yttrium/clients/rust_sign_client.dart'; export 'utils/signature_utils.dart'; +export 'clients/models/chain_abstraction.dart'; +export 'clients/models/rust_sign_client.dart'; +export 'clients/models/shared.dart'; class ReownYttrium { - ReownYttriumPlatform get _yttrium => ReownYttriumPlatform.instance; + ReownYttrium._internal(); - Future init({ - required String projectId, - required PulseMetadataCompat pulseMetadata, - }) async { - return await _yttrium.init( - projectId: projectId, - pulseMetadata: pulseMetadata, - ); - } + static final _instance = ReownYttrium._internal(); + factory ReownYttrium() => _instance; - Future erc20TokenBalance({ - required String chainId, - required String token, - required String owner, - }) async { - return await _yttrium.erc20TokenBalance( - chainId: chainId, - token: token, - owner: owner, - ); - } + // TODO remove CA + final _chainAbstractionClient = ChainAbstractionClient(); + IChainAbstractionClient get chainAbstractionClient => _chainAbstractionClient; - Future estimateFees({ - required String chainId, - }) async { - return await _yttrium.estimateFees( - chainId: chainId, - ); - } - - Future prepareDetailed({ - required String chainId, - required String from, - required CallCompat call, - required Currency localCurrency, - }) async { - return await _yttrium.prepareDetailed( - chainId: chainId, - from: from, - call: call, - localCurrency: localCurrency, - ); - } - - Future execute({ - required UiFieldsCompat uiFields, - required List routeTxnSigs, - required PrimitiveSignatureCompat initialTxnSig, - }) async { - return await _yttrium.execute( - uiFields: uiFields, - routeTxnSigs: routeTxnSigs, - initialTxnSig: initialTxnSig, - ); - } + final _signClient = SignClient(); + ISignClient get signClient => _signClient; } diff --git a/packages/reown_yttrium/lib/reown_yttrium_method_channel.dart b/packages/reown_yttrium/lib/reown_yttrium_method_channel.dart index 8842c2c1..1b99c686 100644 --- a/packages/reown_yttrium/lib/reown_yttrium_method_channel.dart +++ b/packages/reown_yttrium/lib/reown_yttrium_method_channel.dart @@ -1,186 +1,18 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; -import 'package:reown_yttrium/models/chain_abstraction.dart'; +import 'package:reown_yttrium/channels/events_channel/rust_sign_client_event_channel.dart'; +import 'package:reown_yttrium/channels/methods_channel/chain_abstraction_methods_channel.dart'; +import 'package:reown_yttrium/channels/methods_channel/rust_sign_client_methods_channel.dart'; import 'reown_yttrium_platform_interface.dart'; /// An implementation of [ReownYttriumPlatform] that uses method channels. -class MethodChannelReownYttrium extends ReownYttriumPlatform { - /// The method channel used to interact with the native platform. - @visibleForTesting - final methodChannel = const MethodChannel('reown_yttrium'); - - @override - Future init({ - required String projectId, - required PulseMetadataCompat pulseMetadata, - }) async { - try { - final result = await methodChannel.invokeMethod('init', { - 'projectId': projectId, - 'pulseMetadata': pulseMetadata.toJson(), - }); - return result ?? false; - } on PlatformException catch (e) { - debugPrint('[$runtimeType] init $e'); - rethrow; - } - } - +class MethodChannelReownYttrium extends ReownYttriumPlatformInterface { @override - Future erc20TokenBalance({ - required String chainId, - required String token, - required String owner, - }) async { - try { - return await methodChannel.invokeMethod('erc20TokenBalance', { - 'chainId': chainId, - 'token': token, - 'owner': owner, - }); - } on PlatformException catch (e) { - debugPrint('[$runtimeType] erc20TokenBalance $e'); - rethrow; - } - } + MethodChannelChainAbstraction get chainAbstractionChannel => + MethodChannelChainAbstraction(); @override - Future estimateFees({ - required String chainId, - }) async { - try { - final response = await methodChannel.invokeMethod( - 'estimateFees', - { - 'chainId': chainId, - }, - ); - return Eip1559EstimationCompat.fromJson({ - 'maxPriorityFeePerGas': response['maxPriorityFeePerGas'], - 'maxFeePerGas': response['maxFeePerGas'], - }); - } on PlatformException catch (e) { - debugPrint('[$runtimeType] estimateFees $e'); - rethrow; - } - } + MethodChannelSign get methodChannelSign => MethodChannelSign(); @override - Future prepareDetailed({ - required String chainId, - required String from, - required CallCompat call, - required Currency localCurrency, - }) async { - try { - final response = await methodChannel.invokeMethod( - 'prepareDetailed', - { - 'chainId': chainId, - 'from': from, - 'call': call.toJson(), - 'localCurrency': localCurrency.name, - }, - ); - - if (response.containsKey('available')) { - final responseData = _handlePlatformResult(response['available']); - return PrepareDetailedResponseCompat.success( - value: PrepareDetailedResponseSuccessCompat.available( - value: UiFieldsCompat.fromJson( - responseData, - ), - ), - ); - } - if (response.containsKey('notRequired')) { - final responseData = _handlePlatformResult(response['notRequired']); - return PrepareDetailedResponseCompat.success( - value: PrepareDetailedResponseSuccessCompat.notRequired( - value: PrepareResponseNotRequiredCompat.fromJson( - responseData, - ), - ), - ); - } - if ((response ?? {}).containsKey('error')) { - final error = response!['error']!['error']; - final reason = response!['error']?['reason']; - return PrepareDetailedResponseCompat.error( - value: PrepareResponseError( - error: BridgingError.fromString(error), - reason: reason ?? response['reason'] ?? '', - ), - ); - } - throw PlatformException( - code: 'prepareDetailed', - message: 'unable to parse response', - ); - } on PlatformException catch (e) { - debugPrint('[$runtimeType] prepareDetailed $e'); - rethrow; - } catch (e, s) { - debugPrint('[$runtimeType] prepareDetailed $e'); - debugPrint(s.toString()); - rethrow; - } - } - - /// --------------------------------- - /// ⚠️ This method is experimental. Use with caution. - /// --------------------------------- - @override - Future execute({ - required UiFieldsCompat uiFields, - required List routeTxnSigs, - required PrimitiveSignatureCompat initialTxnSig, - }) async { - try { - final response = await methodChannel.invokeMethod( - 'execute', - { - 'orchestrationId': uiFields.routeResponse.orchestrationId, - 'routeTxnSigs': routeTxnSigs.map((e) => e.hexValue).toList(), - 'initialTxnSig': initialTxnSig.hexValue, - }, - ); - - if (response is Map) { - return ExecuteDetailsCompat( - initialTxnReceipt: response['initialTxnReceipt'] as String, - initialTxnHash: response['initialTxnHash'] as String, - ); - } - - throw PlatformException( - code: 'execute', - message: 'unable to parse response', - ); - } on PlatformException catch (e) { - debugPrint('[$runtimeType] execute $e'); - rethrow; - } catch (e, s) { - debugPrint('[$runtimeType] prepareDetailed $e'); - debugPrint(s.toString()); - rethrow; - } - } - - dynamic _handlePlatformResult(dynamic input) { - if (input == null) { - return null; // Handle null explicitly - } else if (input is Map) { - return input.map((key, value) { - // Recursively convert the value, preserving its type - return MapEntry('$key', _handlePlatformResult(value)); - }); - } else if (input is List) { - // Handle lists by recursively converting their elements - return input.map((item) => _handlePlatformResult(item)).toList(); - } - // Return scalar values (int, String, bool, double, etc.) as-is - return input; - } + EventChannelSign get eventChannelSign => EventChannelSign(); } diff --git a/packages/reown_yttrium/lib/reown_yttrium_platform_interface.dart b/packages/reown_yttrium/lib/reown_yttrium_platform_interface.dart index 45cd406f..61d35811 100644 --- a/packages/reown_yttrium/lib/reown_yttrium_platform_interface.dart +++ b/packages/reown_yttrium/lib/reown_yttrium_platform_interface.dart @@ -1,54 +1,34 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; -import 'package:reown_yttrium/models/chain_abstraction.dart'; +import 'package:reown_yttrium/channels/events_channel/rust_sign_client_event_channel.dart'; +import 'package:reown_yttrium/channels/methods_channel/chain_abstraction_methods_channel.dart'; +import 'package:reown_yttrium/channels/methods_channel/rust_sign_client_methods_channel.dart'; import 'reown_yttrium_method_channel.dart'; -abstract class ReownYttriumPlatform extends PlatformInterface { - /// Constructs a ReownYttriumPlatform. - ReownYttriumPlatform() : super(token: _token); +abstract class ReownYttriumPlatformInterface extends PlatformInterface { + /// Constructs a ReownYttriumPlatformInterface. + ReownYttriumPlatformInterface() : super(token: _token); static final Object _token = Object(); - static ReownYttriumPlatform _instance = MethodChannelReownYttrium(); + static ReownYttriumPlatformInterface _instance = MethodChannelReownYttrium(); - /// The default instance of [ReownYttriumPlatform] to use. + /// The default instance of [ReownYttriumPlatformInterface] to use. /// /// Defaults to [MethodChannelReownYttrium]. - static ReownYttriumPlatform get instance => _instance; + static ReownYttriumPlatformInterface get instance => _instance; /// Platform-specific implementations should set this with their own - /// platform-specific class that extends [ReownYttriumPlatform] when + /// platform-specific class that extends [ReownYttriumPlatformInterface] when /// they register themselves. - static set instance(ReownYttriumPlatform instance) { + static set instance(ReownYttriumPlatformInterface instance) { PlatformInterface.verifyToken(instance, _token); _instance = instance; } - Future init({ - required String projectId, - required PulseMetadataCompat pulseMetadata, - }); - - Future erc20TokenBalance({ - required String chainId, - required String token, - required String owner, - }); - - Future estimateFees({ - required String chainId, - }); - - Future prepareDetailed({ - required String chainId, - required String from, - required CallCompat call, - required Currency localCurrency, - }); - - Future execute({ - required UiFieldsCompat uiFields, - required List routeTxnSigs, - required PrimitiveSignatureCompat initialTxnSig, - }); + // TODO remove CA + abstract final MethodChannelChainAbstraction chainAbstractionChannel; + + abstract final MethodChannelSign methodChannelSign; + abstract final EventChannelSign eventChannelSign; } diff --git a/packages/reown_yttrium/lib/utils/channel_utils.dart b/packages/reown_yttrium/lib/utils/channel_utils.dart new file mode 100644 index 00000000..25447ae1 --- /dev/null +++ b/packages/reown_yttrium/lib/utils/channel_utils.dart @@ -0,0 +1,17 @@ +class ChannelUtils { + static dynamic handlePlatformResult(dynamic input) { + if (input == null) { + return null; // Handle null explicitly + } else if (input is Map) { + return input.map((key, value) { + // Recursively convert the value, preserving its type + return MapEntry('$key', handlePlatformResult(value)); + }); + } else if (input is List) { + // Handle lists by recursively converting their elements + return input.map((item) => handlePlatformResult(item)).toList(); + } + // Return scalar values (int, String, bool, double, etc.) as-is + return input; + } +} diff --git a/packages/reown_yttrium/lib/utils/signature_utils.dart b/packages/reown_yttrium/lib/utils/signature_utils.dart index 8270003e..254625d7 100644 --- a/packages/reown_yttrium/lib/utils/signature_utils.dart +++ b/packages/reown_yttrium/lib/utils/signature_utils.dart @@ -1,7 +1,7 @@ import 'package:eth_sig_util/eth_sig_util.dart'; import 'package:eth_sig_util/util/bigint.dart'; import 'package:eth_sig_util/util/utils.dart'; -import 'package:reown_yttrium/models/chain_abstraction.dart'; +import 'package:reown_yttrium/clients/models/chain_abstraction.dart'; extension SignatureExtension on String { PrimitiveSignatureCompat toPrimitiveSignature() { diff --git a/packages/reown_yttrium/test/reown_yttrium_test.dart b/packages/reown_yttrium/test/reown_yttrium_test.dart index ed3bb870..07f3e59d 100644 --- a/packages/reown_yttrium/test/reown_yttrium_test.dart +++ b/packages/reown_yttrium/test/reown_yttrium_test.dart @@ -13,7 +13,7 @@ import 'package:reown_yttrium/reown_yttrium_method_channel.dart'; // } void main() { - final ReownYttriumPlatform initialPlatform = ReownYttriumPlatform.instance; + final initialPlatform = ReownYttriumPlatformInterface.instance; test('$MethodChannelReownYttrium is the default instance', () { expect(initialPlatform, isInstanceOf()); diff --git a/scripts/generate_all.sh b/scripts/generate_all.sh index af969a5a..a2664b46 100644 --- a/scripts/generate_all.sh +++ b/scripts/generate_all.sh @@ -5,25 +5,25 @@ echo "******* GENERATING ROOT *******" flutter clean flutter pub get -echo "******* GENERATING CORE *******" +echo "******* GENERATING YTTRIUM *******" -cd packages/reown_core/ +cd packages/reown_yttrium/ sh generate_files.sh cd .. cd .. -echo "******* GENERATING SIGN *******" +echo "******* GENERATING CORE *******" -cd packages/reown_sign/ +cd packages/reown_core/ sh generate_files.sh cd .. cd .. -echo "******* GENERATING YTTRIUM *******" +echo "******* GENERATING SIGN *******" -cd packages/reown_yttrium/ +cd packages/reown_sign/ sh generate_files.sh cd .. @@ -37,15 +37,15 @@ sh generate_files.sh cd .. cd .. -echo "******* GENERATING APPKIT *******" +# echo "******* GENERATING APPKIT *******" -cd packages/reown_appkit/ -sh generate_files.sh +# cd packages/reown_appkit/ +# sh generate_files.sh -cd .. -cd .. +# cd .. +# cd .. -echo "******* GENERATING CLI *******" +# echo "******* GENERATING CLI *******" -cd packages/reown_cli/ -sh generate_files.sh +# cd packages/reown_cli/ +# sh generate_files.sh