-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support bitcoin ledger, closes #2893
- Loading branch information
1 parent
b7a34a9
commit 8a81f58
Showing
114 changed files
with
1,532 additions
and
896 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"prettier.documentSelectors": ["src/**/*.{ts,tsx}", "*.{js,json}"], | ||
"vitest.include": ["src/**/*.spec.ts"], | ||
"githubPullRequests.ignoredPullRequestBranches": ["dev"], | ||
"editor.folding": false | ||
"githubPullRequests.ignoredPullRequestBranches": ["dev"] | ||
} |
This file contains 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
35 changes: 35 additions & 0 deletions
35
src/app/common/authentication/use-legacy-auth-bitcoin-addresses.ts
This file contains 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,35 @@ | ||
import { bytesToHex } from '@noble/hashes/utils'; | ||
|
||
import { useNativeSegwitNetworkSigners } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks'; | ||
import { useTaprootNetworkSigners } from '@app/store/accounts/blockchain/bitcoin/taproot-account.hooks'; | ||
|
||
export function useGetLegacyAuthBitcoinAddresses() { | ||
const deriveAllNativeSegWitNetworkSigners = useNativeSegwitNetworkSigners(); | ||
const deriveAllTaprootNetworkSigners = useTaprootNetworkSigners(); | ||
|
||
return (accountIndex: number) => { | ||
const taprootAccount = deriveAllTaprootNetworkSigners(accountIndex); | ||
const nativeSegwitAccount = deriveAllNativeSegWitNetworkSigners(accountIndex); | ||
|
||
return { | ||
btcAddress: { | ||
p2tr: { | ||
mainnet: taprootAccount?.mainnet?.payment.address, | ||
testnet: taprootAccount?.testnet?.payment.address, | ||
regtest: taprootAccount?.regtest?.payment.address, | ||
signet: taprootAccount?.signet?.payment.address, | ||
}, | ||
p2wpkh: { | ||
mainnet: nativeSegwitAccount?.mainnet?.payment.address, | ||
testnet: nativeSegwitAccount?.testnet?.payment.address, | ||
regtest: nativeSegwitAccount?.regtest?.payment.address, | ||
signet: nativeSegwitAccount?.signet?.payment.address, | ||
}, | ||
}, | ||
btcPublicKey: { | ||
p2tr: bytesToHex(taprootAccount?.mainnet?.keychain.publicKey!), | ||
p2wpkh: bytesToHex(nativeSegwitAccount?.mainnet?.keychain.publicKey!), | ||
}, | ||
}; | ||
}; | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,21 +1,10 @@ | ||
import { memo } from 'react'; | ||
|
||
import { BoxProps, styled } from 'leather-styles/jsx'; | ||
|
||
import { useAccountDisplayName } from '@app/common/hooks/account/use-account-names'; | ||
import { StacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.models'; | ||
import { styled } from 'leather-styles/jsx'; | ||
|
||
interface AccountNameLayoutProps { | ||
children: React.ReactNode; | ||
} | ||
export const AccountNameLayout = memo(({ children }: AccountNameLayoutProps) => ( | ||
<styled.p textStyle="label.01">{children}</styled.p> | ||
)); | ||
|
||
interface AccountNameProps extends BoxProps { | ||
account: StacksAccount; | ||
} | ||
export const AccountName = memo(({ account }: AccountNameProps) => { | ||
const name = useAccountDisplayName(account); | ||
return <AccountNameLayout>{name}</AccountNameLayout>; | ||
}); |
Oops, something went wrong.