mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-21 14:34:55 +01:00
WIP: lnd
This commit is contained in:
parent
984278ec7e
commit
a08b3527bc
8 changed files with 29 additions and 22 deletions
|
@ -643,7 +643,7 @@ export class BlueTransactionOffchainIcon extends Component {
|
|||
size={16}
|
||||
type="font-awesome"
|
||||
color="#d0021b"
|
||||
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '135deg' }] }}
|
||||
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '155deg' }] }}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
|
|
@ -3,7 +3,7 @@ import Frisbee from 'frisbee';
|
|||
import { LightningCustodianWallet } from './class';
|
||||
let assert = require('assert');
|
||||
|
||||
describe.skip('LightningCustodianWallet', () => {
|
||||
describe('LightningCustodianWallet', () => {
|
||||
let l1 = new LightningCustodianWallet();
|
||||
|
||||
it.skip('can issue wallet credentials', async () => {
|
||||
|
@ -168,7 +168,7 @@ describe.skip('LightningCustodianWallet', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('can create invoice and pay other blitzhub invoice', async () => {
|
||||
it.skip('can create invoice and pay other blitzhub invoice', async () => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100 * 1000;
|
||||
if (!process.env.BLITZHUB) {
|
||||
console.error('process.env.BLITZHUB not set, skipped');
|
||||
|
@ -212,8 +212,8 @@ describe.skip('LightningCustodianWallet', () => {
|
|||
|
||||
await lOld.fetchBalance();
|
||||
await lNew.fetchBalance();
|
||||
assert.equal(oldBalance - lOld.balance, 100);
|
||||
assert.equal(lNew.balance, 100);
|
||||
assert.equal(oldBalance - lOld.balance, 1);
|
||||
assert.equal(lNew.balance, 1);
|
||||
|
||||
// now, paying back that amount
|
||||
invoice = await lOld.addInvoice(1, 'test memo');
|
||||
|
|
|
@ -292,29 +292,31 @@ export class LightningCustodianWallet extends LegacyWallet {
|
|||
getTransactions() {
|
||||
let txs = [];
|
||||
this.pending_transactions_raw = this.pending_transactions_raw || [];
|
||||
console.log('this.pending_transactions_raw', this.pending_transactions_raw);
|
||||
this.transactions_raw = this.transactions_raw || [];
|
||||
console.log('this.transactions_raw', this.transactions_raw);
|
||||
txs = txs.concat(this.pending_transactions_raw, this.transactions_raw.slice().reverse()); // slice so array is cloned
|
||||
// transforming to how wallets/list screen expects it
|
||||
for (let tx of txs) {
|
||||
tx.value = parseInt(tx.amount * 100000000);
|
||||
tx.received = new Date(tx.time * 1000).toString();
|
||||
tx.memo = 'On-chain transaction';
|
||||
|
||||
if (typeof tx.amt !== 'undefined' && typeof tx.fee !== 'undefined') {
|
||||
// lnd tx outgoing
|
||||
tx.value = parseInt((tx.amt * 1 + tx.fee * 1) * -1);
|
||||
}
|
||||
|
||||
if (tx.type === 'paid_invoices') {
|
||||
tx.memo = 'Lightning payment'; // TODO once api is ready
|
||||
if (tx.type === 'paid_invoice') {
|
||||
tx.memo = tx.memo || 'Lightning payment';
|
||||
}
|
||||
|
||||
if (tx.type === 'bitcoind_tx') {
|
||||
tx.memo = 'On-chain transaction';
|
||||
}
|
||||
|
||||
tx.received = new Date(tx.timestamp * 1000).toString(); // TODO once api is ready
|
||||
}
|
||||
console.log('getTx', txs);
|
||||
return txs;
|
||||
return txs.sort(function(a, b) {
|
||||
return b.timestamp - a.timestamp;
|
||||
});
|
||||
}
|
||||
|
||||
async fetchPendingTransactions() {
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
|
||||
"scripts": {
|
||||
"prepare": "./patches/fix_mangle.sh; git apply patches/transaction_builder.js.patch; git apply ./patches/transaction.js.patch",
|
||||
"start": "react-native-scripts start",
|
||||
"eject": "react-native-scripts eject",
|
||||
"android": "react-native-scripts android",
|
||||
"ios": "react-native-scripts ios",
|
||||
"start": "expo start",
|
||||
"eject": "expo eject",
|
||||
"android": "expo android",
|
||||
"ios": "expo ios",
|
||||
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack",
|
||||
"test": "npm run unit && npm run jest && npm run lint",
|
||||
"jest": "node node_modules/jest/bin/jest.js",
|
||||
|
|
|
@ -19,7 +19,9 @@ const { width } = Dimensions.get('window');
|
|||
|
||||
export default class ScanLndInvoice extends React.Component {
|
||||
static navigationOptions = {
|
||||
tabBarVisible: false,
|
||||
header: ({ navigation }) => {
|
||||
return <View />;
|
||||
},
|
||||
};
|
||||
|
||||
state = {
|
||||
|
@ -48,7 +50,7 @@ export default class ScanLndInvoice extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
async onBarCodeRead(ret) {
|
||||
async onBarCodeScanned(ret) {
|
||||
if (this.ignoreRead) return;
|
||||
this.ignoreRead = true;
|
||||
setTimeout(() => {
|
||||
|
@ -220,7 +222,8 @@ export default class ScanLndInvoice extends React.Component {
|
|||
}}
|
||||
onPress={() => {
|
||||
this.setState({
|
||||
type: this.state.type === BarCodeScanner.Constants.Type.back
|
||||
type:
|
||||
this.state.type === BarCodeScanner.Constants.Type.back
|
||||
? BarCodeScanner.Constants.Type.front
|
||||
: BarCodeScanner.Constants.Type.back,
|
||||
});
|
||||
|
|
|
@ -77,7 +77,8 @@ export default class CameraExample extends React.Component {
|
|||
}}
|
||||
onPress={() => {
|
||||
this.setState({
|
||||
type: this.state.type === BarCodeScanner.Constants.Type.back
|
||||
type:
|
||||
this.state.type === BarCodeScanner.Constants.Type.back
|
||||
? BarCodeScanner.Constants.Type.front
|
||||
: BarCodeScanner.Constants.Type.back,
|
||||
});
|
||||
|
|
|
@ -412,7 +412,7 @@ export default class WalletsList extends Component {
|
|||
</View>
|
||||
);
|
||||
}
|
||||
if (rowData.item.type === 'paid_invoices') {
|
||||
if (rowData.item.type === 'paid_invoice') {
|
||||
// is it lightning offchain payment?
|
||||
return (
|
||||
<View style={{ width: 25 }}>
|
||||
|
|
|
@ -192,7 +192,8 @@ export default class ScanQrWif extends React.Component {
|
|||
}}
|
||||
onPress={() => {
|
||||
this.setState({
|
||||
type: this.state.type === BarCodeScanner.Constants.Type.back
|
||||
type:
|
||||
this.state.type === BarCodeScanner.Constants.Type.back
|
||||
? BarCodeScanner.Constants.Type.front
|
||||
: BarCodeScanner.Constants.Type.back,
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue