mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-07-29 09:38:33 -04:00
fetch and display haveno daemon version in react
enable typescript add haveno protobuf definitions to ./config add envoy.yaml to ./config for envoy proxy config add ./bin/build_protobuf.sh to generate and place grpc client update readme
This commit is contained in:
parent
bfc22120cd
commit
c3c86cc643
12 changed files with 84518 additions and 61 deletions
72
src/App.tsx
72
src/App.tsx
|
@ -2,25 +2,59 @@ import React from 'react';
|
|||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
/**
|
||||
* These files are generated by protoc-gen-grpc-web (created with `sudo make install-plugin` in grpc-web) using the following command:
|
||||
*
|
||||
* `protoc -I=./ *.proto --js_out=import_style=commonjs:./ --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./`
|
||||
*/
|
||||
const {GetVersionRequest} = require('./grpc_grpc_web_pb.js');
|
||||
const {GetVersionClient} = require('./grpc_pb.js');
|
||||
|
||||
class App extends React.Component<{}, {daemonVersion: string}> {
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {daemonVersion: ""};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Haveno daemon version: {this.state.daemonVersion}
|
||||
</p>
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload!
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
this.setState({daemonVersion: await this.getDaemonVersion()});
|
||||
}
|
||||
|
||||
async getDaemonVersion(): Promise<string> {
|
||||
let getVersionClient = new GetVersionClient('http://localhost:8080');
|
||||
let request = new GetVersionRequest();
|
||||
return new Promise(function(resolve, reject) {
|
||||
getVersionClient.getVersion(request, {password: 'apitest'}, function(err: any, response: any) {
|
||||
if (err) reject(err);
|
||||
else resolve(response.getVersion());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
1590
src/grpc_grpc_web_pb.js
Normal file
1590
src/grpc_grpc_web_pb.js
Normal file
File diff suppressed because it is too large
Load diff
5658
src/grpc_pb.js
Normal file
5658
src/grpc_pb.js
Normal file
File diff suppressed because it is too large
Load diff
74009
src/pb_pb.js
Normal file
74009
src/pb_pb.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue