From 666538487ab89ba35d6bb2b5314d2b15819ac459 Mon Sep 17 00:00:00 2001 From: Raheel1258 Date: Tue, 18 Feb 2025 16:34:36 +0500 Subject: [PATCH] update time options for inheritance key --- src/components/OptionDropdown.tsx | 58 +++++++++++-------- src/screens/Vault/AddReserveKey.tsx | 17 +++++- src/screens/Vault/ResetInheritanceKey.tsx | 16 ++++- .../Vault/VaultMigrationController.tsx | 14 ++++- src/screens/Vault/constants.ts | 4 +- .../miniscript/default/InheritanceVault.ts | 4 ++ 6 files changed, 83 insertions(+), 30 deletions(-) diff --git a/src/components/OptionDropdown.tsx b/src/components/OptionDropdown.tsx index e90d848aa..85599f3fb 100644 --- a/src/components/OptionDropdown.tsx +++ b/src/components/OptionDropdown.tsx @@ -1,4 +1,4 @@ -import { Box, Pressable, useColorMode } from 'native-base'; +import { Box, Pressable, ScrollView, useColorMode } from 'native-base'; import { StyleSheet, TouchableOpacity } from 'react-native'; import RightArrowIcon from 'src/assets/images/icon_arrow.svg'; import { hp, wp } from 'src/constants/responsive'; @@ -81,29 +81,35 @@ function OptionDropdown({ label, options, selectedOption, onOptionSelect }: Prop backgroundColor={`${colorMode}.boxSecondaryBackground`} style={styles.optionsContainer} > - {options.map((option, index) => ( - handleOptionSelect(option)} - > - - - {`${option.label}`} - - {internalSelectedOption?.value === option.value && } - - {index !== options.length - 1 && ( - - )} - - ))} + + {options.map((option, index) => ( + handleOptionSelect(option)} + > + + + {`${option.label}`} + + {internalSelectedOption?.value === option.value && } + + {index !== options.length - 1 && ( + + )} + + ))} + )} @@ -152,6 +158,7 @@ const styles = StyleSheet.create({ marginTop: hp(5), borderBottomLeftRadius: 10, borderBottomRightRadius: 10, + maxHeight: hp(200), }, optionContainer: { flexDirection: 'row', @@ -161,6 +168,9 @@ const styles = StyleSheet.create({ paddingBottom: hp(15), paddingHorizontal: wp(20), }, + scrollView: { + maxHeight: hp(200), + }, separator: { height: 1, alignSelf: 'center', diff --git a/src/screens/Vault/AddReserveKey.tsx b/src/screens/Vault/AddReserveKey.tsx index d164db11c..7729c081b 100644 --- a/src/screens/Vault/AddReserveKey.tsx +++ b/src/screens/Vault/AddReserveKey.tsx @@ -17,7 +17,15 @@ import KEEPERAPPLIGHT from 'src/assets/images/KeeperIconLight.svg'; import Buttons from 'src/components/Buttons'; import { SDIcons } from './SigningDeviceIcons'; import HorizontalSignerCard from '../AddSigner/HorizontalSignerCard'; -import { MONTHS_12, MONTHS_24, MONTHS_18 } from './constants'; +import { + MONTHS_12, + MONTHS_24, + MONTHS_18, + MONTHS_6, + MONTHS_3, + MONTHS_30, + MONTHS_36, +} from './constants'; import { getKeyUID } from 'src/utils/utilities'; import { MiniscriptTypes, VaultType } from 'src/services/wallets/enums'; import useVault from 'src/hooks/useVault'; @@ -32,11 +40,16 @@ import SuccessIcon from 'src/assets/images/successSvg.svg'; import WalletUtilities from 'src/services/wallets/operations/utils'; import { INHERITANCE_KEY1_IDENTIFIER } from 'src/services/wallets/operations/miniscript/default/InheritanceVault'; -const DEFAULT_INHERITANCE_TIMELOCK = { label: MONTHS_12, value: 12 * 30 * 24 * 60 * 60 * 1000 }; +const DEFAULT_INHERITANCE_TIMELOCK = { label: MONTHS_3, value: 3 * 30 * 24 * 60 * 60 * 1000 }; const INHERITANCE_TIMELOCK_DURATIONS = [ DEFAULT_INHERITANCE_TIMELOCK, + + { label: MONTHS_6, value: 6 * 30 * 24 * 60 * 60 * 1000 }, + { label: MONTHS_12, value: 12 * 30 * 24 * 60 * 60 * 1000 }, { label: MONTHS_18, value: 18 * 30 * 24 * 60 * 60 * 1000 }, { label: MONTHS_24, value: 24 * 30 * 24 * 60 * 60 * 1000 }, + { label: MONTHS_30, value: 30 * 30 * 24 * 60 * 60 * 1000 }, + { label: MONTHS_36, value: 36 * 30 * 24 * 60 * 60 * 1000 }, ]; function AddReserveKey({ route }) { diff --git a/src/screens/Vault/ResetInheritanceKey.tsx b/src/screens/Vault/ResetInheritanceKey.tsx index d38817ebb..55a107853 100644 --- a/src/screens/Vault/ResetInheritanceKey.tsx +++ b/src/screens/Vault/ResetInheritanceKey.tsx @@ -25,13 +25,25 @@ import { getSignerDescription } from 'src/hardware'; import IKSInfocard from './components/IKSInfoCard'; import { SDIcons } from './SigningDeviceIcons'; import VaultMigrationController from './VaultMigrationController'; -import { MONTHS_12, MONTHS_18, MONTHS_24 } from './constants'; +import { + MONTHS_12, + MONTHS_18, + MONTHS_24, + MONTHS_3, + MONTHS_6, + MONTHS_30, + MONTHS_36, +} from './constants'; -const DEFAULT_INHERITANCE_TIMELOCK = { label: MONTHS_12, value: 12 * 30 * 24 * 60 * 60 * 1000 }; +const DEFAULT_INHERITANCE_TIMELOCK = { label: MONTHS_3, value: 3 * 30 * 24 * 60 * 60 * 1000 }; const INHERITANCE_TIMELOCK_DURATIONS = [ DEFAULT_INHERITANCE_TIMELOCK, + { label: MONTHS_6, value: 6 * 30 * 24 * 60 * 60 * 1000 }, + { label: MONTHS_12, value: 12 * 30 * 24 * 60 * 60 * 1000 }, { label: MONTHS_18, value: 18 * 30 * 24 * 60 * 60 * 1000 }, { label: MONTHS_24, value: 24 * 30 * 24 * 60 * 60 * 1000 }, + { label: MONTHS_30, value: 30 * 30 * 24 * 60 * 60 * 1000 }, + { label: MONTHS_36, value: 36 * 30 * 24 * 60 * 60 * 1000 }, ]; function ResetInheritanceKey({ route }) { diff --git a/src/screens/Vault/VaultMigrationController.tsx b/src/screens/Vault/VaultMigrationController.tsx index 0f6f90e1e..127ef8289 100644 --- a/src/screens/Vault/VaultMigrationController.tsx +++ b/src/screens/Vault/VaultMigrationController.tsx @@ -44,7 +44,15 @@ import { INHERITANCE_VAULT_TIMELOCKS_MAINNET, INHERITANCE_VAULT_TIMELOCKS_TESTNET, } from 'src/services/wallets/operations/miniscript/default/InheritanceVault'; -import { MONTHS_12, MONTHS_3, MONTHS_6, MONTHS_18, MONTHS_24 } from './constants'; +import { + MONTHS_12, + MONTHS_3, + MONTHS_6, + MONTHS_18, + MONTHS_24, + MONTHS_30, + MONTHS_36, +} from './constants'; function VaultMigrationController({ vaultCreating, @@ -194,6 +202,10 @@ function VaultMigrationController({ ? 'MONTHS_18' : selectedDuration === MONTHS_24 ? 'MONTHS_24' + : selectedDuration === MONTHS_30 + ? 'MONTHS_30' + : selectedDuration === MONTHS_36 + ? 'MONTHS_36' : null; if (!durationIdentifier) { diff --git a/src/screens/Vault/constants.ts b/src/screens/Vault/constants.ts index 2e8fd6b88..3a618c832 100644 --- a/src/screens/Vault/constants.ts +++ b/src/screens/Vault/constants.ts @@ -3,5 +3,7 @@ export const MONTHS_6 = '6 months'; export const MONTHS_12 = '1 year'; export const MONTHS_18 = '1.5 years'; export const MONTHS_24 = '2 years'; +export const MONTHS_30 = '2.5 years'; +export const MONTHS_36 = '3 years'; -export const TIMELOCK_DURATIONS = [MONTHS_3, MONTHS_6, MONTHS_12, MONTHS_24]; +export const TIMELOCK_DURATIONS = [MONTHS_3, MONTHS_6, MONTHS_12, MONTHS_24, MONTHS_30, MONTHS_36]; diff --git a/src/services/wallets/operations/miniscript/default/InheritanceVault.ts b/src/services/wallets/operations/miniscript/default/InheritanceVault.ts index b08c70582..786ad5745 100644 --- a/src/services/wallets/operations/miniscript/default/InheritanceVault.ts +++ b/src/services/wallets/operations/miniscript/default/InheritanceVault.ts @@ -8,6 +8,8 @@ export const INHERITANCE_VAULT_TIMELOCKS_TESTNET = { MONTHS_12: 12, MONTHS_18: 18, MONTHS_24: 24, + MONTHS_30: 30, + MONTHS_36: 36, }; export const INHERITANCE_VAULT_TIMELOCKS_MAINNET = { @@ -16,6 +18,8 @@ export const INHERITANCE_VAULT_TIMELOCKS_MAINNET = { MONTHS_12: 52560, MONTHS_18: 78840, MONTHS_24: 105120, + MONTHS_30: 131400, + MONTHS_36: 157680, }; export const INHERITANCE_KEY1_IDENTIFIER = 'IK1';