Skip to content

Commit 1b16aa8

Browse files
authored
Merge pull request #2484 from synonymdev/chore/env
chore: environment variables
2 parents 0ab3919 + 5024659 commit 1b16aa8

File tree

11 files changed

+129
-144
lines changed

11 files changed

+129
-144
lines changed

.env.development.template

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,43 @@
1-
# middleware for redux-logger
2-
ENABLE_REDUX_LOGGER=true
3-
4-
# middleware for immutable-state-invariant (disable if things are slow in development)
5-
ENABLE_REDUX_IMMUTABLE_CHECK=true
6-
7-
# i18next debug mode
8-
ENABLE_I18NEXT_DEBUGGER=false
9-
10-
# redux-persist migration debug mode
11-
ENABLE_MIGRATION_DEBUG=false
12-
13-
# react-native-ldk JS logs
14-
ENABLE_LDK_LOGS=true
15-
16-
# Bitkit backend
1+
# Bitkit Backend
172
BACKEND_HOST=https://bitkit.stag0.blocktank.to
183

19-
# LDK backups
4+
# Backup Server
205
BACKUPS_SERVER_HOST=https://bitkit.stag0.blocktank.to/backups-ldk
216
BACKUPS_SERVER_PUBKEY=02c03b8b8c1b5500b622646867d99bf91676fac0f38e2182c91a9ff0d053a21d6d
227

23-
# Slashtags
24-
WEB_RELAY=https://webrelay.slashtags.to
25-
26-
# Blocktank
8+
# LSP API
279
BLOCKTANK_HOST=https://api.stag0.blocktank.to/blocktank/api/v2
2810

29-
# Network
30-
ELECTRUM_BITCOIN_HOST=35.187.18.233
31-
ELECTRUM_BITCOIN_SSL_PORT=8900
32-
ELECTRUM_BITCOIN_TCP_PORT=8911
33-
ELECTRUM_BITCOIN_PROTO=ssl
11+
# bitcoin | bitcoinTestnet | bitcoinRegtest
12+
DEFAULT_BITCOIN_NETWORK=bitcoin
3413

14+
# Default Electrum Peer (Regtest)
3515
ELECTRUM_REGTEST_HOST=34.65.86.104
36-
ELECTRUM_REGTEST_SSL_PORT=18484
3716
ELECTRUM_REGTEST_TCP_PORT=18483
17+
ELECTRUM_REGTEST_SSL_PORT=18484
3818
ELECTRUM_REGTEST_PROTO=tcp
3919

20+
# Default Slashtags Web Relay
21+
WEB_RELAY=https://dht-relay.synonym.to/staging/web-relay
22+
4023
TREASURE_HUNT_HOST=" "
24+
CHATWOOT_API=https://synonym.to/api/chatwoot
4125

42-
# format: "<pubkey>, <pubkey>, ..."
43-
TRUSTED_ZERO_CONF_PEERS="028a8910b0048630d4eb17af25668cdd7ea6f2d8ae20956e7a06e2ae46ebcb69fc,0296b2db342fcf87ea94d981757fdf4d3e545bd5cef4919f58b5d38dfdd73bf5c9,03b9a456fb45d5ac98c02040d39aec77fa3eeb41fd22cf40b862b393bcfc43473a,039b8b4dd1d88c2c5db374290cda397a8f5d79f312d6ea5d5bfdfc7c6ff363eae3,03342eac98d8c07ac8a4f303b2ad09a34b3350357730013d534d0537a4d1d8a14d,03816141f1dce7782ec32b66a300783b1d436b19777e7c686ed00115bd4b88ff4b"
26+
### Debugging
27+
# middleware for redux-logger
28+
ENABLE_REDUX_LOGGER=true
4429

45-
WALLET_DEFAULT_SELECTED_NETWORK=bitcoin
30+
# middleware for immutable-state-invariant (disable if things are slow in development)
31+
ENABLE_REDUX_IMMUTABLE_CHECK=true
4632

47-
E2E=false
33+
# i18next debug mode
34+
ENABLE_I18NEXT_DEBUGGER=false
4835

49-
CHATWOOT_API=https://synonym.to/api/chatwoot
36+
# redux-persist migration debug mode
37+
ENABLE_MIGRATION_DEBUG=false
38+
39+
# react-native-ldk JS logs
40+
ENABLE_LDK_LOGS=true
41+
42+
# Detox E2E Testing
43+
E2E=false

.env.production.template

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Bitkit Backend
2+
BACKEND_HOST=https://blocktank.synonym.to
3+
4+
# Backup Server
5+
BACKUPS_SERVER_HOST=https://blocktank.synonym.to/backups-ldk
6+
BACKUPS_SERVER_PUBKEY=0236efd76e37f96cf2dced9d52ff84c97e5b3d4a75e7d494807291971783f38377
7+
8+
# LSP API
9+
BLOCKTANK_HOST=https://api1.blocktank.to/api
10+
11+
# bitcoin | bitcoinTestnet | bitcoinRegtest
12+
DEFAULT_BITCOIN_NETWORK=bitcoin
13+
14+
# Default Electrum Peer (Regtest)
15+
ELECTRUM_REGTEST_HOST=34.65.86.104
16+
ELECTRUM_REGTEST_TCP_PORT=18483
17+
ELECTRUM_REGTEST_SSL_PORT=18484
18+
ELECTRUM_REGTEST_PROTO=tcp
19+
20+
# Default Slashtags Web Relay
21+
WEB_RELAY=https://webrelay.slashtags.to
22+
23+
TREASURE_HUNT_HOST=" "
24+
CHATWOOT_API=https://synonym.to/api/chatwoot
25+
E2E=false

.env.test.template

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,43 @@
1-
# middleware for redux-logger
2-
ENABLE_REDUX_LOGGER=false
3-
4-
# middleware for immutable-state-invariant (disable if things are slow in development)
5-
ENABLE_REDUX_IMMUTABLE_CHECK=false
6-
7-
# i18next debug mode
8-
ENABLE_I18NEXT_DEBUGGER=false
9-
10-
# redux-persist migration debug mode
11-
ENABLE_MIGRATION_DEBUG=false
12-
13-
# react-native-ldk JS logs
14-
ENABLE_LDK_LOGS=false
15-
16-
# Bitkit backend
1+
# Bitkit Backend
172
BACKEND_HOST=https://bitkit.stag0.blocktank.to
183

19-
# LDK backups
4+
# Backup Server
205
BACKUPS_SERVER_HOST=http://127.0.0.1:3003
216
BACKUPS_SERVER_PUBKEY=0319c4ff23820afec0c79ce3a42031d7fef1dff78b7bdd69b5560684f3e1827675
227

23-
# Slashtags
24-
WEB_RELAY=https://webrelay.slashtags.to
8+
# LSP API
9+
BLOCKTANK_HOST=https://api.stag0.blocktank.to/blocktank/api/v2
2510

26-
# Blocktank
27-
BLOCKTANK_HOST=https://api.stag.blocktank.to
28-
29-
# Network
30-
ELECTRUM_BITCOIN_HOST=35.187.18.233
31-
ELECTRUM_BITCOIN_SSL_PORT=8900
32-
ELECTRUM_BITCOIN_TCP_PORT=8911
33-
ELECTRUM_BITCOIN_PROTO=tcp
11+
# bitcoin | bitcoinTestnet | bitcoinRegtest
12+
DEFAULT_BITCOIN_NETWORK=bitcoinRegtest
3413

14+
# Default Electrum Peer (Regtest)
3515
ELECTRUM_REGTEST_HOST=127.0.0.1
36-
ELECTRUM_REGTEST_SSL_PORT=60001
3716
ELECTRUM_REGTEST_TCP_PORT=60001
17+
ELECTRUM_REGTEST_SSL_PORT=60002
3818
ELECTRUM_REGTEST_PROTO=tcp
3919

20+
# Default Slashtags Web Relay
21+
WEB_RELAY=https://dht-relay.synonym.to/staging/web-relay
22+
4023
TREASURE_HUNT_HOST=" "
24+
CHATWOOT_API=https://synonym.to/api/chatwoot
4125

42-
# format: "<pubkey>, <pubkey>, ..."
43-
TRUSTED_ZERO_CONF_PEERS="03b9a456fb45d5ac98c02040d39aec77fa3eeb41fd22cf40b862b393bcfc43473a"
26+
### Debugging
27+
# middleware for redux-logger
28+
ENABLE_REDUX_LOGGER=false
4429

45-
WALLET_DEFAULT_SELECTED_NETWORK=bitcoinRegtest
30+
# middleware for immutable-state-invariant (disable if things are slow in development)
31+
ENABLE_REDUX_IMMUTABLE_CHECK=false
4632

47-
E2E=true
33+
# i18next debug mode
34+
ENABLE_I18NEXT_DEBUGGER=false
4835

49-
CHATWOOT_API=https://synonym.to/api/chatwoot
36+
# redux-persist migration debug mode
37+
ENABLE_MIGRATION_DEBUG=false
38+
39+
# react-native-ldk JS logs
40+
ENABLE_LDK_LOGS=false
41+
42+
# Detox E2E Testing
43+
E2E=true

BUILD.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Building Bitkit from source
22

