Skip to content

Commit

Permalink
fix: NetworkInput initial value given by network address (#5294)
Browse files Browse the repository at this point in the history
* fix: NetworkInput initial value given by network address

* fix: error always gets thrown

Co-authored-by: Mark Nardi <mark.nardi@iota.org>
  • Loading branch information
jeeanribeiro and MarkNerdi996 committed Nov 28, 2022
1 parent 2717dc4 commit 9a9d0a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/shared/components/inputs/NetworkInput.svelte
Expand Up @@ -16,7 +16,8 @@
$: networkOptions = showLayer2 ? getLayer2NetworkOptions() : [LAYER_1_NETWORK_OPTION]
let selected: IOption = LAYER_1_NETWORK_OPTION
let selected: IOption =
getLayer2NetworkOptions().find((option) => option.value === networkAddress) ?? LAYER_1_NETWORK_OPTION
$: if (!showLayer2) {
selected = LAYER_1_NETWORK_OPTION
}
Expand Down
Expand Up @@ -8,6 +8,7 @@ import { KECCAK_HASH_SIZE } from '../constants'
import { validateBech32Address } from './validateBech32Address'
import { Layer1RecipientError } from '@core/layer-2/errors'
import { InvalidAddressError } from '@auxiliary/deep-link'
import { localize } from '@core/i18n'

export function validateEthereumAddress(address: string): void {
throwIfBech32Address(address)
Expand Down Expand Up @@ -45,7 +46,7 @@ function throwIfBech32Address(address: string): void {
validateBech32Address(get(networkHrp), address)
throw new Layer1RecipientError()
} catch (err) {
if (err === new Layer1RecipientError()) {
if (err.message === localize('error.layer2.layer1Recipient')) {
throw err
}
}
Expand Down

0 comments on commit 9a9d0a8

Please sign in to comment.