mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-05-06 21:47:58 +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;
|
||||
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 (
|
||||
|
||||
Reference in New Issue
Block a user