Skip to content

Commit

Permalink
Reviewed and completed TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBespalov committed Apr 9, 2024
1 parent 8ebb24c commit 242261a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class OwnerInfoKeystoneFragment : BaseViewBindingFragment<FragmentOwnerInfoKeyst

if (it.startsWith(UR_PREFIX_OF_HDKEY)) {
this.ur?.let { ur ->
// TODO KST: parseExtendedPublicKey(ur) -> parseAccount(ur)
val hdKey = keystoneSDK.parseAccount(ur)

findNavController().navigate(
Expand All @@ -77,7 +76,6 @@ class OwnerInfoKeystoneFragment : BaseViewBindingFragment<FragmentOwnerInfoKeyst
}
} else if (it.startsWith(UR_PREFIX_OF_ACCOUNT)) {
this.ur?.let { ur ->
// TODO KST: parseMultiPublicKeys -> parseCryptoAccount (or parseMultiAccounts?)
val multiHDKeys = keystoneSDK.parseCryptoAccount(ur)

findNavController().navigate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ class KeystoneOwnerSelectionViewModel
fun getOwnerData(): Triple<String, String, String> {
multiHDKeys?.let {
val hdKey = it.keys[ownerIndex.toInt()]
// TODO KST: hdKey.sourceFingerprint -> hdKey.xfp
return Triple(hdKey.toAddress().asEthereumAddressString(), derivationPath(ownerIndex), hdKey.xfp)
} ?: run {
val address = derivator.addressesForPage(ownerIndex, 1)[0]
// TODO KST: hdKey.sourceFingerprint -> hdKey.xfp
return Triple(address.asEthereumAddressString(), derivationPath(ownerIndex), hdKey!!.xfp)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class PublicKeyAndAddressDerivator: PublicKeyDerivator, PublicAddressDerivator {

private fun derivedKeyForIndex(index: Long): ByteArray {
val path = if (hdKey.note == Note.LEDGER_LEGACY.value) "m/$index" else "m/0/$index"
// TODO KST: hdKey.xpub? what should be parameter here? xfp? publicKey? must be a root hd node
return sdk.derivePublicKey(hdKey.getExtendedPublicKey(), path).hexStringToByteArray()
}
}

0 comments on commit 242261a

Please sign in to comment.