Skip to content

Commit 2a035e1

Browse files
committed
Merge branch 'frontend-bb01-remove-receive'
2 parents 219ed88 + 05ded97 commit 2a035e1

File tree

9 files changed

+30
-262
lines changed

9 files changed

+30
-262
lines changed

frontends/web/src/locales/en/app.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,6 @@
19571957
"coincontrol": "One or more UTXOs have a reused address. Be aware the receiver will see all UTXOs associated with those addresses.",
19581958
"receivePairing": "Please pair the BitBox to enable secure address verification. Go to 'Manage device' in the sidebar.",
19591959
"sdcard": "Keep the microSD card stored separate from the BitBox, unless you want to manage backups.",
1960-
"sendPairing": "Please pair the BitBox to securely verify transaction details. Go to 'Manage device' in the sidebar.",
19611960
"testnet": "Warning: You are currently using the wallet in Testnet mode. Transactions and balances here are not real and will not appear on the mainnet. Testnet is intended for testing and development purposes only."
19621961
},
19631962
"welcome": {

frontends/web/src/routes/account/send/components/confirm/confirm.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,36 @@
1515
*/
1616

1717
import { useTranslation } from 'react-i18next';
18+
import { CoinCode, ConversionUnit, FeeTargetCode, Fiat, IAmount } from '@/api/account';
1819
import { Amount } from '@/components/amount/amount';
1920
import { customFeeUnit } from '@/routes/account/utils';
2021
import { View, ViewContent, ViewHeader } from '@/components/view/view';
2122
import { Message } from '@/components/message/message';
2223
import { PointToBitBox02 } from '@/components/icon';
23-
import { TConfirmSendProps } from '@/routes/account/send/components/confirm/types';
24-
import { ConfirmingWaitDialog } from '@/routes/account/send/components/confirm/dialogs/confirm-wait-dialog';
2524
import { FiatValue } from '../fiat-value';
2625
import style from './confirm.module.css';
2726

28-
type TConfirmSend = { bb01Paired: boolean | undefined } & TConfirmSendProps;
29-
30-
export const ConfirmSend = (props: TConfirmSend) => {
31-
return (props.bb01Paired !== undefined ? (
32-
<ConfirmingWaitDialog
33-
{...props}
34-
/>
35-
) : (
36-
<BB02ConfirmSend
37-
{...props}
38-
/>
39-
));
27+
type TransactionDetails = {
28+
proposedAmount?: IAmount;
29+
proposedFee?: IAmount;
30+
proposedTotal?: IAmount;
31+
feeTarget?: FeeTargetCode;
32+
customFee: string;
33+
recipientAddress: string;
34+
activeCurrency: Fiat;
4035
};
4136

42-
const BB02ConfirmSend = ({
37+
type TConfirmSendProps = {
38+
baseCurrencyUnit: ConversionUnit;
39+
note: string;
40+
hasSelectedUTXOs: boolean;
41+
isConfirming: boolean;
42+
selectedUTXOs: string[];
43+
coinCode: CoinCode;
44+
transactionDetails: TransactionDetails;
45+
}
46+
47+
export const ConfirmSend = ({
4348
baseCurrencyUnit,
4449
note,
4550
hasSelectedUTXOs,

frontends/web/src/routes/account/send/components/confirm/dialogs/confirm-wait-dialog.module.css

Lines changed: 0 additions & 18 deletions
This file was deleted.

frontends/web/src/routes/account/send/components/confirm/dialogs/confirm-wait-dialog.tsx

Lines changed: 0 additions & 142 deletions
This file was deleted.

frontends/web/src/routes/account/send/components/confirm/types.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

frontends/web/src/routes/account/send/send-wrapper.tsx

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,26 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { useContext, useEffect, useState } from 'react';
18-
import { useTranslation } from 'react-i18next';
17+
import { useContext } from 'react';
1918
import { AccountCode, IAccount } from '@/api/account';
20-
import { hasMobileChannel, TDevices } from '@/api/devices';
21-
import { getDeviceInfo } from '@/api/bitbox01';
2219
import { RatesContext } from '@/contexts/RatesContext';
23-
import { findAccount, isBitcoinBased } from '@/routes/account/utils';
24-
import { alertUser } from '@/components/alert/Alert';
20+
import { findAccount } from '@/routes/account/utils';
2521
import { Send } from './send';
2622

2723
type TSendProps = {
28-
accounts: IAccount[];
29-
code: AccountCode;
30-
devices: TDevices;
31-
deviceIDs: string[];
24+
accounts: IAccount[];
25+
code: AccountCode;
3226
}
3327

34-
export const SendWrapper = ({ accounts, code, deviceIDs, devices }: TSendProps) => {
35-
const { t } = useTranslation();
28+
export const SendWrapper = ({ accounts, code }: TSendProps) => {
3629
const { defaultCurrency } = useContext(RatesContext);
3730

38-
const [bb01Paired, setBB01Paired] = useState<boolean>();
39-
const [noMobileChannelError, setNoMobileChannelError] = useState<boolean>();
40-
4131
const account = findAccount(accounts, code);
4232

43-
useEffect(() => {
44-
const product = deviceIDs.length > 0 ? devices[deviceIDs[0]] : undefined;
45-
if (account && product === 'bitbox') {
46-
const fetchData = async () => {
47-
try {
48-
const mobileChannel = await hasMobileChannel(deviceIDs[0])();
49-
const deviceInfo = await getDeviceInfo(deviceIDs[0]);
50-
if (deviceInfo) {
51-
setBB01Paired(mobileChannel && deviceInfo.pairing);
52-
setNoMobileChannelError(deviceInfo.pairing && !mobileChannel && isBitcoinBased(account.coinCode));
53-
}
54-
} catch (error) {
55-
console.error(error);
56-
}
57-
};
58-
fetchData();
59-
}
60-
}, [account, deviceIDs, devices]);
61-
62-
if (noMobileChannelError) {
63-
alertUser(t('warning.sendPairing'));
64-
}
6533
return (
6634
account ? (
6735
<Send
6836
account={account}
69-
bb01Paired={bb01Paired}
7037
activeCurrency={defaultCurrency}
7138
/>
7239
) : (null)

frontends/web/src/routes/account/send/send.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ import { TProposalError, txProposalErrorHandling } from './services';
4343
import { CoinControl } from './coin-control';
4444
import style from './send.module.css';
4545

46-
interface SendProps {
47-
account: accountApi.IAccount;
48-
// undefined if bb02 is connected.
49-
bb01Paired: boolean | undefined;
50-
activeCurrency: accountApi.Fiat;
46+
type SendProps = {
47+
account: accountApi.IAccount;
48+
activeCurrency: accountApi.Fiat;
5149
}
5250

5351
type Props = SendProps & TranslateProps;
@@ -370,7 +368,6 @@ class Send extends Component<Props, State> {
370368
public render() {
371369
const {
372370
account,
373-
bb01Paired,
374371
activeCurrency,
375372
t,
376373
} = this.props;
@@ -501,7 +498,6 @@ class Send extends Component<Props, State> {
501498
</Grid>
502499
</ViewContent>
503500
<ConfirmSend
504-
bb01Paired={bb01Paired}
505501
baseCurrencyUnit={activeCurrency}
506502
note={note}
507503
hasSelectedUTXOs={this.hasSelectedUTXOs()}

frontends/web/src/routes/device/bitbox01/settings/settings.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { route } from '../../../../utils/route';
2121
import { getDeviceInfo } from '../../../../api/bitbox01';
2222
import { apiGet } from '../../../../utils/request';
2323
import { apiWebsocket } from '../../../../utils/websocket';
24+
import { hasMobileChannel } from '@/api/devices';
2425
import { Guide } from '../../../../components/guide/guide';
2526
import { Entry } from '../../../../components/guide/entry';
2627
import { Header } from '../../../../components/layout';
@@ -79,7 +80,7 @@ class Settings extends Component {
7980
}
8081
});
8182

82-
apiGet('devices/' + this.props.deviceID + '/has-mobile-channel').then(mobileChannel => {
83+
hasMobileChannel(this.props.deviceID).then(mobileChannel => {
8384
this.setState({ mobileChannel });
8485
});
8586

frontends/web/src/routes/router.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ export const AppRouter = ({ devices, deviceIDs, devicesKey, accounts, activeAcco
112112
const AccSend = (<InjectParams>
113113
<SendWrapper
114114
code={'' /* dummy to satisfy TS */}
115-
devices={devices}
116-
deviceIDs={deviceIDs}
117115
accounts={activeAccounts} />
118116
</InjectParams>);
119117

0 commit comments

Comments
 (0)