-
Notifications
You must be signed in to change notification settings - Fork 3
feat: transfer to spending from hw wallet #1039
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
Merged
+2,765
−238
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0eb1267
feat: add hw funding account lookup
ovitrif 42ce34b
feat: fund spending from hardware wallet
ovitrif 130a25e
feat: add spending amount hw screen
ovitrif 06c602f
feat: add hw sign and signed screens
ovitrif be20234
feat: wire hw transfer flow
ovitrif 8ddcc39
test: cover hw transfer view model
ovitrif 3c4dcdf
test: add hw transfer journey
ovitrif 7c1e138
chore: add hw transfer changelog
ovitrif 79c970a
chore: rename changelog fragment
ovitrif 455eb68
fix: track pending hw transfers
ovitrif c0a9e1c
fix: use configured trezor electrum
ovitrif 526d53a
Merge branch 'master' into feat/hw-transfer-to-spending
ovitrif 4dad88c
chore: group hw transfer screens
ovitrif 5af487e
fix: match hw transfer figma visuals
ovitrif 249ba1a
fix: reconnect known ble trezors
ovitrif ad7dc7a
fix: match hw reconnect copy
ovitrif dac6850
fix: refresh hw signing session
ovitrif d36cea3
chore: fix previews text wrap
ovitrif 26ba2a2
chore: code style cleanup
ovitrif 2ecf4d1
fix: harden hardware transfer flow
ovitrif d0865f6
refactor: move hw funding models
ovitrif cb1dc29
fix: harden trezor bridge signing
ovitrif 4673701
refactor: aggregate hw wallet models
ovitrif 56aa8f1
fix: harden hw transfer edge cases
ovitrif 0ee223d
refactor: reuse fee fallback constant
ovitrif 5778f44
refactor: move fee fallback default
ovitrif d9a5314
fix: show hw spending intro
ovitrif e8a5039
fix: handle hw signed effect
ovitrif a5d4dcb
refactor: simplify spending navigation
ovitrif 7583336
fix: preserve reconnect cancellation
ovitrif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package to.bitkit.ext | ||
|
|
||
| import com.synonym.bitkitcore.TrezorTransportType | ||
| import to.bitkit.models.TransportType | ||
|
|
||
| fun TrezorTransportType.toTransportType(): TransportType = when (this) { | ||
| TrezorTransportType.BLUETOOTH -> TransportType.BLUETOOTH | ||
| TrezorTransportType.USB -> TransportType.USB | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| package to.bitkit.models | ||
|
|
||
| import androidx.compose.runtime.Immutable | ||
| import androidx.compose.runtime.Stable | ||
| import com.synonym.bitkitcore.AccountType | ||
| import com.synonym.bitkitcore.Activity | ||
| import com.synonym.bitkitcore.AddressType | ||
| import kotlinx.collections.immutable.ImmutableList | ||
| import kotlinx.collections.immutable.ImmutableSet | ||
| import kotlinx.collections.immutable.persistentSetOf | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| /** A paired hardware wallet tracked as a watch-only balance. */ | ||
| @Stable | ||
| data class HwWallet( | ||
| val id: String, | ||
| val name: String, | ||
| val model: String?, | ||
| val transportType: TransportType, | ||
| val isConnected: Boolean, | ||
| val balanceSats: ULong, | ||
| val activities: ImmutableList<Activity>, | ||
| val fundingBalanceSats: ULong = balanceSats, | ||
| val deviceIds: ImmutableSet<String> = persistentSetOf(id), | ||
| ) | ||
|
|
||
| /** Serializable per-device balance snapshot carried by [BalanceState]. */ | ||
| @Immutable | ||
| @Serializable | ||
| data class HwWalletBalance( | ||
| val id: String, | ||
| val sats: ULong, | ||
| ) | ||
|
|
||
| /** A newly detected inbound transaction to a watched hardware wallet. */ | ||
| @Immutable | ||
| data class HwWalletReceivedTx( | ||
| val txid: String, | ||
| val sats: ULong, | ||
| ) | ||
|
|
||
| sealed interface HwFundingAccount { | ||
| val vendor: HwWalletVendor | ||
| val xpub: String | ||
| val addressType: HwFundingAddressType | ||
| val accountType: AccountType | ||
| val balanceSats: ULong | ||
|
|
||
| data class Trezor( | ||
| override val xpub: String, | ||
| override val addressType: HwFundingAddressType, | ||
| override val balanceSats: ULong, | ||
| ) : HwFundingAccount { | ||
| override val vendor: HwWalletVendor = HwWalletVendor.TREZOR | ||
| override val accountType: AccountType | ||
| get() = addressType.accountType | ||
| } | ||
| } | ||
|
|
||
| data class HwFundingTransaction( | ||
| val psbt: String, | ||
| val miningFeeSats: ULong, | ||
| val feeRate: Float, | ||
| val totalSpent: ULong, | ||
| val satsPerVByte: ULong, | ||
| ) | ||
|
|
||
| data class HwFundingBroadcastResult( | ||
| val txId: String, | ||
| val miningFeeSats: ULong, | ||
| val feeRate: ULong, | ||
| val totalSpent: ULong, | ||
| ) | ||
|
|
||
| enum class HwWalletVendor { | ||
| TREZOR, | ||
| } | ||
|
ovitrif marked this conversation as resolved.
|
||
|
|
||
| enum class HwFundingAddressType( | ||
| val addressType: AddressType, | ||
| ) { | ||
| LEGACY(AddressType.P2PKH), | ||
| NESTED_SEGWIT(AddressType.P2SH), | ||
| NATIVE_SEGWIT(AddressType.P2WPKH), | ||
| TAPROOT(AddressType.P2TR); | ||
|
|
||
| val settingsKey: String | ||
| get() = addressType.toSettingsString() | ||
|
|
||
| val accountType: AccountType | ||
| get() = addressType.toAccountType() | ||
|
|
||
| companion object { | ||
| val DEFAULT: HwFundingAddressType = entries.first { it.addressType == DEFAULT_ADDRESS_TYPE } | ||
| } | ||
| } | ||
|
|
||
| fun HwWallet.toBalance() = HwWalletBalance(id = id, sats = balanceSats) | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package to.bitkit.models | ||
|
|
||
| import androidx.compose.runtime.Immutable | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| @Immutable | ||
| data class KnownDevice( | ||
| val id: String, | ||
| val name: String?, | ||
| val path: String, | ||
| val transportType: TransportType, | ||
| val label: String?, | ||
| val model: String?, | ||
| val lastConnectedAt: Long, | ||
| /** Account-level extended public keys per address type. */ | ||
| val xpubs: Map<String, String> = emptyMap(), | ||
| /** Bitkit-side funds label set by the user while pairing; null until renamed within Bitkit. */ | ||
| val customLabel: String? = null, | ||
| /** Stable app-owned id for future wallet-scoped hardware activity metadata. */ | ||
| val walletId: String = "", | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.