mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
Merge branch 'bug302' of github.com:BlueWallet/BlueWallet into bug302
This commit is contained in:
commit
5d4c213e15
3 changed files with 19 additions and 3 deletions
|
@ -110,6 +110,17 @@ export class LightningCustodianWallet extends LegacyWallet {
|
|||
Authorization: 'Bearer' + ' ' + this.access_token,
|
||||
},
|
||||
});
|
||||
|
||||
if (response.originalResponse && typeof response.originalResponse === 'string') {
|
||||
try {
|
||||
response.originalResponse = JSON.parse(response.originalResponse);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
if (response.originalResponse && response.originalResponse.status && response.originalResponse.status === 503) {
|
||||
throw new Error('Payment is in transit');
|
||||
}
|
||||
|
||||
let json = response.body;
|
||||
if (typeof json === 'undefined') {
|
||||
throw new Error('API failure: ' + response.err + ' ' + JSON.stringify(response.originalResponse));
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class LNDCreateInvoice extends Component {
|
|||
|
||||
renderCreateButton = () => {
|
||||
return (
|
||||
<View style={{ paddingHorizontal: 56, paddingVertical: 16, alignContent: 'center', backgroundColor: '#FFFFFF' }}>
|
||||
<View style={{ marginHorizontal: 56, marginVertical: 16, minHeight: 45, alignContent: 'center', backgroundColor: '#FFFFFF' }}>
|
||||
{this.state.isLoading ? (
|
||||
<ActivityIndicator />
|
||||
) : (
|
||||
|
|
|
@ -83,6 +83,11 @@ export default class SendDetails extends Component {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: refactor this mess, get rid of regexp, use https://github.com/bitcoinjs/bitcoinjs-lib/issues/890 etc etc
|
||||
*
|
||||
* @param data {String} Can be address or `bitcoin:xxxxxxx` uri scheme, or invalid garbage
|
||||
*/
|
||||
processAddressData = data => {
|
||||
this.setState(
|
||||
{ isLoading: true },
|
||||
|
@ -91,7 +96,7 @@ export default class SendDetails extends Component {
|
|||
this.processBIP70Invoice(data);
|
||||
} else {
|
||||
const dataWithoutSchema = data.replace('bitcoin:', '');
|
||||
if (btcAddressRx.test(dataWithoutSchema) || dataWithoutSchema.indexOf('bc1') === 0) {
|
||||
if (btcAddressRx.test(dataWithoutSchema) || (dataWithoutSchema.indexOf('bc1') === 0 && dataWithoutSchema.indexOf('?') === -1)) {
|
||||
this.setState({
|
||||
address: dataWithoutSchema,
|
||||
bip70TransactionExpiration: null,
|
||||
|
@ -111,7 +116,7 @@ export default class SendDetails extends Component {
|
|||
this.setState({ isLoading: false });
|
||||
}
|
||||
console.log(options);
|
||||
if (btcAddressRx.test(address)) {
|
||||
if (btcAddressRx.test(address) || address.indexOf('bc1') === 0) {
|
||||
this.setState({
|
||||
address,
|
||||
amount: options.amount,
|
||||
|
|
Loading…
Add table
Reference in a new issue