Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
30d2b78
ledger connection working in demo
B0Y3R-AVA Aug 5, 2025
4f63df2
iOS able to pull addresses from ledger and create a new wallet, also …
B0Y3R-AVA Aug 8, 2025
a89dc30
connection and wallet creation working
B0Y3R-AVA Aug 10, 2025
26eabbd
avax / solana txs working, can pull addresses from ledger, create led…
B0Y3R-AVA Aug 11, 2025
101f94a
ledger provider, modifications to wallet, ui now using hook
B0Y3R-AVA Aug 12, 2025
7fb2527
docs
B0Y3R-AVA Aug 12, 2025
503cbae
linting
B0Y3R-AVA Aug 19, 2025
4be9aff
ledger live address derivation working, transactiosn on avalanche and…
B0Y3R-AVA Sep 11, 2025
4caa6a3
ledger live wallet creation / demo ui flow much better
B0Y3R-AVA Sep 14, 2025
ecff41e
working on add account flow
B0Y3R-AVA Sep 15, 2025
62f6ef3
feature flag for ledger support
B0Y3R-AVA Sep 15, 2025
4c69b92
small fix for import wallet screen
B0Y3R-AVA Sep 15, 2025
00ee641
linting fixes
B0Y3R-AVA Sep 17, 2025
aa9258f
cleanup
B0Y3R-AVA Sep 17, 2025
3472d68
test fixes
B0Y3R-AVA Sep 17, 2025
ebc9a43
ios bluetooth permissions
B0Y3R-AVA Sep 17, 2025
df32fad
ios bluetooth permissions for internal release build
B0Y3R-AVA Sep 17, 2025
02d6665
removed unused .mdc file
B0Y3R-AVA Sep 17, 2025
7496033
addressed pr comments
B0Y3R-AVA Sep 23, 2025
6e97863
addresed pr comments
B0Y3R-AVA Sep 26, 2025
f852602
removed ledgerSevice so i can rename
B0Y3R-AVA Sep 26, 2025
ca3b592
readded ledger service with captial letter at start
B0Y3R-AVA Sep 26, 2025
0656314
yarn lock
B0Y3R-AVA Sep 30, 2025
f0f28cd
working on pr comments
B0Y3R-AVA Oct 1, 2025
d99164d
yarn lock
B0Y3R-AVA Oct 1, 2025
f59a465
linting
B0Y3R-AVA Oct 1, 2025
731ce90
moved common use types out of ledger wallet hook
B0Y3R-AVA Oct 1, 2025
d62bbb9
linting fixing of transport type with resolution
B0Y3R-AVA Oct 1, 2025
ca26abe
fixed import issue
B0Y3R-AVA Oct 1, 2025
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
65 changes: 65 additions & 0 deletions docs/ledger-flows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Ledger Integration Documentation

This directory contains documentation for the current Ledger device integration in Core Mobile.

## Contents

1. [Ledger Connection Flow](./ledger-connection.md)
- Device discovery and connection
- Account setup process
- Error handling

2. [Transaction Signing Flow](./transaction-signing.md)
- Transaction signing overview
- Chain-specific implementations
- Error handling

## Key Components

### Services
- `LedgerService`: Manages device connection and app detection
- `LedgerWallet`: Implements wallet interface for Ledger devices
- `WalletService`: Coordinates transaction signing across wallet types

### Hooks
- `useLedgerWallet`: React hook for Ledger device management

### UI Components
- `ConnectWallet`: Device discovery and connection UI
- `ConfirmAddresses`: Account setup and verification UI

## Dependencies

- `@ledgerhq/react-native-hw-transport-ble`: Bluetooth transport
- `@ledgerhq/hw-app-solana`: Solana app integration
- `@avalabs/hw-app-avalanche`: Avalanche app integration
- `@ledgerhq/hw-app-eth`: Ethereum app integration

## Implementation Notes

1. **Bluetooth Connectivity**
- Uses BLE for device communication
- Implements connection monitoring
- Handles connection recovery

2. **Multi-Chain Support**
- Supports EVM, Solana, and Avalanche chains
- Handles app switching
- Manages different transaction formats

3. **Security Considerations**
- Implements secure device pairing
- Validates addresses and transactions
- Handles sensitive data appropriately

