Aadd isEthereum props to ScanAddress to import eth addresses (#484)

* add isEthereum props to ScanAddress to import eth addresses

* fix missing seed
This commit is contained in:
Antoine Estienne
2021-06-16 18:49:32 +02:00
committed by GitHub
parent 4c097c5001
commit 26e0ecbbd1
+4 -3
View File
@@ -22,15 +22,16 @@ interface Props {
onScan: (scanned: ScanType) => void;
size?: string | number;
style?: React.CSSProperties;
isEthereum?: boolean
}
function ScanAddress ({ className, onError, onScan, size, style }: Props): React.ReactElement<Props> {
function ScanAddress ({ className, isEthereum, onError, onScan, size, style }: Props): React.ReactElement<Props> {
const _onScan = useCallback(
(data: string | null): void => {
if (data) {
try {
const [prefix, content, genesisHash, ...name] = data.split(':');
const isValidPrefix = prefix === ADDRESS_PREFIX || prefix === SEED_PREFIX;
const isValidPrefix = (prefix === (isEthereum ? 'ethereum' : ADDRESS_PREFIX)) || (prefix === SEED_PREFIX);
assert(isValidPrefix, `Invalid prefix received, expected '${ADDRESS_PREFIX}/${SEED_PREFIX}' , found '${prefix}'`);
@@ -46,7 +47,7 @@ function ScanAddress ({ className, onError, onScan, size, style }: Props): React
}
}
},
[onScan]
[onScan, isEthereum]
);
return (