Skip to content
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

Make sure Taproot support can be assessed when setting Address types #992

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 43 additions & 32 deletions views/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,6 @@ interface ReceiveState {
routeHints: boolean;
}

const ADDRESS_TYPES = RESTUtils.supportsTaproot()
? [
{
key: localeString('views.Receive.np2wkhKey'),
value: '1',
description: localeString('views.Receive.np2wkhDescription')
},
{
key: localeString('views.Receive.p2wkhKey'),
value: '0',
description: localeString('views.Receive.p2wkhDescription')
},
{
key: localeString('views.Receive.p2trKey'),
value: '4',
description: localeString('views.Receive.p2trDescription')
}
]
: [
{
key: localeString('views.Receive.np2wkhKey'),
value: '1',
description: localeString('views.Receive.np2wkhDescriptionAlt')
},
{
key: localeString('views.Receive.p2wkhKey'),
value: '0',
description: localeString('views.Receive.p2wkhDescription')
}
];

@inject('InvoicesStore', 'SettingsStore', 'UnitsStore', 'FiatStore')
@observer
export default class Receive extends React.Component<
Expand Down Expand Up @@ -270,6 +239,45 @@ export default class Receive extends React.Component<
/>
);

const ADDRESS_TYPES = RESTUtils.supportsTaproot()
? [
{
key: localeString('views.Receive.np2wkhKey'),
value: '1',
description: localeString(
'views.Receive.np2wkhDescription'
)
},
{
key: localeString('views.Receive.p2wkhKey'),
value: '0',
description: localeString(
'views.Receive.p2wkhDescription'
)
},
{
key: localeString('views.Receive.p2trKey'),
value: '4',
description: localeString('views.Receive.p2trDescription')
}
]
: [
{
key: localeString('views.Receive.np2wkhKey'),
value: '1',
description: localeString(
'views.Receive.np2wkhDescriptionAlt'
)
},
{
key: localeString('views.Receive.p2wkhKey'),
value: '0',
description: localeString(
'views.Receive.p2wkhDescription'
)
}
];

return (
<View
style={{
Expand All @@ -287,7 +295,10 @@ export default class Receive extends React.Component<
}
}}
rightComponent={
(RESTUtils.supportsAddressTypeSelection() && selectedIndex === 1) ? <SettingsButton /> : null
RESTUtils.supportsAddressTypeSelection() &&
selectedIndex === 1 ? (
<SettingsButton />
) : null
}
backgroundColor={themeColor('background')}
containerStyle={{
Expand Down
3 changes: 1 addition & 2 deletions views/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ export default class Wallet extends React.Component<WalletProps, {}> {
FeeStore,
UTXOsStore,
SettingsStore,
FiatStore,
navigation
FiatStore
} = this.props;
const {
settings,
Expand Down