mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-07-24 19:25:41 +00:00
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:
@@ -22,15 +22,16 @@ interface Props {
|
|||||||
onScan: (scanned: ScanType) => void;
|
onScan: (scanned: ScanType) => void;
|
||||||
size?: string | number;
|
size?: string | number;
|
||||||
style?: React.CSSProperties;
|
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(
|
const _onScan = useCallback(
|
||||||
(data: string | null): void => {
|
(data: string | null): void => {
|
||||||
if (data) {
|
if (data) {
|
||||||
try {
|
try {
|
||||||
const [prefix, content, genesisHash, ...name] = data.split(':');
|
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}'`);
|
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 (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user