Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comment reset #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,7 @@ import { createDrawerNavigator } from '@react-navigation/drawer';
import { Platform, useWindowDimensions, Dimensions, I18nManager } from 'react-native';
import { useTheme } from '@react-navigation/native';

import Settings from './screen/settings/settings';
import About from './screen/settings/about';
import ReleaseNotes from './screen/settings/releasenotes';
import Licensing from './screen/settings/licensing';
import Selftest from './screen/selftest';
import Language from './screen/settings/language';
import Currency from './screen/settings/currency';
import EncryptStorage from './screen/settings/encryptStorage';
import PlausibleDeniability from './screen/plausibledeniability';
import LightningSettings from './screen/settings/lightningSettings';
import ElectrumSettings from './screen/settings/electrumSettings';
import TorSettings from './screen/settings/torSettings';
import Tools from './screen/settings/tools';
import GeneralSettings from './screen/settings/GeneralSettings';
import NetworkSettings from './screen/settings/NetworkSettings';
import NotificationSettings from './screen/settings/notificationSettings';
import DefaultView from './screen/settings/defaultView';

import WalletsList from './screen/wallets/list';
import WalletTransactions from './screen/wallets/transactions';
import AddWallet from './screen/wallets/add';
import WalletsAddMultisig from './screen/wallets/addMultisig';
import WalletsAddMultisigStep2 from './screen/wallets/addMultisigStep2';
import WalletsAddMultisigHelp from './screen/wallets/addMultisigHelp';
import PleaseBackup from './screen/wallets/pleaseBackup';
import PleaseBackupQrcode from './screen/wallets/pleaseBackupQrcode';
import ImportWallet from './screen/wallets/import';
import WalletDetails from './screen/wallets/details';
import WalletExport from './screen/wallets/export';
import ExportMultisigCoordinationSetup from './screen/wallets/exportMultisigCoordinationSetup';
import ViewEditMultisigCosigners from './screen/wallets/viewEditMultisigCosigners';
import WalletXpub from './screen/wallets/xpub';
import SignVerify from './screen/wallets/signVerify';
import WalletAddresses from './screen/wallets/addresses';
import BuyBitcoin from './screen/wallets/buyBitcoin';
import HodlHodl from './screen/wallets/hodlHodl';
import HodlHodlViewOffer from './screen/wallets/hodlHodlViewOffer';
import HodlHodlLogin from './screen/wallets/hodlHodlLogin';
import HodlHodlWebview from './screen/wallets/hodlHodlWebview';
import HodlHodlMyContracts from './screen/wallets/hodlHodlMyContracts';
import Marketplace from './screen/wallets/marketplace';
import ReorderWallets from './screen/wallets/reorderWallets';
import SelectWallet from './screen/wallets/selectWallet';
import ProvideEntropy from './screen/wallets/provideEntropy';
import AOPP from './screen/wallets/aopp';

import TransactionDetails from './screen/transactions/details';
import TransactionStatus from './screen/transactions/transactionStatus';
Expand All @@ -60,8 +16,6 @@ import RBFCancel from './screen/transactions/RBFCancel';
import UnlockWith from './UnlockWith';
import DrawerList from './screen/wallets/drawerList';
import { isDesktop, isTablet } from './blue_modules/environment';
import SettingsPrivacy from './screen/settings/SettingsPrivacy';
import LNDViewAdditionalInvoicePreImage from './screen/lnd/lndViewAdditionalInvoicePreImage';

import MainTabs from './screen/MainTabs'

Expand Down Expand Up @@ -109,7 +63,6 @@ const InitRoot = () => (
<InitStack.Navigator screenOptions={defaultScreenOptions} initialRouteName="UnlockWithScreenRoot">
<InitStack.Screen name="UnlockWithScreenRoot" component={UnlockWithScreenRoot} options={{ headerShown: false, animationEnabled: false }}/>
<InitStack.Screen name="MainTabs" component={MainTabs} options={{ headerShown: false, animationEnabled: false }}/>
<InitStack.Screen name="SettingTabs" component={Settings} options={{ headerShown: false, gestureEnabled: false }} />
</InitStack.Navigator>
);

Expand Down
2 changes: 2 additions & 0 deletions backend/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

server.timeout = 8000;

/**
* Normalize a port into a number, string, or false.
*/
Expand Down
15 changes: 9 additions & 6 deletions backend/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,23 @@ router.post('/arweave/balance', function(req, res, next) {

});

router.post('/arweave/create_transaction', function(req, res, next) {
router.post('/arweave/create_transaction', async function(req, res, next) {
try{
let transaction = arweave.createTransaction({
let key = req.body.key;

let transaction = await arweave.createTransaction({
target: req.body.address,
quantity: arweave.ar.arToWinston(req.body.amount)
}, req.body.key);
console.log('succeed');
}, key);

await arweave.transactions.sign(transaction, key);
console.log(transaction)

res.send({'data' : transaction});

}catch(e) {
next(e);
res.send({'error': '404'});
return next(e)
//res.send({'error': '404'});
}

});
Expand Down
3 changes: 2 additions & 1 deletion components/AmountInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Image, StyleSheet, TextInput, TouchableOpacity, TouchableWithoutFeedbac
import { useTheme } from '@react-navigation/native';

import { BitcoinUnit } from '../models/bitcoinUnits';
import {formatAmountFiat} from '../helpers/arweare'
import loc, { formatBalanceWithoutSuffix, formatBalancePlain, removeTrailingZeros } from '../loc';
const currency = require('../blue_modules/currency');

Expand Down Expand Up @@ -91,7 +92,7 @@ class AmountInput extends Component {
render() {
const { colors, disabled, unit } = this.props;
const amount = this.props.amount || '0';
let secondaryDisplayCurrency = amount*54.2;
let secondaryDisplayCurrency = formatAmountFiat(amount);
secondaryDisplayCurrency += '$'


Expand Down
11 changes: 11 additions & 0 deletions helpers/arweare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const formatBalance = (balance) => {
return balance + 'AR';
}
const formatAmountFiat = (balance) => {
return balance*52.05;
}

export {
formatBalance,
formatAmountFiat
}
2 changes: 1 addition & 1 deletion helpers/pqd.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getUserName = async (props, setUsername) => {
}
const formatBalance = (balance, unit) => {

return balance + 'PQD';
return balance + 'AR';

}

Expand Down
Binary file added img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion loc/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"about": "About",
"about_awesome": "Built with the awesome",
"about_backup": "Always backup your keys!",
"about_free": "BlueWallet is a free and open-source project. Crafted by Bitcoin users.",
"about_free": "Arweave is a free and open-source project. Crafted by Arweave users.",
"about_license": "MIT License",
"about_release_notes": "Release notes",
"about_review": "Leave us a review",
Expand Down
9 changes: 8 additions & 1 deletion screen/mainNative/home/HomeStack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect} from 'react'
import React, {useEffect, Button} from 'react'

import { createStackNavigator } from '@react-navigation/stack'
import { useTheme } from '@react-navigation/native';
Expand All @@ -18,6 +18,8 @@ import SendSuccess from './send/success';

import ReceiveDetails from './receive/details';

import SettingStack from '../settings/SettingStack'

import { getFocusedRouteNameFromRoute } from '@react-navigation/native';

const Stack = createStackNavigator()
Expand All @@ -36,6 +38,8 @@ const HomeStack = ({navigation, route}) => {
} else {
navigation.setOptions({ tabBarVisible: false })
}

//console.log('routeName', routeName)
//return () => { mountedRef.current = false }
}, [navigation, route])

Expand All @@ -53,6 +57,9 @@ const HomeStack = ({navigation, route}) => {
<Stack.Screen name="SendConfirm" component={SendConfirm} />
<Stack.Screen name="SendSuccess" component={SendSuccess} />
<Stack.Screen name="ReceiveDetails" component={ReceiveDetails} options={ReceiveDetails.navigationOptions(theme)} />

<Stack.Screen name="Settings" component={SettingStack} />

</Stack.Navigator>
)
}
Expand Down
50 changes: 10 additions & 40 deletions screen/mainNative/home/send/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { BlueButton, BlueText, SafeBlueArea, BlueCard } from '../../BlueComponen
import navigationStyle from '../../components/navigationStyle';
import { BitcoinUnit } from '../../models/bitcoinUnits';
import Biometric from '../../class/biometrics';
import loc, { formatBalance, formatBalanceWithoutSuffix } from '../../loc';
import loc, {formatBalanceWithoutSuffix } from '../../loc';
import {formatBalance, formatAmountFiat} from '../../helpers/arweare'
import Notifications from '../../blue_modules/notifications';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { Psbt } from 'bitcoinjs-lib';
Expand All @@ -27,11 +28,9 @@ const SendConfirm = () => {
const { wallets, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext);
const [isBiometricUseCapableAndEnabled, setIsBiometricUseCapableAndEnabled] = useState(false);
const { params } = useRoute();
const { recipients = [], walletID, fee, memo, tx, satoshiPerByte, psbt } = params;
const { recipients = [], walletID, fee, memo, tx} = params;
const [isLoading, setIsLoading] = useState(false);
const [isPayjoinEnabled, setIsPayjoinEnabled] = useState(false);
const wallet = wallets.find(wallet => wallet.getID() === walletID);
const feeSatoshi = new Bignumber(fee).multipliedBy(100000000).toNumber();
const { navigate } = useNavigation();
const { colors } = useTheme();
const stylesHook = StyleSheet.create({
Expand Down Expand Up @@ -65,28 +64,17 @@ const SendConfirm = () => {

useEffect(() => {
console.log('params', params)

console.log('send/confirm - useEffect');
console.log('address = ', recipients);
Biometric.isBiometricUseCapableAndEnabled().then(setIsBiometricUseCapableAndEnabled);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

/**
* we need to look into `recipients`, find destination address and return its outputScript
* (needed for payjoin)
*
* @return {string}
*/
const getPaymentScript = () => {
return bitcoin.address.toOutputScript(recipients[0].address);
};


const send = async () => {
setIsLoading(true);
try {


//amount = formatBalanceWithoutSuffix(amount, BitcoinUnit.BTC, false);
amount = params.amount;
navigate('SendSuccess', {
Expand All @@ -107,34 +95,18 @@ const SendConfirm = () => {
}
};

const broadcast = async tx => {
await BlueElectrum.ping();
await BlueElectrum.waitTillConnected();

if (isBiometricUseCapableAndEnabled) {
if (!(await Biometric.unlockWithBiometrics())) {
return;
}
}

const result = await wallet.broadcastTx(tx);
if (!result) {
throw new Error(loc.errors.broadcast);
}

return result;
};

const _renderItem = ({ index, item }) => {
console.log('item', item)
return (
<>
<View style={styles.valueWrap}>
<Text testID="TransactionValue" style={[styles.valueValue, stylesHook.valueValue]}>
{currency.satoshiToBTC(item.value)}
{ item.amount }
</Text>
<Text style={[styles.valueUnit, stylesHook.valueUnit]}>{' ' + loc.units[BitcoinUnit.BTC]}</Text>
</View>
<Text style={[styles.transactionAmountFiat, stylesHook.transactionAmountFiat]}>{currency.satoshiToLocalCurrency(item.value)}</Text>
<Text style={[styles.transactionAmountFiat, stylesHook.transactionAmountFiat]}>{formatAmountFiat(item.amount)}</Text>
<BlueCard>
<Text style={[styles.transactionDetailsTitle, stylesHook.transactionDetailsTitle]}>{loc.send.create_to}</Text>
<Text testID="TransactionAddress" style={[styles.transactionDetailsSubtitle, stylesHook.transactionDetailsSubtitle]}>
Expand Down Expand Up @@ -171,7 +143,7 @@ const SendConfirm = () => {
<View style={styles.cardBottom}>
<BlueCard>
<Text style={styles.cardText} testID="TransactionFee">
{loc.send.create_fee}: {formatBalance(feeSatoshi, BitcoinUnit.BTC)} ({currency.satoshiToLocalCurrency(feeSatoshi)})
{loc.send.create_fee}: { formatBalance(fee) }
</Text>
{isLoading ? <ActivityIndicator /> : <BlueButton onPress={send} title={loc.send.confirm_sendNow} />}
<TouchableOpacity
Expand All @@ -185,14 +157,12 @@ const SendConfirm = () => {
}
}

navigate('CreateTransaction', {
navigate('SendDetails', {
fee,
recipients,
memo,
tx,
satoshiPerByte,
wallet,
feeSatoshi,
wallet
});
}}
>
Expand Down
Loading