Skip to content

Commit

Permalink
Merge pull request #47 from bithyve/main
Browse files Browse the repository at this point in the history
Release v0.1.3 [Live]
  • Loading branch information
ben-kaufman authored Nov 7, 2024
2 parents 5c1d066 + 5ae5659 commit 281f07d
Show file tree
Hide file tree
Showing 63 changed files with 98 additions and 256 deletions.
Binary file modified app-icons/dev-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app-icons/release-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "keeper-desktop",
"private": true,
"version": "0.1.2",
"version": "0.1.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keeper-desktop"
version = "0.1.2"
version = "0.1.3"
description = "Bitcoin Keeper Desktop App"
authors = ["Ben Kaufman"]
repository = "https://github.com/bithyve/keeper-desktop"
Expand Down
Binary file modified src-tauri/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square107x107Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square142x142Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square284x284Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square30x30Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square310x310Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square71x71Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square89x89Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/icon.icns
Binary file not shown.
Binary file modified src-tauri/icons/icon.ico
Binary file not shown.
Binary file modified src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src-tauri/src/hwi/implementations/binary_implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ pub struct BinaryHWIImplementation<T: HWIBinaryExecutor> {
}

impl<T: HWIBinaryExecutor> HWIImplementation for BinaryHWIImplementation<T> {
fn enumerate() -> Result<String, Error> {
let output =
BinaryHWIImplementation::<T>::run_hwi_command(None, false, None, vec!["enumerate"])?;
fn enumerate(chain: Option<HWIChain>) -> Result<String, Error> {
let output = BinaryHWIImplementation::<T>::run_hwi_command(
None,
false,
chain.as_ref(),
vec!["enumerate"],
)?;
Ok(output.to_string())
}

Expand Down
8 changes: 4 additions & 4 deletions src-tauri/src/hwi/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<T: HWIImplementation> HWIClient<T> {
/// # use hwi::implementations::python_implementation::PythonHWIImplementation;
/// # use hwi::error::Error;
/// # fn main() -> Result<(), Error> {
/// let devices = HWIClient::<PythonHWIImplementation>::enumerate()?;
/// let devices = HWIClient::<PythonHWIImplementation>::enumerate(None)?;
/// for device in devices {
/// match device {
/// Ok(d) => println!("I can see a {} here 😄", d.model),
Expand All @@ -43,8 +43,8 @@ impl<T: HWIImplementation> HWIClient<T> {
/// # Ok(())
/// # }
/// ```
pub fn enumerate() -> Result<Vec<Result<HWIDevice, Error>>, Error> {
let output = T::enumerate()?;
pub fn enumerate(chain: Option<HWIChain>) -> Result<Vec<Result<HWIDevice, Error>>, Error> {
let output = T::enumerate(chain)?;
let devices_internal: Vec<HWIDeviceInternal> = deserialize_obj!(&output)?;
Ok(devices_internal.into_iter().map(|d| d.try_into()).collect())
}
Expand All @@ -59,7 +59,7 @@ impl<T: HWIImplementation> HWIClient<T> {
/// # use hwi::error::Error;
/// # use hwi::implementations::python_implementation::PythonHWIImplementation;
/// # fn main() -> Result<(), Error> {
/// let devices = HWIClient::<PythonHWIImplementation>::enumerate()?;
/// let devices = HWIClient::<PythonHWIImplementation>::enumerate(None)?;
/// for device in devices {
/// let device = device?;
/// let client = HWIClient::<PythonHWIImplementation>::get_client(
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/hwi/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub enum HWIWordCount {
}

pub trait HWIImplementation {
fn enumerate() -> Result<String, Error>;
fn enumerate(chain: Option<HWIChain>) -> Result<String, Error>;
fn get_client(device: &HWIDevice, expert: bool, chain: HWIChain) -> Result<Self, Error>
where
Self: Sized;
Expand Down
11 changes: 7 additions & 4 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use device::get_xpub;
use hwi::error::Error;
use hwi::implementations::binary_implementation::BinaryHWIImplementation;
use hwi::interface::HWIClient;
use hwi::types::{HWIBinaryExecutor, HWIDevice, HWIDeviceType};
use hwi::types::{HWIBinaryExecutor, HWIChain, HWIDevice, HWIDeviceType};
#[cfg(target_os = "linux")]
use log::warn;
use serde_json::{json, Value};
Expand Down Expand Up @@ -98,8 +98,11 @@ fn emit_to_channel(state: State<'_, AppState>, event_data: Value) -> Result<(),
// ==================== HWI Commands ====================

#[tauri::command]
async fn hwi_enumerate(_: State<'_, AppState>) -> Result<Vec<Result<HWIDevice, String>>, String> {
HWIAppClient::enumerate()
async fn hwi_enumerate(
_: State<'_, AppState>,
network: Option<bitcoin::Network>,
) -> Result<Vec<Result<HWIDevice, String>>, String> {
HWIAppClient::enumerate(network.map(HWIChain::from))
.map(|devices| {
devices
.into_iter()
Expand Down Expand Up @@ -312,7 +315,7 @@ pub struct HWIBinaryExecutorImpl;
impl HWIBinaryExecutor for HWIBinaryExecutorImpl {
fn execute_command(args: Vec<String>) -> Result<String, Error> {
let mut args = args;
// TODO: Downgrade binaries to HWI 2.x and remove this flag

args.insert(0, "--emulators".to_string());

let output = Command::new_sidecar("hwi")
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Keeper Desktop",
"version": "0.1.2"
"version": "0.1.3"
},
"tauri": {
"allowlist": {
Expand Down
Binary file removed src/assets/fonts/FiraSans/FiraSans-Black.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-BlackItalic.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-Bold.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-BoldItalic.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-ExtraBold.ttf
Binary file not shown.
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-ExtraLight.ttf
Binary file not shown.
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-Italic.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-Light.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-LightItalic.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-Medium.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-MediumItalic.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-Regular.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-SemiBold.ttf
Binary file not shown.
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-Thin.ttf
Binary file not shown.
Binary file removed src/assets/fonts/FiraSans/FiraSans-ThinItalic.ttf
Binary file not shown.
93 changes: 0 additions & 93 deletions src/assets/fonts/FiraSans/OFL.txt

This file was deleted.

Binary file added src/assets/fonts/Inter/Inter-Bold.ttf
Binary file not shown.
Binary file added src/assets/fonts/Inter/Inter-Light.ttf
Binary file not shown.
Binary file added src/assets/fonts/Inter/Inter-Medium.ttf
Binary file not shown.
Binary file added src/assets/fonts/Inter/Inter-Regular.ttf
Binary file not shown.
Binary file added src/assets/fonts/Inter/Inter-SemiBold.ttf
Binary file not shown.
14 changes: 12 additions & 2 deletions src/hooks/useDeviceActions.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { useState } from "react";
import hwiService from "../services/hwiService";
import { HWI_ACTION, HWIDevice, HWIDeviceType } from "../helpers/devices";
import {
HWI_ACTION,
HWIDevice,
HWIDeviceType,
NetworkType,
} from "../helpers/devices";

interface UseDeviceActionsProps {
network: NetworkType | null;
deviceType: HWIDeviceType;
actionType: HWI_ACTION;
psbt: string | null;
Expand All @@ -14,6 +20,7 @@ interface UseDeviceActionsProps {
}

export const useDeviceActions = ({
network,
deviceType,
actionType,
psbt,
Expand All @@ -31,7 +38,10 @@ export const useDeviceActions = ({
try {
switch (actionType) {
case "connect": {
const devices = await hwiService.fetchDevices(deviceType);
const devices = await hwiService.fetchDevices(
deviceType,
network?.toLowerCase(),
);
await onConnectResult(devices);
break;
}
Expand Down
39 changes: 38 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@ html {
margin: 0;
padding: 0;
height: 100%;
font-family: FiraSans, sans-serif;
font-family: Inter;
background: linear-gradient(180deg, #2d6759 30%, #0f7a60 100%);
}

// App Font

@font-face {
font-family: "Inter";
src: url("./assets/fonts/Inter/Inter-Bold.ttf") format("truetype");
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: "Inter";
src: url("./assets/fonts/Inter/Inter-SemiBold.ttf") format("truetype");
font-weight: 600;
font-style: normal;
}

@font-face {
font-family: "Inter";
src: url("./assets/fonts/Inter/Inter-Medium.ttf") format("truetype");
font-weight: 500;
font-style: normal;
}

@font-face {
font-family: "Inter";
src: url("./assets/fonts/Inter/Inter-Regular.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: "Inter";
src: url("./assets/fonts/Inter/Inter-Light.ttf") format("truetype");
font-weight: 300;
font-style: normal;
}
2 changes: 1 addition & 1 deletion src/modals/BaseModal/BaseModal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
font-size: 15px;
color: #3e524d;
margin: 0 7%;
font-weight: light;
font-weight: 300;
line-height: 20px;
}

Expand Down
4 changes: 4 additions & 0 deletions src/modals/DeviceActionModal/DeviceActionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
HWI_DEVICES,
HWIDevice,
HWIDeviceType,
NetworkType,
} from "../../helpers/devices";
import styles from "./DeviceActionModal.module.css";
import baseStyles from "../BaseModal/BaseModal.module.css";
Expand All @@ -15,6 +16,7 @@ import { useDeviceActions } from "../../hooks/useDeviceActions";
interface DeviceActionModalProps {
isOpen: boolean;
onClose: () => void;
network: NetworkType | null;
deviceType: HWIDeviceType;
actionType: HWI_ACTION;
psbt: string | null;
Expand All @@ -37,6 +39,7 @@ const actionTitle = (deviceType: HWIDeviceType) => ({
const DeviceActionModal = ({
isOpen,
onClose,
network,
deviceType,
actionType,
psbt,
Expand All @@ -47,6 +50,7 @@ const DeviceActionModal = ({
onError,
}: DeviceActionModalProps) => {
const { isLoading, handleContinue } = useDeviceActions({
network,
deviceType,
actionType,
psbt,
Expand Down
1 change: 1 addition & 0 deletions src/modals/ModalManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const ModalsManager = ({
<DeviceActionModal
isOpen={openModal === "deviceAction"}
onClose={closeModalHandler}
network={network}
deviceType={deviceType as HWIDeviceType}
actionType={currentAction}
psbt={psbt}
Expand Down
5 changes: 4 additions & 1 deletion src/modals/TrezorPinModal/TrezorPinModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ const TrezorPinModal = ({
setIsLoading(true);
try {
await hwiService.sendPin(pin);
const devices = await hwiService.fetchDevices("trezor");
const devices = await hwiService.fetchDevices(
"trezor",
network?.toLowerCase(),
);
await hwiService.setHWIClient(
devices[0].fingerprint,
"trezor",
Expand Down
4 changes: 2 additions & 2 deletions src/screens/ConnectScreen/ConnectScreen.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
.note p {
margin-top: 5px;
font-size: 12px;
font-weight: 200;
font-weight: 300;
line-height: 17px;
font-weight: 400;
}
Expand Down Expand Up @@ -124,7 +124,7 @@
text-align: center;
font-size: 14px;
font-style: normal;
font-weight: 200;
font-weight: 300;
line-height: 20px;
}

Expand Down
2 changes: 1 addition & 1 deletion src/screens/ConnectScreen/ConnectScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const ConnectScreen = () => {
</button>
</div>
<p className={styles.qrNote}>
Make sure No one is around you when you scan this. You can always
Make sure no one is around you when you scan this. You can always
refresh to get fresh key session.
</p>
</div>
Expand Down
Loading

0 comments on commit 281f07d

Please sign in to comment.