Skip to content

Commit

Permalink
Merge pull request #165 from ZeusLN/master
Browse files Browse the repository at this point in the history
v0.1.2
  • Loading branch information
ZeusLN authored Oct 29, 2019
2 parents 3d6cb60 + 115b6a0 commit 2242122
Show file tree
Hide file tree
Showing 24 changed files with 265 additions and 194 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ We recommend reading
[Raspibolt Tutorial](https://github.com/Stadicus/guides/tree/master/raspibolt) or
[RaspiBlitz](https://github.com/rootzoll/raspiblitz/).

### Tor Connection Guides

On Android Zeus has support for connecting to you node entirely over the Tor network. You can refer to these guides to set up a Tor hidden service on your lnd node. The instructions are generally interchangable and typically only require you to change your Tor path.

* [Zeus over Tor guide for RaspiBolt](http://raspibolt.com/raspibolt_72_zeus-over-tor.html)
* [Zeus over Tor guide for FreeNAS by Seth586](https://github.com/seth586/guides/blob/master/FreeNAS/wallets/zeusln.md)
* [Zeus over Tor guide for RaspiBlitz by openoms](https://github.com/openoms/bitcoin-tutorials/blob/master/Zeus_to_RaspiBlitz_through_Tor.md)

## Integrations

Zeus is proud to be integrated on the following platforms:

* [BTCPay Server](https://btcpayserver.org/)
* [nodl](https://www.nodl.it/)
* [myNode](https://mynodebtc.com/) ([Standard guide](https://mynodebtc.com/guide/zeus), [Tor guide](https://mynodebtc.com/guide/zeus_tor))
* [RaspiBlitz](https://github.com/rootzoll/raspiblitz)

## Building Zeus from source

**Don't trust, verify** the code with your own two eyes. Then when ready proceed to the steps below based on your platform.
Expand All @@ -63,7 +80,7 @@ We recommend reading

## Contributing

Please be sure to run `tsc` to check for type errors and `npm run test` to run all tests.
Please be sure to run `tsc` to check for type errors, `npm run test` to run all tests, and `npm run prettier` to run the prettier

If you are making cosmetic changes please test on both Android and iOS as things don't render exactly the same on both platforms.

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ android {
applicationId "com.zeusln.zeus"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 11
versionName "0.1.1"
versionCode 12
versionName "0.1.2"
}
signingConfigs {
release {
Expand Down
16 changes: 12 additions & 4 deletions components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ interface QRProps {
}

interface QRState {
complete: boolean;
hasCameraPermission: boolean | null;
useInternalScanner: boolean;
}

export default class QRCodeScanner extends React.Component<QRProps, QRState> {
state = {
complete: false,
hasCameraPermission: null,
useInternalScanner: Platform.OS !== 'android' // only try to use the external scanner on android
};
Expand Down Expand Up @@ -97,7 +99,7 @@ export default class QRCodeScanner extends React.Component<QRProps, QRState> {
}

render() {
const { hasCameraPermission } = this.state;
const { complete, hasCameraPermission } = this.state;
const { title, text, handleQRScanned, goBack } = this.props;

if (!this.state.useInternalScanner) {
Expand All @@ -113,6 +115,11 @@ export default class QRCodeScanner extends React.Component<QRProps, QRState> {
return <Text>No access to camera</Text>;
}

// scan has completed, prevent additional scanning
if (complete) {
return null;
}

return (
<React.Fragment>
<Header
Expand All @@ -133,9 +140,10 @@ export default class QRCodeScanner extends React.Component<QRProps, QRState> {
<CameraKitCameraScreen
laserColor={'orange'}
scanBarcode={true}
onReadCode={(event: any) =>
handleQRScanned(event.nativeEvent.codeStringValue)
}
onReadCode={(event: any) => {
this.setState({ complete: true });
handleQRScanned(event.nativeEvent.codeStringValue);
}}
hideControls={true}
showFrame={false}
style={{
Expand Down
2 changes: 1 addition & 1 deletion ios/zeus/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.1</string>
<string>0.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zeus",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
Expand Down
6 changes: 4 additions & 2 deletions stores/BalanceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export default class BalanceStore {
reaction(
() => this.settingsStore.settings,
() => {
this.getBlockchainBalance();
this.getLightningBalance();
if (this.settingsStore.macaroonHex) {
this.getBlockchainBalance();
this.getLightningBalance();
}
}
);
}
Expand Down
21 changes: 12 additions & 9 deletions stores/ChannelsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default class ChannelsStore {
reaction(
() => this.settingsStore.settings,
() => {
this.getChannels();
if (this.settingsStore.macaroonHex) {
this.getChannels();
}
}
);

Expand All @@ -48,15 +50,16 @@ export default class ChannelsStore {
() => this.channels,
() => {
if (this.channels) {
this.nodes = {};
const nodes: any = {};
this.channels.forEach((channel: Channel) => {
this.getNodeInfo(channel.remote_pubkey).then(
nodeInfo => {
nodes[channel.remote_pubkey] = nodeInfo;
this.nodes = nodes;
}
);
if (!this.nodes[channel.remote_pubkey]) {
this.getNodeInfo(channel.remote_pubkey).then(
nodeInfo => {
this.nodes[
channel.remote_pubkey
] = nodeInfo;
}
);
}
});
}
}
Expand Down
1 change: 1 addition & 0 deletions stores/InvoicesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default class InvoicesStore {
public getPayReq = (paymentRequest: string) => {
const { host, port, macaroonHex } = this.settingsStore;

this.pay_req = null;
this.paymentRequest = paymentRequest;
this.loading = true;

Expand Down
4 changes: 3 additions & 1 deletion stores/NodeInfoStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default class NodeInfoStore {
reaction(
() => this.settingsStore.settings,
() => {
this.getNodeInfo();
if (this.settingsStore.macaroonHex) {
this.getNodeInfo();
}
}
);
}
Expand Down
4 changes: 3 additions & 1 deletion stores/TransactionsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export default class TransactionsStore {
reaction(
() => this.settingsStore.settings,
() => {
this.getTransactions();
if (this.settingsStore.macaroonHex) {
this.getTransactions();
}
}
);
}
Expand Down
3 changes: 2 additions & 1 deletion utils/NodeUriUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ describe('NodeUriUtils', () => {
'03e1210c8d4b236a53191bb172701d76ec06dfa869a1afffcfd8f4e07d9129d898@0.0.0.0:9735'
)
).toEqual({
pubkey: '03e1210c8d4b236a53191bb172701d76ec06dfa869a1afffcfd8f4e07d9129d898',
pubkey:
'03e1210c8d4b236a53191bb172701d76ec06dfa869a1afffcfd8f4e07d9129d898',
host: '0.0.0.0:9735'
});
});
Expand Down
2 changes: 1 addition & 1 deletion utils/NodeUriUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class NodeUriUtils {
const host = split[1];

return { pubkey, host };
}
};
}

const nodeUriUtils = new NodeUriUtils();
Expand Down
9 changes: 7 additions & 2 deletions views/AddressQRScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import QRCodeScanner from './../components/QRCodeScanner';
import { inject, observer } from 'mobx-react';

import NodeInfoStore from './../stores/NodeInfoStore';
import InvoicesStore from './../stores/InvoicesStore';

interface AddressQRProps {
navigation: any;
InvoicesStore: InvoicesStore;
NodeInfoStore: NodeInfoStore;
}

@inject('NodeInfoStore')
@inject('InvoicesStore', 'NodeInfoStore')
@observer
export default class AddressQRScanner extends React.Component<
AddressQRProps,
Expand All @@ -26,7 +28,7 @@ export default class AddressQRScanner extends React.Component<
}

handleAddressInvoiceScanned = (data: string) => {
const { NodeInfoStore, navigation } = this.props;
const { InvoicesStore, NodeInfoStore, navigation } = this.props;
const { testnet } = NodeInfoStore;

const { value, amount } = AddressUtils.processSendAddress(data);
Expand All @@ -42,6 +44,9 @@ export default class AddressQRScanner extends React.Component<
destination: value,
transactionType: 'Lightning'
});

InvoicesStore.getPayReq(value);
navigation.navigate('PaymentRequest');
} else {
Alert.alert(
'Error',
Expand Down
5 changes: 4 additions & 1 deletion views/NodeQRScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default class NodeQRScanner extends React.Component<NodeQRProps, {}> {

if (NodeUriUtils.isValidNodeUri(data)) {
const { pubkey, host } = NodeUriUtils.processNodeUri(data);
navigation.navigate('OpenChannel', { node_pubkey_string: pubkey, host });
navigation.navigate('OpenChannel', {
node_pubkey_string: pubkey,
host
});
} else {
Alert.alert(
'Error',
Expand Down
10 changes: 7 additions & 3 deletions views/OpenChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export default class OpenChannel extends React.Component<
}

importClipboard = () => {
const { pubkey, host } = NodeUriUtils.processNodeUri(this.state.suggestImport);
const { pubkey, host } = NodeUriUtils.processNodeUri(
this.state.suggestImport
);

this.setState({
node_pubkey_string: pubkey,
Expand Down Expand Up @@ -158,7 +160,9 @@ export default class OpenChannel extends React.Component<
<Text style={{ color: 'white' }}>
Detected the following Node URI in your clipboard:
</Text>
<Text style={{ color: 'white', padding: 15 }}>{suggestImport}</Text>
<Text style={{ color: 'white', padding: 15 }}>
{suggestImport}
</Text>
<Text style={{ color: 'white' }}>
Would you like to import it?
</Text>
Expand Down Expand Up @@ -303,7 +307,7 @@ export default class OpenChannel extends React.Component<
Satoshis per byte
</Text>
<TextInput
placeholder={'2'}
placeholder="2"
value={sat_per_byte}
onChangeText={(text: string) => this.setFee(text)}
numberOfLines={1}
Expand Down
Loading

0 comments on commit 2242122

Please sign in to comment.