mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
REF: coldcard support
This commit is contained in:
parent
faead2f5fb
commit
fb552b1f3b
5 changed files with 32 additions and 8 deletions
|
@ -18,6 +18,13 @@ const BlueApp = require('../BlueApp');
|
|||
const loc = require('../loc');
|
||||
|
||||
export default class WalletImport {
|
||||
/**
|
||||
*
|
||||
* @param w
|
||||
* @param additionalProperties key-values passed from outside. Used only to set up `masterFingerprint` property for watch-only wallet
|
||||
* @returns {Promise<void>}
|
||||
* @private
|
||||
*/
|
||||
static async _saveWallet(w, additionalProperties) {
|
||||
try {
|
||||
const wallet = BlueApp.getWallets().some(wallet => wallet.getSecret() === w.secret && wallet.type !== PlaceholderWallet.type);
|
||||
|
@ -68,6 +75,12 @@ export default class WalletImport {
|
|||
return BlueApp.getWallets().some(wallet => wallet.type === PlaceholderWallet.type);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param importText
|
||||
* @param additionalProperties key-values passed from outside. Used only to set up `masterFingerprint` property for watch-only wallet
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async processImportText(importText, additionalProperties) {
|
||||
if (WalletImport.isCurrentlyImportingWallet()) {
|
||||
return;
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<key>NSCameraUsageDescription</key>
|
||||
<string>In order to quickly scan the recipient's address, we need your permission to use the camera to scan their QR Code.</string>
|
||||
<key>NSFaceIDUsageDescription</key>
|
||||
<string>In order to confirm your identity, we need your permission to use FaceID.</string>
|
||||
<string>In order to use FaceID please confirm your permission.</string>
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<string>This alert should not show up as we do not require this data</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
|
|
|
@ -80,7 +80,7 @@ module.exports = {
|
|||
error: 'Failed to import. Please, make sure that the provided data is valid.',
|
||||
success: 'Success',
|
||||
do_import: 'Import',
|
||||
scan_qr: 'or scan QR code instead?',
|
||||
scan_qr: '...scan QR or import file instead?',
|
||||
},
|
||||
scanQrWif: {
|
||||
go_back: 'Go Back',
|
||||
|
|
|
@ -725,7 +725,8 @@ export default class SendDetails extends Component {
|
|||
if (this.state.fromWallet.type === WatchOnlyWallet.type) {
|
||||
// watch-only wallets with enabled HW wallet support have different flow. we have to show PSBT to user as QR code
|
||||
// so he can scan it and sign it. then we have to scan it back from user (via camera and QR code), and ask
|
||||
// user whether he wants to broadcast it
|
||||
// user whether he wants to broadcast it.
|
||||
// alternatively, user can export psbt file, sign it externally and then import it
|
||||
this.props.navigation.navigate('PsbtWithHardwareWallet', {
|
||||
memo: this.state.memo,
|
||||
fromWallet: this.state.fromWallet,
|
||||
|
@ -786,10 +787,10 @@ export default class SendDetails extends Component {
|
|||
onSwitch={this.onReplaceableFeeSwitchValueChanged}
|
||||
/>
|
||||
)}
|
||||
{(this.state.fromWallet.type === HDSegwitBech32Wallet.type ||
|
||||
this.state.fromWallet._hdWalletInstance instanceof HDSegwitBech32Wallet) && (
|
||||
<BlueListItem title="Import Transaction" hideChevron component={TouchableOpacity} onPress={this.importTransaction} />
|
||||
)}
|
||||
{this.state.fromWallet.type === WatchOnlyWallet.type &&
|
||||
this.state.fromWallet._hdWalletInstance instanceof HDSegwitBech32Wallet && (
|
||||
<BlueListItem title="Import Transaction" hideChevron component={TouchableOpacity} onPress={this.importTransaction} />
|
||||
)}
|
||||
{this.state.fromWallet.allowBatchSend() && (
|
||||
<>
|
||||
<BlueListItem
|
||||
|
|
|
@ -35,6 +35,11 @@ const WalletsImport = () => {
|
|||
importMnemonic(importText);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param importText
|
||||
* @param additionalProperties key-values passed from outside. Used only to set up `masterFingerprint` property for watch-only wallet
|
||||
*/
|
||||
const importMnemonic = (importText, additionalProperties) => {
|
||||
try {
|
||||
WalletImport.processImportText(importText, additionalProperties);
|
||||
|
@ -45,6 +50,11 @@ const WalletsImport = () => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @param additionalProperties key-values passed from outside. Used only to set up `masterFingerprint` property for watch-only wallet
|
||||
*/
|
||||
const onBarScanned = (value, additionalProperties) => {
|
||||
setImportText(value);
|
||||
importMnemonic(value, additionalProperties);
|
||||
|
@ -108,7 +118,7 @@ const WalletsImport = () => {
|
|||
onPress={importButtonPressed}
|
||||
/>
|
||||
<BlueButtonLink
|
||||
title="...or scan for wallet instead?"
|
||||
title={loc.wallets.import.scan_qr}
|
||||
onPress={() => {
|
||||
navigate('ScanQrAddress', { launchedBy: 'ImportWallet', onBarScanned, showFileImportButton: true });
|
||||
}}
|
||||
|
|
Loading…
Add table
Reference in a new issue