Skip to content

Commit a7a6d88

Browse files
committed
wip
1 parent 97e73ec commit a7a6d88

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

scripts/ci/get-connect-dependencies-to-release.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const checkNonReleasedDependencies = async (packageName: string) => {
2121
);
2222

2323
const packageJSON = JSON.parse(rawPackageJSON);
24+
console.log('packageJSON', packageJSON);
2425
const {
2526
version: localVersion,
2627
dependencies,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { useSelector } from 'react-redux';
2+
3+
import {
4+
AccountsRootState,
5+
selectAccountByKey,
6+
selectSelectedDevice,
7+
} from '@suite-common/wallet-core';
8+
import { useAlert } from '@suite-native/alerts';
9+
import { Button, useBottomSheetModal } from '@suite-native/atoms';
10+
import { Translation, useTranslate } from '@suite-native/intl';
11+
import { SUITE_MOBILE_SUPPORT_URL, useOpenLink } from '@suite-native/link';
12+
import { localFirstToBip329, selectAddressLabels, selectOutputLabels, WithLabelingState } from '@suite-common/local-first-storage';
13+
14+
export const AccountSettingsExportBip329Button = ({ accountKey }: { accountKey: string }) => {
15+
const account = useSelector((state: AccountsRootState) =>
16+
selectAccountByKey(state, accountKey),
17+
);
18+
const device = useSelector(selectSelectedDevice);
19+
const staticSessionId = device?.state?.staticSessionId;
20+
21+
const labels = useSelector((state: WithLabelingState) => {
22+
console.log('staticSessionId', staticSessionId);
23+
if (!staticSessionId) return {outputLabels: [], addressLabels: []};
24+
const outputLabels = selectOutputLabels(state, staticSessionId);
25+
console.log('outputLabels', outputLabels);
26+
27+
const addressLabels = selectAddressLabels({state, deviceStaticSessionId: staticSessionId});
28+
return {outputLabels, addressLabels}
29+
});
30+
31+
console.log('labels', labels);
32+
33+
34+
35+
const exportBip329 = () => {
36+
console.log('exportBip329');
37+
// const handleExportBip329 = () => dispatch(exportMetadataToBip329File());
38+
// console.log('handleExportBip329');
39+
const labelsToExport = localFirstToBip329({
40+
outputLabels: labels.outputLabels,
41+
addressLabels: labels.addressLabels,
42+
allSpendable: true,
43+
});
44+
45+
console.log('labelsToExport', labelsToExport);
46+
};
47+
48+
if (!account) return null;
49+
50+
const buttonTitle = 'Export BIP329 Data';
51+
52+
return (
53+
<>
54+
<Button size="large" onPress={exportBip329} colorScheme="tertiaryElevation0">
55+
{buttonTitle}
56+
</Button>
57+
</>
58+
);
59+
};

suite-native/module-accounts-management/src/screens/AccountSettingsScreen.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import { AccountRenameButton } from '../components/AccountRenameButton';
2424
import { AccountSettingsRemoveCoinButton } from '../components/AccountSettingsRemoveCoinButton';
2525
import { AccountSettingsShowXpubButton } from '../components/AccountSettingsShowXpubButton';
26+
import { AccountSettingsExportBip329Button } from '../components/AccountSettingsExportBip329Button';
2627

2728
const AccountDetailSettingsRow = ({
2829
title,
@@ -72,6 +73,8 @@ export const AccountSettingsScreen = ({
7273

7374
if (!account) return null;
7475

76+
const isBitcoinAccount = account.networkType === 'bitcoin';
77+
7578
return (
7679
<Screen
7780
header={
@@ -103,6 +106,10 @@ export const AccountSettingsScreen = ({
103106
</VStack>
104107
</Card>
105108
<VStack spacing="sp16">
109+
{/* TODO(karliatto): add here the new export BIP329 button */}
110+
{isBitcoinAccount && (
111+
<AccountSettingsExportBip329Button accountKey={account.key} />
112+
)}
106113
<AccountSettingsShowXpubButton accountKey={account.key} />
107114
{isPortfolioTrackerDevice && (
108115
<AccountSettingsRemoveCoinButton accountKey={account.key} />

0 commit comments

Comments
 (0)