Skip to content

Tangem #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 = [] }
Expand Down
1 change: 1 addition & 0 deletions src-tauri/capabilities/desktop.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "desktop-capability",
"platforms": ["macOS", "windows", "linux"],
"permissions": ["window-state:default"]
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/capabilities/mobile.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
2 changes: 1 addition & 1 deletion src-tauri/gen/apple/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17150" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17150" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17122"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/gen/apple/Podfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 4 additions & 3 deletions src-tauri/gen/apple/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: sage-tauri
options:
bundleIdPrefix: com.rigidnetwork.sage
deploymentTarget:
iOS: 13.0
iOS: 15.0
fileGroups: [../../src]
configs:
debug: debug
Expand All @@ -12,6 +12,7 @@ settingGroups:
base:
PRODUCT_NAME: Sage
PRODUCT_BUNDLE_IDENTIFIER: com.rigidnetwork.sage
DEVELOPMENT_TEAM: NQJQRYZZG3
targetTemplates:
app:
type: application
Expand Down Expand Up @@ -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:
Expand Down
53 changes: 12 additions & 41 deletions src-tauri/gen/apple/sage-tauri.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,13 @@
4A3D52136706249F106003A2 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
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 = "<group>"; };
7F4AE3FD85419DB6C21E0D60 /* data.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = data.rs; sourceTree = "<group>"; };
7F5BF2F34A8FE054D23E3F41 /* lib.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = lib.rs; sourceTree = "<group>"; };
893D302D4C4EDB40E4B55D37 /* wallet_info.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = wallet_info.rs; sourceTree = "<group>"; };
99381C16136E96C3E129FD55 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
C3CA5C59E12700C0697667EB /* actions.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = actions.rs; sourceTree = "<group>"; };
D0FC0F0F666AB69665597074 /* sync_event.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = sync_event.rs; sourceTree = "<group>"; };
EFD3C13026CD2B6A72171CD6 /* keys.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = keys.rs; sourceTree = "<group>"; };
F051B947A7DEBAF5B2BB6703 /* transactions.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = transactions.rs; sourceTree = "<group>"; };
F7817F2DF56B54F478F55A1C /* error.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = error.rs; sourceTree = "<group>"; };
FAC6C2B458EA8C4CF914B2D3 /* settings.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = settings.rs; sourceTree = "<group>"; };
FFAE4B03B84DF1CE0FF7B0B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -96,16 +87,6 @@
path = Sources;
sourceTree = "<group>";
};
3BBCB642278EC04F38655EF6 /* models */ = {
isa = PBXGroup;
children = (
D0FC0F0F666AB69665597074 /* sync_event.rs */,
893D302D4C4EDB40E4B55D37 /* wallet_info.rs */,
BD0237FE31D6F7BB679551C7 /* wallet_secrets.rs */,
);
path = models;
sourceTree = "<group>";
};
3CF3CF12A7E4842C67184352 /* Externals */ = {
isa = PBXGroup;
children = (
Expand All @@ -121,9 +102,6 @@
F7817F2DF56B54F478F55A1C /* error.rs */,
7F5BF2F34A8FE054D23E3F41 /* lib.rs */,
2304A1988156A19CBDF4A717 /* main.rs */,
B21A22BA09E13A56C775180C /* models.rs */,
D856C1C1C0F61F26341C7400 /* commands */,
3BBCB642278EC04F38655EF6 /* models */,
);
name = src;
path = ../../src;
Expand Down Expand Up @@ -178,18 +156,6 @@
path = "sage-tauri_iOS";
sourceTree = "<group>";
};
D856C1C1C0F61F26341C7400 /* commands */ = {
isa = PBXGroup;
children = (
C3CA5C59E12700C0697667EB /* actions.rs */,
7F4AE3FD85419DB6C21E0D60 /* data.rs */,
EFD3C13026CD2B6A72171CD6 /* keys.rs */,
FAC6C2B458EA8C4CF914B2D3 /* settings.rs */,
F051B947A7DEBAF5B2BB6703 /* transactions.rs */,
);
path = commands;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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)";
Expand All @@ -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;
Expand All @@ -367,6 +337,7 @@
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
/usr/lib/swift,
);
"LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = (
"$(inherited)",
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -484,6 +454,7 @@
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
/usr/lib/swift,
);
"LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = (
"$(inherited)",
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions src-tauri/gen/apple/sage-tauri_iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@
</array>
<key>NSCameraUsageDescription</key>
<string>Read QR codes</string>
<key>NFCReaderUsageDescription</key>
<string>Read and write various NFC tags</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
<dict>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
</array>
</dict>
</plist>
6 changes: 2 additions & 4 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
6 changes: 5 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
17 changes: 17 additions & 0 deletions src/pages/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -593,6 +594,8 @@ function WalletSettings({ fingerprint }: { fingerprint: number }) {
const [deriveOpen, setDeriveOpen] = useState(false);
const [pending, setPending] = useState(false);

const [card, setCard] = useState<string | null>(null);

useEffect(() => {
commands
.getNetworks({})
Expand Down Expand Up @@ -674,6 +677,20 @@ function WalletSettings({ fingerprint }: { fingerprint: number }) {

return (
<SettingsSection title={t`Wallet`}>
<Button
onClick={() => {
scan()
.then((data) => setCard(JSON.stringify(data, null, 2)))
.catch((error) =>
addError({ kind: 'internal', reason: JSON.stringify(error) }),
);
}}
>
Scan
</Button>

{card && <pre>{card}</pre>}

<SettingItem
label={t`Wallet Name`}
description={t`Give your wallet a memorable name`}
Expand Down
Loading