Skip to content

Commit

Permalink
ImportAccount: add block height instruction and set dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Nov 8, 2024
1 parent 4ba5cba commit 34d397d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
"views.ImportAccount.addressType": "Address type",
"views.ImportAccount.existingAccount": "Existing account (has funds already)",
"views.ImportAccount.existingAccountNote": "If importing an existing account, ZEUS will initiate a rescan from the block height specified below. Please leave the app open for up to 10 minutes for balances to be reflected accurately",
"views.ImportAccount.existingAccountNote2": "For best results, set block height to the block right before the first transaction received to this external wallet.",
"views.ImportAccount.addressesToGenerate": "Number of addresses to generate",
"views.ImportAccount.importAccount": "Import Account",
"views.ImportAccount.note": "NOTE: Events (deposits/spends) for keys derived from an account will only be detected by LND if they happen after the import. Rescans to detect past events will be supported later on.",
Expand Down
23 changes: 22 additions & 1 deletion views/Accounts/ImportAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import TextInput from '../../components/TextInput';
import { ErrorMessage } from '../../components/SuccessErrorMessage';

import UTXOsStore from '../../stores/UTXOsStore';
import NodeInfoStore from '../../stores/NodeInfoStore';
import SettingsStore from '../../stores/SettingsStore';

import Base64Utils from '../../utils/Base64Utils';
Expand All @@ -46,6 +47,7 @@ interface ImportAccountProps {
navigation: StackNavigationProp<any, any>;
UTXOsStore: UTXOsStore;
SettingsStore: SettingsStore;
NodeInfoStore: NodeInfoStore;
route: Route<
'ImportAccount',
{
Expand All @@ -68,7 +70,7 @@ interface ImportAccountState {
understood: boolean;
}

@inject('UTXOsStore', 'SettingsStore')
@inject('UTXOsStore', 'SettingsStore', 'NodeInfoStore')
@observer
export default class ImportAccount extends React.Component<
ImportAccountProps,
Expand All @@ -89,6 +91,7 @@ export default class ImportAccount extends React.Component<
}

handleParams = (props: ImportAccountProps) => {
const { NodeInfoStore } = props;
const {
name,
extended_public_key,
Expand All @@ -110,6 +113,12 @@ export default class ImportAccount extends React.Component<
if (address_type) {
this.setState({ address_type });
}

if (NodeInfoStore?.nodeInfo?.currentBlockHeight) {
this.setState({
block_height: NodeInfoStore?.nodeInfo?.currentBlockHeight
});
}
};

UNSAFE_componentWillMount = () => {
Expand Down Expand Up @@ -370,6 +379,18 @@ export default class ImportAccount extends React.Component<
{localeString(
'views.ImportAccount.existingAccountNote'
)}
.
</Text>
<Text
style={{
color: themeColor('secondaryText'),
fontFamily: 'PPNeueMontreal-Book',
marginBottom: 10
}}
>
{localeString(
'views.ImportAccount.existingAccountNote2'
)}
</Text>
<>
<Text
Expand Down

0 comments on commit 34d397d

Please sign in to comment.