REF: Add mempool.space as the main explorer

This commit is contained in:
ncoelho 2021-04-09 17:05:08 +02:00
parent 4b7081ccb6
commit 0987e1daa6
2 changed files with 33 additions and 14 deletions

View File

@ -1483,7 +1483,7 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
const handleOnCopyTransactionID = useCallback(() => Clipboard.setString(item.hash), [item.hash]); const handleOnCopyTransactionID = useCallback(() => Clipboard.setString(item.hash), [item.hash]);
const handleOnCopyNote = useCallback(() => Clipboard.setString(subtitle), [subtitle]); const handleOnCopyNote = useCallback(() => Clipboard.setString(subtitle), [subtitle]);
const handleOnViewOnBlockExplorer = useCallback(() => { const handleOnViewOnBlockExplorer = useCallback(() => {
const url = `https://blockstream.info/tx/${item.hash}`; const url = `https://mempool.space/tx/${item.hash}`;
Linking.canOpenURL(url).then(supported => { Linking.canOpenURL(url).then(supported => {
if (supported) { if (supported) {
Linking.openURL(url); Linking.openURL(url);
@ -1491,7 +1491,7 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
}); });
}, [item.hash]); }, [item.hash]);
const handleCopyOpenInBlockExplorerPress = useCallback(() => { const handleCopyOpenInBlockExplorerPress = useCallback(() => {
Clipboard.setString(`https://blockstream.info/tx/${item.hash}`); Clipboard.setString(`https://mempool.space/tx/${item.hash}`);
}, [item.hash]); }, [item.hash]);
const toolTipActions = useMemo(() => { const toolTipActions = useMemo(() => {
const actions = [ const actions = [

View File

@ -55,6 +55,12 @@ const TransactionsDetails = () => {
borderBottomColor: colors.formBorder, borderBottomColor: colors.formBorder,
backgroundColor: colors.inputBackgroundColor, backgroundColor: colors.inputBackgroundColor,
}, },
greyButton: {
backgroundColor: colors.lightButton,
},
Link: {
color: colors.buttonTextColor,
},
}); });
useEffect(() => { useEffect(() => {
@ -119,7 +125,7 @@ const TransactionsDetails = () => {
}; };
const handleOnOpenTransactionOnBlockExporerTapped = () => { const handleOnOpenTransactionOnBlockExporerTapped = () => {
const url = `https://blockstream.info/tx/${tx.hash}`; const url = `https://mempool.space/tx/${tx.hash}`;
Linking.canOpenURL(url).then(supported => { Linking.canOpenURL(url).then(supported => {
if (supported) { if (supported) {
Linking.openURL(url); Linking.openURL(url);
@ -128,7 +134,7 @@ const TransactionsDetails = () => {
}; };
const handleCopyPress = () => { const handleCopyPress = () => {
Clipboard.setString(`https://blockstream.info/tx/${tx.hash}`); Clipboard.setString(`https://mempool.space/tx/${tx.hash}`);
}; };
const showToolTipMenu = () => { const showToolTipMenu = () => {
@ -193,7 +199,7 @@ const TransactionsDetails = () => {
<BlueText style={[styles.txId, stylesHooks.txId]}>{loc.transactions.txid}</BlueText> <BlueText style={[styles.txId, stylesHooks.txId]}>{loc.transactions.txid}</BlueText>
<BlueCopyToClipboardButton stringToCopy={tx.hash} /> <BlueCopyToClipboardButton stringToCopy={tx.hash} />
</View> </View>
<BlueText style={styles.txHash}>{tx.hash}</BlueText> <BlueText style={styles.txHash, styles.rowValue}>{tx.hash}</BlueText>
<ToolTipMenu <ToolTipMenu
ref={toolTip} ref={toolTip}
anchorRef={openTransactionOnBlockExplorerRef} anchorRef={openTransactionOnBlockExplorerRef}
@ -205,13 +211,6 @@ const TransactionsDetails = () => {
}, },
]} ]}
/> />
<TouchableOpacity
ref={openTransactionOnBlockExplorerRef}
onPress={handleOnOpenTransactionOnBlockExporerTapped}
onLongPress={showToolTipMenu}
>
<BlueText style={[styles.txLink, stylesHooks.txLink]}>{loc.transactions.details_show_in_block_explorer}</BlueText>
</TouchableOpacity>
</> </>
)} )}
@ -242,6 +241,14 @@ const TransactionsDetails = () => {
<BlueText style={styles.rowValue}>{tx.outputs.length}</BlueText> <BlueText style={styles.rowValue}>{tx.outputs.length}</BlueText>
</> </>
)} )}
<TouchableOpacity
ref={openTransactionOnBlockExplorerRef}
onPress={handleOnOpenTransactionOnBlockExporerTapped}
onLongPress={showToolTipMenu}
style={[styles.greyButton, stylesHooks.greyButton]}
>
<Text style={[styles.Link, stylesHooks.Link]}>{loc.transactions.details_show_in_block_explorer}</Text>
</TouchableOpacity>
</BlueCard> </BlueCard>
</ScrollView> </ScrollView>
</SafeBlueArea> </SafeBlueArea>
@ -275,8 +282,9 @@ const styles = StyleSheet.create({
marginBottom: 8, marginBottom: 8,
color: 'grey', color: 'grey',
}, },
txLink: { Link: {
marginBottom: 26, fontWeight: '600',
fontSize: 15
}, },
save: { save: {
marginHorizontal: 16, marginHorizontal: 16,
@ -295,6 +303,17 @@ const styles = StyleSheet.create({
paddingHorizontal: 8, paddingHorizontal: 8,
color: '#81868e', color: '#81868e',
}, },
greyButton: {
borderRadius: 9,
minHeight: 49,
paddingHorizontal: 8,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
alignSelf: 'auto',
flexGrow: 1,
marginHorizontal: 4,
},
}); });
export default TransactionsDetails; export default TransactionsDetails;