Unverified Commit d9e7e882 authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub
Browse files

fix: custom path derivation with known network (#508)

* fix: custom path derivation with known network

* remove console.log
parent 32cfa5f9
Pipeline #73160 passed with stages
in 16 minutes and 3 seconds
......@@ -30,7 +30,7 @@ import {
navigateToPathsList,
unlockSeedPhrase
} from '../util/navigationHelpers';
import { NETWORK_LIST, UnknownNetworkKeys } from '../constants';
import { NETWORK_LIST } from '../constants';
import { alertPathDerivationError } from '../util/alertUtils';
import testIDs from '../../e2e/testIDs';
import Separator from '../components/Separator';
......@@ -43,16 +43,13 @@ function PathDerivation({ accounts, navigation }) {
const [derivationPath, setDerivationPath] = useState('');
const [keyPairsName, setKeyPairsName] = useState('');
const [isPathValid, setIsPathValid] = useState(true);
const networkKey = navigation.getParam(
'networkKey',
getNetworkKeyByPath(derivationPath)
);
const currentNetworkPath =
networkKey !== UnknownNetworkKeys.UNKNOWN
? `//${NETWORK_LIST[networkKey].pathId}`
: '';
const completePath = `${currentNetworkPath}${derivationPath}`;
const inheritNetworkKey = navigation.getParam('networkKey');
const isCustomPath = inheritNetworkKey === undefined;
const networkKey = inheritNetworkKey || getNetworkKeyByPath(derivationPath);
const currentNetworkPath = `//${NETWORK_LIST[networkKey].pathId}`;
const completePath = isCustomPath
? derivationPath
: `${currentNetworkPath}${derivationPath}`;
const onPathDerivation = async () => {
if (!validateDerivedPath(derivationPath)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment