Skip to content

Commit 9e07833

Browse files
authored
Merge pull request #283 from lightninglabs/mailbox
app: add mailbox support
2 parents fda99a8 + e7c3e7a commit 9e07833

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+6129
-701
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,6 @@ jobs:
168168

169169
- name: run check
170170
run: make protos-check
171+
172+
- name: compile rpc for golang
173+
run: make rpc

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.env*.local
33

44
litd-debug
5+
litcli-debug
56
/lightning-terminal-*
67

78
# MacOS junk

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ EXPOSE 8443 10009 9735
6464

6565
# Copy the binaries and entrypoint from the builder image.
6666
COPY --from=golangbuilder /go/bin/litd /bin/
67+
COPY --from=golangbuilder /go/bin/litcli /bin/
6768
COPY --from=golangbuilder /go/bin/lncli /bin/
6869
COPY --from=golangbuilder /go/bin/frcli /bin/
6970
COPY --from=golangbuilder /go/bin/loop /bin/

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ install: app-build go-install
108108
go-build:
109109
@$(call print, "Building lightning-terminal.")
110110
$(GOBUILD) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litd-debug $(PKG)/cmd/litd
111+
$(GOBUILD) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litcli-debug $(PKG)/cmd/litcli
111112

112113
go-install:
113114
@$(call print, "Installing lightning-terminal.")
114115
$(GOINSTALL) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litd
116+
$(GOINSTALL) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litcli
115117

116118
go-install-cli:
117119
@$(call print, "Installing all CLI binaries.")
@@ -193,6 +195,10 @@ list:
193195
grep -v Makefile | \
194196
sort
195197

198+
rpc:
199+
@$(call print, "Compiling protos.")
200+
cd ./litrpc; ./gen_protos_docker.sh
201+
196202
protos:
197203
@$(call print, "Compiling protos.")
198204
cd proto; ./gen_protos_docker.sh

app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@emotion/styled": "11.3.0",
2222
"@improbable-eng/grpc-web": "0.14.0",
2323
"big.js": "6.1.1",
24-
"bootstrap": "4.5.0",
24+
"bootstrap": "4.6.1",
2525
"copy-to-clipboard": "3.3.1",
2626
"d3": "6.3.1",
2727
"date-fns": "2.14.0",
@@ -81,8 +81,8 @@
8181
"google-protobuf": "3.12.2",
8282
"jest-canvas-mock": "2.3.0",
8383
"jest-environment-jsdom-sixteen": "1.0.3",
84-
"node-sass": "4.14.1",
8584
"prettier": "2.1.2",
85+
"sass": "1.43.4",
8686
"ts-protoc-gen": "0.12.0",
8787
"typescript": "4.1.6"
8888
},

app/scripts/build-protos.js

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,30 @@ const protoSources = async () => {
5050

5151
/** list of proto files and patches to apply */
5252
const filePatches = {
53-
lnd: 'lnrpc: {}',
54-
loop: 'looprpc: {}',
55-
common: 'looprpc: {}',
56-
trader: 'poolrpc: {}',
57-
'auctioneerrpc/auctioneer': 'poolrpc: {}',
53+
lnd: {
54+
patch: 'lnrpc: {}',
55+
folder: 'proto'
56+
},
57+
loop: {
58+
patch: 'looprpc: {}',
59+
folder: 'proto'
60+
},
61+
common: {
62+
patch: 'looprpc: {}',
63+
folder: 'proto'
64+
},
65+
trader: {
66+
patch: 'poolrpc: {}',
67+
folder: 'proto'
68+
},
69+
'auctioneerrpc/auctioneer': {
70+
patch: 'poolrpc: {}',
71+
folder: 'proto'
72+
},
73+
'lit-sessions': {
74+
patch: 'litrpc: {}',
75+
folder: 'litrpc'
76+
}
5877
};
5978

6079
/**
@@ -86,7 +105,7 @@ const download = async () => {
86105
*/
87106
const sanitize = async () => {
88107
const filePaths = Object.keys(filePatches).map(name =>
89-
join(appPath, '..', 'proto', `${name}.proto`),
108+
join(appPath, '..', filePatches[name].folder, `${name}.proto`),
90109
);
91110
for (path of filePaths) {
92111
let content = (await fs.readFile(path)).toString();
@@ -113,14 +132,18 @@ const generate = async () => {
113132
'.bin',
114133
platform() === 'win32' ? 'protoc-gen-ts.cmd' : 'protoc-gen-ts',
115134
);
135+
const files = Object
136+
.keys(filePatches)
137+
.map(name => `../${filePatches[name].folder}/${name}.proto`);
116138
const protocCmd = [
117139
'protoc',
118140
`-I../proto`,
141+
`-I../litrpc`,
119142
`--plugin=protoc-gen-ts=${protocGen}`,
120143
'--proto_path=../proto',
121144
'--js_out=import_style=commonjs,binary:./src/types/generated',
122145
'--ts_out=service=grpc-web:./src/types/generated',
123-
...Object.keys(filePatches).map(file => `../proto/${file}.proto`),
146+
...files,
124147
].join(' ');
125148

126149
console.log(protocCmd);
@@ -153,7 +176,7 @@ const patch = async () => {
153176
// apply the webpack patch
154177
const patch = [
155178
'/* eslint-disable */',
156-
`var proto = { ${filePatches[filename]} };`,
179+
`var proto = { ${filePatches[filename].patch} };`,
157180
'',
158181
].join('\n');
159182
content = `${patch}\n${content}`;

app/src/Routes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const LazyLoopPage = React.lazy(() => import('components/loop/LoopPage'));
1010
const LazyHistoryPage = React.lazy(() => import('components/history/HistoryPage'));
1111
const LazyPoolPage = React.lazy(() => import('components/pool/PoolPage'));
1212
const LazySettingsPage = React.lazy(() => import('components/settings/SettingsPage'));
13+
const LazyConnectPage = React.lazy(() => import('components/connect/ConnectPage'));
1314

1415
const Routes: React.FC = () => {
1516
const { router } = useStore();
@@ -26,6 +27,7 @@ const Routes: React.FC = () => {
2627
<Route path={`${PUBLIC_URL}/history`} component={LazyHistoryPage} />
2728
<Route path={`${PUBLIC_URL}/pool`} component={LazyPoolPage} />
2829
<Route path={`${PUBLIC_URL}/settings`} component={LazySettingsPage} />
30+
<Route path={`${PUBLIC_URL}/connect`} component={LazyConnectPage} />
2931
</Suspense>
3032
</Switch>
3133
</Layout>

app/src/__tests__/components/layout/Layout.spec.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ describe('Layout component', () => {
3939
fireEvent.click(getByText('History'));
4040
expect(store.router.location.pathname).toBe('/history');
4141
expect(getByText('History').parentElement).toHaveClass('active');
42-
fireEvent.click(getByText('Lightning Terminal'));
42+
fireEvent.click(getByText('Lightning Loop'));
4343
expect(store.router.location.pathname).toBe('/loop');
44-
expect(getByText('Lightning Terminal').parentElement).toHaveClass('active');
44+
expect(getByText('Lightning Loop').parentElement).toHaveClass('active');
4545
});
4646

4747
it('should navigate to the Pool page', () => {
@@ -50,9 +50,9 @@ describe('Layout component', () => {
5050
fireEvent.click(getByText('Lightning Pool'));
5151
expect(store.router.location.pathname).toBe('/pool');
5252
expect(getByText('Lightning Pool').parentElement).toHaveClass('active');
53-
fireEvent.click(getByText('Lightning Terminal'));
53+
fireEvent.click(getByText('Lightning Loop'));
5454
expect(store.router.location.pathname).toBe('/loop');
55-
expect(getByText('Lightning Terminal').parentElement).toHaveClass('active');
55+
expect(getByText('Lightning Loop').parentElement).toHaveClass('active');
5656
});
5757

5858
it('should navigate to the Settings page', () => {
@@ -61,8 +61,8 @@ describe('Layout component', () => {
6161
fireEvent.click(getByText('Settings'));
6262
expect(store.router.location.pathname).toBe('/settings');
6363
expect(getByText('Settings').parentElement).toHaveClass('active');
64-
fireEvent.click(getByText('Lightning Terminal'));
64+
fireEvent.click(getByText('Lightning Loop'));
6565
expect(store.router.location.pathname).toBe('/loop');
66-
expect(getByText('Lightning Terminal').parentElement).toHaveClass('active');
66+
expect(getByText('Lightning Loop').parentElement).toHaveClass('active');
6767
});
6868
});

app/src/__tests__/components/loop/LoopPage.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('LoopPage component', () => {
3333

3434
it('should display the page title', () => {
3535
const { getByText } = render();
36-
expect(getByText('Lightning Terminal')).toBeInTheDocument();
36+
expect(getByText('Lightning Loop')).toBeInTheDocument();
3737
});
3838

3939
it('should display the network badge', () => {

app/src/api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as GrpcClient } from './grpc';
22
export { default as LndApi } from './lnd';
33
export { default as LoopApi } from './loop';
44
export { default as PoolApi } from './pool';
5+
export { default as LitApi } from './lit';

0 commit comments

Comments
 (0)