4. **Error Handling**
- Comprehensive error types
- User-friendly error messages
- Recovery procedures

## Recent Updates

- Successfully implemented legacy transaction format for EVM chains
- Added proper RLP encoding for transactions
- Implemented correct signature handling
- Added connection monitoring and recovery
167 changes: 167 additions & 0 deletions docs/ledger-flows/ledger-connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Ledger Connection Flow

This document describes the current implementation of Ledger device connection and account setup in Core Mobile.

## Device Discovery and Connection

### Flow Diagram

```mermaid
sequenceDiagram
box User Interface
participant User
end
box Core Mobile
participant App
end
box External Devices
participant BLE
participant Ledger
end

User->>App: Initiate Add Ledger
App->>BLE: Check Bluetooth Status

alt Bluetooth Disabled
BLE-->>App: Status: Disabled
App-->>User: Show Enable Bluetooth Prompt
User->>BLE: Enable Bluetooth
end

App->>BLE: Request Permissions

alt Permissions Denied
BLE-->>App: Permission Denied
App-->>User: Show Permission Request
User->>BLE: Grant Permissions
end

App->>BLE: Start Device Scan
BLE->>Ledger: Discover Devices
Ledger-->>BLE: Device Info
BLE-->>App: Available Devices
App-->>User: Display Device List

Note over User,App: User selects device from list

User->>App: Select Device
App->>Ledger: Initiate Connection
Ledger-->>App: Connection Established
App-->>User: Show Success & Continue
```

## Account Setup Flow

### Flow Diagram

```mermaid
sequenceDiagram
box User Interface
participant User
end
box Core Mobile
participant App
participant Store
end
box External Device
participant Ledger
end

User->>App: Continue to Address Setup

Note over App,Ledger: Solana Setup Phase
App->>Ledger: Request Solana App
Ledger-->>User: Prompt: Open Solana App
User->>Ledger: Open Solana App
App->>Ledger: Get Solana Keys
Ledger-->>App: Solana Public Keys

Note over App,Ledger: Avalanche Setup Phase
App->>Ledger: Request Avalanche App
Ledger-->>User: Prompt: Open Avalanche App
User->>Ledger: Open Avalanche App
App->>Ledger: Get Avalanche Keys
Ledger-->>App: Avalanche Public Keys

Note over App,Store: Storage Phase
App->>Store: Create Wallet Entry
Store-->>App: Wallet Created
App->>Store: Create Account Entry
Store-->>App: Account Created

App-->>User: Show Success
```

## Error Handling

### Flow Diagram

```mermaid
stateDiagram-v2
direction LR

[*] --> CheckBluetooth

state "Bluetooth Check" as CheckBluetooth {
[*] --> Checking
Checking --> Available
Checking --> Disabled
Disabled --> Settings
Settings --> Checking
}

state "Permission Check" as PermissionCheck {
[*] --> Requesting
Requesting --> Granted
Requesting --> Denied
Denied --> RequestAgain
RequestAgain --> Requesting
}

state "Device Connection" as DeviceConnection {
[*] --> Scanning
Scanning --> Found
Scanning --> NotFound
Found --> Connecting
Connecting --> Connected
Connecting --> Failed
}

CheckBluetooth --> PermissionCheck: Available
PermissionCheck --> DeviceConnection: Granted
DeviceConnection --> [*]: Connected

state "Error Recovery" as ErrorRecovery {
[*] --> IdentifyError
IdentifyError --> ShowMessage
ShowMessage --> RecoverySteps
RecoverySteps --> [*]
}

Disabled --> ErrorRecovery
Denied --> ErrorRecovery
Failed --> ErrorRecovery
NotFound --> ErrorRecovery

ErrorRecovery --> CheckBluetooth: Retry
```

### Error Types and Handling

1. **Bluetooth Errors**
- Bluetooth unavailable
- Bluetooth disabled
- Permission denied

2. **Connection Errors**
- Device not found
- Connection timeout
- Pairing removed
- Connection lost

3. **App Errors**
- App not open
- Wrong app open
- App version mismatch

Each error type has specific handling and user messaging to guide through recovery steps.
Loading
Loading