3+
These instructions are for building Bitkit from source to get a production version of the app. If you are looking for the latest release, you can download it from the [App Store](https://apps.apple.com/app/bitkit-wallet/id6502440655) or [Google Play](https://play.google.com/store/apps/details?id=to.bitkit) or get the latest APK from the [releases page](https://github.com/synonymdev/bitkit/releases).
4+
5+
## Requirements
6+
7+
Make sure you have [setup your environment for React Native](https://reactnative.dev/docs/environment-setup).
8+
9+
> [!NOTE]
10+
> Not all of the steps outlined in the above link may be required for building the app. You can skip the ones not relevant to you.
11+
312
## Setup
413

514
1. Clone the repository
@@ -10,33 +19,26 @@ git clone [email protected]:synonymdev/bitkit.git && cd bitkit
1019

1120
2. Switch Node version
1221

13-
Switch to the Node.js version defined in `.nvmrc`. If `nvm` (or similar) is installed on your system you can run `nvm use`.
22+
Switch to the Node.js version defined in `.node-version`. You can visit [.node-version File Usage](https://github.com/shadowspawn/node-version-usage) and use one of these methods to change the node version you need.
1423

1524
3. Install dependencies
1625

1726
```shell
1827
yarn install
1928
```
2029

30+
4. Set environment variables
31+
32+
```shell
33+
cp .env.production.template .env.production
34+
```
35+
2136
## Build
2237

2338
### iOS
2439

25-
For iOS: Open the `ios` folder in Xcode to build the project.
40+
Follow instructions from the [React Native docs](https://reactnative.dev/docs/publishing-to-app-store) for iOS.
2641

2742
### Android
2843

29-
For Android: `yarn bundle`.
30-
31-
Moreover, to build the Android APK, it is necessary to configure a signing store to sign
32-
the apk, as explained by [React Docs](https://reactnative.dev/docs/signed-apk-android).
33-
34-
It is recommend to use the already presented `debug.store` in `android/app`.
35-
Add the following lines to `~/.gradle/gradle.properties`:
36-
37-
```shell
38-
BITKIT_UPLOAD_STORE_FILE=debug.keystore
39-
BITKIT_UPLOAD_STORE_PASSWORD=android
40-
BITKIT_UPLOAD_KEY_ALIAS=androiddebugkey
41-
BITKIT_UPLOAD_KEY_PASSWORD=android
42-
```
44+
Follow instructions from the [React Native docs](https://reactnative.dev/docs/signed-apk-android) for Android. After that you can find the `.aab` under `android/app/build/outputs/bundle/release/app-release.aab` which can be installed on your device.

DEVELOPMENT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Development
22

3+
This document describes how to setup your environment to build Bitkit for development and to run automated tests. If you just want to build it from source for normal usage, see [BUILD.md](./BUILD.md).
4+
5+
## Requirements
6+
37
Make sure you have [setup your environment for React Native](https://reactnative.dev/docs/environment-setup).
48

59
## Installation

metro.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const { assetExts, sourceExts } = defaultConfig.resolver;
1515
* @type {import('metro-config').MetroConfig}
1616
*/
1717
const config = {
18+
resetCache: true,
1819
transformer: {
1920
// Need this here because of some metro weirdness
2021
getTransformOptions: async () => ({}),

src/@types/env.d.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
declare module '@env' {
2-
export const ENABLE_REDUX_LOGGER: string;
3-
export const ENABLE_REDUX_IMMUTABLE_CHECK: string;
4-
export const ENABLE_I18NEXT_DEBUGGER: string;
5-
export const ENABLE_MIGRATION_DEBUG: string;
6-
export const ENABLE_LDK_LOGS: string;
7-
82
export const BACKEND_HOST: string;
93
export const BACKUPS_SERVER_HOST: string;
104
export const BACKUPS_SERVER_PUBKEY: string;
115
export const BLOCKTANK_HOST: string;
126

13-
export const ELECTRUM_BITCOIN_HOST: string;
14-
export const ELECTRUM_BITCOIN_SSL_PORT: number;
15-
export const ELECTRUM_BITCOIN_TCP_PORT: number;
16-
export const ELECTRUM_BITCOIN_PROTO: string;
7+
export const DEFAULT_BITCOIN_NETWORK: string;
8+
179
export const ELECTRUM_REGTEST_HOST: string;
1810
export const ELECTRUM_REGTEST_SSL_PORT: number;
1911
export const ELECTRUM_REGTEST_TCP_PORT: number;
2012
export const ELECTRUM_REGTEST_PROTO: string;
2113

14+
export const WEB_RELAY: string;
2215
export const TREASURE_HUNT_HOST: string;
16+
export const CHATWOOT_API: string;
2317

24-
export const TRUSTED_ZERO_CONF_PEERS: string;
25-
26-
export const WALLET_DEFAULT_SELECTED_NETWORK: string;
27-
18+
export const ENABLE_REDUX_LOGGER: string;
19+
export const ENABLE_REDUX_IMMUTABLE_CHECK: string;
20+
export const ENABLE_I18NEXT_DEBUGGER: string;
21+
export const ENABLE_MIGRATION_DEBUG: string;
22+
export const ENABLE_LDK_LOGS: string;
2823
export const E2E: string;
29-
export const WEB_RELAY: string;
30-
export const CHATWOOT_API: string;
3124
}

src/constants/env.ts

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import {
44
BACKUPS_SERVER_PUBKEY,
55
BLOCKTANK_HOST,
66
CHATWOOT_API,
7+
DEFAULT_BITCOIN_NETWORK,
78
E2E,
8-
ELECTRUM_BITCOIN_HOST,
9-
ELECTRUM_BITCOIN_PROTO,
10-
ELECTRUM_BITCOIN_SSL_PORT,
11-
ELECTRUM_BITCOIN_TCP_PORT,
129
ELECTRUM_REGTEST_HOST,
1310
ELECTRUM_REGTEST_PROTO,
1411
ELECTRUM_REGTEST_SSL_PORT,
@@ -19,21 +16,13 @@ import {
1916
ENABLE_REDUX_IMMUTABLE_CHECK,
2017
ENABLE_REDUX_LOGGER,
2118
TREASURE_HUNT_HOST,
22-
TRUSTED_ZERO_CONF_PEERS,
23-
WALLET_DEFAULT_SELECTED_NETWORK,
2419
WEB_RELAY,
2520
} from '@env';
2621
import { isProtocol } from '../store/types/settings';
2722
import { isBitcoinNetwork } from '../utils/networks';
2823

29-
if (!isBitcoinNetwork(WALLET_DEFAULT_SELECTED_NETWORK)) {
30-
throw new Error(
31-
`${WALLET_DEFAULT_SELECTED_NETWORK} is not a valid Bitcoin network.`,
32-
);
33-
}
34-
35-
if (!isProtocol(ELECTRUM_BITCOIN_PROTO)) {
36-
throw new Error(`${ELECTRUM_BITCOIN_PROTO} is not a valid protocol.`);
24+
if (!isBitcoinNetwork(DEFAULT_BITCOIN_NETWORK)) {
25+
throw new Error(`${DEFAULT_BITCOIN_NETWORK} is not a valid Bitcoin network.`);
3726
}
3827

3928
if (!isProtocol(ELECTRUM_REGTEST_PROTO)) {
@@ -67,24 +56,14 @@ export const __BACKUPS_SERVER_PUBKEY__ = BACKUPS_SERVER_PUBKEY;
6756

6857
export const __BLOCKTANK_HOST__ = BLOCKTANK_HOST;
6958

70-
export const __ELECTRUM_BITCOIN_HOST__ = ELECTRUM_BITCOIN_HOST;
71-
export const __ELECTRUM_BITCOIN_SSL_PORT__ = ELECTRUM_BITCOIN_SSL_PORT;
72-
export const __ELECTRUM_BITCOIN_TCP_PORT__ = ELECTRUM_BITCOIN_TCP_PORT;
73-
export const __ELECTRUM_BITCOIN_PROTO__ = ELECTRUM_BITCOIN_PROTO;
59+
export const __DEFAULT_BITCOIN_NETWORK__ = DEFAULT_BITCOIN_NETWORK;
60+
7461
export const __ELECTRUM_REGTEST_HOST__ = ELECTRUM_REGTEST_HOST;
7562
export const __ELECTRUM_REGTEST_SSL_PORT__ = ELECTRUM_REGTEST_SSL_PORT;
7663
export const __ELECTRUM_REGTEST_TCP_PORT__ = ELECTRUM_REGTEST_TCP_PORT;
7764
export const __ELECTRUM_REGTEST_PROTO__ = ELECTRUM_REGTEST_PROTO;
7865

79-
export const __TREASURE_HUNT_HOST__ = TREASURE_HUNT_HOST;
80-
81-
export const __TRUSTED_ZERO_CONF_PEERS__ = TRUSTED_ZERO_CONF_PEERS.split(
82-
',',
83-
).map((nodeId) => nodeId.trim());
84-
85-
export const __WALLET_DEFAULT_SELECTED_NETWORK__ =
86-
WALLET_DEFAULT_SELECTED_NETWORK;
87-
88-
export const __E2E__ = E2E === 'true';
8966
export const __WEB_RELAY__ = WEB_RELAY;
67+
export const __TREASURE_HUNT_HOST__ = TREASURE_HUNT_HOST;
9068
export const __CHATWOOT_API__ = CHATWOOT_API;
69+
export const __E2E__ = E2E === 'true';

0 commit comments

Comments
 (0)