diff --git a/Cargo.lock b/Cargo.lock index 8f9089ed..a5355c12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5836,6 +5836,7 @@ dependencies = [ "tauri-plugin-opener", "tauri-plugin-os", "tauri-plugin-safe-area-insets", + "tauri-plugin-tangem", "tauri-plugin-window-state", "tauri-specta", "tokio", @@ -7018,6 +7019,16 @@ dependencies = [ "thiserror 2.0.3", ] +[[package]] +name = "tauri-plugin-tangem" +version = "0.0.0" +dependencies = [ + "serde", + "tauri", + "tauri-plugin", + "thiserror 1.0.69", +] + [[package]] name = "tauri-plugin-window-state" version = "2.2.0" diff --git a/Cargo.toml b/Cargo.toml index 701d43ab..bbe6b548 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,11 @@ tauri = "2.3.1" tauri-plugin-clipboard-manager = "2.2.2" tauri-plugin-opener = "2.2.6" tauri-plugin-os = "2.2.1" +tauri-plugin-tangem = { path = "../tauri-plugin-tangem" } +tauri-plugin-http = "2.0.0-rc" +tauri-plugin-window-state = "2.0.0-rc" +tauri-plugin-barcode-scanner = "2.0.0-rc" +tauri-plugin-safe-area-insets = "0.1.0" tauri-build = "2.0.6" # Specta diff --git a/package.json b/package.json index 793166bc..603290dc 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "tauri-plugin-safe-area-insets": "^0.1.0", + "tauri-plugin-tangem-api": "link:../tauri-plugin-tangem", "usehooks-ts": "^3.1.0", "zod": "^3.23.8", "zustand": "^4.5.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a5bf2d70..1c42b7c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -161,6 +161,9 @@ importers: tauri-plugin-safe-area-insets: specifier: ^0.1.0 version: 0.1.0 + tauri-plugin-tangem-api: + specifier: link:../tauri-plugin-tangem + version: link:../tauri-plugin-tangem usehooks-ts: specifier: ^3.1.0 version: 3.1.0(react@18.3.1) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2fce7cce..422866c6 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -31,6 +31,11 @@ tokio = { workspace = true } chia-wallet-sdk = { workspace = true, features = ["rustls"] } tauri-plugin-opener = { workspace = true } tauri-plugin-os = { workspace = true } +tauri-plugin-tangem = { workspace = true } +tauri-plugin-http = { workspace = true } +tauri-plugin-window-state = { workspace = true } +tauri-plugin-barcode-scanner = { workspace = true } +tauri-plugin-safe-area-insets = { workspace = true } serde_json = { workspace = true, features = ["arbitrary_precision"] } tracing = { workspace = true } anyhow = { workspace = true } @@ -39,14 +44,10 @@ rustls = { workspace = true } # This is to ensure that the bindgen feature is enabled for the aws-lc-rs crate. # https://aws.github.io/aws-lc-rs/platform_support.html#tested-platforms aws-lc-rs = { version = "1", features = ["bindgen"] } -tauri-plugin-http = "2.0.0-rc" [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] -tauri-plugin-window-state = "2.0.0-rc" [target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies] -tauri-plugin-barcode-scanner = "2.0.0-rc" -tauri-plugin-safe-area-insets = "0.1.0" [build-dependencies] tauri-build = { workspace = true, features = [] } diff --git a/src-tauri/capabilities/desktop.json b/src-tauri/capabilities/desktop.json index 7212a3fd..3bec78b1 100644 --- a/src-tauri/capabilities/desktop.json +++ b/src-tauri/capabilities/desktop.json @@ -1,4 +1,5 @@ { + "$schema": "../gen/schemas/desktop-schema.json", "identifier": "desktop-capability", "platforms": ["macOS", "windows", "linux"], "permissions": ["window-state:default"] diff --git a/src-tauri/capabilities/mobile.json b/src-tauri/capabilities/mobile.json index 00d31369..036b8e9a 100644 --- a/src-tauri/capabilities/mobile.json +++ b/src-tauri/capabilities/mobile.json @@ -1,6 +1,11 @@ { + "$schema": "../gen/schemas/mobile-schema.json", "identifier": "mobile-capability", "windows": ["main"], "platforms": ["android", "iOS"], - "permissions": ["safe-area-insets:default", "barcode-scanner:default"] + "permissions": [ + "safe-area-insets:default", + "barcode-scanner:default", + "tangem:default" + ] } diff --git a/src-tauri/gen/apple/LaunchScreen.storyboard b/src-tauri/gen/apple/LaunchScreen.storyboard index dd79351e..81b5f90e 100644 --- a/src-tauri/gen/apple/LaunchScreen.storyboard +++ b/src-tauri/gen/apple/LaunchScreen.storyboard @@ -1,5 +1,5 @@ - + diff --git a/src-tauri/gen/apple/Podfile b/src-tauri/gen/apple/Podfile index 6d1beac4..8fa705b1 100644 --- a/src-tauri/gen/apple/Podfile +++ b/src-tauri/gen/apple/Podfile @@ -1,7 +1,7 @@ # Uncomment the next line to define a global platform for your project target 'sage-tauri_iOS' do -platform :ios, '13.0' +platform :ios, '15.0' # Pods for sage-tauri_iOS end diff --git a/src-tauri/gen/apple/project.yml b/src-tauri/gen/apple/project.yml index 1cb48e16..8d975db8 100644 --- a/src-tauri/gen/apple/project.yml +++ b/src-tauri/gen/apple/project.yml @@ -2,7 +2,7 @@ name: sage-tauri options: bundleIdPrefix: com.rigidnetwork.sage deploymentTarget: - iOS: 13.0 + iOS: 15.0 fileGroups: [../../src] configs: debug: debug @@ -12,6 +12,7 @@ settingGroups: base: PRODUCT_NAME: Sage PRODUCT_BUNDLE_IDENTIFIER: com.rigidnetwork.sage + DEVELOPMENT_TEAM: NQJQRYZZG3 targetTemplates: app: type: application @@ -51,8 +52,8 @@ targets: - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - CFBundleShortVersionString: 0.1.0 - CFBundleVersion: 0.1.0 + CFBundleShortVersionString: 0.10.1 + CFBundleVersion: 0.10.1 entitlements: path: sage-tauri_iOS/sage-tauri_iOS.entitlements scheme: diff --git a/src-tauri/gen/apple/sage-tauri.xcodeproj/project.pbxproj b/src-tauri/gen/apple/sage-tauri.xcodeproj/project.pbxproj index 34146cdf..15379b54 100644 --- a/src-tauri/gen/apple/sage-tauri.xcodeproj/project.pbxproj +++ b/src-tauri/gen/apple/sage-tauri.xcodeproj/project.pbxproj @@ -35,22 +35,13 @@ 4A3D52136706249F106003A2 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; 4F5E5720FDE8B96D681CBAED /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 518875D00FD14133C61149AB /* commands.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = commands.rs; sourceTree = ""; }; - 7F4AE3FD85419DB6C21E0D60 /* data.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = data.rs; sourceTree = ""; }; 7F5BF2F34A8FE054D23E3F41 /* lib.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = lib.rs; sourceTree = ""; }; - 893D302D4C4EDB40E4B55D37 /* wallet_info.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = wallet_info.rs; sourceTree = ""; }; 99381C16136E96C3E129FD55 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = ""; }; 9B47ECAF54C86639AF69E484 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; 9BE24BD519EDDCAD25BB3710 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; A5A605B7CB8DC8CA37D58A02 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = SOURCE_ROOT; }; - B21A22BA09E13A56C775180C /* models.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = models.rs; sourceTree = ""; }; BCDAEB1DE5FD02983C866661 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; }; - BD0237FE31D6F7BB679551C7 /* wallet_secrets.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = wallet_secrets.rs; sourceTree = ""; }; - C3CA5C59E12700C0697667EB /* actions.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = actions.rs; sourceTree = ""; }; - D0FC0F0F666AB69665597074 /* sync_event.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = sync_event.rs; sourceTree = ""; }; - EFD3C13026CD2B6A72171CD6 /* keys.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = keys.rs; sourceTree = ""; }; - F051B947A7DEBAF5B2BB6703 /* transactions.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = transactions.rs; sourceTree = ""; }; F7817F2DF56B54F478F55A1C /* error.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = error.rs; sourceTree = ""; }; - FAC6C2B458EA8C4CF914B2D3 /* settings.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = settings.rs; sourceTree = ""; }; FFAE4B03B84DF1CE0FF7B0B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ @@ -96,16 +87,6 @@ path = Sources; sourceTree = ""; }; - 3BBCB642278EC04F38655EF6 /* models */ = { - isa = PBXGroup; - children = ( - D0FC0F0F666AB69665597074 /* sync_event.rs */, - 893D302D4C4EDB40E4B55D37 /* wallet_info.rs */, - BD0237FE31D6F7BB679551C7 /* wallet_secrets.rs */, - ); - path = models; - sourceTree = ""; - }; 3CF3CF12A7E4842C67184352 /* Externals */ = { isa = PBXGroup; children = ( @@ -121,9 +102,6 @@ F7817F2DF56B54F478F55A1C /* error.rs */, 7F5BF2F34A8FE054D23E3F41 /* lib.rs */, 2304A1988156A19CBDF4A717 /* main.rs */, - B21A22BA09E13A56C775180C /* models.rs */, - D856C1C1C0F61F26341C7400 /* commands */, - 3BBCB642278EC04F38655EF6 /* models */, ); name = src; path = ../../src; @@ -178,18 +156,6 @@ path = "sage-tauri_iOS"; sourceTree = ""; }; - D856C1C1C0F61F26341C7400 /* commands */ = { - isa = PBXGroup; - children = ( - C3CA5C59E12700C0697667EB /* actions.rs */, - 7F4AE3FD85419DB6C21E0D60 /* data.rs */, - EFD3C13026CD2B6A72171CD6 /* keys.rs */, - FAC6C2B458EA8C4CF914B2D3 /* settings.rs */, - F051B947A7DEBAF5B2BB6703 /* transactions.rs */, - ); - path = commands; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -219,6 +185,11 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastUpgradeCheck = 1430; + TargetAttributes = { + 24D652EC5BE9A86367B2B089 = { + DevelopmentTeam = NQJQRYZZG3; + }; + }; }; buildConfigurationList = DA6C23F1856A16A27853A977 /* Build configuration list for PBXProject "sage-tauri" */; compatibilityVersion = "Xcode 14.0"; @@ -271,7 +242,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "pnpm tauri ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}\n"; + shellScript = "pnpm tauri ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}"; }; /* End PBXShellScriptBuildPhase section */ @@ -332,7 +303,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -354,8 +325,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "sage-tauri_iOS/sage-tauri_iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = NQJQRYZZG3; + DEVELOPMENT_TEAM = "NQJQRYZZG3"; ENABLE_BITCODE = NO; "EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64"; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; @@ -367,6 +337,7 @@ LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", + /usr/lib/swift, ); "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = ( "$(inherited)", @@ -448,7 +419,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -471,8 +442,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "sage-tauri_iOS/sage-tauri_iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = NQJQRYZZG3; + DEVELOPMENT_TEAM = "NQJQRYZZG3"; ENABLE_BITCODE = NO; "EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64"; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; @@ -484,6 +454,7 @@ LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", + /usr/lib/swift, ); "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = ( "$(inherited)", diff --git a/src-tauri/gen/apple/sage-tauri.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/src-tauri/gen/apple/sage-tauri.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/src-tauri/gen/apple/sage-tauri.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/src-tauri/gen/apple/sage-tauri_iOS/Info.plist b/src-tauri/gen/apple/sage-tauri_iOS/Info.plist index 73acce72..8df0933c 100644 --- a/src-tauri/gen/apple/sage-tauri_iOS/Info.plist +++ b/src-tauri/gen/apple/sage-tauri_iOS/Info.plist @@ -44,5 +44,7 @@ NSCameraUsageDescription Read QR codes + NFCReaderUsageDescription + Read and write various NFC tags \ No newline at end of file diff --git a/src-tauri/gen/apple/sage-tauri_iOS/sage-tauri_iOS.entitlements b/src-tauri/gen/apple/sage-tauri_iOS/sage-tauri_iOS.entitlements index 0c67376e..2bb4dee1 100644 --- a/src-tauri/gen/apple/sage-tauri_iOS/sage-tauri_iOS.entitlements +++ b/src-tauri/gen/apple/sage-tauri_iOS/sage-tauri_iOS.entitlements @@ -1,5 +1,10 @@ - + + com.apple.developer.nfc.readersession.formats + + TAG + + diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index c3081c75..470964dc 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -142,12 +142,10 @@ pub fn run() { #[cfg(mobile)] { app.handle().plugin(tauri_plugin_barcode_scanner::init())?; - } - - #[cfg(mobile)] - { app.handle().plugin(tauri_plugin_safe_area_insets::init())?; + app.handle().plugin(tauri_plugin_tangem::init())?; } + builder.mount_events(app); let path = app.path().app_data_dir()?; let app_state = AppState::new(Mutex::new(Sage::new(&path))); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 2aadf9b9..d7572216 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -32,7 +32,11 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ] + ], + "iOS": { + "developmentTeam": "NQJQRYZZG3", + "minimumSystemVersion": "15.0" + } }, "$schema": "../node_modules/@tauri-apps/cli/config.schema.json" } diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index d8a23ca2..425ccbec 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -49,6 +49,7 @@ import { LoaderCircleIcon, TrashIcon, WalletIcon } from 'lucide-react'; import { useContext, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; import { useNavigate, useSearchParams } from 'react-router-dom'; +import { scan } from 'tauri-plugin-tangem-api'; import { z } from 'zod'; import { DarkModeContext } from '../App'; import { commands, Network, NetworkConfig, Wallet } from '../bindings'; @@ -593,6 +594,8 @@ function WalletSettings({ fingerprint }: { fingerprint: number }) { const [deriveOpen, setDeriveOpen] = useState(false); const [pending, setPending] = useState(false); + const [card, setCard] = useState(null); + useEffect(() => { commands .getNetworks({}) @@ -674,6 +677,20 @@ function WalletSettings({ fingerprint }: { fingerprint: number }) { return ( + + + {card &&
{card}
} +